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
StoredObjects or Ids.- Author:
- Syam
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidThis method is called whenever a filter predicate is changed.voidclear()Clear the field value.default Tconvert(StoredObject object) Convert a raw object to the type that is accepted.voidfocus()Focus this field.Get 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 object that is currently set.default TGet the object for the givenId.Class of the object supported in this input field.default IdGet theIdof the current object.default IdgetObjectId(T object) Get theIdof the given object.default booleanWhether this field allows any derived object values or not.default voidCache an object instance.voidsetDetailComponent(com.vaadin.flow.component.Component detailComponent) Set a component that will display details of the object value.voidsetDisplayDetail(Consumer<T> displayDetail) Set a consumer that can display/consume the details of the object value.voidsetEnabled(boolean enabled) Enable/disable this field.default voidsetItemLabelGenerator(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 voidSet object for the givenId.voidSet the object.voidsetPrefixFieldControl(boolean prefixFieldControl) Decide whether "prefix components" needs to be controlled by this field or not.voidsetReadOnly(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, setViewFilterMethods 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.HasLabel
getLabel, setLabelMethods inherited from interface com.vaadin.flow.component.HasPlaceholder
getPlaceholder, setPlaceholderMethods inherited from interface com.storedobject.vaadin.HasThemeStyle
addTheme, asPrimary, asSmall, clearThemes, getInternalElement, removeTheme, setThemeMethods inherited from interface com.storedobject.core.ObjectSetter
accept
-
Method Details
-
clear
void clear()Clear the field value. -
getObjectClass
Class of the object supported in this input field.- Specified by:
getObjectClassin interfaceObjectGetter<T extends StoredObject>- Specified by:
getObjectClassin interfaceObjectProvider<T extends StoredObject>- Specified by:
getObjectClassin interfaceObjectSetter<T extends StoredObject>- Returns:
- Class of the supported object.
-
getObject
T getObject()Get the object that is currently set.- Specified by:
getObjectin interfaceObjectGetter<T extends StoredObject>- Specified by:
getObjectin interfaceObjectProvider<T extends StoredObject>- Returns:
- Object that is currently set. It could be
null.
-
setObject
Set the object.- Specified by:
setObjectin 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:
setObjectin interfaceObjectSetter<T extends StoredObject>- Parameters:
objectId-Idof 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 theIdof the current object.- Specified by:
getObjectIdin interfaceObjectGetter<T extends StoredObject>- Specified by:
getObjectIdin interfaceObjectProvider<T extends StoredObject>- Returns:
Idornullif no object is currently set.
-
isAllowAny
default boolean isAllowAny()Whether this field allows any derived object values or not.- Specified by:
isAllowAnyin interfaceObjectGetter<T extends StoredObject>- Specified by:
isAllowAnyin 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:FilterMethodsThis 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:
applyFilterPredicatein interfaceFilterMethods<T extends StoredObject>
-