Package snap.view

Class MenuItem

All Implemented Interfaces:
Cloneable, PropChange.DoChange, XMLArchiver.Archivable
Direct Known Subclasses:
CheckBoxMenuItem, Menu

public class MenuItem extends ButtonBase implements Cloneable
A ButtonBaseNode for MenuItem.
  • Field Details

  • Constructor Details

    • MenuItem

      public MenuItem()
      Constructor.
  • Method Details

    • isSelected

      public boolean isSelected()
      Returns whether button is selected.
      Overrides:
      isSelected in class ButtonBase
    • setSelected

      public void setSelected(boolean aValue)
      Sets whether button is selected.
    • getShortcut

      public String getShortcut()
      Returns the key string.
    • setShortcut

      public void setShortcut(String aValue)
      Sets the key string.
    • getShortcutCombo

      public KeyCombo getShortcutCombo()
      Returns the accelerator key combo.
    • getShortcutText

      public String getShortcutText()
      Returns the shortcut key as string.
    • isSeparator

      public boolean isSeparator()
      Returns whether menu item is a separator.
    • getParentMenu

      public Menu getParentMenu()
      Returns the parent Menu (if there is one).
    • getValuePropName

      public String getValuePropName()
      Returns a mapped property name.
      Overrides:
      getValuePropName in class View
    • setTargeted

      protected void setTargeted(boolean aValue)
      Sets whether button is under mouse.
      Overrides:
      setTargeted in class ButtonBase
    • paintButton

      protected void paintButton(Painter aPntr)
      Override to suppress painting.
      Overrides:
      paintButton in class ButtonBase
    • paintSeparator

      protected void paintSeparator(Painter aPntr)
      Paints the menu item as a separator.
    • getPrefHeightImpl

      protected double getPrefHeightImpl(double aW)
      Returns the preferred height.
      Overrides:
      getPrefHeightImpl in class ButtonBase
    • fireActionEvent

      protected void fireActionEvent(ViewEvent anEvent)
      Override to notify parent menu (to hide all).
      Overrides:
      fireActionEvent in class ButtonBase
    • getPropValue

      public Object getPropValue(String aPropName)
      Override because TeaVM hates reflection.
      Overrides:
      getPropValue in class ButtonBase
    • setPropValue

      public void setPropValue(String aPropName, Object aValue)
      Override because TeaVM hates reflection.
      Overrides:
      setPropValue in class ButtonBase
    • clone

      public MenuItem clone()
      Copies a menu item.
      Overrides:
      clone in class View
    • toXMLView

      public XMLElement toXMLView(XMLArchiver anArchiver)
      XML archival.
      Overrides:
      toXMLView in class ButtonBase
    • fromXMLView

      public void fromXMLView(XMLArchiver anArchiver, XMLElement anElement)
      XML unarchival.
      Overrides:
      fromXMLView in class ButtonBase