com.yospace.yae.yogi
Class YogiDropDownMenu
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.YogiDropDownMenu
- All Implemented Interfaces:
- PropertyChangeListener, RendererFactory
- public class YogiDropDownMenu
- extends AbstractMenu
- implements RendererFactory, PropertyChangeListener
A component that represents a drop-down menu. Data is stored in an underlying
YogiList, and is displayed within a
YogiScrollPane which is itself contained within a
YogiPopup.
| 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 |
YogiDropDownMenu()
Constructor which sets the text to be "" and the image to be null for the menu. |
YogiDropDownMenu(java.lang.String text,
Image image)
Constructor which sets the text and image for the menu. |
| Methods inherited from class com.yospace.yae.yogi.AbstractMenu |
add, addMenuListener, getFocusBounds, getItem, getItemCount, getList, getMenuItem, getPopupMenu, getPopupOrigin, getSelectedIndex, initPopup, isPopupMenuVisible, popdownMenu, setFocus, setPopupBounds, setPopupMenu, setPopupMenuVisible |
| 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 |
YogiDropDownMenu
public YogiDropDownMenu()
- Constructor which sets the text to be "" and the image to be
null for the menu.
YogiDropDownMenu
public YogiDropDownMenu(java.lang.String text,
Image image)
- Constructor which sets the text and image for the menu.
- Parameters:
text - String to be displayed on the menu.image - Image to be displayed on the menu.
setList
public void setList(YogiList list)
- Sets the
YogiList for use with a
drop down menu, and adds it to the scroll pane.
- Overrides:
setList in class AbstractMenu
- Parameters:
list - the list that will be used for the drop down menu.
getScrollPane
public YogiScrollPane getScrollPane()
- Gets the
YogiScrollPane used to scroll the list
of selectable items in a drop down menu.
- Returns:
- the scroll pane
addItem
public void addItem(java.lang.Object item)
- Adds an item to the drop down menu.
- Overrides:
addItem in class AbstractMenu
- Parameters:
item - the Object to add to the drop down menu.
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
getCellRendererComponent
public YogiComponent getCellRendererComponent(AbstractTable table,
java.lang.Object value,
boolean isSelected,
boolean cellHasFocus)
- Provided to implement the
RendererFactory interface.
Returns a YogiDropDownMenu customised to the arguments passed from the
AbstractTable subclass.
- Specified by:
getCellRendererComponent in interface RendererFactory- Overrides:
getCellRendererComponent in class YogiLabel
- Parameters:
table - The table 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 YogiDropDownMenu.
setSelectedIndex
public void setSelectedIndex(int index)
- Convenience method for setting the current selected item.
- Parameters:
index - the index to set the current selected index to be.
propertyChanged
public void propertyChanged(java.lang.Object source,
int propertyCode)
- This method is extended to allow scroll 'notching' to be implemented. The
menu listens for vertical scroll property change events from the
YogiScrollContentPane and sets the value of
the vertical scroll bar
to be a multiple of the cell height when the scroll offset is changed.
- Specified by:
propertyChanged in interface PropertyChangeListener
- Parameters:
source - Object which fired the property change event.propertyCode - the code that defines which property changed.