Class CloseableDockableMenuPiece

Direct Known Subclasses:
SingleCDockableListMenuPiece

public class CloseableDockableMenuPiece extends BaseMenuPiece
A piece of a menu allowing to close or reopen some Dockables that are registered in a DockFrontend.
Author:
Benjamin Sigg
  • Constructor Details

    • CloseableDockableMenuPiece

      public CloseableDockableMenuPiece()
      Creates a new piece
    • CloseableDockableMenuPiece

      public CloseableDockableMenuPiece(DockFrontend frontend)
      Creates a new piece
      Parameters:
      frontend - the list of Dockables, can be null
  • Method Details

    • setOrder

      public void setOrder(Comparator<String> order)
      Sets the order of the menu items. The default behavior is to order the items alphabetically.
      Parameters:
      order - the order, or null
    • getOrder

      public Comparator<String> getOrder()
      Gets the order of the menu items.
      Returns:
      the order, can be null
    • reorder

      protected void reorder()
      Asynchronously order the menu items
    • getFrontend

      public DockFrontend getFrontend()
      Gets the frontend which is observed by this piece.
      Returns:
      the frontend, might be null
      See Also:
    • setFrontend

      public void setFrontend(DockFrontend frontend)
      Sets the frontend which will be observed by this piece. Every Dockable that is registered at the frontend will get an item in the menu of this piece.
      Parameters:
      frontend - the list of Dockables, can be null
    • bind

      public void bind()
      Description copied from class: MenuPiece
      This method is called if there is a possibility for the user to see this menu. The menu should register listeners, update its text etc. to be ready for that event. This method must never be called twice in a row.
      Overrides:
      bind in class MenuPiece
      See Also:
    • unbind

      public void unbind()
      Description copied from class: MenuPiece
      This method is called if the user has no longer any possibility to see this menu. The menu should unregister its listeners. This method must never be called twice in a row.
      Overrides:
      unbind in class MenuPiece
      See Also:
    • create

      protected CloseableDockableMenuPiece.Item create(Dockable dockable)
      Creates a new item for the menu.
      Parameters:
      dockable - the element which will be shown/hidden when the user clicks onto the item.
      Returns:
      the new item
    • insert

      protected void insert(CloseableDockableMenuPiece.Item item)
      Adds an earlier created item into the menu, subclasses might override this method to add the item at a different location.
      Parameters:
      item - the item to insert
      See Also:
    • show

      protected void show(Dockable dockable)
      Ensures that dockable is visible.
      Parameters:
      dockable - the element to show
    • hide

      protected void hide(Dockable dockable)
      Ensures that dockable is not visible.
      Parameters:
      dockable - the element to hide
    • include

      protected boolean include(Dockable dockable)
      Tells whether an item should be inserted into the menu for the given dockable or not.
      Parameters:
      dockable - the element to check
      Returns:
      true if there should be an item added to the menu
    • check

      public void check(Dockable dockable)
      Ensures that dockable has an item if it is included, and does not have otherwise.
      Parameters:
      dockable - the element whose item is to be checked