com.yospace.yae.yogi
Class YogiMenu
java.lang.Object
|
+--com.yospace.yae.yogi.YogiComponent
|
+--com.yospace.yae.yogi.YogiImageComponent
|
+--com.yospace.yae.yogi.YogiLabel
|
+--com.yospace.yae.yogi.AbstractMenu
|
+--com.yospace.yae.yogi.YogiMenu
- All Implemented Interfaces:
- PropertyChangeListener, RendererFactory
- public class YogiMenu
- extends AbstractMenu
- implements RendererFactory, PropertyChangeListener
A component that represents a menu. Data is stored in an underlying
YogiList, and is displayed within a
YogiPopup. Sub-menus can be created by
adding one YogiMenu object to another. A menu can have text and/or an image associated with it.
These can be used by the relevant UI as a "title", for example "File" or an "open file" icon.
| Fields inherited from class com.yospace.yae.yogi.YogiComponent |
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, BORDER_DOTTED, BORDER_NONE, BORDER_PLAIN, BORDER_ROUNDED, BORDER_SOLID, COLOR_BACKGROUND, COLOR_BORDER, COLOR_FOREGROUND, FOCUS_DEFAULT, FOCUS_OFF, FOCUS_ON, PROPERTY_ALIGN, PROPERTY_BORDER_STYLE, PROPERTY_BOUNDS, PROPERTY_COLOR, PROPERTY_CONTEXT_ENABLED, PROPERTY_ENABLED, PROPERTY_FOCUS, PROPERTY_FOCUS_INDEX, PROPERTY_FOCUS_TRAVERSABLE, PROPERTY_FONT, PROPERTY_HOTKEY, PROPERTY_LOCATION, PROPERTY_OPAQUE, PROPERTY_SIZE, PROPERTY_VISIBLE, PROPERTY_X_INSET, PROPERTY_Y_INSET |
|
Constructor Summary |
YogiMenu()
The default constructor. |
YogiMenu(java.lang.String text,
Image image)
Constructor taking the text and image for the menu. |
|
Method Summary |
void |
addItem(java.lang.Object item)
Adds an item to the menu. |
YogiComponent |
getCellRendererComponent(AbstractTable table,
java.lang.Object value,
boolean isSelected,
boolean cellHasFocus)
Provided to implement the RendererFactory interface. |
protected void |
initPopup()
Initialises the popup menu. |
boolean |
isSubMenu()
Convenience method returning whether or not this menu is a sub menu. |
protected void |
popupMenu()
This method is called by the AbstractMenu superclass before the popup is displayed. |
void |
propertyChanged(java.lang.Object source,
int propertyCode)
This method is extended to allow child menus to be killed when appropriate. |
void |
setList(YogiList list)
Sets the underlying list used to store the data items in a menu. |
void |
setPopupMenuVisible(boolean menuVisible)
This method sets the visibility of the popup used to display the YogiMenu. |
void |
setSelectedIndex(int index)
|
| Methods inherited from class com.yospace.yae.yogi.AbstractMenu |
add, addMenuListener, getFocusBounds, getItem, getItemCount, getList, getMenuItem, getPopupMenu, getPopupOrigin, getSelectedIndex, isPopupMenuVisible, popdownMenu, setFocus, setPopupBounds, setPopupMenu |
| Methods inherited from class com.yospace.yae.yogi.YogiComponent |
_debugPrintComponents, addPropertyChangeListener, bringForwards, bringInFrontOf, bringToFront, contains, containsComponent, ensureVisible, ensureVisible, findComponentAt, findCurrentFocus, findFirstFocus, findFocusDomainRoot, findFocusDomainRootImpl, findHotkeyComponent, findNextFocus, fireActionPerformedEvent, firePropertyChangeEvent, getAlign, getBorderStyle, getBounds, getColor, getColors, getComponent, getComponent, getComponentCount, getComponentIndex, getComponents, getFocusIndex, getFont, getGlobalLocation, getHeight, getHotkey, getId, getParent, getParent, getTreeLock, getUI, getWidth, getX, getXInset, getY, getYInset, hasFocus, isActive, isContextEnabled, isEnabled, isFocusDomainRoot, isFocusTraversable, isOpaque, isVisible, keyPressed, keyReleased, keyRepeated, paint, paintBackground, paintBorder, paintForeground, pointerDragged, pointerPressed, pointerReleased, remove, remove, removeAll, removePropertyChangeListener, repaint, repaint, repaintAfterRebounding, requestFocus, requestFocus, sendBackwards, sendBehind, sendToBack, setActionListener, setActive, setAlign, setBorderStyle, setBounds, setColor, setColors, setContextEnabled, setDefaultColor, setEnabled, setFocusDomainRoot, setFocusIndex, setFocusTraversable, setFont, setHotkey, setId, setLocation, setNoFocus, setOpaque, setProperty, setSize, setUI, setVisible, setXInset, setYInset, updateUI |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
YogiMenu
public YogiMenu()
- The default constructor. The menu will have no title and no image.
YogiMenu
public YogiMenu(java.lang.String text,
Image image)
- Constructor taking the text and image for the menu.
- Parameters:
text - the String to be displayed as the title for the menu.image - the Image to be displayed as the title for the menu.
addItem
public void addItem(java.lang.Object item)
- Adds an item to the menu.
- Overrides:
addItem in class AbstractMenu
- Parameters:
item - Item to be added to the menu.
setList
public void setList(YogiList list)
- Sets the underlying list used to store the data items in a menu.
- Overrides:
setList in class AbstractMenu
- Parameters:
list - new list.
initPopup
protected void initPopup()
- Initialises the popup menu.
- Overrides:
initPopup in class AbstractMenu
isSubMenu
public boolean isSubMenu()
- Convenience method returning whether or not this menu is a sub menu.
- Returns:
- true if the menu is a sub menu, false if not.
setSelectedIndex
public void setSelectedIndex(int index)
getCellRendererComponent
public YogiComponent getCellRendererComponent(AbstractTable table,
java.lang.Object value,
boolean isSelected,
boolean cellHasFocus)
- Provided to implement the
RendererFactory interface.
Returns a YogiMenu customised to the arguments passed from the
AbstractTable subclass.
- Specified by:
getCellRendererComponent in interface RendererFactory- Overrides:
getCellRendererComponent in class YogiLabel
- Parameters:
table - The AbstractTable for which the check box is rendering.value - The object to be custom rendererd.isSelected - The selected state of the object to be custom rendererd.cellHasFocus - The focus state of the object to be custom rendererd.- Returns:
- the custom rendered YogiCheckBox.
setPopupMenuVisible
public void setPopupMenuVisible(boolean menuVisible)
- This method sets the visibility of the popup used to display the YogiMenu.
If the visibility is being set to false, all child menus will be
hidden too.
- Overrides:
setPopupMenuVisible in class AbstractMenu
- Parameters:
menuVisible - the new visibility setting for this menu's popup.
popupMenu
protected void popupMenu()
- This method is called by the AbstractMenu superclass before the popup is displayed.
It prepares the popup menu for display.
- Overrides:
popupMenu in class AbstractMenu
propertyChanged
public void propertyChanged(java.lang.Object source,
int propertyCode)
- This method is extended to allow child menus to be killed when appropriate.
- Specified by:
propertyChanged in interface PropertyChangeListener
- Parameters:
source - Object which fired the property change event.propertyCode - the changed property.