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.ClickEventNested 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.ContextHelpIconClickEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Actionprotected Consumer<PropertyChangeEvent>protected Booleanprotected Booleanprotected KeyCombinationprotected BooleanFields inherited from class io.jmix.ui.component.impl.AbstractComponent
alignment, applicationContext, component, contextHelpIconClickHandler, contextHelpIconClickListener, descriptionAsHtml, element, frame, htmlSanitizerEnabled, icon, ICON_STYLE, id, parentFields inherited from interface io.jmix.ui.component.Component
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddClickListener(Consumer<Button.ClickEvent> listener) voidaddStyleName(String styleName) Adds one or more style names to this component.protected voidprotected voidprotected voidbuttonClicked(com.vaadin.shared.MouseEventDetails mouseEventDetails) voidclick()Simulates a button click, notifying all server-side listeners.protected JmixButtonvoidfocus()Sets focus to this componentprotected ComponentintGets the tabulator index of theHasTabIndexcomponent.protected voidinitComponent(JmixButton component) booleanbooleanvoidremoveStyleName(String styleName) Removes one or more style names from component.voidSets the action to the owner.voidsetCaptionAsHtml(boolean captionAsHtml) Sets whether the caption is rendered as HTML.voidsetDisableOnClick(boolean value) Determines if a button is automatically disabled when clicked.voidsetEnabled(boolean enabled) Sets the component enabled state.voidSet an icon by its source: "font-icon:ADD", "icons/myicon.png", "theme://createIcon", etc.voidsetShortcut(String shortcut) Sets shortcut from string representation.voidsetShortcutCombination(KeyCombination shortcut) Sets shortcut combination.voidsetTabIndex(int tabIndex) Sets the tabulator index of theFocusablecomponent.voidsetVisible(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, 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.ActionOwner
setActionMethods 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, withUnwrappedCompositionMethods inherited from interface io.jmix.ui.component.Component.BelongToFrame
getFrame, setFrameMethods inherited from interface io.jmix.ui.component.Component.Focusable
isFocusable, setFocusableMethods inherited from interface io.jmix.ui.component.Component.HasCaption
getCaption, setCaptionMethods inherited from interface io.jmix.ui.component.Component.HasDescription
getDescription, setDescriptionMethods inherited from interface io.jmix.ui.component.Component.HasIcon
getIcon, setIconFromSetMethods inherited from interface io.jmix.ui.component.HasHtmlDescription
isDescriptionAsHtml, setDescriptionAsHtmlMethods 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:
getActionin interfaceActionOwner- Returns:
- an action or
null
-
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- Overrides:
setIconin classAbstractComponent<JmixButton>
-
setAction
Description copied from interface:ActionOwnerSets the action to the owner. IfoverrideOwnerPropertiesistruethen 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:
captiondescriptionshortcutenabledvisibleprimaryicon
- Specified by:
setActionin interfaceActionOwner- Parameters:
action- an actionoverrideOwnerProperties- whether action properties override owner properties
-
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
-
setDisableOnClick
public void setDisableOnClick(boolean value) Description copied from interface:ButtonDetermines 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:
setDisableOnClickin interfaceButton- Parameters:
value- disable on click option.
-
isDisableOnClick
public boolean isDisableOnClick()- Specified by:
isDisableOnClickin interfaceButton- Returns:
- true if the button is disabled when clicked.
-
setCaptionAsHtml
public void setCaptionAsHtml(boolean captionAsHtml) Description copied from interface:HasHtmlCaptionSets whether the caption is rendered as HTML.- Specified by:
setCaptionAsHtmlin interfaceHasHtmlCaption- Overrides:
setCaptionAsHtmlin classAbstractComponent<JmixButton>- Parameters:
captionAsHtml-trueif the caption is rendered as HTML,falseif rendered as plain text- See Also:
-
isCaptionAsHtml
public boolean isCaptionAsHtml()- Specified by:
isCaptionAsHtmlin interfaceHasHtmlCaption- Overrides:
isCaptionAsHtmlin classAbstractComponent<JmixButton>- Returns:
trueif the caption is rendered as HTML,falseif rendered as plain text
-
getShortcutCombination
- Specified by:
getShortcutCombinationin interfaceButton- Returns:
- action's shortcut
-
setShortcutCombination
Description copied from interface:ButtonSets shortcut combination.- Specified by:
setShortcutCombinationin interfaceButton- Parameters:
shortcut- key combination
-
setShortcut
Description copied from interface:ButtonSets shortcut from string representation.- Specified by:
setShortcutin interfaceButton- Parameters:
shortcut- string of type "Modifiers-Key", e.g. "Alt-N". Case-insensitive.
-
click
public void click()Description copied from interface:ButtonSimulates a button click, notifying all server-side listeners.No action is taken if the button is disabled.
-
addClickListener
- Specified by:
addClickListenerin interfaceButton
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:ComponentSets 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:
setEnabledin interfaceComponent- Overrides:
setEnabledin classAbstractComponent<JmixButton>- Parameters:
enabled- enabled flag
-
setVisible
public void setVisible(boolean visible) Description copied from interface:ComponentSets 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:
setVisiblein interfaceComponent- Overrides:
setVisiblein classAbstractComponent<JmixButton>- Parameters:
visible- visible flag
-
addStyleName
Description copied from interface:ComponentAdds one or more style names to this component. Multiple styles can be specified as a space-separated list of style names.- Specified by:
addStyleNamein interfaceComponent- Overrides:
addStyleNamein classAbstractComponent<JmixButton>- Parameters:
styleName- one or more style names separated by space.
-
removeStyleName
Description copied from interface:ComponentRemoves one or more style names from component. Multiple styles can be specified as a space-separated list of style names.- Specified by:
removeStyleNamein interfaceComponent- Overrides:
removeStyleNamein classAbstractComponent<JmixButton>- Parameters:
styleName- one or more style names separated by space.
-