Package tripleplay.ui

Class MenuItem

All Implemented Interfaces:
Clickable<MenuItem>, Togglable<MenuItem>

public class MenuItem extends TextWidget<MenuItem> implements Togglable<MenuItem>
An item in a menu. This overrides clicking with a two phase click behavior: clicking an unselected menu item selects it; clicking a selected menu item triggers it.
  • Field Details

    • text

      public final react.Value<String> text
      The text shown.
    • icon

      public final react.Value<Icon> icon
      The icon shown.
  • Constructor Details

    • MenuItem

      public MenuItem(String label)
      Creates a new menu item with the given label.
    • MenuItem

      public MenuItem(String label, Icon icon)
      Creates a new menu item with the given label and icon.
  • Method Details

    • showText

      public MenuItem showText(MenuItem.ShowText value)
      Sets the text display mode for this menu item.
    • hideTextWhenInactive

      public MenuItem hideTextWhenInactive()
      Sets the menu item to show its text when the item is selected
    • hideText

      public MenuItem hideText()
      Sets the menu item to only use an icon and no tex. This is useful for layouts that show the text of the selected item in a central location.
    • setPreferredSize

      public MenuItem setPreferredSize(float wid, float hei)
      Sets the preferred size of the menu item.
    • triggered

      public react.SignalView<MenuItem> triggered()
      Gets the signal that dispatches when a menu item is triggered. Most callers will just connect to Menu.itemTriggered().
    • selected

      public react.Value<Boolean> selected()
      Description copied from interface: Togglable
      A value that reflects the current selection state and is updated when said state changes.
      Specified by:
      selected in interface Togglable<MenuItem>
    • clicked

      public react.SignalView<MenuItem> clicked()
      Description copied from interface: Clickable
      A signal that is emitted when this element is clicked.
      Specified by:
      clicked in interface Clickable<MenuItem>
    • click

      public void click()
      Description copied from interface: Clickable
      Programmatically triggers a click of this element.
      Specified by:
      click in interface Clickable<MenuItem>