public class ButtonImpl extends AbstractComponent<JmixButton> implements Button
Button.ClickEvent
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.Wrapper
HasContextHelp.ContextHelpIconClickEvent
Modifier and Type | Field and Description |
---|---|
protected Action |
action |
protected java.util.function.Consumer<java.beans.PropertyChangeEvent> |
actionPropertyChangeListener |
protected java.lang.Boolean |
enabled |
protected java.lang.Boolean |
primary |
protected KeyCombination |
shortcut |
protected java.lang.Boolean |
visible |
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parent
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE
Constructor and Description |
---|
ButtonImpl() |
Modifier and Type | Method and Description |
---|---|
io.jmix.core.common.event.Subscription |
addClickListener(java.util.function.Consumer<Button.ClickEvent> listener) |
void |
addStyleName(java.lang.String styleName)
Adds one or more style names to this component.
|
protected void |
afterActionPerformed() |
protected void |
beforeActionPerformed() |
protected void |
buttonClicked(com.vaadin.shared.MouseEventDetails mouseEventDetails) |
void |
click()
Simulates a button click, notifying all server-side listeners.
|
protected JmixButton |
createComponent() |
void |
focus()
Sets focus to this component
|
Action |
getAction() |
protected Component |
getActionEventTarget() |
KeyCombination |
getShortcutCombination() |
int |
getTabIndex()
Gets the tabulator index of the
HasTabIndex component. |
protected void |
initComponent(JmixButton component) |
boolean |
isCaptionAsHtml() |
boolean |
isDisableOnClick() |
void |
removeStyleName(java.lang.String styleName)
Removes one or more style names from component.
|
void |
setAction(Action action,
boolean overrideOwnerProperties)
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 |
setIcon(java.lang.String icon)
Set an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.
|
void |
setShortcut(java.lang.String shortcut)
Sets shortcut from string representation.
|
void |
setShortcutCombination(KeyCombination shortcut)
Sets shortcut combination.
|
void |
setTabIndex(int tabIndex)
Sets the tabulator index of the
Focusable component. |
void |
setVisible(boolean visible)
Sets visibility value for the component.
|
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFrame, setFrame
setAction
getIcon, setIconFromSet
isFocusable, setFocusable
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
getCaption, setCaption
getDescription, setDescription
isDescriptionAsHtml, setDescriptionAsHtml
isHtmlSanitizerEnabled, setHtmlSanitizerEnabled
protected Action action
protected java.util.function.Consumer<java.beans.PropertyChangeEvent> actionPropertyChangeListener
protected KeyCombination shortcut
protected java.lang.Boolean enabled
protected java.lang.Boolean visible
protected java.lang.Boolean primary
protected JmixButton createComponent()
protected void initComponent(JmixButton component)
protected void beforeActionPerformed()
protected void buttonClicked(com.vaadin.shared.MouseEventDetails mouseEventDetails)
protected Component getActionEventTarget()
protected void afterActionPerformed()
@Nullable public Action getAction()
getAction
in interface ActionOwner
null
public void setIcon(@Nullable java.lang.String icon)
Component.HasIcon
setIcon
in interface Component.HasIcon
setIcon
in class AbstractComponent<JmixButton>
public void setAction(@Nullable Action action, boolean overrideOwnerProperties)
ActionOwner
overrideOwnerProperties
is true
then the action properties will
override owner properties, otherwise the owner properties will be overridden if they are null
.
List of properties that the action and the owner have and which can be overridden:
caption
description
shortcut
enabled
visible
primary
icon
setAction
in interface ActionOwner
action
- an actionoverrideOwnerProperties
- whether action properties override owner propertiespublic 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 indexpublic void setDisableOnClick(boolean value)
Button
setDisableOnClick
in interface Button
value
- disable on click option.public boolean isDisableOnClick()
isDisableOnClick
in interface Button
public void setCaptionAsHtml(boolean captionAsHtml)
HasHtmlCaption
setCaptionAsHtml
in interface HasHtmlCaption
setCaptionAsHtml
in class AbstractComponent<JmixButton>
captionAsHtml
- true
if the caption is rendered as HTML,
false
if rendered as plain textComponent.HasCaption.setCaption(String)
public boolean isCaptionAsHtml()
isCaptionAsHtml
in interface HasHtmlCaption
isCaptionAsHtml
in class AbstractComponent<JmixButton>
true
if the caption is rendered as HTML,
false
if rendered as plain text@Nullable public KeyCombination getShortcutCombination()
getShortcutCombination
in interface Button
public void setShortcutCombination(@Nullable KeyCombination shortcut)
Button
setShortcutCombination
in interface Button
shortcut
- key combinationpublic void setShortcut(@Nullable java.lang.String shortcut)
Button
setShortcut
in interface Button
shortcut
- string of type "Modifiers-Key", e.g. "Alt-N". Case-insensitive.public void click()
Button
No action is taken if the button is disabled.
public io.jmix.core.common.event.Subscription addClickListener(java.util.function.Consumer<Button.ClickEvent> listener)
addClickListener
in interface Button
public void setEnabled(boolean enabled)
Component
setEnabled
in interface Component
setEnabled
in class AbstractComponent<JmixButton>
enabled
- enabled flagpublic void setVisible(boolean visible)
Component
setVisible
in interface Component
setVisible
in class AbstractComponent<JmixButton>
visible
- visible flagpublic void addStyleName(java.lang.String styleName)
Component
addStyleName
in interface Component
addStyleName
in class AbstractComponent<JmixButton>
styleName
- one or more style names separated by space.public void removeStyleName(java.lang.String styleName)
Component
removeStyleName
in interface Component
removeStyleName
in class AbstractComponent<JmixButton>
styleName
- one or more style names separated by space.