org.vostok.vaadin.addon.input.tfar
Class TextFieldActionRollback
java.lang.Object
com.vaadin.server.AbstractClientConnector
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractField<java.lang.String>
com.vaadin.ui.AbstractTextField
com.vaadin.ui.TextField
org.vostok.vaadin.addon.input.tfar.TextFieldActionRollback
- All Implemented Interfaces:
- com.vaadin.data.Buffered, com.vaadin.data.BufferedValidatable, com.vaadin.data.Property<java.lang.String>, com.vaadin.data.Property.Editor, com.vaadin.data.Property.ReadOnlyStatusChangeListener, com.vaadin.data.Property.ReadOnlyStatusChangeNotifier, com.vaadin.data.Property.ValueChangeListener, com.vaadin.data.Property.ValueChangeNotifier, com.vaadin.data.Property.Viewer, com.vaadin.data.Validatable, com.vaadin.event.Action.ShortcutNotifier, com.vaadin.event.ConnectorEventListener, com.vaadin.event.ContextClickEvent.ContextClickNotifier, com.vaadin.event.FieldEvents.BlurListener, com.vaadin.event.FieldEvents.BlurNotifier, com.vaadin.event.FieldEvents.FocusNotifier, com.vaadin.event.FieldEvents.TextChangeNotifier, com.vaadin.event.MethodEventSource, com.vaadin.server.ClientConnector, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.DetachListener, com.vaadin.server.Sizeable, com.vaadin.server.VariableOwner, com.vaadin.shared.Connector, com.vaadin.ui.Component, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Field<java.lang.String>, com.vaadin.ui.LegacyComponent, java.io.Serializable, java.util.EventListener
public class TextFieldActionRollback
- extends com.vaadin.ui.TextField
- implements com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.DetachListener, com.vaadin.event.FieldEvents.BlurListener
TextFieldActionRollback extend TextField with KeyPressAction for Enter, Tabulation, Escape, and also provides a 1 step history.
Key press support :
Enter and Tabulation validate entry and if correct, update the history state. You can ask TextFieldActionRollback to then automatically focus a specific component; really useful with form.
Escape rollback to a previously saved entry value.
TextFieldActionRollback & DataSource :
Keep in mind entry won't be submitted to ObjectProperty until you explicitly perform a commit. Therefore it's FieldGroup safe.
Listening for actions :
You can direclty listen for those 3 key press actions with addUserKeyPressListener. Events will only fires if validation successes (for enter and tab, always to esc).
Blur :
On blur event, it will implicitly validate entry. Unlike key press, no KeyPressActionListener will be called neither automaticaly focusing of next component.
Note TextFieldActionRollback force buffering. You must call commit to update DataSource.
See sample at http://vaadin.vostoksystem.eu
- Author:
- levreau.jerome@vostoksystem.eu
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractTextField |
com.vaadin.ui.AbstractTextField.TextChangeEventImpl, com.vaadin.ui.AbstractTextField.TextChangeEventMode |
Nested classes/interfaces inherited from class com.vaadin.ui.AbstractField |
com.vaadin.ui.AbstractField.FocusShortcut, com.vaadin.ui.AbstractField.ReadOnlyStatusChangeEvent |
Nested classes/interfaces inherited from interface com.vaadin.ui.Component |
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.Listener |
Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector |
com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListener |
Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable |
com.vaadin.server.Sizeable.Unit |
Nested classes/interfaces inherited from interface com.vaadin.ui.Field |
com.vaadin.ui.Field.ValueChangeEvent |
Nested classes/interfaces inherited from interface com.vaadin.data.Buffered |
com.vaadin.data.Buffered.SourceException |
Nested classes/interfaces inherited from interface com.vaadin.data.Property |
com.vaadin.data.Property.Editor, com.vaadin.data.Property.ReadOnlyException, com.vaadin.data.Property.ReadOnlyStatusChangeListener, com.vaadin.data.Property.ReadOnlyStatusChangeNotifier, com.vaadin.data.Property.Transactional<T>, com.vaadin.data.Property.ValueChangeListener, com.vaadin.data.Property.ValueChangeNotifier, com.vaadin.data.Property.Viewer |
Fields inherited from class com.vaadin.ui.AbstractComponent |
DESIGN_ATTR_PLAIN_TEXT |
Fields inherited from interface com.vaadin.server.ClientConnector.AttachListener |
attachMethod |
Fields inherited from interface com.vaadin.server.ClientConnector.DetachListener |
detachMethod |
Fields inherited from interface com.vaadin.event.FieldEvents.BlurListener |
blurMethod |
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 |
Methods inherited from class com.vaadin.ui.TextField |
clear, readDesign, writeDesign |
Methods inherited from class com.vaadin.ui.AbstractTextField |
addBlurListener, addFocusListener, addListener, addListener, addListener, addTextChangeListener, beforeClientResponse, changeVariables, getColumns, getCursorPosition, getCustomAttributes, getInputPrompt, getMaxLength, getNullRepresentation, getState, getState, getTextChangeEventMode, getTextChangeTimeout, getType, isEmpty, isNullSettingAllowed, paintContent, removeBlurListener, removeFocusListener, removeListener, removeListener, removeListener, removeTextChangeListener, selectAll, setColumns, setCursorPosition, setInputPrompt, setInternalValue, setMaxLength, setNullRepresentation, setNullSettingAllowed, setSelectionRange, setTextChangeEventMode, setTextChangeTimeout, setValue |
Methods inherited from class com.vaadin.ui.AbstractField |
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, attach, detach, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getTabIndex, getValidators, getValue, isBuffered, isImmediate, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isRequired, isValid, isValidationVisible, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInvalidAllowed, setInvalidCommitted, setLocale, setPropertyDataSource, setReadOnly, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, setValue, shouldHideErrors, toString, validate, validate, valueChange |
Methods inherited from class com.vaadin.ui.AbstractComponent |
addContextClickListener, 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, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, 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.LegacyComponent |
markAsDirty |
Methods inherited from interface com.vaadin.server.VariableOwner |
isEnabled, isImmediate |
Methods inherited from interface com.vaadin.ui.Component |
addListener, addStyleName, attach, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisible |
Methods inherited from interface com.vaadin.server.ClientConnector |
addAttachListener, addDetachListener, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler |
Methods inherited from interface com.vaadin.shared.Connector |
getConnectorId |
Methods inherited from interface com.vaadin.server.Sizeable |
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthUndefined |
Methods inherited from interface com.vaadin.event.Action.ShortcutNotifier |
addShortcutListener, removeShortcutListener |
TextFieldActionRollback
public TextFieldActionRollback()
TextFieldActionRollback
public TextFieldActionRollback(java.lang.String caption)
TextFieldActionRollback
public TextFieldActionRollback(com.vaadin.data.Property dataSource)
TextFieldActionRollback
public TextFieldActionRollback(java.lang.String caption,
com.vaadin.data.Property dataSource)
TextFieldActionRollback
public TextFieldActionRollback(java.lang.String caption,
java.lang.String value)
TextFieldActionRollback
public TextFieldActionRollback(com.vaadin.ui.Component.Focusable component)
TextFieldActionRollback
public TextFieldActionRollback(java.lang.String caption,
com.vaadin.ui.Component.Focusable component)
TextFieldActionRollback
public TextFieldActionRollback(com.vaadin.data.Property dataSource,
com.vaadin.ui.Component.Focusable component)
TextFieldActionRollback
public TextFieldActionRollback(java.lang.String caption,
com.vaadin.data.Property dataSource,
com.vaadin.ui.Component.Focusable component)
TextFieldActionRollback
public TextFieldActionRollback(java.lang.String caption,
java.lang.String value,
com.vaadin.ui.Component.Focusable component)
addUserKeyPressListener
public void addUserKeyPressListener(KeyPressAction.KeyPressActionListener listener)
- Fired uppon key press action -Enter, Tabulation, Escape - and validation.
- Parameters:
listener
-
removeUserKeyPressListener
public void removeUserKeyPressListener(KeyPressAction.KeyPressActionListener listener)
- Parameters:
listener
-
setFocusNext
public void setFocusNext(com.vaadin.ui.Component.Focusable component)
- When pressing enter or tabulation, can automatically focus
component
- Parameters:
component
- next component to focus, null for none
getFocusNext
public com.vaadin.ui.Component.Focusable getFocusNext()
- Which component to focus next.Default to none
- Returns:
- next component or
null
attach
public void attach(com.vaadin.server.ClientConnector.AttachEvent event)
- DO NOT CHANGE ! internal use
- Specified by:
attach
in interface com.vaadin.server.ClientConnector.AttachListener
- Parameters:
event
-
detach
public void detach(com.vaadin.server.ClientConnector.DetachEvent event)
- DO NOT CHANGE ! internal use
- Specified by:
detach
in interface com.vaadin.server.ClientConnector.DetachListener
- Parameters:
event
-
discard
public void discard()
throws com.vaadin.data.Buffered.SourceException
- DO NOT CHANGE ! internal use
- Specified by:
discard
in interface com.vaadin.data.Buffered
- Overrides:
discard
in class com.vaadin.ui.AbstractField<java.lang.String>
- Throws:
com.vaadin.data.Buffered.SourceException
commit
public void commit()
throws com.vaadin.data.Buffered.SourceException,
com.vaadin.data.Validator.InvalidValueException
- DO NOT CHANGE ! internal use
- Specified by:
commit
in interface com.vaadin.data.Buffered
- Overrides:
commit
in class com.vaadin.ui.AbstractField<java.lang.String>
- Throws:
com.vaadin.data.Buffered.SourceException
com.vaadin.data.Validator.InvalidValueException
blur
public void blur(com.vaadin.event.FieldEvents.BlurEvent event)
- DO NOT CHANGE ! internal use
- Specified by:
blur
in interface com.vaadin.event.FieldEvents.BlurListener
- Parameters:
event
-