T - field value typepublic abstract class CustomField<T> extends AbstractField<T> implements HasComponents
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.AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEventHasComponents.ComponentAttachDetachNotifier, HasComponents.ComponentAttachEvent, HasComponents.ComponentAttachListener, HasComponents.ComponentDetachEvent, HasComponents.ComponentDetachListenerComponent.ErrorEvent, Component.Event, Component.Focusable, Component.ListenerClientConnector.AttachEvent, ClientConnector.AttachListener, ClientConnector.ConnectorErrorEvent, ClientConnector.DetachEvent, ClientConnector.DetachListenerSizeable.UnitField.ValueChangeEventBuffered.SourceExceptionProperty.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.Transactional<T>, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.ViewerDESIGN_ATTR_PLAIN_TEXTSIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS| Constructor and Description |
|---|
CustomField()
Constructs a new custom field.
|
| Modifier and Type | Method and Description |
|---|---|
void |
attach()
Constructs the content and notifies it that the
CustomField is
attached to a window. |
protected Component |
getContent()
Returns the content (UI) of the custom component.
|
protected abstract Component |
initContent()
Create the content component or layout for the field.
|
Iterator<Component> |
iterator()
Gets an iterator to the collection of contained components.
|
void |
setHeight(float height,
Sizeable.Unit unit)
Sets the height of the object.
|
void |
setWidth(float width,
Sizeable.Unit unit)
Sets the width of the object.
|
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, isImmediate, 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, setValue, shouldHideErrors, toString, validate, validate, valueChange, writeDesignaddContextClickListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidthUndefinedaddAttachListener, 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, setResourceclone, finalize, getClass, notify, notifyAll, wait, wait, waitaddListener, 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, writeDesignaddAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandlergetConnectorIdgetHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidthUndefinedforEach, spliteratoraddShortcutListener, removeShortcutListenerpublic CustomField()
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.
public void attach()
CustomField is
attached to a window.attach in interface ClientConnectorattach in interface Componentattach in class AbstractField<T>Component.attach()protected Component getContent()
protected abstract Component initContent()
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.Component representing the UI of the CustomFieldpublic void setHeight(float height,
Sizeable.Unit unit)
SizeablesetHeight in interface SizeablesetHeight in class AbstractComponentheight - the height of the object.unit - the unit used for the width.public void setWidth(float width,
Sizeable.Unit unit)
SizeablesetWidth in interface SizeablesetWidth in class AbstractComponentwidth - the width of the object.unit - the unit used for the width.public Iterator<Component> iterator()
HasComponentsiterator in interface HasComponentsiterator in interface Iterable<Component>Copyright © 2016 Vaadin Ltd. All rights reserved.