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 UIButtonIcongetButtonIcon()Returns the icon of the button,nullif it was not set.UIButtonLayoutgetButtonLayout()Returns the layout of the button,UIButtonLayout.TEXT_ONLYby default.UserMessagegetConfirmationMessage()Returns the confirmation message of the button,nullif it was not set.StringgetIconURL()Returns the URL of the icon of the button,nullif it was not set.StringgetId()Returns the id of the button,nullif it was not set.UserMessagegetLabel()Returns the label of the button.UIButtonReliefgetRelief()Returns the relief of this button.UserMessagegetTooltip()Returns the tooltip of the button,nullif it is not set.booleanhasConfirmationMessage()Returnstrueif a confirmation message is set,falseotherwise.booleanisDefaultButton()Returnstrueif the button is set as the default button,falseotherwise.booleanisDisabled()Returnstrueif the button is set as disabled,falseotherwise.booleanisExcludedFromTabFocus()Returnstrueif the button is set as excluded from the tab focus,falseotherwise.voidsetButtonIcon(UIButtonIcon buttonIcon)Sets a predefined icon for the button.voidsetButtonLayout(UIButtonLayout buttonLayout)Sets the button layout.voidsetConfirmationMessage(UserMessage confirmationMessage)Sets a message to confirm the button action.voidsetCssClass(String cssClass)Sets additional CSS classes for the button.voidsetDefaultButton(boolean isDefaultButton)Enables the default mode for a button.voidsetDisabled(boolean disabled)Sets the button to disable.voidsetExcludedFromTabFocus(boolean excludeFromTabFocus)Disables user access to the button using the keyboard.voidsetIconURL(String iconURL)Sets a custom icon for the button.voidsetId(String id)Sets an id for the button.voidsetLabel(UserMessage aLabel)Sets a label for the button.voidsetRelief(UIButtonRelief aRelief)Defines a specific relief for the current button.voidsetTooltip(UserMessage tooltip)Sets a tooltip for the button.
-
-
-
Method Detail
-
getButtonIcon
public final UIButtonIcon getButtonIcon()
Returns the icon of the button,nullif it was not set.
-
getButtonLayout
public final UIButtonLayout getButtonLayout()
Returns the layout of the button,UIButtonLayout.TEXT_ONLYby default.
-
getConfirmationMessage
public final UserMessage getConfirmationMessage()
Returns the confirmation message of the button,nullif it was not set.
-
getIconURL
public final String getIconURL()
Returns the URL of the icon of the button,nullif it was not set.- See Also:
setIconURL(String)
-
getId
public final String getId()
Returns the id of the button,nullif 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,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
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- theUIButtonLayoutto 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-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
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, ornullto 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.
-
-