Package com.storedobject.ui.inventory
Class AssemblyItemField<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.inventory.AssemblyItemField<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>
public class AssemblyItemField<I extends InventoryItem>
extends CustomField<I>
implements ItemInput<I>
Field to accept an item that is fitted on an assembly.
- 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<?>> -
Constructor Summary
ConstructorsConstructorDescriptionAssemblyItemField(Class<I> objectClass) Constructor.AssemblyItemField(Class<I> objectClass, boolean allowAny) Constructor.AssemblyItemField(String label, Class<I> objectClass) Constructor.AssemblyItemField(String label, Class<I> objectClass, boolean allowAny) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is called whenever a filter condition is changed.voidclear()Clear the field value.voidfixPartNumber(InventoryItemType partNumber) Fix the part number (an instance ofInventoryItemType).protected IGet the currently cached object.com.vaadin.flow.component.ComponentGet 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.Get the current object.Class of the object supported in this input field.Get theIdof the current object.ObjectProvider<? extends InventoryItemType> Get the P/N provider of this.getValue()Get the current value.booleanWhether this field allows any derived object values or not.voidload(ObjectIterator<I> objects) Load allowed values from a list.voidreload()Reload the allowed values by applying newly set filters.<IT extends InventoryItemType>
voidsetAssembly(InventoryItem assemblyParent) Set the parent assembly.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) This method doesn't have any effect.voidsetInternalLabel(String label) Set the internal label for this field.voidsetItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<I> itemLabelGenerator) Set an "item label generator" that returns the string value of the object value of this field.voidsetLocation(InventoryLocation location) This method doesn't have any effect.voidsetLocation(ObjectProvider<? extends InventoryLocation> locationField) This method doesn't have any effect.voidsetPrefixFieldControl(boolean prefixFieldControl) Decide whether "prefix components" needs to be controlled by this field or not.protected voidsetPresentationValue(I item) voidsetReadOnly(boolean readOnly) Make this field read-only.voidsetStore(InventoryStore store) This method doesn't have any effect.voidsetStore(ObjectProvider<? extends InventoryStore> storeField) This method doesn't have any effect.Methods inherited from class com.storedobject.vaadin.CustomField
addField, addField, focusMethods 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, isEmpty, setModelValue, setValue, 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, onAttach, 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, getObject, getObjectId, setCached, 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
getEffectiveCondition, getFilterCondition, 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, isInvalid, setErrorMessage, setInvalidMethods inherited from interface com.vaadin.flow.component.HasValue
addValueChangeListener, getEmptyValue, getOptionalValue, isEmpty, setValueMethods inherited from interface com.vaadin.flow.component.HasValueAndElement
isReadOnly, isRequiredIndicatorVisible, setRequiredIndicatorVisibleMethods inherited from interface com.storedobject.ui.ObjectInput
getSearcher, setObject, setObjectClass, setValue, setValueMethods inherited from interface com.storedobject.core.ObjectSetter
acceptMethods inherited from interface com.storedobject.vaadin.ValueRequired
isRequired, setRequired
-
Constructor Details
-
AssemblyItemField
Constructor.- Parameters:
objectClass- Class of theInventoryItemobjects that are valid.
-
AssemblyItemField
Constructor.- Parameters:
label- Label for the field.objectClass- Class of theInventoryItemobjects that are valid.
-
AssemblyItemField
Constructor.- Parameters:
objectClass- Class of theInventoryItemobjects that are valid.allowAny- Whether subclasses should be allowed or not.
-
AssemblyItemField
Constructor.- Parameters:
label- Label for the field.objectClass- Class of theInventoryItemobjects that are valid.allowAny- Whether subclasses should be allowed or not.
-
-
Method Details
-
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>
-
fixPartNumber
Description copied from interface:ItemInputFix 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.
-
setStore
This method doesn't have any effect.- Specified by:
setStorein interfaceItemInput<I extends InventoryItem>- Parameters:
storeField- Any provider that can supply anInventoryStoreinstance.
-
setStore
This method doesn't have any effect.- Specified by:
setStorein interfaceItemInput<I extends InventoryItem>- Parameters:
store- An instance ofInventoryStore.
-
setLocation
This method doesn't have any effect.- Specified by:
setLocationin interfaceItemInput<I extends InventoryItem>- Parameters:
locationField- Any provider that can supply anInventoryLocationinstance.
-
setLocation
This method doesn't have any effect.- Specified by:
setLocationin interfaceItemInput<I extends InventoryItem>- Parameters:
location- An instance of anInventoryLocation.
-
setExtraFilterProvider
This method doesn't have any effect.- 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.
-
setAssembly
Set the parent assembly.- Type Parameters:
IT- The item type.- Parameters:
assemblyParent- Parent assembly to set.
-
setInternalLabel
Description copied from interface:ObjectInputSet the internal label for this field. Internal labels are used by the embedded field within this field.- Specified by:
setInternalLabelin interfaceObjectInput<I extends InventoryItem>- Parameters:
label- Label.
-
getInternalLabel
Description copied from interface:ObjectInputGet the internal label of this field. Internal labels are used by the embedded field within this field.- Specified by:
getInternalLabelin interfaceObjectInput<I extends InventoryItem>- Returns:
- Label.
-
load
Description copied from interface:ObjectInputLoad allowed values from a list. Once invoked, only this list will be used for showing the allowed objects that can be selected via this field.- Specified by:
loadin interfaceObjectInput<I extends InventoryItem>- Parameters:
objects- Objects to load.
-
reload
public void reload()Description copied from interface:ObjectInputReload the allowed values by applying newly set filters.- Specified by:
reloadin interfaceObjectInput<I extends InventoryItem>
-
getObjectClass
Description copied from interface:AbstractObjectInputClass of the object supported in this input field.- Specified by:
getObjectClassin interfaceAbstractObjectInput<I extends InventoryItem>- Specified by:
getObjectClassin interfaceObjectGetter<I extends InventoryItem>- Specified by:
getObjectClassin interfaceObjectProvider<I extends InventoryItem>- Specified by:
getObjectClassin interfaceObjectSetter<I extends InventoryItem>- Returns:
- Class of the supported object.
-
getCached
Description copied from interface:AbstractObjectInputGet the currently cached object.- Specified by:
getCachedin interfaceAbstractObjectInput<I extends InventoryItem>- Returns:
- Object that is currently cached. It may return
null.
-
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>- Parameters:
detailComponent- A component that can display information regarding the object.
-
getDetailComponent
public com.vaadin.flow.component.Component getDetailComponent()Description copied from interface:AbstractObjectInputGet the component that is currently displaying details of the object value.- Specified by:
getDetailComponentin interfaceAbstractObjectInput<I extends InventoryItem>- Returns:
- Component that is displaying the details.
-
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>- Parameters:
displayDetail- A consumer that can accept the object value.
-
getDisplayDetail
Description copied from interface:AbstractObjectInputGet the consumer that is currently consuming details of the object value.- Specified by:
getDisplayDetailin interfaceAbstractObjectInput<I extends InventoryItem>- Returns:
- Consumer that is currently set.
-
setPrefixFieldControl
public void setPrefixFieldControl(boolean prefixFieldControl) 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>- Parameters:
prefixFieldControl- True if it needs to be controlled by this field.
-
applyFilter
public void applyFilter()Description copied from interface:FilterMethodsThis 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:
applyFilterin interfaceFilterMethods<I extends InventoryItem>
-
getLoadFilter
Description copied from interface:FilterMethodsGet the load filter.- Specified by:
getLoadFilterin interfaceFilterMethods<I extends InventoryItem>- Returns:
- Current load filter.
-
generateModelValue
- Specified by:
generateModelValuein classcom.vaadin.flow.component.customfield.CustomField<I extends InventoryItem>
-
setPresentationValue
- Specified by:
setPresentationValuein classcom.vaadin.flow.component.customfield.CustomField<I extends InventoryItem>
-
getValue
Description copied from interface:ObjectInputGet the current value.- Specified by:
getValuein 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:
getValuein interfaceObjectInput<I extends InventoryItem>- Overrides:
getValuein classcom.vaadin.flow.component.AbstractField<com.vaadin.flow.component.customfield.CustomField<I extends InventoryItem>,I extends InventoryItem> - Returns:
- Value.
-
getObject
Description copied from interface:ObjectInputGet the current object. Same asObjectInput.getValue().- Specified by:
getObjectin interfaceAbstractObjectInput<I extends InventoryItem>- Specified by:
getObjectin interfaceObjectGetter<I extends InventoryItem>- Specified by:
getObjectin interfaceObjectInput<I extends InventoryItem>- Specified by:
getObjectin interfaceObjectProvider<I extends InventoryItem>- Returns:
- Current object.
-
getObjectId
Description copied from interface:AbstractObjectInputGet theIdof the current object.- Specified by:
getObjectIdin interfaceAbstractObjectInput<I extends InventoryItem>- Specified by:
getObjectIdin interfaceObjectGetter<I extends InventoryItem>- Specified by:
getObjectIdin interfaceObjectProvider<I extends InventoryItem>- Returns:
Idornullif no object is currently set.
-
isAllowAny
public boolean isAllowAny()Description copied from interface:AbstractObjectInputWhether this field allows any derived object values or not.- Specified by:
isAllowAnyin interfaceAbstractObjectInput<I extends InventoryItem>- Specified by:
isAllowAnyin interfaceObjectGetter<I extends InventoryItem>- Specified by:
isAllowAnyin interfaceObjectSetter<I extends InventoryItem>- Returns:
- True or false.
-
setItemLabelGenerator
public void setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<I> itemLabelGenerator) Description copied from interface:AbstractObjectInputSet an "item label generator" that returns the string value of the object value of this field. (It is mainly used to display the object).- Specified by:
setItemLabelGeneratorin interfaceAbstractObjectInput<I extends InventoryItem>- Parameters:
itemLabelGenerator- Item value generator.
-
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> - 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- Parameters:
enabled- True for enabling.
-