Class UIButtonSpec

    • Method Detail

      • getButtonIcon

        public final UIButtonIcon getButtonIcon()
        Returns the icon of the button, null if it was not set.
      • 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.
      • getTooltip

        public final UserMessage getTooltip()
        Returns the tooltip of the button, null if it is not set.
      • hasConfirmationMessage

        public final boolean hasConfirmationMessage()
        Returns true if a confirmation message is set, false otherwise.
      • isDefaultButton

        public final boolean isDefaultButton()
        Returns true if the button is set as the default button, false otherwise.
      • isDisabled

        public final boolean isDisabled()
        Returns true if the button is set as disabled, false otherwise.
      • isExcludedFromTabFocus

        public final boolean isExcludedFromTabFocus()
        Returns true 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.
      • 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, or null 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.