|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.server.AbstractClientConnector
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractField<java.lang.Object>
com.vaadin.ui.Form
FieldGroup instead of Form for more
flexibility.
@Deprecated public class Form
Form component provides easy way of creating and managing sets fields.
Form is a container for fields implementing Field
interface. It provides support for any layouts and provides buffering
interface for easy connection of commit and discard buttons. All the form
fields can be customized by adding validators, setting captions and icons,
setting immediateness, etc. Also direct mechanism for replacing existing
fields with selections is given.
Form provides customizable editor for classes implementing
Item interface. Also the form itself implements this
interface for easier connectivity to other items. To use the form as editor
for an item, just connect the item to form with
setItemDataSource(Item). If only a part of the item needs to be
edited, setItemDataSource(Item,Collection) can be used instead.
After the item has been connected to the form, the automatically created
fields can be customized and new fields can be added. If you need to connect
a class that does not implement Item interface, most
properties of any class following bean pattern, can be accessed trough
BeanItem.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.vaadin.ui.AbstractField |
|---|
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent |
| Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent |
|---|
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler |
| Nested classes/interfaces inherited from interface com.vaadin.data.Buffered |
|---|
Buffered.SourceException |
| Nested classes/interfaces inherited from interface com.vaadin.data.Item |
|---|
Item.Editor, Item.PropertySetChangeEvent, Item.PropertySetChangeListener, Item.PropertySetChangeNotifier, Item.Viewer |
| Nested classes/interfaces inherited from interface com.vaadin.server.VariableOwner |
|---|
VariableOwner.ErrorEvent |
| Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
|---|
Component.ErrorEvent, Component.ErrorListener, Component.Event, Component.Focusable, Component.Listener |
| Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable |
|---|
Sizeable.Unit |
| Nested classes/interfaces inherited from interface com.vaadin.ui.Field |
|---|
Field.ValueChangeEvent |
| Nested classes/interfaces inherited from interface com.vaadin.data.Property |
|---|
Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer |
| Field Summary |
|---|
| Fields inherited from interface com.vaadin.server.Sizeable |
|---|
SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS |
| Constructor Summary | |
|---|---|
Form()
Deprecated. Constructs a new form with default layout. |
|
Form(Layout formLayout)
Deprecated. Constructs a new form with given Layout. |
|
Form(Layout formLayout,
FormFieldFactory fieldFactory)
Deprecated. Constructs a new form with given Layout and
FormFieldFactory. |
|
| Method Summary | ||
|---|---|---|
|
addAction(T action)
Deprecated. |
|
void |
addActionHandler(Action.Handler actionHandler)
Deprecated. Registers a new action handler for this container |
|
void |
addField(java.lang.Object propertyId,
Field<?> field)
Deprecated. Registers the field with the form and adds the field to the form layout. |
|
boolean |
addItemProperty(java.lang.Object id,
Property property)
Deprecated. Adds a new property to form and create corresponding field. |
|
void |
addValidator(Validator validator)
Deprecated. Adding validators directly to form is not supported. |
|
protected void |
attachField(java.lang.Object propertyId,
Field field)
Deprecated. Adds the field to the form layout. |
|
protected void |
bindPropertyToField(java.lang.Object propertyId,
Property property,
Field field)
Deprecated. Binds an item property to a field. |
|
void |
changeVariables(java.lang.Object source,
java.util.Map<java.lang.String,java.lang.Object> variables)
Deprecated. Called when one or more variables handled by the implementing class are changed. |
|
void |
commit()
Deprecated. Updates all changes since the previous commit to the data source. |
|
protected void |
detachField(Field field)
Deprecated. Called when a form field is detached from a Form. |
|
void |
discard()
Deprecated. Discards all changes since last commit. |
|
void |
focus()
Deprecated. Focuses the first field in the form. |
|
int |
getComponentCount()
Deprecated. |
|
java.util.Iterator<Component> |
getComponentIterator()
Deprecated. As of 7.0, use iterator() instead. |
|
ErrorMessage |
getErrorMessage()
Deprecated. The error message of a Form is the error of the first field with a non-empty error. |
|
Field |
getField(java.lang.Object propertyId)
Deprecated. Gets the field identified by the propertyid. |
|
Layout |
getFooter()
Deprecated. Returns a layout that is rendered below normal form contents. |
|
FormFieldFactory |
getFormFieldFactory()
Deprecated. Get the field factory of the form. |
|
Item |
getItemDataSource()
Deprecated. Gets the Item serving as the data source of the viewer. |
|
Property |
getItemProperty(java.lang.Object id)
Deprecated. The property identified by the property id. |
|
java.util.Collection<?> |
getItemPropertyIds()
Deprecated. Gets the collection of IDs of all Properties stored in the Item. |
|
Layout |
getLayout()
Deprecated. Gets the layout of the form. |
|
protected ActionManager |
getOwnActionManager()
Deprecated. Gets the ActionManager responsible for handling Actions
added to this Form.Note that Form has another ActionManager inherited from AbstractField. |
|
protected com.vaadin.shared.ui.form.FormState |
getState()
Deprecated. Returns the shared state bean with information to be sent from the server to the client. |
|
java.lang.Class<?> |
getType()
Deprecated. Gets the field type. |
|
java.util.Collection<?> |
getVisibleItemProperties()
Deprecated. Returns the visibleProperties. |
|
boolean |
isComponentVisible(Component childComponent)
Deprecated. Checks if the child component is visible. |
|
protected boolean |
isEmpty()
Deprecated. Form is empty if all of its fields are empty. |
|
boolean |
isInvalidAllowed()
Deprecated. Checks the validabtable object accept invalid values. |
|
boolean |
isModified()
Deprecated. Tests if the value stored in the object has been modified since it was last updated from the data source. |
|
boolean |
isValidationVisibleOnCommit()
Deprecated. Is validation made automatically visible on commit? See setValidationVisibleOnCommit(). |
|
java.util.Iterator<Component> |
iterator()
Deprecated. Gets an iterator to the collection of contained components. |
|
void |
paintContent(PaintTarget target)
Deprecated. Paints the Paintable into a UIDL stream. |
|
|
removeAction(T action)
Deprecated. |
|
void |
removeActionHandler(Action.Handler actionHandler)
Deprecated. Removes a previously registered action handler for the contents of this container. |
|
void |
removeAllActionHandlers()
Deprecated. Removes all action handlers |
|
boolean |
removeAllProperties()
Deprecated. Removes all properties and fields from the form. |
|
boolean |
removeItemProperty(java.lang.Object id)
Deprecated. Removes the property and corresponding field from the form. |
|
AbstractSelect |
replaceWithSelect(java.lang.Object propertyId,
java.lang.Object[] values,
java.lang.Object[] descriptions)
Deprecated. Sets the form field to be selectable from static list of changes. |
|
void |
setBuffered(boolean buffered)
Deprecated. Sets the buffered mode of this Field. |
|
void |
setEnabled(boolean enabled)
Deprecated. Enables or disables the component. |
|
void |
setFooter(Layout footer)
Deprecated. Sets the layout that is rendered below normal form contents. |
|
protected void |
setFormDataSource(java.lang.Object data,
java.util.Collection<?> properties)
Deprecated. Updates the internal form datasource. |
|
void |
setFormFieldFactory(FormFieldFactory fieldFactory)
Deprecated. Sets the field factory used by this Form to genarate Fields for properties. |
|
void |
setImmediate(boolean immediate)
Deprecated. Setting the form to be immediate also sets all the fields of the form to the same state. |
|
protected void |
setInternalValue(java.lang.Object newValue)
Deprecated. Sets the internal value. |
|
void |
setInvalidAllowed(boolean invalidValueAllowed)
Deprecated. Should the validabtable object accept invalid values. |
|
void |
setItemDataSource(Item newDataSource)
Deprecated. Sets the item datasource for the form. |
|
void |
setItemDataSource(Item newDataSource,
java.util.Collection<?> propertyIds)
Deprecated. Set the item datasource for the form, but limit the form contents to specified properties of the item. |
|
void |
setLayout(Layout layout)
Deprecated. Sets the layout of the form. |
|
void |
setReadOnly(boolean readOnly)
Deprecated. Sets the component's to read-only mode to the specified state. |
|
void |
setTabIndex(int tabIndex)
Deprecated. Sets the Tabulator index of this Focusable component. |
|
void |
setValidationVisibleOnCommit(boolean makeVisible)
Deprecated. Controls the making validation visible implicitly on commit. |
|
void |
setVisibleItemProperties(java.util.Collection<?> visibleProperties)
Deprecated. Sets the visibleProperties. |
|
void |
setVisibleItemProperties(java.lang.Object[] visibleProperties)
Deprecated. Sets the visibleProperties. |
|
void |
validate()
Deprecated. Checks the validity of the Form and all of its fields. |
|
| Methods inherited from class com.vaadin.server.AbstractClientConnector |
|---|
addExtension, addMethodInvocationToQueue, createState, encodeState, getAllChildrenIterable, getConnectorId, getExtensions, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setResource |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.vaadin.data.Buffered |
|---|
isBuffered |
| Methods inherited from interface com.vaadin.data.Validatable |
|---|
getValidators, isValid, removeAllValidators, removeValidator |
| Methods inherited from interface com.vaadin.server.LegacyComponent |
|---|
markAsDirty |
| Methods inherited from interface com.vaadin.server.VariableOwner |
|---|
isEnabled, isImmediate |
| Methods inherited from interface com.vaadin.ui.Component |
|---|
addListener, addStyleName, attach, getCaption, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setIcon, setId, setPrimaryStyleName, setStyleName, setVisible |
| Methods inherited from interface com.vaadin.server.ClientConnector |
|---|
beforeClientResponse, detach, encodeState, getExtensions, getStateType, handleConnectorRequest, isConnectorEnabled, markAsDirtyRecursive, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setParent |
| Methods inherited from interface com.vaadin.shared.Connector |
|---|
getConnectorId |
| Methods inherited from interface com.vaadin.server.RpcTarget |
|---|
getRpcManager |
| Methods inherited from interface com.vaadin.server.Sizeable |
|---|
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setSizeFull, setSizeUndefined, setWidth, setWidth |
| Methods inherited from interface com.vaadin.event.Action.ShortcutNotifier |
|---|
addShortcutListener, removeShortcutListener |
| Constructor Detail |
|---|
public Form()
By default the form uses FormLayout.
public Form(Layout formLayout)
Layout.
formLayout - the layout of the form.
public Form(Layout formLayout,
FormFieldFactory fieldFactory)
Layout and
FormFieldFactory.
formLayout - the layout of the form.fieldFactory - the FieldFactory of the form.| Method Detail |
|---|
protected com.vaadin.shared.ui.form.FormState getState()
AbstractComponent
getState in class AbstractField<java.lang.Object>
public void paintContent(PaintTarget target)
throws PaintException
LegacyComponentPaints the Paintable into a UIDL stream. This method creates the UIDL sequence describing it and outputs it to the given UIDL stream.
It is called when the contents of the component should be painted in response to the component first being shown or having been altered so that its visual representation is changed.
paintContent in interface LegacyComponenttarget - the target UIDL stream where the component should paint itself
to.
PaintException - if the paint operation failed.
public void changeVariables(java.lang.Object source,
java.util.Map<java.lang.String,java.lang.Object> variables)
VariableOwner
changeVariables in interface VariableOwnersource - the Source of the variable change. This is the origin of the
event. For example in Web Adapter this is the request.variables - the Mapping from variable names to new variable values.public ErrorMessage getErrorMessage()
getErrorMessage in class AbstractField<java.lang.Object>AbstractComponent.getErrorMessage()public void setValidationVisibleOnCommit(boolean makeVisible)
makeVisible - If true (default), validation is made visible when commit() is
called. If false, the visibility is left as it is.public boolean isValidationVisibleOnCommit()
public void commit()
throws Buffered.SourceException,
Validator.InvalidValueException
Bufferedcommit is called.
commit in interface Bufferedcommit in class AbstractField<java.lang.Object>Buffered.SourceException - if the operation fails because of an exception is thrown by
the data source. The cause is included in the exception.
Validator.InvalidValueException - if the operation fails because validation is enabled and the
values do not validate
public void discard()
throws Buffered.SourceException
Buffered
discard in interface Buffereddiscard in class AbstractField<java.lang.Object>Buffered.SourceException - if the operation fails because of an exception is thrown by
the data source. The cause is included in the exception.public boolean isModified()
Buffered
isModified in interface BufferedisModified in class AbstractField<java.lang.Object>true if the value in the object has been modified
since the last data source update, false if not.public void setBuffered(boolean buffered)
AbstractField
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.
setBuffered in interface BufferedsetBuffered in class AbstractField<java.lang.Object>buffered - true if buffered mode should be turned on, false otherwise
public boolean addItemProperty(java.lang.Object id,
Property property)
addItemProperty in interface Itemid - ID of the new Propertyproperty - the Property to be added and associated with the id
true if the operation succeeded, false
if notItem.addItemProperty(Object, Property)
public void addField(java.lang.Object propertyId,
Field<?> field)
The property id must not be already used in the form.
This field is added to the layout using the
attachField(Object, Field) method.
propertyId - the Property id the the field.field - the field which should be added to the form.
protected void attachField(java.lang.Object propertyId,
Field field)
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.
propertyId - field - public Property getItemProperty(java.lang.Object 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.
getItemProperty in interface Itemid - identifier of the Property to get
nullItem.getItemProperty(Object)public Field getField(java.lang.Object propertyId)
propertyId - the id of the property.public java.util.Collection<?> getItemPropertyIds()
Item
getItemPropertyIds in interface Itempublic boolean removeItemProperty(java.lang.Object id)
removeItemProperty in interface Itemid - ID of the Property to be removed
true if the operation succeededItem.removeItemProperty(Object)protected void detachField(Field field)
setItemDataSource(Item).
Override this method to control how the fields are removed from the layout.
field - the field to be detached from the forms layout.public boolean removeAllProperties()
true.public Item getItemDataSource()
Item.Viewer
getItemDataSource in interface Item.Viewerpublic void setItemDataSource(Item newDataSource)
Setting item datasource clears any fields, the form might contain and adds all the properties as fields to the form.
setItemDataSource in interface Item.ViewernewDataSource - The new data source ItemItem.Viewer.setItemDataSource(Item)
public void setItemDataSource(Item newDataSource,
java.util.Collection<?> propertyIds)
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.
Item.Viewer.setItemDataSource(Item)
protected void bindPropertyToField(java.lang.Object propertyId,
Property property,
Field field)
propertyId - property - field - public Layout getLayout()
By default form uses OrderedLayout with form
-style.
public void setLayout(Layout layout)
If set to null then Form uses a FormLayout by default.
layout - the layout of the form.
public AbstractSelect replaceWithSelect(java.lang.Object propertyId,
java.lang.Object[] values,
java.lang.Object[] descriptions)
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 anAbstractSelect instead of a
Select.
propertyId - the id of the property.values - descriptions -
public void validate()
throws Validator.InvalidValueException
validate in interface Validatablevalidate in class AbstractField<java.lang.Object>Validator.InvalidValueException - if the value is not validValidatable.validate()public boolean isInvalidAllowed()
isInvalidAllowed in interface ValidatableisInvalidAllowed in class AbstractField<java.lang.Object>Validatable.isInvalidAllowed()
public void setInvalidAllowed(boolean invalidValueAllowed)
throws java.lang.UnsupportedOperationException
setInvalidAllowed in interface ValidatablesetInvalidAllowed in class AbstractField<java.lang.Object>java.lang.UnsupportedOperationException - if the setInvalidAllowed is not supported.Validatable.setInvalidAllowed(boolean)public void setReadOnly(boolean readOnly)
setReadOnly in interface Property<java.lang.Object>setReadOnly in interface ComponentsetReadOnly in class AbstractField<java.lang.Object>readOnly - a boolean value specifying whether the component is put
read-only mode or notComponent.setReadOnly(boolean)public void setFormFieldFactory(FormFieldFactory fieldFactory)
FormFieldFactory is used to create fields for form properties.
DefaultFieldFactory is used by default.
fieldFactory - the new factory used to create the fields.Field,
FormFieldFactorypublic FormFieldFactory getFormFieldFactory()
public java.lang.Class<?> getType()
getType in interface Property<java.lang.Object>getType in class AbstractField<java.lang.Object>AbstractField.getType()protected void setInternalValue(java.lang.Object newValue)
setInternalValue in class AbstractField<java.lang.Object>newValue - the new value to be set.AbstractField.setInternalValue(java.lang.Object)
protected void setFormDataSource(java.lang.Object data,
java.util.Collection<?> properties)
data - properties - public java.util.Collection<?> getVisibleItemProperties()
public void setVisibleItemProperties(java.util.Collection<?> visibleProperties)
visibleProperties - the visibleProperties to set.public void setVisibleItemProperties(java.lang.Object[] visibleProperties)
visibleProperties - the visibleProperties to set.public void focus()
focus in interface Component.Focusablefocus in class AbstractField<java.lang.Object>Component.Focusable.focus()public void setTabIndex(int tabIndex)
setTabIndex in interface Component.FocusablesetTabIndex in class AbstractField<java.lang.Object>tabIndex - the tab order of this component. Indexes usually start
from 1. Zero means that default tab order should be used.
A negative value means that the field should not be
included in the tabbing sequence.Component.Focusable.setTabIndex(int)public void setImmediate(boolean immediate)
setImmediate in class AbstractComponentimmediate - the boolean value specifying if the component should be in the
immediate mode after the call.Component#isImmediate()protected boolean isEmpty()
isEmpty in class AbstractField<java.lang.Object>public void addValidator(Validator validator)
addValidator in interface ValidatableaddValidator in class AbstractField<java.lang.Object>validator - the new validator to be added.public Layout getFooter()
public void setFooter(Layout footer)
footer - the new footer layoutpublic void setEnabled(boolean enabled)
Component
Button enabled = new Button("Enabled");
enabled.setEnabled(true); // The default
layout.addComponent(enabled);
Button disabled = new Button("Disabled");
disabled.setEnabled(false);
layout.addComponent(disabled);
This method will trigger a RepaintRequestEvent for the component
and, if it is a ComponentContainer, for all its children
recursively.
setEnabled in interface ComponentsetEnabled in class AbstractComponentenabled - a boolean value specifying if the component should be enabled
or notprotected ActionManager getOwnActionManager()
ActionManager responsible for handling Actions
added to this Form.AbstractField. The ownActionManager handles Actions attached to
this Form specifically, while the ActionManager in AbstractField
delegates to the containing Window (i.e global Actions).
public void addActionHandler(Action.Handler actionHandler)
Action.Container
addActionHandler in interface Action.ContaineractionHandler - the new handler to be added.public void removeActionHandler(Action.Handler actionHandler)
Action.Container
removeActionHandler in interface Action.ContaineractionHandler - the handler to be removed.public void removeAllActionHandlers()
public <T extends Action & Action.Listener> void addAction(T action)
addAction in interface Action.Notifierpublic <T extends Action & Action.Listener> void removeAction(T action)
removeAction in interface Action.Notifierpublic java.util.Iterator<Component> iterator()
HasComponents
iterator in interface HasComponentsiterator in interface java.lang.Iterable<Component>@Deprecated public java.util.Iterator<Component> getComponentIterator()
iterator() instead.
public int getComponentCount()
public boolean isComponentVisible(Component childComponent)
HasComponentsNote that this will prevent updates from reaching the child even though the child itself is set to visible. Also if a child is set to invisible this will not force it to be visible.
isComponentVisible in interface HasComponentschildComponent - The child component to check
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||