Class Form

    • Constructor Detail

      • Form

        public Form()
        Deprecated.
        Constructs a new form with default layout.

        By default the form uses FormLayout.

      • Form

        public Form​(Layout formLayout)
        Deprecated.
        Constructs a new form with given Layout.
        Parameters:
        formLayout - the layout of the form.
      • Form

        public Form​(Layout formLayout,
                    FormFieldFactory fieldFactory)
        Deprecated.
        Constructs a new form with given Layout and FormFieldFactory.
        Parameters:
        formLayout - the layout of the form.
        fieldFactory - the FieldFactory of the form.
    • Method Detail

      • getErrorMessage

        public ErrorMessage getErrorMessage()
        Deprecated.
        The error message of a Form is the error of the first field with a non-empty error. Empty error messages of the contained fields are skipped, because an empty error indicator would be confusing to the user, especially if there are errors that have something to display. This is also the reason why the calculation of the error message is separate from validation, because validation fails also on empty errors.
        Overrides:
        getErrorMessage in class AbstractField<Object>
        See Also:
        AbstractComponent.getErrorMessage()
      • setValidationVisibleOnCommit

        public void setValidationVisibleOnCommit​(boolean makeVisible)
        Deprecated.
        Controls the making validation visible implicitly on commit. Having commit() call setValidationVisible(true) implicitly is the default behavior. You can disable the implicit setting by setting this property as false. It is useful, because you usually want to start with the form free of errors and only display them after the user clicks Ok. You can disable the implicit setting by setting this property as false.
        Parameters:
        makeVisible - If true (default), validation is made visible when commit() is called. If false, the visibility is left as it is.
      • isValidationVisibleOnCommit

        public boolean isValidationVisibleOnCommit()
        Deprecated.
        Is validation made automatically visible on commit? See setValidationVisibleOnCommit().
        Returns:
        true if validation is made automatically visible on commit.
      • isModified

        public boolean isModified()
        Deprecated.
        Description copied from interface: Buffered
        Tests if the value stored in the object has been modified since it was last updated from the data source.
        Specified by:
        isModified in interface Buffered
        Overrides:
        isModified in class AbstractField<Object>
        Returns:
        true if the value in the object has been modified since the last data source update, false if not.
      • setBuffered

        public void setBuffered​(boolean buffered)
        Deprecated.
        Description copied from class: AbstractField
        Sets the buffered mode of this Field.

        When the field is in buffered mode, changes will not be committed to the property data source until AbstractField.commit() is called.

        Setting buffered mode from true to false will commit any pending changes.

        Specified by:
        setBuffered in interface Buffered
        Overrides:
        setBuffered in class AbstractField<Object>
        Parameters:
        buffered - true if buffered mode should be turned on, false otherwise
      • addItemProperty

        public boolean addItemProperty​(Object id,
                                       Property property)
        Deprecated.
        Adds a new property to form and create corresponding field.
        Specified by:
        addItemProperty in interface Item
        Parameters:
        id - ID of the new Property
        property - the Property to be added and associated with the id
        Returns:
        true if the operation succeeded, false if not
        See Also:
        Item.addItemProperty(Object, Property)
      • addField

        public void addField​(Object propertyId,
                             Field<?> field)
        Deprecated.
        Registers the field with the form and adds the field to the form layout.

        The property id must not be already used in the form.

        This field is added to the layout using the attachField(Object, Field) method.

        Parameters:
        propertyId - the Property id the the field.
        field - the field which should be added to the form.
      • attachField

        protected void attachField​(Object propertyId,
                                   Field field)
        Deprecated.
        Adds the field to the form layout.

        The field is added to the form layout in the default position (the position used by ComponentContainer.addComponent(Component). If the underlying layout is a CustomLayout the field is added to the CustomLayout location given by the string representation of the property id using CustomLayout.addComponent(Component, String).

        Override this method to control how the fields are added to the layout.

        Parameters:
        propertyId -
        field -
      • getItemProperty

        public Property getItemProperty​(Object id)
        Deprecated.
        The property identified by the property id.

        The property data source of the field specified with property id is returned. If there is a (with specified property id) having no data source, the field is returned instead of the data source.

        Specified by:
        getItemProperty in interface Item
        Parameters:
        id - identifier of the Property to get
        Returns:
        the Property with the given ID or null
        See Also:
        Item.getItemProperty(Object)
      • getField

        public Field getField​(Object propertyId)
        Deprecated.
        Gets the field identified by the propertyid.
        Parameters:
        propertyId - the id of the property.
      • getItemPropertyIds

        public Collection<?> getItemPropertyIds()
        Deprecated.
        Description copied from interface: Item
        Gets the collection of IDs of all Properties stored in the Item.
        Specified by:
        getItemPropertyIds in interface Item
        Returns:
        unmodifiable collection containing IDs of the Properties stored the Item
      • removeItemProperty

        public boolean removeItemProperty​(Object id)
        Deprecated.
        Removes the property and corresponding field from the form.
        Specified by:
        removeItemProperty in interface Item
        Parameters:
        id - ID of the Property to be removed
        Returns:
        true if the operation succeeded
        See Also:
        Item.removeItemProperty(Object)
      • detachField

        protected void detachField​(Field field)
        Deprecated.
        Called when a form field is detached from a Form. Typically when a new Item is assigned to Form via setItemDataSource(Item).

        Override this method to control how the fields are removed from the layout.

        Parameters:
        field - the field to be detached from the forms layout.
      • removeAllProperties

        public boolean removeAllProperties()
        Deprecated.
        Removes all properties and fields from the form.
        Returns:
        the Success of the operation. Removal of all fields succeeded if (and only if) the return value is true.
      • getItemDataSource

        public Item getItemDataSource()
        Deprecated.
        Description copied from interface: Item.Viewer
        Gets the Item serving as the data source of the viewer.
        Specified by:
        getItemDataSource in interface Item.Viewer
        Returns:
        data source Item
      • setItemDataSource

        public void setItemDataSource​(Item newDataSource)
        Deprecated.
        Sets the item datasource for the form.

        Setting item datasource clears any fields, the form might contain and adds all the properties as fields to the form.

        Specified by:
        setItemDataSource in interface Item.Viewer
        Parameters:
        newDataSource - The new data source Item
        See Also:
        Item.Viewer.setItemDataSource(Item)
      • setItemDataSource

        public void setItemDataSource​(Item newDataSource,
                                      Collection<?> propertyIds)
        Deprecated.
        Set the item datasource for the form, but limit the form contents to specified properties of the item.

        Setting item datasource clears any fields, the form might contain and adds the specified the properties as fields to the form, in the specified order.

        See Also:
        Item.Viewer.setItemDataSource(Item)
      • bindPropertyToField

        protected void bindPropertyToField​(Object propertyId,
                                           Property property,
                                           Field field)
        Deprecated.
        Binds an item property to a field. The default behavior is to bind property straight to Field. If Property.Viewer type property (e.g. PropertyFormatter) is already set for field, the property is bound to that Property.Viewer.
        Parameters:
        propertyId -
        property -
        field -
        Since:
        6.7.3
      • getLayout

        public Layout getLayout()
        Deprecated.
        Gets the layout of the form.

        By default form uses OrderedLayout with form -style.

        Returns:
        the Layout of the form.
      • setLayout

        public void setLayout​(Layout layout)
        Deprecated.
        Sets the layout of the form.

        If set to null then Form uses a FormLayout by default.

        Parameters:
        layout - the layout of the form.
      • replaceWithSelect

        public AbstractSelect replaceWithSelect​(Object propertyId,
                                                Object[] values,
                                                Object[] descriptions)
        Deprecated.
        Sets the form field to be selectable from static list of changes.

        The list values and descriptions are given as array. The value-array must contain the current value of the field and the lengths of the arrays must match. Null values are not supported.

        Note: since Vaadin 7.0, returns an AbstractSelect instead of a Select.
        Parameters:
        propertyId - the id of the property.
        values -
        descriptions -
        Returns:
        the select property generated
      • setFormFieldFactory

        public void setFormFieldFactory​(FormFieldFactory fieldFactory)
        Deprecated.
        Sets the field factory used by this Form to genarate Fields for properties. FormFieldFactory is used to create fields for form properties. DefaultFieldFactory is used by default.
        Parameters:
        fieldFactory - the new factory used to create the fields.
        See Also:
        Field, FormFieldFactory
      • getFormFieldFactory

        public FormFieldFactory getFormFieldFactory()
        Deprecated.
        Get the field factory of the form.
        Returns:
        the FormFieldFactory Factory used to create the fields.
      • setFormDataSource

        protected void setFormDataSource​(Object data,
                                         Collection<?> properties)
        Deprecated.
        Updates the internal form datasource. Method setFormDataSource.
        Parameters:
        data -
        properties -
      • getVisibleItemProperties

        public Collection<?> getVisibleItemProperties()
        Deprecated.
        Returns the visibleProperties.
        Returns:
        the Collection of visible Item properites.
      • setVisibleItemProperties

        public void setVisibleItemProperties​(Collection<?> visibleProperties)
        Deprecated.
        Sets the visibleProperties.
        Parameters:
        visibleProperties - the visibleProperties to set.
      • setVisibleItemProperties

        public void setVisibleItemProperties​(Object... visibleProperties)
        Deprecated.
        Sets the visibleProperties.
        Parameters:
        visibleProperties - the visibleProperties to set.
      • setImmediate

        public void setImmediate​(boolean immediate)
        Deprecated.
        Setting the form to be immediate also sets all the fields of the form to the same state.
        Overrides:
        setImmediate in class AbstractLegacyComponent
        Parameters:
        immediate - the boolean value specifying if the component should be in the immediate mode after the call.
      • isEmpty

        public boolean isEmpty()
        Deprecated.
        Is the field empty? In general, "empty" state is same as null. As an exception, TextField also treats empty string as "empty".

        A Form is empty if all of its fields are empty.

        Specified by:
        isEmpty in interface Field<Object>
        Overrides:
        isEmpty in class AbstractField<Object>
        Returns:
        true if the field is empty, false otherwise
      • clear

        public void clear()
        Deprecated.
        Description copied from interface: Field
        Clears the value of the field.

        The field value is typically reset to the initial value of the field. Calling Field.isEmpty() on a cleared field must always returns true.

        Specified by:
        clear in interface Field<Object>
        Overrides:
        clear in class AbstractField<Object>
      • addValidator

        public void addValidator​(Validator validator)
        Deprecated.
        Adding validators directly to form is not supported. Add the validators to form fields instead.
        Specified by:
        addValidator in interface Validatable
        Overrides:
        addValidator in class AbstractField<Object>
        Parameters:
        validator - the new validator to be added.
      • getFooter

        public Layout getFooter()
        Deprecated.
        Returns a layout that is rendered below normal form contents. This area can be used for example to include buttons related to form contents.
        Returns:
        layout rendered below normal form contents or null if no footer is used
      • setFooter

        public void setFooter​(Layout footer)
        Deprecated.
        Sets the layout that is rendered below normal form contents. No footer is rendered if this is set to null, .
        Parameters:
        footer - the new footer layout
      • getOwnActionManager

        protected ActionManager getOwnActionManager()
        Deprecated.
        Gets the ActionManager responsible for handling Actions added to this Form.
        Note that Form has another ActionManager inherited from AbstractField. The ownActionManager handles Actions attached to this Form specifically, while the ActionManager in AbstractField delegates to the containing Window (i.e global Actions).
        Returns:
      • removeAllActionHandlers

        public void removeAllActionHandlers()
        Deprecated.
        Removes all action handlers.
      • getComponentCount

        public int getComponentCount()
        Deprecated.