Package com.storedobject.ui.util
Interface AbstractObjectInput<T extends StoredObject>
- Type Parameters:
T
- Type of input.
- All Superinterfaces:
Consumer<T>
,FilterMethods<T>
,HasElement
,com.vaadin.flow.component.HasElement
,com.vaadin.flow.component.HasLabel
,com.vaadin.flow.component.HasPlaceholder
,HasThemeStyle
,ObjectGetter<T>
,ObjectProvider<T>
,ObjectSetter<T>
,Serializable
- All Known Subinterfaces:
DelegatedIdInput<T>
,DelegatedObjectInput<T>
,IdInput<T>
,ItemInput<T>
,ObjectInput<T>
- All Known Implementing Classes:
AbstractObjectField
,AccountField
,AssemblyItemField
,BinField
,BlockComboField
,FileField
,ItemComboField
,ItemField
,ItemGetField
,ItemTypeGetField
,LocationField
,ObjectCodeField
,ObjectComboField
,ObjectField
,ObjectFormField
,ObjectGetField
,ObjectListField
,ObjectSearcherField
,ObjectSearchField
,UserField
public interface AbstractObjectInput<T extends StoredObject>
extends ObjectProvider<T>, ObjectSetter<T>, ObjectGetter<T>, HasElement, com.vaadin.flow.component.HasLabel, com.vaadin.flow.component.HasPlaceholder, FilterMethods<T>
Methods used by fields for inputting
StoredObject
s or Id
s.- Author:
- Syam
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
This method is called whenever a filter predicate is changed.default T
convert
(StoredObject object) Convert a raw object to the type that is accepted.void
focus()
Focus this field.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 object that is currently set.default T
Get the object for the givenId
.Class of the object supported in this input field.default Id
Get theId
of the current object.default Id
getObjectId
(T object) Get theId
of the given object.default boolean
Whether this field allows any derived object values or not.default 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
setEnabled
(boolean enabled) Enable/disable this field.default void
setItemLabelGenerator
(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator) Set an "item label generator" that returns the string value of the object value of this field.default void
Set object for the givenId
.void
Set the object.void
setPrefixFieldControl
(boolean prefixFieldControl) Decide whether "prefix components" needs to be controlled by this field or not.void
setReadOnly
(boolean readOnly) Make this field read-only.Methods inherited from interface com.storedobject.core.FilterMethods
applyFilter, getEffectiveCondition, getFilterCondition, getLoadFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setFilter, setLoadFilter, setLoadFilter, setViewFilter, setViewFilter
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.HasLabel
getLabel, setLabel
Methods inherited from interface com.vaadin.flow.component.HasPlaceholder
getPlaceholder, setPlaceholder
Methods inherited from interface com.storedobject.vaadin.HasThemeStyle
addTheme, asPrimary, asSmall, clearThemes, getInternalElement, removeTheme, setTheme
Methods inherited from interface com.storedobject.core.ObjectSetter
accept
-
Method Details
-
getObjectClass
Class of the object supported in this input field.- 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.
-
getObject
T getObject()Get the object that is currently set.- Specified by:
getObject
in interfaceObjectGetter<T extends StoredObject>
- Specified by:
getObject
in interfaceObjectProvider<T extends StoredObject>
- Returns:
- Object that is currently set. It could be
null
.
-
setObject
Set the object.- Specified by:
setObject
in interfaceObjectSetter<T extends StoredObject>
- Parameters:
object
- Object to set.
-
convert
Convert a raw object to the type that is accepted. (This is a helper method).- Parameters:
object
- Object to convert.- Returns:
- Converted object or null if not convertible.
-
setObject
Set object for the givenId
.- Specified by:
setObject
in interfaceObjectSetter<T extends StoredObject>
- Parameters:
objectId
-Id
of the object to be set.
-
getObject
-
setCached
Cache an object instance. Default implementation doesn't do anything but a field may cache it and re-used for eliminating unwanted database access.- Parameters:
cached
- Object to be cached.
-
getCached
T getCached()Get the currently cached object.- Returns:
- Object that is currently cached. It may return
null
.
-
getObjectId
-
getObjectId
Get theId
of the current object.- Specified by:
getObjectId
in interfaceObjectGetter<T extends StoredObject>
- Specified by:
getObjectId
in interfaceObjectProvider<T extends StoredObject>
- Returns:
Id
ornull
if no object is currently set.
-
isAllowAny
default boolean isAllowAny()Whether this field allows any derived object values or not.- Specified by:
isAllowAny
in interfaceObjectGetter<T extends StoredObject>
- Specified by:
isAllowAny
in interfaceObjectSetter<T extends StoredObject>
- Returns:
- True or false.
-
setDetailComponent
void setDetailComponent(com.vaadin.flow.component.Component detailComponent) Set a component that will display details of the object value.- Parameters:
detailComponent
- A component that can display information regarding the object.
-
getDetailComponent
com.vaadin.flow.component.Component getDetailComponent()Get the component that is currently displaying details of the object value.- Returns:
- Component that is displaying the details.
-
setDisplayDetail
-
getDisplayDetail
-
setPrefixFieldControl
void setPrefixFieldControl(boolean prefixFieldControl) 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 assetEnabled(boolean)
,setReadOnly(boolean)
etc. In some cases, prefix components may be displayed elsewhere and needs to be controlled outside the field.- Parameters:
prefixFieldControl
- True if it needs to be controlled by this field.
-
setReadOnly
void setReadOnly(boolean readOnly) Make this field read-only.- Parameters:
readOnly
- True to set as read-only.
-
setEnabled
void setEnabled(boolean enabled) Enable/disable this field.- Parameters:
enabled
- True for enabling.
-
setItemLabelGenerator
default void setItemLabelGenerator(com.vaadin.flow.component.ItemLabelGenerator<T> itemLabelGenerator) Set an "item label generator" that returns the string value of the object value of this field. (It is mainly used to display the object).- Parameters:
itemLabelGenerator
- Item value generator.
-
focus
void focus()Focus this field. -
applyFilterPredicate
default void applyFilterPredicate()Description copied from interface:FilterMethods
This method is called whenever a filter predicate 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.Note: This method is used to show the filtered result of the existing entries
- Specified by:
applyFilterPredicate
in interfaceFilterMethods<T extends StoredObject>
-