Class UIButtonSpec
- Direct Known Subclasses:
UIButtonSpecJSAction
,UIButtonSpecJSActionToggle
,UIButtonSpecNavigation
- Since:
- 5.2.0
-
Method Summary
Modifier and TypeMethodDescriptionfinal UIButtonIcon
Returns the icon of the button,null
if it was not set.final UIButtonLayout
Returns the layout of the button,UIButtonLayout.TEXT_ONLY
by default.final UserMessage
Returns the confirmation message of the button,null
if it was not set.final String
Returns the URL of the icon of the button,null
if it was not set.final String
getId()
Returns the id of the button,null
if it was not set.final UserMessage
getLabel()
Returns the label of the button.final UIButtonRelief
Returns the relief of this button.final UserMessage
Returns the tooltip of the button,null
if it is not set.final boolean
Returnstrue
if a confirmation message is set,false
otherwise.final boolean
Returnstrue
if the button is set as the default button,false
otherwise.final boolean
Returnstrue
if the button is set as disabled,false
otherwise.final boolean
Returnstrue
if the button is set as excluded from the tab focus,false
otherwise.final void
setButtonIcon
(UIButtonIcon buttonIcon) Sets a predefined icon for the button.final void
setButtonLayout
(UIButtonLayout buttonLayout) Sets the button layout.final void
setConfirmationMessage
(UserMessage confirmationMessage) Sets a message to confirm the button action.final void
setCssClass
(String cssClass) Sets additional CSS classes for the button.final void
setDefaultButton
(boolean isDefaultButton) Enables the default mode for a button.final void
setDisabled
(boolean disabled) Sets the button to disable.final void
setExcludedFromTabFocus
(boolean excludeFromTabFocus) Disables user access to the button using the keyboard.final void
setIconURL
(String iconURL) Sets a custom icon for the button.final void
Sets an id for the button.final void
setLabel
(UserMessage aLabel) Sets a label for the button.final void
setRelief
(UIButtonRelief aRelief) Defines a specific relief for the current button.final void
setTooltip
(UserMessage tooltip) Sets a tooltip for the button.
-
Method Details
-
getButtonIcon
Returns the icon of the button,null
if it was not set. -
getButtonLayout
Returns the layout of the button,UIButtonLayout.TEXT_ONLY
by default. -
getConfirmationMessage
Returns the confirmation message of the button,null
if it was not set. -
getIconURL
Returns the URL of the icon of the button,null
if it was not set.- See Also:
-
getId
Returns the id of the button,null
if 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,null
if it is not set. -
hasConfirmationMessage
public final boolean hasConfirmationMessage()Returnstrue
if a confirmation message is set,false
otherwise. -
isDefaultButton
public final boolean isDefaultButton()Returnstrue
if the button is set as the default button,false
otherwise. -
isDisabled
public final boolean isDisabled()Returnstrue
if the button is set as disabled,false
otherwise. -
isExcludedFromTabFocus
public final boolean isExcludedFromTabFocus()Returnstrue
if the button is set as excluded from the tab focus,false
otherwise. -
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
- theUIButtonLayout
to 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
-true
to enable the default mode for the button,false
to 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
-true
to disable the button,false
to reactivate it.
-
setExcludedFromTabFocus
public final void setExcludedFromTabFocus(boolean excludeFromTabFocus) Disables user access to the button using the keyboard.Default value is
false
.- Parameters:
excludeFromTabFocus
-true
to disable keyboard access,false
for 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, ornull
to 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.
-