PDA

View Full Version : best method to add padding to a container?



george9
30 Jun 2009, 2:53 PM
For example, if there's a FormPanel in a TabItem, both have their own layouts - what is the best method to add a padding so that there is space between the form fields and the tab border?

a) insert a panel with padding support, ie. HorizontalPanel

b) insert a panel with TableRowLayout

c) use TabItem.setStyleAttribute("padding", ...)

d) use FormPanel.addStyleName(...) and add the padding in CSS

c) use TabItem.addStyleName(...) and add the padding in CSS

I've used d), but I'd like to know what you think about it.
Maybe a) is a cleaner way, because the CSS depends on how the components render into elements, which is more likely to change in the future, then how the Java API works. For example,
HorizonalPanel.setPadding() looks more future-proof than
div.ct-login-tab { padding: 10px; }.