diff options
author | Marc Englund <marc.englund@itmill.com> | 2007-11-19 14:03:05 +0000 |
---|---|---|
committer | Marc Englund <marc.englund@itmill.com> | 2007-11-19 14:03:05 +0000 |
commit | f2e3722df9676436680afc0f1991e91e1696fb99 (patch) | |
tree | 6f255ff78abaf96f1e71a1f2c9ecd3b66647f4a2 /src/com/itmill/toolkit/ui/BaseFieldFactory.java | |
parent | 93291f532db9d545cf2a8dd98e2671f27cd197b0 (diff) | |
download | vaadin-framework-f2e3722df9676436680afc0f1991e91e1696fb99.tar.gz vaadin-framework-f2e3722df9676436680afc0f1991e91e1696fb99.zip |
MASS REFORMAT.
According to http://toolkit.intra.itmill.com/trac/itmilltoolkit/wiki/CodingConventions
svn changeset:2864/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/ui/BaseFieldFactory.java')
-rw-r--r-- | src/com/itmill/toolkit/ui/BaseFieldFactory.java | 158 |
1 files changed, 81 insertions, 77 deletions
diff --git a/src/com/itmill/toolkit/ui/BaseFieldFactory.java b/src/com/itmill/toolkit/ui/BaseFieldFactory.java index c9881e6854..e5d6af12e6 100644 --- a/src/com/itmill/toolkit/ui/BaseFieldFactory.java +++ b/src/com/itmill/toolkit/ui/BaseFieldFactory.java @@ -50,82 +50,86 @@ import com.itmill.toolkit.data.Property; public class BaseFieldFactory implements FieldFactory { - /** - * Creates the field based on type of data. - * - * - * @param type - * the type of data presented in field. - * @param uiContext - * the context where the Field is presented. - * - * @see com.itmill.toolkit.ui.FieldFactory#createField(Class, Component) - */ - public Field createField(Class type, Component uiContext) { - // Null typed properties can not be edited - if (type == null) - return null; - - // Item field - if (Item.class.isAssignableFrom(type)) { - return new Form(); - } - - // Date field - if (Date.class.isAssignableFrom(type)) { - DateField df = new DateField(); - df.setResolution(DateField.RESOLUTION_DAY); - return df; - } - - // Boolean field - if (Boolean.class.isAssignableFrom(type)) { - Button button = new Button(); - button.setSwitchMode(true); - button.setImmediate(false); - return button; - } - - // Nested form is used by default - return new TextField(); - } - - /** - * Creates the field based on the datasource property. - * - * @see com.itmill.toolkit.ui.FieldFactory#createField(Property, Component) - */ - public Field createField(Property property, Component uiContext) { - if (property != null) - return createField(property.getType(), uiContext); - else - return null; - } - - /** - * Creates the field based on the item and property id. - * - * @see com.itmill.toolkit.ui.FieldFactory#createField(Item, Object, - * Component) - */ - public Field createField(Item item, Object propertyId, Component uiContext) { - if (item != null && propertyId != null) { - Field f = createField(item.getItemProperty(propertyId), uiContext); - if (f instanceof AbstractComponent) - ((AbstractComponent) f).setCaption(propertyId.toString()); - return f; - } else - return null; - } - - /** - * @see com.itmill.toolkit.ui.FieldFactory#createField(com.itmill.toolkit.data.Container, - * java.lang.Object, java.lang.Object, com.itmill.toolkit.ui.Component) - */ - public Field createField(Container container, Object itemId, - Object propertyId, Component uiContext) { - return createField(container.getContainerProperty(itemId, propertyId), - uiContext); - } + /** + * Creates the field based on type of data. + * + * + * @param type + * the type of data presented in field. + * @param uiContext + * the context where the Field is presented. + * + * @see com.itmill.toolkit.ui.FieldFactory#createField(Class, Component) + */ + public Field createField(Class type, Component uiContext) { + // Null typed properties can not be edited + if (type == null) { + return null; + } + + // Item field + if (Item.class.isAssignableFrom(type)) { + return new Form(); + } + + // Date field + if (Date.class.isAssignableFrom(type)) { + DateField df = new DateField(); + df.setResolution(DateField.RESOLUTION_DAY); + return df; + } + + // Boolean field + if (Boolean.class.isAssignableFrom(type)) { + Button button = new Button(); + button.setSwitchMode(true); + button.setImmediate(false); + return button; + } + + // Nested form is used by default + return new TextField(); + } + + /** + * Creates the field based on the datasource property. + * + * @see com.itmill.toolkit.ui.FieldFactory#createField(Property, Component) + */ + public Field createField(Property property, Component uiContext) { + if (property != null) { + return createField(property.getType(), uiContext); + } else { + return null; + } + } + + /** + * Creates the field based on the item and property id. + * + * @see com.itmill.toolkit.ui.FieldFactory#createField(Item, Object, + * Component) + */ + public Field createField(Item item, Object propertyId, Component uiContext) { + if (item != null && propertyId != null) { + Field f = createField(item.getItemProperty(propertyId), uiContext); + if (f instanceof AbstractComponent) { + ((AbstractComponent) f).setCaption(propertyId.toString()); + } + return f; + } else { + return null; + } + } + + /** + * @see com.itmill.toolkit.ui.FieldFactory#createField(com.itmill.toolkit.data.Container, + * java.lang.Object, java.lang.Object, com.itmill.toolkit.ui.Component) + */ + public Field createField(Container container, Object itemId, + Object propertyId, Component uiContext) { + return createField(container.getContainerProperty(itemId, propertyId), + uiContext); + } } |