Class UIButtonSpec
- java.lang.Object
-
- com.orchestranetworks.ui.UIButtonSpec
-
- Direct Known Subclasses:
UIButtonSpecJSAction
,UIButtonSpecJSActionToggle
,UIButtonSpecNavigation
public abstract class UIButtonSpec extends Object
This abstract class provides the common features for different types of buttons.- Since:
- 5.2.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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()
Returnstrue
if a confirmation message is set,false
otherwise.boolean
isDefaultButton()
Returnstrue
if the button is set as the default button,false
otherwise.boolean
isDisabled()
Returnstrue
if the button is set as disabled,false
otherwise.boolean
isExcludedFromTabFocus()
Returnstrue
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.
-
-
-
Method Detail
-
getButtonIcon
public final UIButtonIcon getButtonIcon()
Returns the icon of the button,null
if it was not set.
-
getButtonLayout
public final UIButtonLayout getButtonLayout()
Returns the layout of the button,UIButtonLayout.TEXT_ONLY
by default.
-
getConfirmationMessage
public final UserMessage getConfirmationMessage()
Returns the confirmation message of the button,null
if it was not set.
-
getIconURL
public final String getIconURL()
Returns the URL of the icon of the button,null
if it was not set.- See Also:
setIconURL(String)
-
getId
public final String getId()
Returns the id of the button,null
if it was not set.
-
getLabel
public final UserMessage getLabel()
Returns the label of the button.- See Also:
setLabel(UserMessage)
-
getRelief
public final UIButtonRelief getRelief()
Returns the relief of this button.- See Also:
setRelief(UIButtonRelief)
-
getTooltip
public final UserMessage 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
public final void setButtonIcon(UIButtonIcon buttonIcon)
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
public final void setButtonLayout(UIButtonLayout buttonLayout)
Sets the button layout.Default is
UIButtonLayout.TEXT_ONLY
.- Parameters:
buttonLayout
- theUIButtonLayout
to set for the button.
-
setIconURL
public final void setIconURL(String iconURL)
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
public final void setConfirmationMessage(UserMessage confirmationMessage)
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
public final void setCssClass(String cssClass)
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
public final void setId(String id)
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
public final void setLabel(UserMessage aLabel)
Sets a label for the button.- Parameters:
aLabel
- the label to set for the button.- Since:
- 5.4.2
-
setRelief
public final void setRelief(UIButtonRelief aRelief)
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
public final void setTooltip(UserMessage tooltip)
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.
-
-