Package io.jmix.ui.component.impl
Class ButtonImpl
- All Implemented Interfaces:
ActionOwner
,AttachNotifier
,Button
,Component
,Component.BelongToFrame
,Component.Focusable
,Component.HasCaption
,Component.HasDescription
,Component.HasIcon
,Component.HasXmlDescriptor
,Component.Wrapper
,HasContextHelp
,HasDebugId
,HasHtmlCaption
,HasHtmlDescription
,HasHtmlSanitizer
- Direct Known Subclasses:
LinkButtonImpl
,PaletteButton
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.jmix.ui.component.Button
Button.ClickEvent
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
-
Field Summary
Modifier and TypeFieldDescriptionprotected Action
protected Consumer<PropertyChangeEvent>
protected Boolean
protected Boolean
protected KeyCombination
protected Boolean
Fields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
Fields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddClickListener
(Consumer<Button.ClickEvent> listener) void
addStyleName
(String styleName) Adds one or more style names to this component.protected void
protected void
protected void
buttonClicked
(com.vaadin.shared.MouseEventDetails mouseEventDetails) void
click()
Simulates a button click, notifying all server-side listeners.protected JmixButton
void
focus()
Sets focus to this componentprotected Component
int
Gets the tabulator index of theHasTabIndex
component.protected void
initComponent
(JmixButton component) boolean
boolean
void
removeStyleName
(String styleName) Removes one or more style names from component.void
Sets the action to the owner.void
setCaptionAsHtml
(boolean captionAsHtml) Sets whether the caption is rendered as HTML.void
setDisableOnClick
(boolean value) Determines if a button is automatically disabled when clicked.void
setEnabled
(boolean enabled) Sets the component enabled state.void
Set an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.void
setShortcut
(String shortcut) Sets shortcut from string representation.void
setShortcutCombination
(KeyCombination shortcut) Sets shortcut combination.void
setTabIndex
(int tabIndex) Sets the tabulator index of theFocusable
component.void
setVisible
(boolean visible) Sets visibility value for the component.Methods inherited from class io.jmix.ui.component.impl.AbstractComponent
addAttachListener, addDetachListener, assignDebugId, attached, detached, getAlignment, getCaption, getComponent, getComposition, getContextHelpIconClickHandler, getContextHelpText, getDebugId, getDescription, getEventHub, getFrame, getHeight, getHeightSizeUnit, getHtmlSanitizer, getIcon, getIconName, getIconResource, getId, getParent, getStyleName, getUiComponentProperties, getUiProperties, getWidth, getWidthSizeUnit, getXmlDescriptor, hasSubscriptions, hasValidationError, isAttached, isContextHelpTextHtmlEnabled, isDescriptionAsHtml, isEnabled, isEnabledRecursive, isHtmlSanitizerEnabled, isResponsive, isVisible, isVisibleRecursive, onContextHelpIconClick, publish, sanitize, setAlignment, setApplicationContext, setCaption, setContextHelpIconClickHandler, setContextHelpText, setContextHelpTextHtmlEnabled, setDebugId, setDescription, setDescriptionAsHtml, setFrame, setHeight, setHtmlSanitizerEnabled, setIconFromSet, setId, setParent, setResponsive, setStyleName, setValidationError, setWidth, setXmlDescriptor, unsubscribe, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, 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.ActionOwner
setAction
Methods inherited from interface io.jmix.ui.component.Component
getAlignment, getHeight, getHeightSizeUnit, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, isEnabled, isEnabledRecursive, isResponsive, isVisible, isVisibleRecursive, setAlignment, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setWidth, 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.Focusable
isFocusable, setFocusable
Methods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaption
Methods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescription
Methods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIconFromSet
Methods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtml
Methods inherited from interface io.jmix.ui.component.HasHtmlSanitizer
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
-
Field Details
-
action
-
actionPropertyChangeListener
-
shortcut
-
enabled
-
visible
-
-
-
Constructor Details
-
ButtonImpl
public ButtonImpl()
-
-
Method Details
-
createComponent
-
initComponent
-
beforeActionPerformed
protected void beforeActionPerformed() -
getActionEventTarget
-
afterActionPerformed
protected void afterActionPerformed() -
getAction
- Specified by:
getAction
in interfaceActionOwner
- Returns:
- an action or
null
-
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
- Overrides:
setIcon
in classAbstractComponent<JmixButton>
-
setAction
Description copied from interface:ActionOwner
Sets the action to the owner. IfoverrideOwnerProperties
istrue
then the action properties will override owner properties, otherwise the owner properties will be overridden if they arenull
.List of properties that the action and the owner have and which can be overridden:
caption
description
shortcut
enabled
visible
primary
icon
- Specified by:
setAction
in interfaceActionOwner
- Parameters:
action
- an actionoverrideOwnerProperties
- whether action properties override owner properties
-
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
-
setDisableOnClick
public void setDisableOnClick(boolean value) Description copied from interface:Button
Determines if a button is automatically disabled when clicked. If this is set to true the button will be automatically disabled when clicked, typically to prevent (accidental) extra clicks on a button.- Specified by:
setDisableOnClick
in interfaceButton
- Parameters:
value
- disable on click option.
-
isDisableOnClick
public boolean isDisableOnClick()- Specified by:
isDisableOnClick
in interfaceButton
- Returns:
- true if the button is disabled when clicked.
-
setCaptionAsHtml
public void setCaptionAsHtml(boolean captionAsHtml) Description copied from interface:HasHtmlCaption
Sets whether the caption is rendered as HTML.- Specified by:
setCaptionAsHtml
in interfaceHasHtmlCaption
- Overrides:
setCaptionAsHtml
in classAbstractComponent<JmixButton>
- Parameters:
captionAsHtml
-true
if the caption is rendered as HTML,false
if rendered as plain text- See Also:
-
isCaptionAsHtml
public boolean isCaptionAsHtml()- Specified by:
isCaptionAsHtml
in interfaceHasHtmlCaption
- Overrides:
isCaptionAsHtml
in classAbstractComponent<JmixButton>
- Returns:
true
if the caption is rendered as HTML,false
if rendered as plain text
-
getShortcutCombination
- Specified by:
getShortcutCombination
in interfaceButton
- Returns:
- action's shortcut
-
setShortcutCombination
Description copied from interface:Button
Sets shortcut combination.- Specified by:
setShortcutCombination
in interfaceButton
- Parameters:
shortcut
- key combination
-
setShortcut
Description copied from interface:Button
Sets shortcut from string representation.- Specified by:
setShortcut
in interfaceButton
- Parameters:
shortcut
- string of type "Modifiers-Key", e.g. "Alt-N". Case-insensitive.
-
click
public void click()Description copied from interface:Button
Simulates a button click, notifying all server-side listeners.No action is taken if the button is disabled.
-
addClickListener
- Specified by:
addClickListener
in interfaceButton
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:Component
Sets the component enabled state.
The user can not interact with disabled components, which are shown with a style that indicates the status. Components are enabled by default.- Specified by:
setEnabled
in interfaceComponent
- Overrides:
setEnabled
in classAbstractComponent<JmixButton>
- Parameters:
enabled
- enabled flag
-
setVisible
public void setVisible(boolean visible) Description copied from interface:Component
Sets visibility value for the component.
Visible components are drawn in the user interface, while invisible ones are not. The effect is not a cosmetic CSS change - no information about an invisible component will be sent to the client. The effect is thus the same as removing the component from its parent.- Specified by:
setVisible
in interfaceComponent
- Overrides:
setVisible
in classAbstractComponent<JmixButton>
- Parameters:
visible
- visible flag
-
addStyleName
Description copied from interface:Component
Adds one or more style names to this component. Multiple styles can be specified as a space-separated list of style names.- Specified by:
addStyleName
in interfaceComponent
- Overrides:
addStyleName
in classAbstractComponent<JmixButton>
- Parameters:
styleName
- one or more style names separated by space.
-
removeStyleName
Description copied from interface:Component
Removes one or more style names from component. Multiple styles can be specified as a space-separated list of style names.- Specified by:
removeStyleName
in interfaceComponent
- Overrides:
removeStyleName
in classAbstractComponent<JmixButton>
- Parameters:
styleName
- one or more style names separated by space.
-