Package io.jmix.ui.component.impl
Class AbstractSingleFilterComponent<V>
java.lang.Object
io.jmix.ui.component.CompositeComponent<HBoxLayout>
io.jmix.ui.component.impl.AbstractSingleFilterComponent<V>
- All Implemented Interfaces:
AttachNotifier
,Component
,Component.BelongToFrame
,Component.Editable
,Component.Focusable
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,CompositeWithCaption
,CompositeWithDescription
,CompositeWithHtmlCaption
,CompositeWithHtmlDescription
,FilterComponent
,HasContextHelp
,HasDebugId
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
,HasValue<V>
,Requirable
,SingleFilterComponent<V>
,SupportsCaptionPosition
,Validatable
- Direct Known Subclasses:
FullTextFilterImpl
,JpqlFilterImpl
,PropertyFilterImpl
public abstract class AbstractSingleFilterComponent<V>
extends CompositeComponent<HBoxLayout>
implements SingleFilterComponent<V>, CompositeWithHtmlCaption, CompositeWithHtmlDescription
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.ui.component.CompositeComponent
CompositeComponent.CreateEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.Component
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEvent
Nested classes/interfaces inherited from interface io.jmix.ui.component.HasValue
HasValue.ValueChangeEvent<V>
Nested classes/interfaces inherited from interface io.jmix.ui.component.SupportsCaptionPosition
SupportsCaptionPosition.CaptionPosition
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected String
protected SupportsCaptionPosition.CaptionPosition
protected boolean
protected String
protected boolean
protected DataLoader
protected String
protected Condition
protected UiComponents
Fields inherited from class io.jmix.ui.component.CompositeComponent
applicationContext, frame, id, prefixId, root
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddValueChangeListener
(Consumer<HasValue.ValueChangeEvent<V>> listener) void
apply()
Applies the current filter component condition.protected void
protected abstract Condition
protected HBoxLayout
void
focus()
Sets focus to this componentfloat
protected Component.Alignment
getIcon()
Get icon source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.protected String
getIconName
(Icons.Icon icon) abstract String
int
Gets the tabulator index of theHasTabIndex
component.getValue()
protected void
initRootComponent
(HBoxLayout root) protected void
initValueComponent
(HasValue<V> valueComponent) boolean
boolean
boolean
boolean
boolean
boolean
boolean
isValid()
protected void
onCreate
(CompositeComponent.CreateEvent createEvent) protected void
onValueChanged
(HasValue.ValueChangeEvent<V> valueChangeEvent) void
setAutoApply
(boolean autoApply) Sets whether the filter component should be automatically applied to theDataLoader
when the value component value is changed.void
setCaption
(String caption) Sets the component's caption.void
setCaptionAsHtml
(boolean captionAsHtml) Sets whether the caption is rendered as HTML.void
setCaptionPosition
(SupportsCaptionPosition.CaptionPosition captionPosition) Sets position of component caption.void
setCaptionVisible
(boolean captionVisible) Sets caption visibility.void
setCaptionWidth
(String captionWidth) Sets the caption width.void
setConditionModificationDelegated
(boolean conditionModificationDelegated) Sets whether the modification ofDataLoader
condition is delegated to the ownerFilterComponent
orFilter
.void
Sets a context help icon click handler.void
setContextHelpText
(String contextHelpText) Sets context help text.void
setContextHelpTextHtmlEnabled
(boolean enabled) Defines if context help text can be presented as HTML.void
setDataLoader
(DataLoader dataLoader) Sets aDataLoader
related to the current filter component.void
setEditable
(boolean editable) void
Set an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.void
setIconFromSet
(Icons.Icon icon) Set an icon from an icon set.void
setRequired
(boolean required) Sets whether the component must contain a non-null value.void
setRequiredMessage
(String msg) Sets a message that will be displayed to user if the field is required but has null value.void
setTabIndex
(int tabIndex) Sets the tabulator index of theFocusable
component.void
setUiComponentProperties
(UiComponentProperties componentProperties) void
setUiComponents
(UiComponents uiComponents) protected void
void
void
setValueComponent
(HasValue<V> valueComponent) Sets the field for editing a property value.void
Set component width inComponent.getWidthSizeUnit()
}protected void
updateCaption
(String caption) protected void
protected void
protected void
protected void
protected abstract void
updateQueryCondition
(V newValue) void
validate()
Methods inherited from class io.jmix.ui.component.CompositeComponent
addAttachListener, addCreateListener, addDetachListener, addStyleName, assignDebugId, attached, detached, disableEventListeners, enableEventListeners, getAlignment, getComposition, getCompositionOrNull, getDebugId, getEventHub, getFrame, getFullId, getHeight, getHeightSizeUnit, getId, getInnerComponent, getInnerComponentOptional, getParent, getPrefixId, getStyleName, getUiEventListeners, getWidth, getWidthSizeUnit, hasSubscriptions, isAttached, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, publish, removeStyleName, setAlignment, setApplicationContext, setComposition, setDebugId, setEnabled, setFrame, setHeight, setHtmlSanitizerEnabled, setId, setParent, setResponsive, setStyleName, setUiEventListeners, setVisible, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, updateComponentIds, updateIdIfNeeded, withUnwrapped, withUnwrappedComposition
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.ui.component.Component
addStyleName, getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, removeStyleName, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
Methods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrame
Methods inherited from interface io.jmix.ui.component.Component.Editable
isEditableWithParent
Methods inherited from interface io.jmix.ui.component.Component.Focusable
isFocusable, setFocusable
Methods inherited from interface io.jmix.ui.component.CompositeWithDescription
getDescription, setDescription
Methods inherited from interface io.jmix.ui.component.CompositeWithHtmlCaption
isCaptionAsHtml
Methods inherited from interface io.jmix.ui.component.CompositeWithHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
Methods inherited from interface io.jmix.ui.component.HasValue
clear, getEmptyValue, isEmpty
Methods inherited from interface io.jmix.ui.component.SingleFilterComponent
getParameterName, setParameterName
Methods inherited from interface io.jmix.ui.component.Validatable
isValidateOnCommit
-
Field Details
-
uiComponents
-
valueComponent
-
dataLoader
-
autoApply
protected boolean autoApply -
queryCondition
-
conditionModificationDelegated
protected boolean conditionModificationDelegated -
icon
-
-
Constructor Details
-
AbstractSingleFilterComponent
public AbstractSingleFilterComponent()
-
-
Method Details
-
setUiComponents
-
setUiComponentProperties
-
onCreate
-
createRootComponent
-
createQueryCondition
-
initRootComponent
-
createCaptionLabel
-
getInnerComponentPrefix
-
getDataLoader
- Specified by:
getDataLoader
in interfaceFilterComponent
- Returns:
- a
DataLoader
related to the current filter component
-
setDataLoader
Description copied from interface:FilterComponent
Sets aDataLoader
related to the current filter component.- Specified by:
setDataLoader
in interfaceFilterComponent
- Parameters:
dataLoader
- aDataLoader
to set
-
updateDataLoaderCondition
protected void updateDataLoaderCondition() -
isAutoApply
public boolean isAutoApply()- Specified by:
isAutoApply
in interfaceFilterComponent
- Returns:
true
if the filter component should be automatically applied to theDataLoader
when the value component value is changed
-
setAutoApply
public void setAutoApply(boolean autoApply) Description copied from interface:FilterComponent
Sets whether the filter component should be automatically applied to theDataLoader
when the value component value is changed.- Specified by:
setAutoApply
in interfaceFilterComponent
- Parameters:
autoApply
-true
if the filter component should be automatically applied to theDataLoader
when the value component value is changed
-
isConditionModificationDelegated
public boolean isConditionModificationDelegated()- Specified by:
isConditionModificationDelegated
in interfaceFilterComponent
- Returns:
true
if the filter component is located inside theFilter
orLogicalFilterComponent
and the modification ofDataLoader
condition is delegated to the ownerFilterComponent
orFilter
,false
otherwise
-
setConditionModificationDelegated
public void setConditionModificationDelegated(boolean conditionModificationDelegated) Description copied from interface:FilterComponent
Sets whether the modification ofDataLoader
condition is delegated to the ownerFilterComponent
orFilter
.- Specified by:
setConditionModificationDelegated
in interfaceFilterComponent
- Parameters:
conditionModificationDelegated
-true
if the filter component is located inside theFilter
orLogicalFilterComponent
and the modification ofDataLoader
condition is delegated to the ownerFilterComponent
orFilter
,false
otherwise
-
getQueryCondition
- Specified by:
getQueryCondition
in interfaceFilterComponent
- Returns:
- a
Condition
related to the current filter component
-
getCaptionPosition
- Specified by:
getCaptionPosition
in interfaceSupportsCaptionPosition
- Returns:
- position of component caption
-
setCaptionPosition
Description copied from interface:SupportsCaptionPosition
Sets position of component caption.- Specified by:
setCaptionPosition
in interfaceSupportsCaptionPosition
- Parameters:
captionPosition
- component caption position
-
updateCaptionLayout
protected void updateCaptionLayout() -
updateChildAlignment
protected void updateChildAlignment() -
getChildAlignment
-
getCaption
- Specified by:
getCaption
in interfaceComponent.HasCaption
- Specified by:
getCaption
in interfaceCompositeWithCaption
- Returns:
- the caption of the component
-
setCaption
Description copied from interface:Component.HasCaption
Sets the component's caption.- Specified by:
setCaption
in interfaceComponent.HasCaption
- Specified by:
setCaption
in interfaceCompositeWithCaption
- Parameters:
caption
- the new component's caption
-
updateCaption
-
setCaptionAsHtml
public void setCaptionAsHtml(boolean captionAsHtml) Description copied from interface:HasHtmlCaption
Sets whether the caption is rendered as HTML.- Specified by:
setCaptionAsHtml
in interfaceCompositeWithHtmlCaption
- Specified by:
setCaptionAsHtml
in interfaceHasHtmlCaption
- Parameters:
captionAsHtml
-true
if the caption is rendered as HTML,false
if rendered as plain text- See Also:
-
getCaptionWidth
public float getCaptionWidth()- Specified by:
getCaptionWidth
in interfaceSingleFilterComponent<V>
- Returns:
- a caption width value in
Component.getWidthSizeUnit()
-
getCaptionWidthSizeUnit
- Specified by:
getCaptionWidthSizeUnit
in interfaceSingleFilterComponent<V>
- Returns:
- units used in the caption width property
-
setCaptionWidth
Description copied from interface:SingleFilterComponent
Sets the caption width.- Specified by:
setCaptionWidth
in interfaceSingleFilterComponent<V>
- Parameters:
captionWidth
- a string width representation
-
isCaptionVisible
public boolean isCaptionVisible()- Specified by:
isCaptionVisible
in interfaceSingleFilterComponent<V>
- Returns:
true
if caption is visible
-
setCaptionVisible
public void setCaptionVisible(boolean captionVisible) Description copied from interface:SingleFilterComponent
Sets caption visibility. Default value istrue
.- Specified by:
setCaptionVisible
in interfaceSingleFilterComponent<V>
- Parameters:
captionVisible
- whether to show caption or not
-
setWidth
Description copied from interface:Component
Set component width inComponent.getWidthSizeUnit()
}- Specified by:
setWidth
in interfaceComponent
- Overrides:
setWidth
in classCompositeComponent<HBoxLayout>
-
getValueComponent
- Specified by:
getValueComponent
in interfaceSingleFilterComponent<V>
- Returns:
- a field for editing a property value
-
setValueComponent
Description copied from interface:SingleFilterComponent
Sets the field for editing a property value.- Specified by:
setValueComponent
in interfaceSingleFilterComponent<V>
- Parameters:
valueComponent
- a field for editing a property value
-
initValueComponent
-
onValueChanged
-
apply
public void apply()Description copied from interface:FilterComponent
Applies the current filter component condition.- Specified by:
apply
in interfaceFilterComponent
-
updateQueryCondition
-
getValue
-
setValue
-
checkValueComponentState
protected void checkValueComponentState() -
addValueChangeListener
- Specified by:
addValueChangeListener
in interfaceHasValue<V>
-
getIcon
Description copied from interface:Component.HasIcon
Get icon source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.- Specified by:
getIcon
in interfaceComponent.HasIcon
-
setIcon
Description copied from interface:Component.HasIcon
Set an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.- Specified by:
setIcon
in interfaceComponent.HasIcon
-
updateIcon
protected void updateIcon() -
setIconFromSet
Description copied from interface:Component.HasIcon
Set an icon from an icon set.- Specified by:
setIconFromSet
in interfaceComponent.HasIcon
-
getIconName
-
isEditable
public boolean isEditable()- Specified by:
isEditable
in interfaceComponent.Editable
-
setEditable
public void setEditable(boolean editable) - Specified by:
setEditable
in interfaceComponent.Editable
-
focus
public void focus()Description copied from interface:Component.Focusable
Sets focus to this component- Specified by:
focus
in interfaceComponent.Focusable
-
getTabIndex
public int getTabIndex()Description copied from interface:Component.Focusable
Gets the tabulator index of theHasTabIndex
component.- Specified by:
getTabIndex
in interfaceComponent.Focusable
- Returns:
- tab index set for the
HasTabIndex
component
-
setTabIndex
public void setTabIndex(int tabIndex) Description copied from interface:Component.Focusable
Sets the tabulator index of theFocusable
component. The tab index property is used to specify the order in which the fields are focused when the user presses the Tab key. Components with a defined tab index are focused sequentially first, and then the components with no tab index.- Specified by:
setTabIndex
in interfaceComponent.Focusable
- Parameters:
tabIndex
- tab index
-
getContextHelpText
- Specified by:
getContextHelpText
in interfaceHasContextHelp
- Returns:
- context help text
-
setContextHelpText
Description copied from interface:HasContextHelp
Sets context help text. If set, then a special icon will be added for a field.- Specified by:
setContextHelpText
in interfaceHasContextHelp
- Parameters:
contextHelpText
- context help text to be set
-
isContextHelpTextHtmlEnabled
public boolean isContextHelpTextHtmlEnabled()- Specified by:
isContextHelpTextHtmlEnabled
in interfaceHasContextHelp
- Returns:
- true if field accepts context help text in HTML format, false otherwise
-
setContextHelpTextHtmlEnabled
public void setContextHelpTextHtmlEnabled(boolean enabled) Description copied from interface:HasContextHelp
Defines if context help text can be presented as HTML.- Specified by:
setContextHelpTextHtmlEnabled
in interfaceHasContextHelp
- Parameters:
enabled
- true if field accepts context help text in HTML format, false otherwise
-
getContextHelpIconClickHandler
@Nullable public Consumer<HasContextHelp.ContextHelpIconClickEvent> getContextHelpIconClickHandler()- Specified by:
getContextHelpIconClickHandler
in interfaceHasContextHelp
- Returns:
- a context help icon click handler
-
setContextHelpIconClickHandler
public void setContextHelpIconClickHandler(@Nullable Consumer<HasContextHelp.ContextHelpIconClickEvent> handler) Description copied from interface:HasContextHelp
Sets a context help icon click handler. If set, then a special icon will be added for a field. Click handler has priority over context help text, i.e. no tooltip with context help text will be shown if click listener is set.- Specified by:
setContextHelpIconClickHandler
in interfaceHasContextHelp
- Parameters:
handler
- the handler to set
-
isRequired
public boolean isRequired()- Specified by:
isRequired
in interfaceRequirable
- Returns:
- whether the component must contain a non-null value
-
setRequired
public void setRequired(boolean required) Description copied from interface:Requirable
Sets whether the component must contain a non-null value.- Specified by:
setRequired
in interfaceRequirable
- Parameters:
required
- required
-
getRequiredMessage
- Specified by:
getRequiredMessage
in interfaceRequirable
- Returns:
- a message that will be displayed to user if the component is required but has null value
-
setRequiredMessage
Description copied from interface:Requirable
Sets a message that will be displayed to user if the field is required but has null value.- Specified by:
setRequiredMessage
in interfaceRequirable
- Parameters:
msg
- message
-
isValid
public boolean isValid()- Specified by:
isValid
in interfaceValidatable
-
validate
- Specified by:
validate
in interfaceValidatable
- Throws:
ValidationException
-
setupLoaderFirstResult
protected void setupLoaderFirstResult()
-