public abstract class UIButtonSpec extends Object
Modifier and Type | Method and Description |
---|---|
UIButtonIcon |
getButtonIcon()
Returns the icon of the button,
null if it was not set. |
UIButtonLayout |
getButtonLayout()
Returns the layout of the button,
UIButtonLayout.TEXT_ONLY by default. |
UserMessage |
getConfirmationMessage()
Returns the confirmation message of the button,
null if it was not set. |
String |
getIconURL()
Returns the URL of the icon of the button,
null if it was not set. |
String |
getId()
Returns the id of the button,
null if it was not set. |
UserMessage |
getLabel()
Returns the label of the button.
|
UIButtonRelief |
getRelief()
Returns the relief of this button.
|
UserMessage |
getTooltip()
Returns the tooltip of the button,
null if it is not set. |
boolean |
hasConfirmationMessage()
Returns
true if a confirmation message is set,
false otherwise. |
boolean |
isDefaultButton()
Returns
true if the button is set as the default button,
false otherwise. |
boolean |
isDisabled()
Returns
true if the button is set as disabled,
false otherwise. |
boolean |
isExcludedFromTabFocus()
Returns
true if the button is set as excluded from the tab focus,
false otherwise. |
void |
setButtonIcon(UIButtonIcon buttonIcon)
Sets a predefined icon for the button.
|
void |
setButtonLayout(UIButtonLayout buttonLayout)
Sets the button layout.
|
void |
setConfirmationMessage(UserMessage confirmationMessage)
Sets a message to confirm the button action.
|
void |
setCssClass(String cssClass)
Sets additional CSS classes for the button.
|
void |
setDefaultButton(boolean isDefaultButton)
Enables the default mode for a button.
|
void |
setDisabled(boolean disabled)
Sets the button to disable.
|
void |
setExcludedFromTabFocus(boolean excludeFromTabFocus)
Disables user access to the button using the keyboard.
|
void |
setIconURL(String iconURL)
Sets a custom icon for the button.
|
void |
setId(String id)
Sets an id for the button.
|
void |
setLabel(UserMessage aLabel)
Sets a label for the button.
|
void |
setRelief(UIButtonRelief aRelief)
Defines a specific relief for the current button.
|
void |
setTooltip(UserMessage tooltip)
Sets a tooltip for the button.
|
public final UIButtonIcon getButtonIcon()
null
if it was not set.public final UIButtonLayout getButtonLayout()
UIButtonLayout.TEXT_ONLY
by default.public final UserMessage getConfirmationMessage()
null
if it was not set.public final String getIconURL()
null
if it was not set.setIconURL(String)
public final String getId()
null
if it was not set.public final UserMessage getLabel()
setLabel(UserMessage)
public final UIButtonRelief getRelief()
setRelief(UIButtonRelief)
public final UserMessage getTooltip()
null
if it is not set.public final boolean hasConfirmationMessage()
true
if a confirmation message is set,
false
otherwise.public final boolean isDefaultButton()
true
if the button is set as the default button,
false
otherwise.public final boolean isDisabled()
true
if the button is set as disabled,
false
otherwise.public final boolean isExcludedFromTabFocus()
true
if the button is set as excluded from the tab focus,
false
otherwise.public final void setButtonIcon(UIButtonIcon buttonIcon)
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
.
buttonIcon
- the icon to set.public final void setButtonLayout(UIButtonLayout buttonLayout)
Default is UIButtonLayout.TEXT_ONLY
.
buttonLayout
- the UIButtonLayout
to set for the button.public final void setIconURL(String iconURL)
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
.
iconURL
- the URL of the icon to set.public final void setConfirmationMessage(UserMessage confirmationMessage)
If the user clicks "Cancel" in the dialog, the action will not be called.
confirmationMessage
- the confirmation message to set for the button.public final void setCssClass(String cssClass)
The class attribute must respect the W3C Recommendation. See https://www.w3.org/TR/REC-html40/struct/global.html#adef-class for more information.
cssClass
- the additional CSS classes to set for the button.public final void setDefaultButton(boolean isDefaultButton)
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
.
isDefaultButton
- true
to enable the default mode for the button,
false
to disable it.public final void setDisabled(boolean disabled)
Default value is false
.
The activation of a button can also be managed by JavaScript
using the function UIJavaScriptWriter.addJS_setButtonDisabled(String, String)
.
disabled
- true
to disable the button,
false
to reactivate it.public final void setExcludedFromTabFocus(boolean excludeFromTabFocus)
Default value is false
.
excludeFromTabFocus
- true
to disable keyboard access,
false
for default behavior.public final void setId(String id)
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.
id
- the id to set for the button.public final void setLabel(UserMessage aLabel)
aLabel
- the label to set for the button.public final void setRelief(UIButtonRelief aRelief)
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.
aRelief
- a specific relief to be applied to this button, or null
to
reset the default relief.public final void setTooltip(UserMessage tooltip)
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.
tooltip
- the tooltip to set the button.