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.CreateEventNested 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.WrapperNested classes/interfaces inherited from interface io.jmix.ui.component.HasContextHelp
HasContextHelp.ContextHelpIconClickEventNested 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
FieldsModifier and TypeFieldDescriptionprotected booleanprotected Stringprotected SupportsCaptionPosition.CaptionPositionprotected booleanprotected Stringprotected booleanprotected DataLoaderprotected Stringprotected Conditionprotected static final Stringprotected UiComponentsFields inherited from class io.jmix.ui.component.CompositeComponent
applicationContext, frame, id, prefixId, rootFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddValueChangeListener(Consumer<HasValue.ValueChangeEvent<V>> listener) voidapply()Applies the current filter component condition.protected voidprotected abstract Conditionprotected HBoxLayoutvoidfocus()Sets focus to this componentfloatprotected Component.AlignmentgetIcon()Get icon source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.protected StringgetIconName(Icons.Icon icon) abstract StringintGets the tabulator index of theHasTabIndexcomponent.getValue()protected voidinitRootComponent(HBoxLayout root) protected voidinitValueComponent(HasValue<V> valueComponent) booleanbooleanbooleanbooleanbooleanbooleanbooleanisValid()protected voidonCreate(CompositeComponent.CreateEvent createEvent) protected voidonValueChanged(HasValue.ValueChangeEvent<V> valueChangeEvent) voidsetAutoApply(boolean autoApply) Sets whether the filter component should be automatically applied to theDataLoaderwhen the value component value is changed.voidsetCaption(String caption) Sets the component's caption.voidsetCaptionAsHtml(boolean captionAsHtml) Sets whether the caption is rendered as HTML.voidsetCaptionPosition(SupportsCaptionPosition.CaptionPosition captionPosition) Sets position of component caption.voidsetCaptionVisible(boolean captionVisible) Sets caption visibility.voidsetCaptionWidth(String captionWidth) Sets the caption width.voidsetConditionModificationDelegated(boolean conditionModificationDelegated) Sets whether the modification ofDataLoadercondition is delegated to the ownerFilterComponentorFilter.voidSets a context help icon click handler.voidsetContextHelpText(String contextHelpText) Sets context help text.voidsetContextHelpTextHtmlEnabled(boolean enabled) Defines if context help text can be presented as HTML.voidsetDataLoader(DataLoader dataLoader) Sets aDataLoaderrelated to the current filter component.voidsetEditable(boolean editable) voidSet an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.voidsetIconFromSet(Icons.Icon icon) Set an icon from an icon set.voidsetRequired(boolean required) Sets whether the component must contain a non-null value.voidsetRequiredMessage(String msg) Sets a message that will be displayed to user if the field is required but has null value.voidsetTabIndex(int tabIndex) Sets the tabulator index of theFocusablecomponent.voidsetUiComponentProperties(UiComponentProperties componentProperties) voidsetUiComponents(UiComponents uiComponents) protected voidvoidvoidsetValueComponent(HasValue<V> valueComponent) Sets the field for editing a property value.voidSet component width inComponent.getWidthSizeUnit()}protected voidupdateCaption(String caption) protected voidupdateCaptionLabelTruncation(String caption) protected voidprotected voidprotected voidprotected voidprotected abstract voidupdateQueryCondition(V newValue) voidvalidate()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, withUnwrappedCompositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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, withUnwrappedCompositionMethods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrameMethods inherited from interface io.jmix.ui.component.Component.Editable
isEditableWithParentMethods inherited from interface io.jmix.ui.component.Component.Focusable
isFocusable, setFocusableMethods inherited from interface io.jmix.ui.component.CompositeWithDescription
getDescription, setDescriptionMethods inherited from interface io.jmix.ui.component.CompositeWithHtmlCaption
isCaptionAsHtmlMethods inherited from interface io.jmix.ui.component.CompositeWithHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtmlMethods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabledMethods inherited from interface io.jmix.ui.component.HasValue
clear, getEmptyValue, isEmptyMethods inherited from interface io.jmix.ui.component.SingleFilterComponent
getParameterName, setParameterNameMethods inherited from interface io.jmix.ui.component.Validatable
isValidateOnCommit
-
Field Details
-
TRUNCATED_CAPTION_STYLENAME
- See Also:
-
uiComponents
-
captionLabel
-
valueComponent
-
dataLoader
-
autoApply
protected boolean autoApply -
queryCondition
-
captionVisible
protected boolean captionVisible -
conditionModificationDelegated
protected boolean conditionModificationDelegated -
caption
-
captionWidth
-
icon
-
captionPosition
-
-
Constructor Details
-
AbstractSingleFilterComponent
public AbstractSingleFilterComponent()
-
-
Method Details
-
setUiComponents
-
setUiComponentProperties
-
onCreate
-
createRootComponent
-
createQueryCondition
-
initRootComponent
-
createCaptionLabel
-
getInnerComponentPrefix
-
getDataLoader
- Specified by:
getDataLoaderin interfaceFilterComponent- Returns:
- a
DataLoaderrelated to the current filter component
-
setDataLoader
Description copied from interface:FilterComponentSets aDataLoaderrelated to the current filter component.- Specified by:
setDataLoaderin interfaceFilterComponent- Parameters:
dataLoader- aDataLoaderto set
-
updateDataLoaderCondition
protected void updateDataLoaderCondition() -
isAutoApply
public boolean isAutoApply()- Specified by:
isAutoApplyin interfaceFilterComponent- Returns:
trueif the filter component should be automatically applied to theDataLoaderwhen the value component value is changed
-
setAutoApply
public void setAutoApply(boolean autoApply) Description copied from interface:FilterComponentSets whether the filter component should be automatically applied to theDataLoaderwhen the value component value is changed.- Specified by:
setAutoApplyin interfaceFilterComponent- Parameters:
autoApply-trueif the filter component should be automatically applied to theDataLoaderwhen the value component value is changed
-
isConditionModificationDelegated
public boolean isConditionModificationDelegated()- Specified by:
isConditionModificationDelegatedin interfaceFilterComponent- Returns:
trueif the filter component is located inside theFilterorLogicalFilterComponentand the modification ofDataLoadercondition is delegated to the ownerFilterComponentorFilter,falseotherwise
-
setConditionModificationDelegated
public void setConditionModificationDelegated(boolean conditionModificationDelegated) Description copied from interface:FilterComponentSets whether the modification ofDataLoadercondition is delegated to the ownerFilterComponentorFilter.- Specified by:
setConditionModificationDelegatedin interfaceFilterComponent- Parameters:
conditionModificationDelegated-trueif the filter component is located inside theFilterorLogicalFilterComponentand the modification ofDataLoadercondition is delegated to the ownerFilterComponentorFilter,falseotherwise
-
getQueryCondition
- Specified by:
getQueryConditionin interfaceFilterComponent- Returns:
- a
Conditionrelated to the current filter component
-
getCaptionPosition
- Specified by:
getCaptionPositionin interfaceSupportsCaptionPosition- Returns:
- position of component caption
-
setCaptionPosition
Description copied from interface:SupportsCaptionPositionSets position of component caption.- Specified by:
setCaptionPositionin interfaceSupportsCaptionPosition- Parameters:
captionPosition- component caption position
-
updateCaptionLayout
protected void updateCaptionLayout() -
updateChildAlignment
protected void updateChildAlignment() -
getChildAlignment
-
getCaption
- Specified by:
getCaptionin interfaceComponent.HasCaption- Specified by:
getCaptionin interfaceCompositeWithCaption- Returns:
- the caption of the component
-
setCaption
Description copied from interface:Component.HasCaptionSets the component's caption.- Specified by:
setCaptionin interfaceComponent.HasCaption- Specified by:
setCaptionin interfaceCompositeWithCaption- Parameters:
caption- the new component's caption
-
updateCaption
-
setCaptionAsHtml
public void setCaptionAsHtml(boolean captionAsHtml) Description copied from interface:HasHtmlCaptionSets whether the caption is rendered as HTML.- Specified by:
setCaptionAsHtmlin interfaceCompositeWithHtmlCaption- Specified by:
setCaptionAsHtmlin interfaceHasHtmlCaption- Parameters:
captionAsHtml-trueif the caption is rendered as HTML,falseif rendered as plain text- See Also:
-
getCaptionWidth
public float getCaptionWidth()- Specified by:
getCaptionWidthin interfaceSingleFilterComponent<V>- Returns:
- a caption width value in
Component.getWidthSizeUnit()
-
getCaptionWidthSizeUnit
- Specified by:
getCaptionWidthSizeUnitin interfaceSingleFilterComponent<V>- Returns:
- units used in the caption width property
-
setCaptionWidth
Description copied from interface:SingleFilterComponentSets the caption width.- Specified by:
setCaptionWidthin interfaceSingleFilterComponent<V>- Parameters:
captionWidth- a string width representation
-
isCaptionVisible
public boolean isCaptionVisible()- Specified by:
isCaptionVisiblein interfaceSingleFilterComponent<V>- Returns:
trueif caption is visible
-
setCaptionVisible
public void setCaptionVisible(boolean captionVisible) Description copied from interface:SingleFilterComponentSets caption visibility. Default value istrue.- Specified by:
setCaptionVisiblein interfaceSingleFilterComponent<V>- Parameters:
captionVisible- whether to show caption or not
-
setWidth
Description copied from interface:ComponentSet component width inComponent.getWidthSizeUnit()}- Specified by:
setWidthin interfaceComponent- Overrides:
setWidthin classCompositeComponent<HBoxLayout>
-
getValueComponent
- Specified by:
getValueComponentin interfaceSingleFilterComponent<V>- Returns:
- a field for editing a property value
-
setValueComponent
Description copied from interface:SingleFilterComponentSets the field for editing a property value.- Specified by:
setValueComponentin interfaceSingleFilterComponent<V>- Parameters:
valueComponent- a field for editing a property value
-
initValueComponent
-
onValueChanged
-
apply
public void apply()Description copied from interface:FilterComponentApplies the current filter component condition.- Specified by:
applyin interfaceFilterComponent
-
updateQueryCondition
-
getValue
-
setValue
-
checkValueComponentState
protected void checkValueComponentState() -
addValueChangeListener
- Specified by:
addValueChangeListenerin interfaceHasValue<V>
-
getIcon
Description copied from interface:Component.HasIconGet icon source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.- Specified by:
getIconin interfaceComponent.HasIcon
-
setIcon
Description copied from interface:Component.HasIconSet an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.- Specified by:
setIconin interfaceComponent.HasIcon
-
updateIcon
protected void updateIcon() -
setIconFromSet
Description copied from interface:Component.HasIconSet an icon from an icon set.- Specified by:
setIconFromSetin interfaceComponent.HasIcon
-
getIconName
-
isEditable
public boolean isEditable()- Specified by:
isEditablein interfaceComponent.Editable
-
setEditable
public void setEditable(boolean editable) - Specified by:
setEditablein interfaceComponent.Editable
-
focus
public void focus()Description copied from interface:Component.FocusableSets focus to this component- Specified by:
focusin interfaceComponent.Focusable
-
getTabIndex
public int getTabIndex()Description copied from interface:Component.FocusableGets the tabulator index of theHasTabIndexcomponent.- Specified by:
getTabIndexin interfaceComponent.Focusable- Returns:
- tab index set for the
HasTabIndexcomponent
-
setTabIndex
public void setTabIndex(int tabIndex) Description copied from interface:Component.FocusableSets the tabulator index of theFocusablecomponent. 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:
setTabIndexin interfaceComponent.Focusable- Parameters:
tabIndex- tab index
-
getContextHelpText
- Specified by:
getContextHelpTextin interfaceHasContextHelp- Returns:
- context help text
-
setContextHelpText
Description copied from interface:HasContextHelpSets context help text. If set, then a special icon will be added for a field.- Specified by:
setContextHelpTextin interfaceHasContextHelp- Parameters:
contextHelpText- context help text to be set
-
isContextHelpTextHtmlEnabled
public boolean isContextHelpTextHtmlEnabled()- Specified by:
isContextHelpTextHtmlEnabledin interfaceHasContextHelp- Returns:
- true if field accepts context help text in HTML format, false otherwise
-
setContextHelpTextHtmlEnabled
public void setContextHelpTextHtmlEnabled(boolean enabled) Description copied from interface:HasContextHelpDefines if context help text can be presented as HTML.- Specified by:
setContextHelpTextHtmlEnabledin interfaceHasContextHelp- Parameters:
enabled- true if field accepts context help text in HTML format, false otherwise
-
getContextHelpIconClickHandler
@Nullable public Consumer<HasContextHelp.ContextHelpIconClickEvent> getContextHelpIconClickHandler()- Specified by:
getContextHelpIconClickHandlerin interfaceHasContextHelp- Returns:
- a context help icon click handler
-
setContextHelpIconClickHandler
public void setContextHelpIconClickHandler(@Nullable Consumer<HasContextHelp.ContextHelpIconClickEvent> handler) Description copied from interface:HasContextHelpSets 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:
setContextHelpIconClickHandlerin interfaceHasContextHelp- Parameters:
handler- the handler to set
-
isRequired
public boolean isRequired()- Specified by:
isRequiredin interfaceRequirable- Returns:
- whether the component must contain a non-null value
-
setRequired
public void setRequired(boolean required) Description copied from interface:RequirableSets whether the component must contain a non-null value.- Specified by:
setRequiredin interfaceRequirable- Parameters:
required- required
-
getRequiredMessage
- Specified by:
getRequiredMessagein interfaceRequirable- Returns:
- a message that will be displayed to user if the component is required but has null value
-
setRequiredMessage
Description copied from interface:RequirableSets a message that will be displayed to user if the field is required but has null value.- Specified by:
setRequiredMessagein interfaceRequirable- Parameters:
msg- message
-
isValid
public boolean isValid()- Specified by:
isValidin interfaceValidatable
-
validate
- Specified by:
validatein interfaceValidatable- Throws:
ValidationException
-
setupLoaderFirstResult
protected void setupLoaderFirstResult() -
updateCaptionLabelTruncation
-