Class UIButtonSpec
- Direct Known Subclasses:
UIButtonSpecJSAction,UIButtonSpecJSActionToggle,UIButtonSpecNavigation
- Since:
- 5.2.0
-
Method Summary
Modifier and TypeMethodDescriptionfinal UIButtonIconReturns the icon of the button,nullif it was not set.final UIButtonLayoutReturns the layout of the button,UIButtonLayout.TEXT_ONLYby default.final UserMessageReturns the confirmation message of the button,nullif it was not set.final StringReturns the URL of the icon of the button,nullif it was not set.final StringgetId()Returns the id of the button,nullif it was not set.final UserMessagegetLabel()Returns the label of the button.final UIButtonReliefReturns the relief of this button.final UserMessageReturns the tooltip of the button,nullif it is not set.final booleanReturnstrueif a confirmation message is set,falseotherwise.final booleanReturnstrueif the button is set as the default button,falseotherwise.final booleanReturnstrueif the button is set as disabled,falseotherwise.final booleanReturnstrueif the button is set as excluded from the tab focus,falseotherwise.final voidsetButtonIcon(UIButtonIcon buttonIcon) Sets a predefined icon for the button.final voidsetButtonLayout(UIButtonLayout buttonLayout) Sets the button layout.final voidsetConfirmationMessage(UserMessage confirmationMessage) Sets a message to confirm the button action.final voidsetCssClass(String cssClass) Sets additional CSS classes for the button.final voidsetDefaultButton(boolean isDefaultButton) Enables the default mode for a button.final voidsetDisabled(boolean disabled) Sets the button to disable.final voidsetExcludedFromTabFocus(boolean excludeFromTabFocus) Disables user access to the button using the keyboard.final voidsetIconURL(String iconURL) Sets a custom icon for the button.final voidSets an id for the button.final voidsetLabel(UserMessage aLabel) Sets a label for the button.final voidsetRelief(UIButtonRelief aRelief) Defines a specific relief for the current button.final voidsetTooltip(UserMessage tooltip) Sets a tooltip for the button.
-
Method Details
-
getButtonIcon
Returns the icon of the button,nullif it was not set. -
getButtonLayout
Returns the layout of the button,UIButtonLayout.TEXT_ONLYby default. -
getConfirmationMessage
Returns the confirmation message of the button,nullif it was not set. -
getIconURL
Returns the URL of the icon of the button,nullif it was not set.- See Also:
-
getId
Returns the id of the button,nullif it was not set. -
getLabel
Returns the label of the button.- See Also:
-
getRelief
Returns the relief of this button.- See Also:
-
getTooltip
Returns the tooltip of the button,nullif it is not set. -
hasConfirmationMessage
public final boolean hasConfirmationMessage()Returnstrueif a confirmation message is set,falseotherwise. -
isDefaultButton
public final boolean isDefaultButton()Returnstrueif the button is set as the default button,falseotherwise. -
isDisabled
public final boolean isDisabled()Returnstrueif the button is set as disabled,falseotherwise. -
isExcludedFromTabFocus
public final boolean isExcludedFromTabFocus()Returnstrueif the button is set as excluded from the tab focus,falseotherwise. -
setButtonIcon
Sets a predefined icon for the button.To get an effective display of the icon, it is necessary to also set the button layout accordingly, for example:
aButtonSpec.setButtonLayout(UIButtonLayout.TEXT_AND_ICON_LEFT)
or
aButtonSpec.setButtonLayout(UIButtonLayout.ICON_ONLY)
Setting a button icon will override the icon URL.
Default value is
null.- Parameters:
buttonIcon- the icon to set.
-
setButtonLayout
Sets the button layout.Default is
UIButtonLayout.TEXT_ONLY.- Parameters:
buttonLayout- theUIButtonLayoutto set for the button.
-
setIconURL
Sets a custom icon for the button.To get an effective display of the icon, it is necessary to also set the button layout accordingly, for example:
aButtonSpec.setButtonLayout(UIButtonLayout.TEXT_AND_ICON_LEFT)
or
aButtonSpec.setButtonLayout(UIButtonLayout.ICON_ONLY)
The display area of the icon is 16x16 pixels. Within a form input field area, the size is 14x14 pixels.
Setting an icon URL will override the button icon.
Default value is
null.- Parameters:
iconURL- the URL of the icon to set.
-
setConfirmationMessage
Sets a message to confirm the button action. An "OK"/"Cancel" dialog will pop up when the button is clicked.If the user clicks "Cancel" in the dialog, the action will not be called.
- Parameters:
confirmationMessage- the confirmation message to set for the button.
-
setCssClass
Sets additional CSS classes for the button. Multiple classes are whitespace-separated.The class attribute must respect the W3C Recommendation. See https://www.w3.org/TR/REC-html40/struct/global.html#adef-class for more information.
- Parameters:
cssClass- the additional CSS classes to set for the button.
-
setDefaultButton
public final void setDefaultButton(boolean isDefaultButton) Enables the default mode for a button.The default mode button can be slightly highlighted.
If the button is a submit button, it must be activated when the "ENTER" key is used in the form. If multiple submit buttons are defined as being the default ones in a form, only the last one must be activated.
Default value is
false.- Parameters:
isDefaultButton-trueto enable the default mode for the button,falseto disable it.
-
setDisabled
public final void setDisabled(boolean disabled) Sets the button to disable. A disabled button is less visible and cannot be clicked nor focused on.Default value is
false.The activation of a button can also be managed by JavaScript using the function
UIJavaScriptWriter.addJS_setButtonDisabled(String, String).- Parameters:
disabled-trueto disable the button,falseto reactivate it.
-
setExcludedFromTabFocus
public final void setExcludedFromTabFocus(boolean excludeFromTabFocus) Disables user access to the button using the keyboard.Default value is
false.- Parameters:
excludeFromTabFocus-trueto disable keyboard access,falsefor default behavior.
-
setId
Sets an id for the button.The id attribute must respect the W3C Recommendation (in particular, by being unique in the page). See https://www.w3.org/TR/REC-html40/struct/global.html#adef-id for more information.
If no id is specified, an id will be randomly generated.
- Parameters:
id- the id to set for the button.
-
setLabel
Sets a label for the button.- Parameters:
aLabel- the label to set for the button.- Since:
- 5.4.2
-
setRelief
Defines a specific relief for the current button.If this method is not invoked, the default relief, complying with the guidelines, should be applied. If this button is a default button (also called a primary button), defining a specific relief will be ignored.
- Parameters:
aRelief- a specific relief to be applied to this button, ornullto reset the default relief.- Since:
- 5.3.0
-
setTooltip
Sets a tooltip for the button.If the button layout is set to
UIButtonLayout.ICON_ONLY, the label will be used for the tooltip, and thus this tooltip will not be used.- Parameters:
tooltip- the tooltip to set the button.
-