Package com.storedobject.ui.inventory
Class ItemField<I extends InventoryItem>
java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.AbstractField<com.vaadin.flow.component.customfield.CustomField<I>,I>
com.vaadin.flow.component.customfield.CustomField<I>
com.storedobject.vaadin.CustomField<I>
com.storedobject.ui.AbstractObjectField<I>
com.storedobject.ui.ObjectGetField<I>
com.storedobject.ui.inventory.ItemField<I>
- Type Parameters:
I- Type of inventory item to accept.
- All Implemented Interfaces:
FilterMethods<I>,ObjectGetter<I>,ObjectSetter<I>,ItemInput<I>,ObjectInput<I>,ObjectProvider<I>,AbstractObjectInput<I>,HasElement,HasThemeStyle,ValueRequired,com.vaadin.flow.component.AttachNotifier,com.vaadin.flow.component.BlurNotifier<com.vaadin.flow.component.customfield.CustomField<I>>,com.vaadin.flow.component.DetachNotifier,com.vaadin.flow.component.Focusable<com.vaadin.flow.component.customfield.CustomField<I>>,com.vaadin.flow.component.FocusNotifier<com.vaadin.flow.component.customfield.CustomField<I>>,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<I>,,I>, I> com.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<I>,,I>, I> 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<I>,,I>, I> Serializable,Consumer<I>
Field to accept an instance of the
InventoryItem with provision to input part number.- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.storedobject.ui.ObjectGetField
ObjectGetField.GetProvider<O extends StoredObject>, ObjectGetField.GetSupplier<O extends StoredObject>, ObjectGetField.GetTypedSupplier<O extends StoredObject>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<?>> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the field value.protected ObjectGetField.GetProvider<I> Create the "get" provider for this field.protected ObjectBrowser<I> Get the searcher for this field.protected voiddoSearch()Do a search using the searcher component.protected booleanLoad the searcher with all the available instances.voidfixPartNumber(InventoryItemType partNumber) Fix the part number (an instance ofInventoryItemType).Get the current value of the part number.GetIdof the current part number value.ObjectProvider<? extends InventoryItemType> Get the P/N provider of this.<T extends InventoryItemType>
ObjectField<T> protected ButtonLayoutThis is where the display parts of the field is initialized.voidsetDetailComponent(com.vaadin.flow.component.Component detailComponent) Set a component that will display details of the object value.voidsetDisplayDetail(Consumer<I> displayDetail) Set a consumer that can display/consume the details of the object value.voidsetEnabled(boolean enabled) Enable/disable this field.voidsetExtraFilterProvider(FilterProvider extraFilterProvider) Set extra filters that need to be added to other filters when item's accessibility is checked.voidsetLocation(InventoryLocation location) Set the location (it could be bin location or any other location).voidsetLocation(ObjectProvider<? extends InventoryLocation> locationField) Set the location (it could be bin location or any other location).voidsetPartNumber(InventoryItemType partNumber) Set the part number (an instance ofInventoryItemType) portion.voidsetPrefixFieldControl(boolean searchFieldControl) Decide whether "prefix components" needs to be controlled by this field or not.protected voidsetPresentationValue(I value) voidsetReadOnly(boolean readOnly) Make this field read-only.voidsetRequired(boolean required) Set value required flag.voidsetStore(InventoryStore store) Set the store.voidsetStore(ObjectProvider<? extends InventoryStore> storeField) Set the store.voidSet the value.Methods inherited from class com.storedobject.ui.ObjectGetField
canCreate, createPrefixComponent, focus, generateModelValue, getSearchField, setNotFoundHandler, setNotFoundTacker, setPlaceholderMethods inherited from class com.storedobject.ui.AbstractObjectField
applyFilter, createDefaultSearcher, editor, filter, filteredList, getBrowseColumns, getCached, getContent, getDetailComponent, getDisplayDetail, getInternalLabel, getLoadFilter, getObjectClass, getPrefixComponent, getSearchColumns, getSearcher, isAllowAny, isInvalid, isRequired, load, onAttach, reget, reload, setBrowseColumns, setCached, setInternalLabel, setItemLabelGenerator, setSearchColumnsMethods inherited from class com.storedobject.vaadin.CustomField
addField, addFieldMethods inherited from class com.vaadin.flow.component.customfield.CustomField
add, addThemeVariants, getLabel, remove, removeThemeVariants, setLabel, updateValueMethods inherited from class com.vaadin.flow.component.AbstractField
addValueChangeListener, getEmptyValue, getValue, isEmpty, setModelValue, valueEqualsMethods 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, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.storedobject.ui.util.AbstractObjectInput
applyFilterPredicate, convert, focus, getCached, getDetailComponent, getDisplayDetail, getObject, getObjectClass, getObjectId, getObjectId, isAllowAny, setCached, setItemLabelGenerator, setObjectMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.BlurNotifier
addBlurListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.storedobject.core.FilterMethods
applyFilter, getEffectiveCondition, getFilterCondition, getLoadFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setLoadFilter, setLoadFilter, setViewFilter, setViewFilterMethods inherited from interface com.vaadin.flow.component.Focusable
addFocusShortcut, blur, getTabIndex, setTabIndexMethods inherited from interface com.vaadin.flow.component.FocusNotifier
addFocusListenerMethods inherited from interface com.storedobject.vaadin.HasElement
getAttribute, getStyle, setAttribute, setStyleMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods inherited from interface com.vaadin.flow.component.HasEnabled
isEnabledMethods inherited from interface com.vaadin.flow.component.HasHelper
getHelperComponent, getHelperText, setHelperComponent, setHelperTextMethods inherited from interface com.vaadin.flow.component.HasLabel
getLabel, setLabelMethods inherited from interface com.vaadin.flow.component.HasPlaceholder
getPlaceholder, setPlaceholderMethods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFullMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassNameMethods inherited from interface com.vaadin.flow.component.HasTheme
addThemeName, addThemeNames, getThemeName, getThemeNames, hasThemeName, removeThemeName, removeThemeNames, setThemeName, setThemeNameMethods inherited from interface com.storedobject.vaadin.HasThemeStyle
addTheme, asPrimary, asSmall, clearThemes, getInternalElement, removeTheme, setThemeMethods inherited from interface com.vaadin.flow.component.shared.HasTooltip
getTooltip, setTooltipTextMethods inherited from interface com.vaadin.flow.component.HasValidation
setManualValidationMethods inherited from interface com.vaadin.flow.component.shared.HasValidationProperties
getErrorMessage, setErrorMessage, setInvalidMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, getEmptyValue, getOptionalValue, getValue, isEmptyMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisibleMethods inherited from interface com.storedobject.ui.ObjectInput
getInternalLabel, getObject, getSearcher, getValue, load, reload, setInternalLabel, setObject, setObjectClass, setValueMethods inherited from interface com.storedobject.core.ObjectSetter
acceptMethods inherited from interface com.storedobject.vaadin.ValueRequired
isRequired
-
Constructor Details
-
ItemField
Constructor.- Parameters:
objectClass- Class of theInventoryItemobjects that are valid.
-
ItemField
Constructor.- Parameters:
label- Label for the field.objectClass- Class of theInventoryItemobjects that are valid.
-
ItemField
Constructor.- Parameters:
objectClass- Class of theInventoryItemobjects that are valid.allowAny- Whether subclasses should be allowed or not.
-
ItemField
Constructor.- Parameters:
label- Label for the field.objectClass- Class of theInventoryItemobjects that are valid.allowAny- Whether subclasses should be allowed or not.
-
-
Method Details
-
getPNField
-
clear
public void clear()Description copied from interface:AbstractObjectInputClear the field value.- Specified by:
clearin interfaceAbstractObjectInput<I extends InventoryItem>- Specified by:
clearin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<I extends InventoryItem>,I extends InventoryItem>, I extends InventoryItem> - Overrides:
clearin classAbstractObjectField<I extends InventoryItem>
-
setValue
Description copied from interface:ObjectInputSet the value.- Specified by:
setValuein interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<I extends InventoryItem>,I extends InventoryItem>, I extends InventoryItem> - Specified by:
setValuein interfaceObjectInput<I extends InventoryItem>- Overrides:
setValuein classcom.vaadin.flow.component.AbstractField<com.vaadin.flow.component.customfield.CustomField<I extends InventoryItem>,I extends InventoryItem> - Parameters:
value- Value to set.
-
setRequired
public void setRequired(boolean required) Description copied from interface:ValueRequiredSet value required flag.- Specified by:
setRequiredin interfaceValueRequired- Overrides:
setRequiredin classAbstractObjectField<I extends InventoryItem>- Parameters:
required- Required or not
-
fixPartNumber
Fix the part number (an instance ofInventoryItemType). If a non-null value is set, the "part number" portion will be locked with that value. Anullvalue may be set later to unlock it.- Specified by:
fixPartNumberin interfaceItemInput<I extends InventoryItem>- Parameters:
partNumber- Part number to set.
-
setPartNumber
Set the part number (an instance ofInventoryItemType) portion.- Parameters:
partNumber- Part number to set.
-
getPartNumber
Get the current value of the part number.- Returns:
- Current value of the part number. It may be
null.
-
getPartNumberId
-
initComponent
Description copied from class:AbstractObjectFieldThis is where the display parts of the field is initialized. If overridden, you need to make sure to always return the same component between calls.- Overrides:
initComponentin classAbstractObjectField<I extends InventoryItem>- Returns:
- The layout component containing other display components.
-
setPresentationValue
- Overrides:
setPresentationValuein classObjectGetField<I extends InventoryItem>
-
setReadOnly
public void setReadOnly(boolean readOnly) Description copied from interface:AbstractObjectInputMake this field read-only.- Specified by:
setReadOnlyin interfaceAbstractObjectInput<I extends InventoryItem>- Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValue<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<I extends InventoryItem>,I extends InventoryItem>, I extends InventoryItem> - Specified by:
setReadOnlyin interfacecom.vaadin.flow.component.HasValueAndElement<com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent<com.vaadin.flow.component.customfield.CustomField<I extends InventoryItem>,I extends InventoryItem>, I extends InventoryItem> - Overrides:
setReadOnlyin classAbstractObjectField<I extends InventoryItem>- Parameters:
readOnly- True to set as read-only.
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:AbstractObjectInputEnable/disable this field.- Specified by:
setEnabledin interfaceAbstractObjectInput<I extends InventoryItem>- Specified by:
setEnabledin interfacecom.vaadin.flow.component.HasEnabled- Overrides:
setEnabledin classAbstractObjectField<I extends InventoryItem>- Parameters:
enabled- True for enabling.
-
createGetProvider
Description copied from class:ObjectGetFieldCreate the "get" provider for this field.- Overrides:
createGetProviderin classObjectGetField<I extends InventoryItem>- Returns:
- By default, it will create an instance of
ObjectGetField.GetSupplier.
-
setDetailComponent
public void setDetailComponent(com.vaadin.flow.component.Component detailComponent) Description copied from interface:AbstractObjectInputSet a component that will display details of the object value.- Specified by:
setDetailComponentin interfaceAbstractObjectInput<I extends InventoryItem>- Overrides:
setDetailComponentin classAbstractObjectField<I extends InventoryItem>- Parameters:
detailComponent- A component that can display information regarding the object.
-
setDisplayDetail
Description copied from interface:AbstractObjectInputSet a consumer that can display/consume the details of the object value.- Specified by:
setDisplayDetailin interfaceAbstractObjectInput<I extends InventoryItem>- Overrides:
setDisplayDetailin classAbstractObjectField<I extends InventoryItem>- Parameters:
displayDetail- A consumer that can accept the object value.
-
setPrefixFieldControl
public void setPrefixFieldControl(boolean searchFieldControl) Description copied from interface:AbstractObjectInputDecide 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:
setPrefixFieldControlin interfaceAbstractObjectInput<I extends InventoryItem>- Overrides:
setPrefixFieldControlin classAbstractObjectField<I extends InventoryItem>- Parameters:
searchFieldControl- True if it needs to be controlled by this field.
-
setStore
Description copied from interface:ItemInputSet the store. If set, only items from the given store will be acceptable.- Specified by:
setStorein interfaceItemInput<I extends InventoryItem>- Parameters:
storeField- Any provider that can supply anInventoryStoreinstance.
-
setStore
Description copied from interface:ItemInputSet the store. If set, only items from the given store will be acceptable.- Specified by:
setStorein interfaceItemInput<I extends InventoryItem>- Parameters:
store- An instance ofInventoryStore.
-
setLocation
Description copied from interface:ItemInputSet the location (it could be bin location or any other location). If set, only items from the given location will be acceptable.- Specified by:
setLocationin interfaceItemInput<I extends InventoryItem>- Parameters:
locationField- Any provider that can supply anInventoryLocationinstance.
-
setLocation
Description copied from interface:ItemInputSet the location (it could be bin location or any other location). If set, only items from the given location will be acceptable.- Specified by:
setLocationin interfaceItemInput<I extends InventoryItem>- Parameters:
location- An instance of anInventoryLocation.
-
setExtraFilterProvider
Description copied from interface:ItemInputSet extra filters that need to be added to other filters when item's accessibility is checked.- Specified by:
setExtraFilterProviderin interfaceItemInput<I extends InventoryItem>- Parameters:
extraFilterProvider- Extra filter to be set.
-
getPartNumberProvider
Description copied from interface:ItemInputGet the P/N provider of this.- Specified by:
getPartNumberProviderin interfaceItemInput<I extends InventoryItem>- Returns:
- P/N provider.
-
doSearch
protected void doSearch()Description copied from class:AbstractObjectFieldDo a search using the searcher component.- Overrides:
doSearchin classObjectGetField<I extends InventoryItem>
-
doSearchLoadAll
protected boolean doSearchLoadAll()Description copied from class:ObjectGetFieldLoad the searcher with all the available instances. Iftrueis returned from this method, it will be assumed that appropriate search action is already carried out.- Overrides:
doSearchLoadAllin classObjectGetField<I extends InventoryItem>- Returns:
- True if loaded. Default implementation reapplies the filter if the load filter is dynamic and
returns
false.
-
createSearcher
Description copied from class:AbstractObjectFieldGet the searcher for this field.- Overrides:
createSearcherin classAbstractObjectField<I extends InventoryItem>- Returns:
- Typically, an instance of the
ObjectBrowserthat has search capability.
-