Class Checkbox

    • Method Detail

      • getLabel

        public String getLabel()
        Get the current label text.
        Specified by:
        getLabel in interface HasLabel
        Returns:
        the current label text
      • setLabel

        public void setLabel​(String label)
        Set the current label text of this checkbox.
        Specified by:
        setLabel in interface HasLabel
        Parameters:
        label - the label text to set
      • setLabelAsHtml

        @Deprecated
        public void setLabelAsHtml​(String htmlContent)
        Deprecated.
        Since 23.2, this API is deprecated in favor of setLabelComponent(Component)
        Set the current label text of this checkbox with HTML formatting.

        XSS vulnerability warning: the given HTML is rendered in the browser as is and the developer is responsible for ensuring no harmful HTML is used.

        Parameters:
        htmlContent - the label html to set
      • setLabelComponent

        public void setLabelComponent​(Component component)
        Replaces the label content with the given label component.
        Parameters:
        component - the component to be added to the label.
        Since:
        23.1
      • setAriaLabel

        public void setAriaLabel​(String ariaLabel)
        Set the accessibility label of this checkbox.
        Parameters:
        ariaLabel - the accessibility label to set
        See Also:
        aria-label at MDN
      • setAutofocus

        public void setAutofocus​(boolean autofocus)
        Set the checkbox to be input focused when the page loads.
        Overrides:
        setAutofocus in class GeneratedVaadinCheckbox<Checkbox,​Boolean>
        Parameters:
        autofocus - the boolean value to set
      • isAutofocus

        public boolean isAutofocus()
        Get the state for the auto-focus property of the checkbox.

        This property is not synchronized automatically from the client side, so the returned value may not be the same as in client side.

        Returns:
        the autofocus property from the checkbox
      • setIndeterminate

        public void setIndeterminate​(boolean indeterminate)
        Set the indeterminate state of the checkbox.

        NOTE: As according to the HTML5 standard, this has only effect on the visual appearance, not on the checked value!

        Overrides:
        setIndeterminate in class GeneratedVaadinCheckbox<Checkbox,​Boolean>
        Parameters:
        indeterminate - the boolean value to set
        See Also:
        isIndeterminate()
      • isIndeterminate

        public boolean isIndeterminate()
        Get the indeterminate state of the checkbox. The default value is false.

        An indeterminate checkbox is neither checked nor unchecked. A typical use case is a “Select All” checkbox indicating that some, but not all, items are selected. When the user clicks an indeterminate checkbox, it is no longer indeterminate, and the checked value also changes.

        NOTE: As according to the HTML5 standard, this has only effect on the visual appearance, not on the checked value!

        Returns:
        the indeterminate property from the checkbox