Interface IOrgitem

All Superinterfaces:
IComponent<IOrgitem>, IComposite<IOrgitem,IOrgitemComposite>, IDisable<IOrgitem>, IHtmlBasedComponent<IOrgitem>, IXulElement<IOrgitem>

Immutable Orgitem component

Orgitem contains a node (Orgnode), and an optional Orgchildren. If the component doesn't contain an Orgchildren, it is a leaf node that doesn't accept any child items. If it contains an Orgchildren, it is a branch node that might contain other items.

For a branch node, an +/- button will appear at the bottom right of the node, such that user could open and close the item by clicking on the +/- button.

Support @Action

Name Action Type
onOpen ActionData: OpenData
Denotes user has opened or closed a component. It is useful to implement load-on-demand by listening to the onOpen action, and creating components when the first time the component is opened.
Author:
katherine
See Also:
  • Orgitem
  • Field Details

    • DEFAULT

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

    • getWidgetClass

      default String getWidgetClass()
      Returns the client widget class.

      Default: "zkmax.layout.Orgitem"

      Specified by:
      getWidgetClass in interface IComponent<IOrgitem>
      Returns:
    • getLabel

      @Nullable default String getLabel()
      Returns the label of the IOrgnode it contains, or null if no such node.
      Returns:
      the label of the IOrgnode it contains
    • withLabel

      IOrgitem withLabel(@Nullable String label)
      Returns a copy of this immutable component with the specified label.

      Sets the label of the IOrgnode it contains.

      If Orgnode is not created, we automatically create it.

      Notice that this method will create an Orgnode automatically if it doesn't exist. Thus, you cannot attach a node to it again if set an image or a label.

      Parameters:
      label - The label of the IOrgnode it contains.

      Default: null.

      Returns:
      A modified copy of the this object
    • getImage

      @Nullable default String getImage()
      Returns the image of the first IOrgnode it contains.

      Default: null

    • withImage

      IOrgitem withImage(@Nullable String image)
      Returns a copy of this immutable component with the specified image.

      Sets the image of the IOrgnode it contains.

      If Orgnode is not created, we automatically create it.

      Notice that this method will create an Orgnode automatically if it doesn't exist. Thus, you cannot attach a node to it again if set an image or a label.

      Parameters:
      image - The image of the IOrgnode it contains.

      Default: null.

      Returns:
      A modified copy of the this object
    • isSelectable

      default boolean isSelectable()
      Returns whether it is selectable. Default: true.
    • withSelectable

      IOrgitem withSelectable(boolean selectable)
      Returns a copy of this immutable component with the specified selectable.

      Sets whether it is selectable.

      When selectable equals true, user can select this item by clicking it.

      Parameters:
      selectable - Whether it is selectable.

      Default: true.

      Returns:
      A modified copy of the this object
    • isDisabled

      default boolean isDisabled()
      Returns whether it is disabled, Default: false.
      Specified by:
      isDisabled in interface IDisable<IOrgitem>
    • withDisabled

      IOrgitem withDisabled(boolean disabled)
      Returns a copy of this immutable component with the specified disabled.

      Sets whether it is disabled.

      When disabled equals true, user can't select this item.

      Specified by:
      withDisabled in interface IDisable<IOrgitem>
      Parameters:
      disabled - Whether it is disabled.

      Default: false.

      Returns:
      A modified copy of the this object
    • isRendered

      default boolean isRendered()
      Returns true whether this Orgitem is rendered at client. Unlike isLoaded() which is used to check whether all children of this Orgitem are loaded.

      Default: true

    • isLoaded

      default boolean isLoaded()
      Return true whether all children of this tree item, if any, is loaded at client

      Default: false

    • isOpen

      default boolean isOpen()
      Returns whether this container is open.

      Default: true.

    • withOpen

      IOrgitem withOpen(boolean open)
      Returns a copy of this immutable component with the specified open.

      Sets whether this container is open.

      Parameters:
      open - false to hide all sublevel items.

      Default: true.

      Returns:
      A modified copy of the this object
    • isSelected

      default boolean isSelected()
      Returns whether this item is selected.

      Default: false

    • withSelected

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

      Sets whether the component is selected.

      Parameters:
      selected - true to select this component.

      Default: false.

      Returns:
      A modified copy of the this object
    • getOrgchildren

      @Nullable IOrgchildren getOrgchildren()
      Returns the Orgchildren that this Orgitem owns, or null if doesn't have any child.
    • withOrgchildren

      IOrgitem withOrgchildren(@Nullable IOrgchildren children)
      Returns a copy of this immutable component with the specified treechildren.

      Sets the Orgchildren as a child to this component

      Parameters:
      children - The Orgchildren child.

      Default: null.

      Returns:
      A modified copy of the this object
    • getOrgnode

      @Nullable IOrgnode<IAnyGroup> getOrgnode()
      Returns the Orgnode that this Orgitem owns, or null if doesn't have any child.
    • withOrgnode

      IOrgitem withOrgnode(@Nullable IOrgnode<IAnyGroup> orgnode)
      Returns a copy of this immutable component with the specified orgnode.

      Sets the Orgnode as a child to this component

      Parameters:
      orgnode - The Orgnode child.

      Default: null.

      Returns:
      A modified copy of the this object
    • isContainer

      @Lazy default boolean isContainer()
      Returns whether the component is to act as a container which can have sublevel items.
    • isEmpty

      @Lazy default boolean isEmpty()
      Returns whether to contain any sublevel items or not.
    • withAllComponents

      default IOrgitem withAllComponents(Iterable<? extends IOrgitemComposite> elements)
      Description copied from interface: IComposite
      Copy the current immutable object with elements that replace the content of children. A shallow reference equality check is used to prevent copying of the same value by returning this.
      Specified by:
      withAllComponents in interface IComposite<IOrgitem,IOrgitemComposite>
      Parameters:
      elements - An iterable of children elements to set
      Returns:
      A modified copy of this object
    • of

      static IOrgitem of(String label)
      Returns the instance with the given label.
      Parameters:
      label - The label that the node holds.
    • ofImage

      static IOrgitem ofImage(String image)
      Returns the instance with the given image.
      Parameters:
      image - The image that the node holds.
    • ofId

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