com.vaadin.ui
Class CustomField<T>
java.lang.Object
com.vaadin.server.AbstractClientConnector
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractField<T>
com.vaadin.ui.CustomField<T>
- Type Parameters:
T - field value type
- All Implemented Interfaces:
- Buffered, BufferedValidatable, Property<T>, Property.Editor, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer, Validatable, Action.ShortcutNotifier, MethodEventSource, ClientConnector, Sizeable, com.vaadin.shared.Connector, Component, Component.Focusable, Field<T>, HasComponents, java.io.Serializable, java.lang.Iterable<Component>
public abstract class CustomField<T>
- extends AbstractField<T>
- implements HasComponents
A Field whose UI content can be constructed by the user, enabling the
creation of e.g. form fields by composing Vaadin components. Customization of
both the visual presentation and the logic of the field is possible.
Subclasses must implement AbstractField.getType() and initContent().
Most custom fields can simply compose a user interface that calls the methods
AbstractField.setInternalValue(Object) and AbstractField.getInternalValue() when
necessary.
It is also possible to override AbstractField.validate(),
AbstractField.setInternalValue(Object), AbstractField.commit(),
AbstractField.setPropertyDataSource(Property), AbstractField.isEmpty() and other logic
of the field. Methods overriding AbstractField.setInternalValue(Object) should
also call the corresponding superclass method.
- Since:
- 7.0
- See Also:
- Serialized Form
|
Constructor Summary |
CustomField()
Constructs a new custom field. |
| Methods inherited from class com.vaadin.ui.AbstractField |
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, beforeClientResponse, clear, commit, detach, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getCustomAttributes, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getState, getState, getTabIndex, getType, getValidators, getValue, isBuffered, isEmpty, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isRequired, isValid, isValidationVisible, readDesign, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInternalValue, setInvalidAllowed, setInvalidCommitted, setLocale, setPropertyDataSource, setReadOnly, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, setValue, shouldHideErrors, toString, validate, validate, valueChange, writeDesign |
| Methods inherited from class com.vaadin.ui.AbstractComponent |
addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isImmediate, isOrHasAncestor, isVisible, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setParent, setPrimaryStyleName, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidthUndefined |
| Methods inherited from class com.vaadin.server.AbstractClientConnector |
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.vaadin.ui.Component |
addListener, addStyleName, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, readDesign, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisible, writeDesign |
| Methods inherited from interface com.vaadin.server.ClientConnector |
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler |
| Methods inherited from interface com.vaadin.shared.Connector |
getConnectorId |
CustomField
public CustomField()
- Constructs a new custom field.
The component is implemented by wrapping the methods of the composition
root component given as parameter. The composition root must be set
before the component can be used.
attach
public void attach()
- Constructs the content and notifies it that the
CustomField is
attached to a window.
- Specified by:
attach in interface ClientConnector- Specified by:
attach in interface Component- Overrides:
attach in class AbstractField<T>
- See Also:
Component.attach()
getContent
protected Component getContent()
- Returns the content (UI) of the custom component.
- Returns:
- Component
initContent
protected abstract Component initContent()
- Create the content component or layout for the field. Subclasses of
CustomField should implement this method.
Note that this method is called when the CustomField is attached to a
layout or when getContent() is called explicitly for the first
time. It is only called once for a CustomField.
- Returns:
Component representing the UI of the CustomField
setHeight
public void setHeight(float height,
Sizeable.Unit unit)
- Description copied from interface:
Sizeable
- Sets the height of the object. Negative number implies unspecified size
(terminal is free to set the size).
- Specified by:
setHeight in interface Sizeable- Overrides:
setHeight in class AbstractComponent
- Parameters:
height - the height of the object.unit - the unit used for the width.
setWidth
public void setWidth(float width,
Sizeable.Unit unit)
- Description copied from interface:
Sizeable
- Sets the width of the object. Negative number implies unspecified size
(terminal is free to set the size).
- Specified by:
setWidth in interface Sizeable- Overrides:
setWidth in class AbstractComponent
- Parameters:
width - the width of the object.unit - the unit used for the width.
iterator
public java.util.Iterator<Component> iterator()
- Description copied from interface:
HasComponents
- Gets an iterator to the collection of contained components. Using this
iterator it is possible to step through all components contained in this
container.
- Specified by:
iterator in interface HasComponents- Specified by:
iterator in interface java.lang.Iterable<Component>
- Returns:
- the component iterator.
Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.