com.samskivert.swing
Class RadialMenuItem

java.lang.Object
  extended by com.samskivert.swing.LabelSausage
      extended by com.samskivert.swing.RadialLabelSausage
          extended by com.samskivert.swing.RadialMenuItem

public class RadialMenuItem
extends RadialLabelSausage

Used to track info for each menu item in a RadialMenu.


Field Summary
 Object argument
          A special argument to be used when this menu item is selected, rather than the argument provided to the radial menu when it was activated.
 String command
          The command to issue if this item is selected.
 RadialMenu.Predicate predicate
          Used to determine whether or not this menu item should be included in a menu and whether or not it should be enabled.
 
Fields inherited from class com.samskivert.swing.RadialLabelSausage
_active, BORDER_STROKE, BORDER_THICKNESS, closedBounds, DISABLED_ALPHA, openBounds
 
Fields inherited from class com.samskivert.swing.LabelSausage
_dia, _icon, _label, _lxoff, _lyoff, _size, _xoff, _yoff
 
Constructor Summary
RadialMenuItem(String command, String label)
          Constructs a radial menu item with the specified command and label.
RadialMenuItem(String command, String label, Icon icon)
          Constructs a radial menu item with the specified command, label and icon.
RadialMenuItem(String command, String label, Icon icon, RadialMenu.Predicate predicate)
          Constructs a radial menu item with the specified command, label and icon.
 
Method Summary
protected  void drawIcon(Graphics2D gfx, int x, int y, Object cliData)
          Draws the icon, if applicable.
 boolean equals(Object other)
          Menu items are equal if their commands are equal.
 boolean isEnabled(RadialMenu menu)
          Returns true if this menu item should be enabled when it is displayed.
 boolean isIncluded(RadialMenu menu)
          Returns true if this menu item should be included in a menu when it is displayed.
 void render(Component host, RadialMenu menu, Graphics2D gfx, int x, int y)
          Renders this menu item at the specified location.
 
Methods inherited from class com.samskivert.swing.RadialLabelSausage
drawBase, drawBorder, drawExtras, drawLabel, layout, paint, setActive
 
Methods inherited from class com.samskivert.swing.LabelSausage
layout, layout, paint
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

command

public String command
The command to issue if this item is selected.


argument

public Object argument
A special argument to be used when this menu item is selected, rather than the argument provided to the radial menu when it was activated.


predicate

public RadialMenu.Predicate predicate
Used to determine whether or not this menu item should be included in a menu and whether or not it should be enabled. If no predicate is available, a menu item is assumed always to be included and enabled.

Constructor Detail

RadialMenuItem

public RadialMenuItem(String command,
                      String label)
Constructs a radial menu item with the specified command and label. No icon or menu predicate will be used.


RadialMenuItem

public RadialMenuItem(String command,
                      String label,
                      Icon icon)
Constructs a radial menu item with the specified command, label and icon. No menu predicate will be used.


RadialMenuItem

public RadialMenuItem(String command,
                      String label,
                      Icon icon,
                      RadialMenu.Predicate predicate)
Constructs a radial menu item with the specified command, label and icon.

Method Detail

isIncluded

public boolean isIncluded(RadialMenu menu)
Returns true if this menu item should be included in a menu when it is displayed. Calls through to the RadialMenu.Predicate if we have one.


isEnabled

public boolean isEnabled(RadialMenu menu)
Returns true if this menu item should be enabled when it is displayed. Calls through to the RadialMenu.Predicate if we have one.

Overrides:
isEnabled in class RadialLabelSausage

equals

public boolean equals(Object other)
Menu items are equal if their commands are equal. We also declare ourselves to be equal to a string with the same value as our command.

Overrides:
equals in class Object

render

public void render(Component host,
                   RadialMenu menu,
                   Graphics2D gfx,
                   int x,
                   int y)
Renders this menu item at the specified location.


drawIcon

protected void drawIcon(Graphics2D gfx,
                        int x,
                        int y,
                        Object cliData)
Description copied from class: LabelSausage
Draws the icon, if applicable.

Overrides:
drawIcon in class LabelSausage


Copyright © 2000-2008 Michael Bayne. All Rights Reserved.