|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.yospace.yae.yogi.YogiComponent
|
+--com.yospace.yae.yogi.YogiImageComponent
|
+--com.yospace.yae.yogi.YogiLabel
|
+--com.yospace.yae.yogi.AbstractMenu
This class provides a basis for menus. Data is stored in an underlying
YogiList, and is displayed within a
YogiPopup.
| Field Summary | |
protected YogiList |
list
YogiList containing the data items in the
menu. |
protected boolean |
popupMenuVisible
Visibility of the popup. |
static int |
PROPERTY_LIST
Constant for the list property. |
static int |
PROPERTY_POPUP_BOUNDS
Constant for the popup bounds property. |
static int |
PROPERTY_POPUP_MENU_VISIBLE
Constant for the popup menu visible property. |
static int |
PROPERTY_SELECTION
Constant for the selection property. |
| Fields inherited from class com.yospace.yae.yogi.YogiLabel |
PROPERTY_TEXT, PROPERTY_TEXT_PLACEMENT |
| Fields inherited from class com.yospace.yae.yogi.YogiImageComponent |
PROPERTY_IMAGE |
| Constructor Summary | |
AbstractMenu()
Default constructor which constructs a menu with no text and no image; |
|
AbstractMenu(Image image)
Constructor taking a menu image. |
|
AbstractMenu(java.lang.String text)
Constructor taking text for the menu. |
|
AbstractMenu(java.lang.String text,
Image image)
Constructor taking the text and image for the menu. |
|
AbstractMenu(java.lang.String text,
java.lang.String imageName)
Create a AbstractMenu with given text and image. |
|
| Method Summary | |
void |
add(YogiComponent c)
Overrides YogiComponent.add(YogiComponent c) to delegate all additions of YogiComponents to the
underlying list. |
void |
addItem(java.lang.Object item)
Convenience method for adding items to the underlying YogiList of data items. |
void |
addMenuListener(int index,
ActionListener listener)
Convenience method for adding a ActionListener
to a specified item in the menu. |
Rectangle |
getFocusBounds()
Finds the bounds of the focussed area by delegating to the underlying YogiList. |
java.lang.Object |
getItem(int index)
Convenience method for getting items from the underlying YogiList of data items. |
int |
getItemCount()
Convenience method for obtaining the number of elements in the menu. |
YogiList |
getList()
Returns the YogiList containing the data items
in the menu. |
java.lang.Object |
getMenuItem(int index)
Convenience method for obtaining the item at a given index in the menu. |
YogiPopup |
getPopupMenu()
This method retrieves the popup associated with the AbstractMenu. |
protected Point |
getPopupOrigin(YogiComponent c)
Calculates the location of a component with respect to the nearest popup modal root. |
int |
getSelectedIndex()
Convenience method for accessing the current selected item. |
protected void |
initPopup()
Initialises the popup menu to its default state. |
boolean |
isPopupMenuVisible()
Returns the visibility state of the popup menu. |
protected void |
popdownMenu()
This method is called when the popup menu needs to be removed from display. |
protected abstract void |
popupMenu()
This method is called by the AbstractMenu before the popup is displayed. |
boolean |
setFocus(int y)
Sets the current focus index of an AbstractMenu. |
void |
setList(YogiList list)
Sets the underlying list to be used. |
void |
setPopupBounds(int x,
int y,
int width,
int height)
Convenience method to set the bounds of the popup menu. |
protected void |
setPopupMenu(YogiPopup popup)
Sets the popup menu. |
void |
setPopupMenuVisible(boolean visible)
Sets the visibility state of the popup menu to the desired state. |
| Methods inherited from class com.yospace.yae.yogi.YogiLabel |
getCellRendererComponent, getText, isTextOnRight, setText, setTextImpl, setTextOnRight |
| Methods inherited from class com.yospace.yae.yogi.YogiImageComponent |
getImage, getImageName, setImage, setImage |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int PROPERTY_LIST
public static final int PROPERTY_SELECTION
public static final int PROPERTY_POPUP_BOUNDS
public static final int PROPERTY_POPUP_MENU_VISIBLE
protected boolean popupMenuVisible
protected YogiList list
YogiList containing the data items in the
menu.| Constructor Detail |
public AbstractMenu()
public AbstractMenu(Image image)
image - Image to be displayed on the menu.public AbstractMenu(java.lang.String text)
text - String to be displayed on the menu.
public AbstractMenu(java.lang.String text,
Image image)
text - String to be displayed on the menu.image - Image to be displayed on the menu.
public AbstractMenu(java.lang.String text,
java.lang.String imageName)
text - the text to be displayed.imageName - the String that defines the name of the resource to create the image to be displayed from.| Method Detail |
public YogiList getList()
YogiList containing the data items
in the menu.public int getSelectedIndex()
public void addItem(java.lang.Object item)
YogiList of data items.item - Object to add to the menu.public java.lang.Object getItem(int index)
YogiList of data items.index - the index of the item to return.public boolean setFocus(int y)
y - vertical focus index.public void add(YogiComponent c)
YogiComponent.add(YogiComponent c) to delegate all additions of YogiComponents to the
underlying list. Hence adding a YogiComponent to an AbstractMenu subclass
has the same effect as calling {#addItem(java.lang.Object)} and passing in the YogiComponent in
question. The only exception is when a YogiList
is added, in which case this object becomes the underlying list.add in class YogiComponentc - The YogiComponent to add to the underlying list.addItem(Object item)public void setList(YogiList list)
PROPERTY_LIST change event
is fired.list - YogiList representing the data to be displayed by this menu.public YogiPopup getPopupMenu()
public void setPopupBounds(int x,
int y,
int width,
int height)
PROPERTY_POPUP_BOUNDS change event is fired.x - the desired x value.y - the desired y value.width - the desired width.height - the desired height.public boolean isPopupMenuVisible()
public void setPopupMenuVisible(boolean visible)
PROPERTY_POPUP_MENU_VISIBLE
change event is fired.visible - true to display the popup menu, false will hide the popup menu.public int getItemCount()
public java.lang.Object getMenuItem(int index)
public void addMenuListener(int index,
ActionListener listener)
ActionListener
to a specified item in the menu.index - The index of the item to which to attach the listener.listener - The listenerprotected abstract void popupMenu()
protected void popdownMenu()
protected void initPopup()
protected void setPopupMenu(YogiPopup popup)
popup - the new popup menu.protected final Point getPopupOrigin(YogiComponent c)
c - the start component.public Rectangle getFocusBounds()
YogiList.getFocusBounds in class YogiComponentcom.yospace.yae.yogi.YogiComponent
|
Copyright 2002 Yospace Holdings Ltd. All Rights Reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||