diff options
author | Artur Signell <artur@vaadin.com> | 2012-12-07 15:51:01 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-12-07 16:56:16 +0200 |
commit | 7ac9f6509ef97bcf19b83c82318a3f29f9491d91 (patch) | |
tree | 4bbe8daaa66293bb4c813c13a445eec969c03d9c /server | |
parent | 83b5695f5585f6a1aa305df40ae0c9739ac02d8b (diff) | |
download | vaadin-framework-7ac9f6509ef97bcf19b83c82318a3f29f9491d91.tar.gz vaadin-framework-7ac9f6509ef97bcf19b83c82318a3f29f9491d91.zip |
Added support for empty footer for Form (#10478)
Change-Id: I4a9b4206ad735934246cdb0e03dc6b70a24fc726
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/ui/Form.java | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/server/src/com/vaadin/ui/Form.java b/server/src/com/vaadin/ui/Form.java index 862d98bb3c..d95b0ec70e 100644 --- a/server/src/com/vaadin/ui/Form.java +++ b/server/src/com/vaadin/ui/Form.java @@ -187,7 +187,7 @@ public class Form extends AbstractField<Object> implements Item.Editor, public Form(Layout formLayout, FormFieldFactory fieldFactory) { super(); setLayout(formLayout); - setFooter(null); + setFooter(new HorizontalLayout()); setFormFieldFactory(fieldFactory); setValidationVisible(false); setWidth(100, UNITS_PERCENTAGE); @@ -1210,16 +1210,16 @@ public class Form extends AbstractField<Object> implements Item.Editor, * Returns a layout that is rendered below normal form contents. This area * can be used for example to include buttons related to form contents. * - * @return layout rendered below normal form contents. + * @return layout rendered below normal form contents or null if no footer + * is used */ public Layout getFooter() { return (Layout) getState().footer; } /** - * Sets the layout that is rendered below normal form contents. Setting this - * to null will cause an empty HorizontalLayout to be rendered in the - * footer. + * Sets the layout that is rendered below normal form contents. No footer is + * rendered if this is set to null, . * * @param footer * the new footer layout @@ -1228,12 +1228,10 @@ public class Form extends AbstractField<Object> implements Item.Editor, if (getFooter() != null) { getFooter().setParent(null); } - if (footer == null) { - footer = new HorizontalLayout(); - } - getState().footer = footer; - footer.setParent(this); + if (footer != null) { + footer.setParent(this); + } } @Override @@ -1332,9 +1330,16 @@ public class Form extends AbstractField<Object> implements Item.Editor, } i++; if (i == 1) { - return getLayout() != null ? getLayout() : getFooter(); + if (getLayout() != null) { + return getLayout(); + } + if (getFooter() != null) { + return getFooter(); + } } else if (i == 2) { - return getFooter(); + if (getFooter() != null) { + return getFooter(); + } } return null; } |