public abstract class AbstractSingleFilterComponent<V> extends CompositeComponent<HBoxLayout> implements SingleFilterComponent<V>, CompositeWithHtmlCaption, CompositeWithHtmlDescription
CompositeComponent.CreateEvent
HasValue.ValueChangeEvent<V>
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
SupportsCaptionPosition.CaptionPosition
HasContextHelp.ContextHelpIconClickEvent
Modifier and Type | Field and Description |
---|---|
protected boolean |
autoApply |
protected java.lang.String |
caption |
protected Label<java.lang.String> |
captionLabel |
protected SupportsCaptionPosition.CaptionPosition |
captionPosition |
protected java.lang.String |
captionWidth |
protected boolean |
conditionModificationDelegated |
protected DataLoader |
dataLoader |
protected java.lang.String |
icon |
protected io.jmix.core.querycondition.Condition |
queryCondition |
protected UiComponents |
uiComponents |
protected HasValue<V> |
valueComponent |
applicationContext, frame, id, root
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Constructor and Description |
---|
AbstractSingleFilterComponent() |
Modifier and Type | Method and Description |
---|---|
io.jmix.core.common.event.Subscription |
addValueChangeListener(java.util.function.Consumer<HasValue.ValueChangeEvent<V>> listener) |
void |
apply()
Applies the current filter component condition.
|
protected void |
checkValueComponentState() |
protected Label<java.lang.String> |
createCaptionLabel() |
protected abstract io.jmix.core.querycondition.Condition |
createQueryCondition() |
protected HBoxLayout |
createRootComponent() |
void |
focus()
Sets focus to this component
|
java.lang.String |
getCaption() |
SupportsCaptionPosition.CaptionPosition |
getCaptionPosition() |
float |
getCaptionWidth() |
SizeUnit |
getCaptionWidthSizeUnit() |
protected Component.Alignment |
getChildAlignment() |
java.util.function.Consumer<HasContextHelp.ContextHelpIconClickEvent> |
getContextHelpIconClickHandler() |
java.lang.String |
getContextHelpText() |
DataLoader |
getDataLoader() |
java.lang.String |
getIcon()
Get icon source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.
|
protected java.lang.String |
getIconName(Icons.Icon icon) |
abstract java.lang.String |
getInnerComponentPrefix() |
io.jmix.core.querycondition.Condition |
getQueryCondition() |
java.lang.String |
getRequiredMessage() |
int |
getTabIndex()
Gets the tabulator index of the
HasTabIndex component. |
V |
getValue() |
HasValue<V> |
getValueComponent() |
protected void |
initRootComponent(HBoxLayout root) |
protected void |
initValueComponent(HasValue<V> valueComponent) |
boolean |
isAutoApply() |
boolean |
isConditionModificationDelegated() |
boolean |
isContextHelpTextHtmlEnabled() |
boolean |
isEditable() |
boolean |
isRequired() |
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 the
DataLoader when the value component value is changed. |
void |
setCaption(java.lang.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 |
setCaptionWidth(java.lang.String captionWidth)
Sets the caption width.
|
void |
setConditionModificationDelegated(boolean conditionModificationDelegated)
Sets whether the modification of
DataLoader condition is delegated to the owner
FilterComponent or Filter . |
void |
setContextHelpIconClickHandler(java.util.function.Consumer<HasContextHelp.ContextHelpIconClickEvent> handler)
Sets a context help icon click handler.
|
void |
setContextHelpText(java.lang.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 a
DataLoader related to the current filter component. |
void |
setEditable(boolean editable) |
void |
setIcon(java.lang.String icon)
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(java.lang.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 the
Focusable component. |
void |
setUiComponentProperties(UiComponentProperties componentProperties) |
void |
setUiComponents(UiComponents uiComponents) |
void |
setValue(V value) |
void |
setValueComponent(HasValue<V> valueComponent)
Sets the field for editing a property value.
|
void |
setWidth(java.lang.String width)
Set component width in
Component.getWidthSizeUnit() } |
protected void |
updateCaption(java.lang.String caption) |
protected void |
updateCaptionLayout() |
protected void |
updateChildAlignment() |
protected void |
updateDataLoaderCondition() |
protected void |
updateIcon() |
protected abstract void |
updateQueryCondition(V newValue) |
void |
validate() |
addAttachListener, addCreateListener, addDetachListener, addStyleName, assignDebugId, attached, detached, disableEventListeners, enableEventListeners, getAlignment, getComposition, getCompositionOrNull, getDebugId, getEventHub, getFrame, getHeight, getHeightSizeUnit, getId, getInnerComponent, getInnerComponentOptional, getParent, 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, withUnwrapped, withUnwrappedComposition
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getParameterName, setParameterName
getFrame, setFrame
clear, getEmptyValue, isEmpty
isFocusable, setFocusable
isEditableWithParent
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
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
isValidateOnCommit
isCaptionAsHtml
getDescription, setDescription
isDescriptionAsHtml, setDescriptionAsHtml
protected UiComponents uiComponents
protected Label<java.lang.String> captionLabel
protected DataLoader dataLoader
protected boolean autoApply
protected io.jmix.core.querycondition.Condition queryCondition
protected boolean conditionModificationDelegated
protected java.lang.String caption
protected java.lang.String captionWidth
protected java.lang.String icon
protected SupportsCaptionPosition.CaptionPosition captionPosition
@Autowired public void setUiComponents(UiComponents uiComponents)
@Autowired public void setUiComponentProperties(UiComponentProperties componentProperties)
protected void onCreate(CompositeComponent.CreateEvent createEvent)
protected HBoxLayout createRootComponent()
protected abstract io.jmix.core.querycondition.Condition createQueryCondition()
protected void initRootComponent(HBoxLayout root)
protected Label<java.lang.String> createCaptionLabel()
public abstract java.lang.String getInnerComponentPrefix()
public DataLoader getDataLoader()
getDataLoader
in interface FilterComponent
DataLoader
related to the current filter componentpublic void setDataLoader(DataLoader dataLoader)
FilterComponent
DataLoader
related to the current filter component.setDataLoader
in interface FilterComponent
dataLoader
- a DataLoader
to setprotected void updateDataLoaderCondition()
public boolean isAutoApply()
isAutoApply
in interface FilterComponent
true
if the filter component should be automatically applied to
the DataLoader
when the value component value is changedpublic void setAutoApply(boolean autoApply)
FilterComponent
DataLoader
when the value component value is changed.setAutoApply
in interface FilterComponent
autoApply
- true
if the filter component should be automatically
applied to the DataLoader
when the value component
value is changedpublic boolean isConditionModificationDelegated()
isConditionModificationDelegated
in interface FilterComponent
true
if the filter component is located inside the Filter
or LogicalFilterComponent
and the modification of DataLoader
condition is delegated to the owner FilterComponent
or Filter
,
false
otherwisepublic void setConditionModificationDelegated(boolean conditionModificationDelegated)
FilterComponent
DataLoader
condition is delegated to the owner
FilterComponent
or Filter
.setConditionModificationDelegated
in interface FilterComponent
conditionModificationDelegated
- true
if the filter component is located inside
the Filter
or LogicalFilterComponent
and the modification of DataLoader
condition
is delegated to the owner FilterComponent
or Filter
,
false
otherwisepublic io.jmix.core.querycondition.Condition getQueryCondition()
getQueryCondition
in interface FilterComponent
Condition
related to the current filter componentpublic SupportsCaptionPosition.CaptionPosition getCaptionPosition()
getCaptionPosition
in interface SupportsCaptionPosition
public void setCaptionPosition(SupportsCaptionPosition.CaptionPosition captionPosition)
SupportsCaptionPosition
setCaptionPosition
in interface SupportsCaptionPosition
captionPosition
- component caption positionprotected void updateCaptionLayout()
protected void updateChildAlignment()
protected Component.Alignment getChildAlignment()
@Nullable public java.lang.String getCaption()
getCaption
in interface Component.HasCaption
getCaption
in interface CompositeWithCaption
public void setCaption(@Nullable java.lang.String caption)
Component.HasCaption
setCaption
in interface Component.HasCaption
setCaption
in interface CompositeWithCaption
caption
- the new component's captionprotected void updateCaption(@Nullable java.lang.String caption)
public void setCaptionAsHtml(boolean captionAsHtml)
HasHtmlCaption
setCaptionAsHtml
in interface CompositeWithHtmlCaption
setCaptionAsHtml
in interface HasHtmlCaption
captionAsHtml
- true
if the caption is rendered as HTML,
false
if rendered as plain textComponent.HasCaption.setCaption(String)
public float getCaptionWidth()
getCaptionWidth
in interface SingleFilterComponent<V>
Component.getWidthSizeUnit()
public SizeUnit getCaptionWidthSizeUnit()
getCaptionWidthSizeUnit
in interface SingleFilterComponent<V>
public void setCaptionWidth(java.lang.String captionWidth)
SingleFilterComponent
setCaptionWidth
in interface SingleFilterComponent<V>
captionWidth
- a string width representationpublic void setWidth(@Nullable java.lang.String width)
Component
Component.getWidthSizeUnit()
}setWidth
in interface Component
setWidth
in class CompositeComponent<HBoxLayout>
public HasValue<V> getValueComponent()
getValueComponent
in interface SingleFilterComponent<V>
public void setValueComponent(HasValue<V> valueComponent)
SingleFilterComponent
setValueComponent
in interface SingleFilterComponent<V>
valueComponent
- a field for editing a property valueprotected void onValueChanged(HasValue.ValueChangeEvent<V> valueChangeEvent)
public void apply()
FilterComponent
apply
in interface FilterComponent
protected abstract void updateQueryCondition(@Nullable V newValue)
protected void checkValueComponentState()
public io.jmix.core.common.event.Subscription addValueChangeListener(java.util.function.Consumer<HasValue.ValueChangeEvent<V>> listener)
addValueChangeListener
in interface HasValue<V>
@Nullable public java.lang.String getIcon()
Component.HasIcon
getIcon
in interface Component.HasIcon
public void setIcon(@Nullable java.lang.String icon)
Component.HasIcon
setIcon
in interface Component.HasIcon
protected void updateIcon()
public void setIconFromSet(@Nullable Icons.Icon icon)
Component.HasIcon
setIconFromSet
in interface Component.HasIcon
@Nullable protected java.lang.String getIconName(@Nullable Icons.Icon icon)
public boolean isEditable()
isEditable
in interface Component.Editable
public void setEditable(boolean editable)
setEditable
in interface Component.Editable
public void focus()
Component.Focusable
focus
in interface Component.Focusable
public int getTabIndex()
Component.Focusable
HasTabIndex
component.getTabIndex
in interface Component.Focusable
HasTabIndex
componentpublic void setTabIndex(int tabIndex)
Component.Focusable
Focusable
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.setTabIndex
in interface Component.Focusable
tabIndex
- tab index@Nullable public java.lang.String getContextHelpText()
getContextHelpText
in interface HasContextHelp
public void setContextHelpText(@Nullable java.lang.String contextHelpText)
HasContextHelp
setContextHelpText
in interface HasContextHelp
contextHelpText
- context help text to be setpublic boolean isContextHelpTextHtmlEnabled()
isContextHelpTextHtmlEnabled
in interface HasContextHelp
public void setContextHelpTextHtmlEnabled(boolean enabled)
HasContextHelp
setContextHelpTextHtmlEnabled
in interface HasContextHelp
enabled
- true if field accepts context help text in HTML format, false otherwise@Nullable public java.util.function.Consumer<HasContextHelp.ContextHelpIconClickEvent> getContextHelpIconClickHandler()
getContextHelpIconClickHandler
in interface HasContextHelp
public void setContextHelpIconClickHandler(@Nullable java.util.function.Consumer<HasContextHelp.ContextHelpIconClickEvent> handler)
HasContextHelp
setContextHelpIconClickHandler
in interface HasContextHelp
handler
- the handler to setpublic boolean isRequired()
isRequired
in interface Requirable
public void setRequired(boolean required)
Requirable
setRequired
in interface Requirable
required
- required@Nullable public java.lang.String getRequiredMessage()
getRequiredMessage
in interface Requirable
public void setRequiredMessage(@Nullable java.lang.String msg)
Requirable
setRequiredMessage
in interface Requirable
msg
- messagepublic boolean isValid()
isValid
in interface Validatable
public void validate() throws ValidationException
validate
in interface Validatable
ValidationException