Wednesday, August 18, 2010

GWT panel for HTML UL/LI lists

For my current GWT projects I wanted to make more use of HTML UL/LI elements than the table based layouts that you normally use in GWT applications. Biggest advantages for me is that other people can make changes to the layout/design of the page without having to touch the code itself.

I couldn't find a class in GWT or anywhere else that helps with that, so I wrote my own. I can create HTML like this now:

  • Widget A
  • Widget B
with this code:
UlListPanel ulList = new UlListPanel();
ulList.addStyleName("sampleList");
ulList.add(widgetA);
ulList.add(widgetB);

Download here: UlListPanel.java
The code is a bit messy, so if you have a better version let me know.

I'm using this class for my GWT based travel blog software.