Class SeparatingMenuPiece

java.lang.Object
bibliothek.gui.dock.support.menu.MenuPiece
bibliothek.gui.dock.support.menu.SeparatingMenuPiece

public class SeparatingMenuPiece extends MenuPiece
A piece which envelops another piece with separators.
Author:
Benjamin Sigg
  • Constructor Details

    • SeparatingMenuPiece

      public SeparatingMenuPiece()
      Creates a new piece
    • SeparatingMenuPiece

      public SeparatingMenuPiece(boolean topSeparator, boolean emptySeparator, boolean bottomSeparator)
      Creates a new piece
      Parameters:
      topSeparator - whether to show a separator at the top
      emptySeparator - whether to show a separator if piece is empty
      bottomSeparator - whether to show a separator at the bottom
    • SeparatingMenuPiece

      public SeparatingMenuPiece(MenuPiece piece)
      Creates a new piece
      Parameters:
      piece - the piece which might be covered by separators
    • SeparatingMenuPiece

      public SeparatingMenuPiece(MenuPiece piece, boolean topSeparator, boolean emptySeparator, boolean bottomSeparator)
      Creates a new piece
      Parameters:
      piece - the piece which might be covered by separators
      topSeparator - whether to show a separator at the top
      emptySeparator - whether to show a separator if piece is empty
      bottomSeparator - whether to show a separator at the bottom
  • Method Details

    • getPiece

      public MenuPiece getPiece()
      Gets the piece which is embraced by separators.
      Returns:
      the piece
    • 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:
    • setPiece

      public void setPiece(MenuPiece piece)
      Sets the piece which will be embraced by separators.
      Parameters:
      piece - the child of this piece
    • getItemCount

      public int getItemCount()
      Description copied from class: MenuPiece
      Gets the number of items this MenuPiece added to its menu.
      Specified by:
      getItemCount in class MenuPiece
      Returns:
      the number of items
    • fill

      public void fill(List<Component> items)
      Description copied from class: MenuPiece
      Inserts all items of this piece into items.
      Specified by:
      fill in class MenuPiece
      Parameters:
      items - the list which has to be filled in the same order as the items will appear on the menu
    • getSeparatorCount

      protected int getSeparatorCount()
      Gets the number of separators which were added by this piece.
      Returns:
      the number of separators
    • isBottomSeparator

      public boolean isBottomSeparator()
      Tells whether there is a separator below this piece.
      Returns:
      true if there is a separator
      See Also:
    • setBottomSeparator

      public void setBottomSeparator(boolean bottomSeparator)
      Sets whether there should be a separator added to the menu after the contents described in this piece. Note that there might not be any separator if this piece is empty.
      Parameters:
      bottomSeparator - true if there should be a separator
    • isEmptySeparator

      public boolean isEmptySeparator()
      Tells whether there should be a single separator shown when this piece is empty.
      Returns:
      true if there is a separator
    • setEmptySeparator

      public void setEmptySeparator(boolean emptySeparator)
      Sets whether there should be a separator shown when this piece is empty.
      Parameters:
      emptySeparator - true if a separator should be made visible
    • isTopSeparator

      public boolean isTopSeparator()
      Tells whether there is a separator shown above the content of this piece.
      Returns:
      true if there is a separator
    • setTopSeparator

      public void setTopSeparator(boolean topSeparator)
      Sets whether there should be a separator shown above the content of this piece. Note that there might not be any separator if this piece is empty.
      Parameters:
      topSeparator - true if the separator should be shown