Package com.storedobject.ui
Class ObjectCodeField<T extends StoredObject>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.customfield.CustomField<T>,T>
com.vaadin.flow.component.customfield.CustomField<T>
com.storedobject.vaadin.CustomField<T>
com.storedobject.vaadin.CustomTextField<T>
com.storedobject.ui.ObjectCodeField<T>
- Type Parameters:
T
- Type of object instance.
- All Implemented Interfaces:
FilterMethods<T>
,ObjectGetter<T>
,ObjectSetter<T>
,ObjectInput<T>
,ObjectProvider<T>
,AbstractObjectInput<T>
,DisablePaste
,HasElement
,HasStyle
,HasThemeStyle
,ValueRequired
,com.vaadin.flow.component.AttachNotifier
,com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.customfield.CustomField<T>>
,com.vaadin.flow.component.DetachNotifier
,com.vaadin.flow.component.Focusable<com.vaadin.flow.component.customfield.CustomField<T>>
,com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.customfield.CustomField<T>>
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasEnabled
,com.vaadin.flow.component.HasHelper
,com.vaadin.flow.component.HasLabel
,com.vaadin.flow.component.HasPlaceholder
,com.vaadin.flow.component.HasSize
,com.vaadin.flow.component.HasStyle
,com.vaadin.flow.component.HasTheme
,com.vaadin.flow.component.HasValidation
,com.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,
,T>, T> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,
,T>, T> com.vaadin.flow.component.shared.HasPrefix
,com.vaadin.flow.component.shared.HasSuffix
,com.vaadin.flow.component.shared.HasTooltip
,com.vaadin.flow.component.shared.HasValidationProperties
,com.vaadin.flow.component.shared.InputField<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<T>,
,T>, T> com.vaadin.flow.component.textfield.HasAutocomplete
,Serializable
,Consumer<T>
public class ObjectCodeField<T extends StoredObject>
extends CustomTextField<T>
implements ObjectInput<T>
In many situations, a
StoredObject
instance may contain a code attribute (a String attribute that looks
like a code - part number of an inventory item for example) and this field accept such codes for inputting the
object instance.- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.flow.component.AbstractField
com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<C extends com.vaadin.flow.component.Component,
V> Nested classes/interfaces inherited from interface com.vaadin.flow.component.BlurNotifier
com.vaadin.flow.component.BlurNotifier.BlurEvent<C extends com.vaadin.flow.component.Component>
Nested classes/interfaces inherited from interface com.vaadin.flow.component.FocusNotifier
com.vaadin.flow.component.FocusNotifier.FocusEvent<C extends com.vaadin.flow.component.Component>
Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasValue
com.vaadin.flow.component.HasValue.ValueChangeEvent<V>, com.vaadin.flow.component.HasValue.ValueChangeListener<E extends com.vaadin.flow.component.HasValue.ValueChangeEvent<?>>
-
Field Summary
Fields inherited from interface com.vaadin.flow.component.textfield.HasAutocomplete
AUTOCOMPLETE_ATTRIBUTE
-
Constructor Summary
ConstructorsConstructorDescriptionObjectCodeField
(Class<T> objectClass) Constructor.ObjectCodeField
(Class<T> objectClass, int maxLength) Constructor.ObjectCodeField
(Class<T> objectClass, String codeAttribute) Constructor.ObjectCodeField
(Class<T> objectClass, String codeAttribute, int maxLength) Constructor.ObjectCodeField
(String label, Class<T> objectClass) Constructor.ObjectCodeField
(String label, Class<T> objectClass, int maxLength) Constructor.ObjectCodeField
(String label, Class<T> objectClass, String codeAttribute) Constructor.ObjectCodeField
(String label, Class<T> objectClass, String codeAttribute, int maxLength) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
This method is called whenever a filter condition is changed.protected String
Format the value to display it as a string.Get the currently cached object.com.vaadin.flow.component.Component
Get the component that is currently displaying details of the object value.Get the consumer that is currently consuming details of the object value.Get the internal label of this field.Get the load filter.protected T
getModelValue
(String string) Create the model value from the string value passed.Class of the object supported in this input field.void
load
(ObjectIterator<T> objects) This method does nothing in this field.void
reload()
Reload the allowed values by applying newly set filters.void
Cache an object instance.void
setDetailComponent
(com.vaadin.flow.component.Component detailComponent) Set a component that will display details of the object value.void
setDisplayDetail
(Consumer<T> displayDetail) Set a consumer that can display/consume the details of the object value.void
setInternalLabel
(String label) Set the internal label for this field.void
setPrefixFieldControl
(boolean prefixFieldControl) Decide whether "prefix components" needs to be controlled by this field or not.Methods inherited from class com.storedobject.vaadin.CustomTextField
alignRight, createField, customizeTextField, disablePaste, generateModelValue, getAutocomplete, getField, getInternalElement, getPrefixComponent, getSuffixComponent, isAutoselect, onAttach, setAutocomplete, setAutoselect, setEmptyDisplay, setEnabled, setHeight, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setPlaceholder, setPrefixComponent, setPresentationValue, setReadOnly, setSuffixComponent, setWidth
Methods inherited from class com.storedobject.vaadin.CustomField
addField, addField, focus
Methods inherited from class com.vaadin.flow.component.customfield.CustomField
add, addThemeVariants, getLabel, remove, removeThemeVariants, setLabel, updateValue
Methods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, setValue, valueEquals
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.storedobject.ui.util.AbstractObjectInput
applyFilterPredicate, convert, focus, getObject, getObjectId, getObjectId, isAllowAny, setEnabled, setItemLabelGenerator, setObject, setReadOnly
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.storedobject.core.FilterMethods
getEffectiveCondition, getFilterCondition, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setLoadFilter, setLoadFilter, setViewFilter, setViewFilter
Methods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, getTabIndex, setTabIndex
Methods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListener
Methods inherited from interface com.storedobject.vaadin.HasElement
getAttribute, getStyle, setAttribute, setStyle
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
Methods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabled
Methods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperText
Methods inherited from interface com.vaadin.flow.component.HasLabel
getLabel, setLabel
Methods inherited from interface com.vaadin.flow.component.HasPlaceholder
getPlaceholder, setPlaceholder
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeightFull, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidthFull
Methods inherited from interface com.storedobject.vaadin.HasStyle
getClassName, getClassNames, getStyle, setClassName
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, hasClassName, removeClassName, removeClassNames, setClassName
Methods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeName
Methods inherited from interface com.storedobject.vaadin.HasThemeStyle
addTheme, asPrimary, asSmall, clearThemes, getInternalElement, removeTheme, setTheme
Methods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipText
Methods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidation
Methods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, isInvalid, setErrorMessage, setInvalid
Methods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, clear, getEmptyValue, getOptionalValue, getValue, isEmpty, setValue
Methods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisible
Methods inherited from interface com.storedobject.ui.ObjectInput
getObject, getSearcher, getValue, setObject, setObjectClass, setValue, setValue
Methods inherited from interface com.storedobject.core.ObjectSetter
accept
Methods inherited from interface com.storedobject.vaadin.ValueRequired
isRequired, setRequired
-
Constructor Details
-
ObjectCodeField
-
ObjectCodeField
-
ObjectCodeField
-
ObjectCodeField
-
ObjectCodeField
-
ObjectCodeField
-
ObjectCodeField
-
ObjectCodeField
-
-
Method Details
-
setInternalLabel
Description copied from interface:ObjectInput
Set the internal label for this field. Internal labels are used by the embedded field within this field.- Specified by:
setInternalLabel
in interfaceObjectInput<T extends StoredObject>
- Parameters:
label
- Label.
-
getInternalLabel
Description copied from interface:ObjectInput
Get the internal label of this field. Internal labels are used by the embedded field within this field.- Specified by:
getInternalLabel
in interfaceObjectInput<T extends StoredObject>
- Returns:
- Label.
-
getObjectClass
Description copied from interface:AbstractObjectInput
Class of the object supported in this input field.- Specified by:
getObjectClass
in interfaceAbstractObjectInput<T extends StoredObject>
- Specified by:
getObjectClass
in interfaceObjectGetter<T extends StoredObject>
- Specified by:
getObjectClass
in interfaceObjectProvider<T extends StoredObject>
- Specified by:
getObjectClass
in interfaceObjectSetter<T extends StoredObject>
- Returns:
- Class of the supported object.
-
getCached
Description copied from interface:AbstractObjectInput
Get the currently cached object.- Specified by:
getCached
in interfaceAbstractObjectInput<T extends StoredObject>
- Returns:
- Object that is currently cached. It may return
null
.
-
setCached
Description copied from interface:AbstractObjectInput
Cache an object instance. Default implementation doesn't do anything but a field may cache it and re-used for eliminating unwanted database access.- Specified by:
setCached
in interfaceAbstractObjectInput<T extends StoredObject>
- Parameters:
cached
- Object to be cached.
-
setDetailComponent
public void setDetailComponent(com.vaadin.flow.component.Component detailComponent) Description copied from interface:AbstractObjectInput
Set a component that will display details of the object value.- Specified by:
setDetailComponent
in interfaceAbstractObjectInput<T extends StoredObject>
- Parameters:
detailComponent
- A component that can display information regarding the object.
-
getDetailComponent
public com.vaadin.flow.component.Component getDetailComponent()Description copied from interface:AbstractObjectInput
Get the component that is currently displaying details of the object value.- Specified by:
getDetailComponent
in interfaceAbstractObjectInput<T extends StoredObject>
- Returns:
- Component that is displaying the details.
-
setDisplayDetail
Description copied from interface:AbstractObjectInput
Set a consumer that can display/consume the details of the object value.- Specified by:
setDisplayDetail
in interfaceAbstractObjectInput<T extends StoredObject>
- Parameters:
displayDetail
- A consumer that can accept the object value.
-
getDisplayDetail
Description copied from interface:AbstractObjectInput
Get the consumer that is currently consuming details of the object value.- Specified by:
getDisplayDetail
in interfaceAbstractObjectInput<T extends StoredObject>
- Returns:
- Consumer that is currently set.
-
setPrefixFieldControl
public void setPrefixFieldControl(boolean prefixFieldControl) Description copied from interface:AbstractObjectInput
Decide whether "prefix components" needs to be controlled by this field or not. "Prefix components" are parts of the field that display extra information, and it needs to be turned on or off when the status of the field changes via methods such asAbstractObjectInput.setEnabled(boolean)
,AbstractObjectInput.setReadOnly(boolean)
etc. In some cases, prefix components may be displayed elsewhere and needs to be controlled outside the field.- Specified by:
setPrefixFieldControl
in interfaceAbstractObjectInput<T extends StoredObject>
- Parameters:
prefixFieldControl
- True if it needs to be controlled by this field.
-
getLoadFilter
Description copied from interface:FilterMethods
Get the load filter.- Specified by:
getLoadFilter
in interfaceFilterMethods<T extends StoredObject>
- Returns:
- Current load filter.
-
applyFilter
public void applyFilter()Description copied from interface:FilterMethods
This method is called whenever a filter condition is changed. Methods with default implementation already invoke this method. If any of those methods are overridden, make sure that it invokes this method so that logic to handle filter changes can be coded here.- Specified by:
applyFilter
in interfaceFilterMethods<T extends StoredObject>
-
getModelValue
Description copied from class:CustomTextField
Create the model value from the string value passed.- Specified by:
getModelValue
in classCustomTextField<T extends StoredObject>
- Parameters:
string
- String value to convert.- Returns:
- Model value created from the string value.
-
format
Description copied from class:CustomTextField
Format the value to display it as a string.- Overrides:
format
in classCustomTextField<T extends StoredObject>
- Parameters:
value
- Value to format.- Returns:
- Displayable string.
-
load
This method does nothing in this field.- Specified by:
load
in interfaceObjectInput<T extends StoredObject>
- Parameters:
objects
- Objects to load.
-
reload
public void reload()Description copied from interface:ObjectInput
Reload the allowed values by applying newly set filters.- Specified by:
reload
in interfaceObjectInput<T extends StoredObject>
-