Class AbstractMenuItem

java.lang.Object
ch.tocco.nice2.model.menu.api.AbstractMenuItem
All Implemented Interfaces:
MenuItem
Direct Known Subclasses:
ActionMenuItemImpl, DefaultMenuItem, DefaultRootMenuItem, EntityExplorerMenuItemImpl, FlowMenuItemImpl

public abstract class AbstractMenuItem extends Object implements MenuItem
Abstract menu item for convenience. If you just want to extend the menu with an ordinary item, just extend this abstract implementation. It just provides a few getter and setters and you yourself could add individual properties via the extendProperties(Map) method.
  • Constructor Details

    • AbstractMenuItem

      public AbstractMenuItem()
  • Method Details

    • getPosition

      public int getPosition()
      Get the items position which represents the item's position within one hirachy.
      Specified by:
      getPosition in interface MenuItem
      Returns:
      the position
    • setPosition

      public void setPosition(int position)
      Set the item's position which represents the item's position within one hirachy.
      Specified by:
      setPosition in interface MenuItem
      Parameters:
      position - the position
    • extendProperties

      protected void extendProperties(Map<Object,Object> propertyMap)
      Empty implementation for convinience
      Parameters:
      propertyMap - the propertymap where you can add you're own properties
    • writeProperties

      public void writeProperties(Map<Object,Object> map)
      Writes the the local properties to the passed map
      Specified by:
      writeProperties in interface MenuItem
      Parameters:
      map - the map
    • getProperties

      public Map<Object,Object> getProperties(boolean useExtIcon)
      Description copied from interface: MenuItem
      Get the item's properties (for json serialization)
      Specified by:
      getProperties in interface MenuItem
      Parameters:
      useExtIcon - if true the ext icon is used (else the react icon)
      Returns:
      the properties
    • getMenuType

      public String getMenuType()
      Description copied from interface: MenuItem
      Get the menu type
      Specified by:
      getMenuType in interface MenuItem
      Returns:
      the menu type
    • setMenuType

      public void setMenuType(String menuType)
      Description copied from interface: MenuItem
      Menu type is in fact the tag-name of the menu
      Specified by:
      setMenuType in interface MenuItem
      Parameters:
      menuType - menu type
    • getChildren

      public List<MenuItem> getChildren()
      Description copied from interface: MenuItem
      Get the item's children
      Specified by:
      getChildren in interface MenuItem
      Returns:
      the item's children
    • appendChildren

      public void appendChildren(Collection<MenuItem> children)
      Description copied from interface: MenuItem
      Appends the item's children to the passed list
      Specified by:
      appendChildren in interface MenuItem
      Parameters:
      children - the list where you want to add the item's children
    • setChildren

      public void setChildren(List<MenuItem> children)
      Description copied from interface: MenuItem
      Set children
      Specified by:
      setChildren in interface MenuItem
      Parameters:
      children - the children
    • getParent

      public MenuItem getParent()
      Description copied from interface: MenuItem
      Get the item's parent
      Specified by:
      getParent in interface MenuItem
      Returns:
      parent item or null when no parent
    • setParent

      public void setParent(MenuItem parent)
      Description copied from interface: MenuItem
      Set parent item
      Specified by:
      setParent in interface MenuItem
      Parameters:
      parent - the item
    • getName

      public String getName()
      Description copied from interface: MenuItem
      Every item must have a name
      Specified by:
      getName in interface MenuItem
      Returns:
      the name
    • setName

      public void setName(String name)
      Description copied from interface: MenuItem
      Set the name
      Specified by:
      setName in interface MenuItem
      Parameters:
      name - the name of the item
    • getLabel

      @Nullable public @Nullable DisplayValue getLabel()
      Description copied from interface: MenuItem
      Get label
      Specified by:
      getLabel in interface MenuItem
      Returns:
      the label
    • setLabel

      public void setLabel(DisplayValue label)
      Description copied from interface: MenuItem
      Set label
      Specified by:
      setLabel in interface MenuItem
      Parameters:
      label - the label
    • getExtIcon

      public String getExtIcon()
      Description copied from interface: MenuItem
      An item *can* have an icon. Otherwise null is returned
      Specified by:
      getExtIcon in interface MenuItem
      Returns:
      the icon string
    • setExtIcon

      public void setExtIcon(String extIcon)
      Description copied from interface: MenuItem
      Set the icon string
      Specified by:
      setExtIcon in interface MenuItem
      Parameters:
      extIcon - the icon string
    • getReactIcon

      public String getReactIcon()
      Description copied from interface: MenuItem
      An item *can* have an icon. Otherwise null is returned
      Specified by:
      getReactIcon in interface MenuItem
      Returns:
      the icon string
    • setReactIcon

      public void setReactIcon(String reactIcon)
      Description copied from interface: MenuItem
      Set the icon string
      Specified by:
      setReactIcon in interface MenuItem
      Parameters:
      reactIcon - the icon string
    • setOldClientDisabled

      public void setOldClientDisabled(boolean disabled)
      Description copied from interface: MenuItem
      Set if menu item is disabled in the old client
      Specified by:
      setOldClientDisabled in interface MenuItem
      Parameters:
      disabled - boolean
    • isOldClientDisabled

      public boolean isOldClientDisabled()
      Specified by:
      isOldClientDisabled in interface MenuItem
    • setNewClientDisabled

      public void setNewClientDisabled(boolean disabled)
      Description copied from interface: MenuItem
      Set if menu item is disabled in the new client
      Specified by:
      setNewClientDisabled in interface MenuItem
      Parameters:
      disabled - boolean
    • isNewClientDisabled

      public boolean isNewClientDisabled()
      Specified by:
      isNewClientDisabled in interface MenuItem
    • findChildByName

      public MenuItem findChildByName(String name)
      Specified by:
      findChildByName in interface MenuItem
    • getPath

      public String getPath()
      Specified by:
      getPath in interface MenuItem