All Implemented Interfaces:
Control, View

public class MenuView extends BoxView
MenuView shows MenuView items vertically and is typically used in layouts which builds complete terminal UI's.
  • Constructor Details

    • MenuView

      public MenuView()
      Construct menu view with no initial menu items.
    • MenuView

      public MenuView(MenuView.MenuItem[] items)
      Construct menu view with menu items.
      Parameters:
      items - the menu items
    • MenuView

      public MenuView(@Nullable List<MenuView.MenuItem> items)
      Construct menu view with menu items.
      Parameters:
      items - the menu items
  • Method Details

    • setItems

      public void setItems(@Nullable List<MenuView.MenuItem> items)
      Sets a new menu items. Will always clear existing items and if null is passed this effectively keeps items empty.
      Parameters:
      items - the menu items
    • getItems

      public List<MenuView.MenuItem> getItems()
      Gets a menu items.
      Returns:
      the menu items
    • getPreferredDimension

      public Dimension getPreferredDimension()
      Gets a preferred dimension menu needs to show it's content.
      Returns:
      preferred dimension
    • drawInternal

      protected void drawInternal(Screen screen)
      Description copied from class: BoxView
      Possibly draws a box around this view and title in a box top boundary. Also calls a draw function if defined.
      Overrides:
      drawInternal in class BoxView
      Parameters:
      screen - the screen
    • initInternal

      protected void initInternal()
      Description copied from class: AbstractView
      Internal init method called from AbstractView.init(). Override to do something usefull. Typically key and mousebindings are registered from this method.
      Overrides:
      initInternal in class AbstractView
    • toggle

      public void toggle(MenuView.MenuItem item)
      Toggle MenuView.MenuItem checked state.
      Parameters:
      item - the menu item to toggle