PDA

View Full Version : change padding in FormLayout



pepgrifell
20 Mar 2009, 2:12 AM
hi,

I have a FieldSet with a LayoutContainer (ColumnLayout) as I want to put 3 fields algined horizontally. Then, I add each field in a LayoutContainer (FormLayout). See code below.



FieldSet fieldSet = new FieldSet();

LayoutContainer firstLine = new LayoutContainer();
firstLine.setLayout(new ColumnLayout());

LayoutContainer firstLineFirstColumn = new LayoutContainer();
firstLineFirstColumn.setLayout(new FormLayout());
firstLine.add(firstLineFirstColumn, new ColumnData(0.33));
TextField textField = new TextField();
textField.setFieldLabel("someLabel");
firstLineFirstColumn.add(textField, new FormData("100%"));
...


by this way I cannot change the padding of the FormLayout. If instead of



firstLineFirstColumn.setLayout(new FormLayout());


I try:



FormLayout formLayout = new FormLayout();
formLayout.setPadding(2);
firstLineFirstColumn.setLayout(formLayout);


Then the field does not appear inside the fieldset... (fieldset appears empty)
If I just want to change one of the paddings (ex: left padding) does I need to do this in the layout (FormLayout) or in the LayoutContainer ?


formLayout.setStyleAttribute("padding", "0 0 10px 0");
or

firstLineFirstColumn.setStyleAttribute("padding", "0 0 10px 0");


Thanks !

pepgrifell
20 Mar 2009, 2:15 AM
Sorry, I saw that I cannot call setStyleAttribute(...) in FormLayout