Interface INavitem

All Superinterfaces:
IChildrenOfInputgroup<INavitem>, IChildrenOfNavbar<INavitem>, IComponent<INavitem>, IDisable<INavitem>, IHtmlBasedComponent<INavitem>, ILabelElement<INavitem>, ILabelImageElement<INavitem>, IXulElement<INavitem>

Immutable Navitem component

A single choice in a INavbar or INav component. It acts much like a button but it is rendered on a navbar or nav.

Author:
katherine
See Also:
  • Navitem
  • Field Details

    • DEFAULT

      static final INavitem DEFAULT
      Constant for default attributes of this immutable component.
  • Method Details

    • getWidgetClass

      default String getWidgetClass()
      Returns the client widget class.

      Default: "zkmax.nav.Navitem"

      Specified by:
      getWidgetClass in interface IComponent<INavitem>
    • getContent

      @Nullable String getContent()
      Returns the embedded content (i.e., HTML tags) that is shown as part of the description.

      It is useful to show the description in more versatile way.

      Default: null

    • withContent

      INavitem withContent(@Nullable String content)
      Returns a copy of this immutable component with the specified content.

      Sets the embedded content (i.e., HTML tags) that is shown as part of the description.

      Note: the content is sanitized by default to avoid XSS attack, and please don't use JavaScript in the content.

      Parameters:
      content - The embedded content.

      Default: null.

      Returns:
      A modified copy of the this object
    • getHref

      @Nullable String getHref()
      Returns the href.

      Default: null. If null, the button has no function unless you specify the onClick handler.

    • withHref

      INavitem withHref(@Nullable String href)
      Returns a copy of this immutable component with the specified href.

      Sets the href.

      Parameters:
      href - The href.

      Default: null.

      Returns:
      A modified copy of the this object
    • getTarget

      @Nullable String getTarget()
      Returns the target frame or window.

      Note: it is useful only if href (withHref(java.lang.String)) is specified (i.e., use the onClick listener).

      Default: null.

    • withTarget

      INavitem withTarget(@Nullable String target)
      Returns a copy of this immutable component with the specified target.

      Sets the target frame or window.

      Note: it is useful only if href (withHref(java.lang.String)) is specified (i.e., use the onClick listener).

      Parameters:
      target - The target frame or window.

      Default: null.

      Returns:
      A modified copy of the this object
    • isSelected

      default boolean isSelected()
      Returns whether it is selected.

      Default: false. Notice: while Navbar have two selected Navitem, only last navitem would be selected.

    • withSelected

      INavitem withSelected(boolean selected)
      Returns a copy of this immutable component with the specified selected.

      Sets whether it is selected.

      Parameters:
      selected - Whether it is selected.

      Default: false.

      Returns:
      A modified copy of the this object
    • getBadgeText

      default String getBadgeText()
      Returns the badge text of the nav

      Default: ""

    • withBadgeText

      INavitem withBadgeText(@Nullable String badgeText)
      Returns a copy of this immutable component with the specified badgeText.

      Sets the badge text of the navitem

      Parameters:
      badgeText - The badge text of the navitem

      Default: "".

      Returns:
      A modified copy of the this object
    • of

      static INavitem of(String label)
      Returns the instance with the given label.
      Parameters:
      label - The label that the component holds.
    • ofIconSclass

      static INavitem ofIconSclass(String iconSclass)
      Returns the instance with the given iconSclass.
      Parameters:
      iconSclass - The iconSclass that the navitem holds.
    • ofId

      static INavitem ofId(String id)
      Returns the instance with the given id.
      Parameters:
      id - The id to identify this component