Class ThemeMenuPiece

Direct Known Subclasses:
CThemeMenuPiece

@ClientOnly public class ThemeMenuPiece extends BaseMenuPiece
A MenuPiece that can change the DockTheme.
Author:
Benjamin Sigg
  • Constructor Details

    • ThemeMenuPiece

      public ThemeMenuPiece(DockController controller, boolean defaultThemes)
      Creates a new piece. The transfer-flag will be set to true.
      Parameters:
      controller - the controller whose theme might be changed, can be null
      defaultThemes - whether the piece should be filled up with the factories that can be obtained through the DockUI
    • ThemeMenuPiece

      public ThemeMenuPiece(DockController controller, ThemeMap map)
      Creates a new piece using the themes of map. The transfer-flag will be set to false.
      Parameters:
      controller - the controller, will just be stored but not used unless setTransferTheme(boolean) is called with the argument true. Can be null
      map - the list of themes, can be null
  • Method Details

    • setTransferTheme

      public void setTransferTheme(boolean transferTheme)
      Instructs this piece whether it should transfer the DockTheme from its map to the controller.
      Parameters:
      transferTheme - true if this piece should transfer the theme
    • isTransferTheme

      public boolean isTransferTheme()
      Tells whether this piece is transfers the DockTheme from its map to the controller.
      Returns:
      true if this piece transfers the theme
      See Also:
    • destroy

      public void destroy()
      Severs all connections of this ThemeMenuPiece with other objects, allowing the garbage collector to remove this.
    • setThemes

      public void setThemes(ThemeMap themes)
      Sets the themes which this piece offers
      Parameters:
      themes - the offered themes, 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:
    • getThemes

      public ThemeMap getThemes()
      Gets the set of themes used by this piece.
      Returns:
      the set of themes
    • getController

      public DockController getController()
      Gets the controller whose theme might be changed by this piece.
      Returns:
      the controller
    • setController

      public void setController(DockController controller)
      Sets the controller whose theme might be changed by this piece. The theme of the controller is changed if there is a selection on this piece.
      Parameters:
      controller - the new controller, can be null