marimba.gui
Class SparseDropDownMenu

java.lang.Object
  |
  +--marimba.gui.Widget
        |
        +--marimba.gui.ContainerWidget
              |
              +--marimba.gui.GroupWidget
                    |
                    +--marimba.gui.PopupWidget
                          |
                          +--marimba.gui.PopupMenu
                                |
                                +--marimba.gui.DropDownMenu
                                      |
                                      +--marimba.gui.SparseDropDownMenu
All Implemented Interfaces:
java.awt.image.ImageObserver, PropertyObject, TimerClient, WidgetConstants

public class SparseDropDownMenu
extends DropDownMenu

A sparse drop down menu, it calls a method called 'getData' of its user to get the currently visible items.

Version:
1.9, 03/18/98
Author:
Klaas Waslander

Field Summary
protected  int firstItem
          The first item that is currently in the menu.
protected  int itemCount
          The total number of items in this menu.
protected  int lastItem
          The last item that is currently in the menu.
 
Fields inherited from class marimba.gui.DropDownMenu
autoSize, user
 
Fields inherited from class marimba.gui.PopupMenu
container, current, dragged, itemFocus, maxVisible, mouseUpPopDown, owner, poppingDown, scrollJump, ticking
 
Fields inherited from class marimba.gui.PopupWidget
player
 
Fields inherited from class marimba.gui.GroupWidget
editing, fillMode, fillOptions, lineMode, lineOptions, patsrc, pattern, prevtx, prevty
 
Fields inherited from class marimba.gui.ContainerWidget
content
 
Fields inherited from class marimba.gui.Widget
adapter, background, clazz, defaultBackground, defaultFont, defaultForeground, defaultHilite, directGraphics, disabled, east, editor, focus, font, foreground, height, hilite, layoutMgr, name, north, nwidgets, parent, script, south, tip, transparent, tx, ty, valid, visible, wBackground, west, wFont, wForeground, wHilite, widgets, width, wScript, wTip, x, y
 
Fields inherited from interface marimba.gui.WidgetConstants
ALWAYS, ANYWHERE, APPLET, ASCENDING, BLINK, BLUE, BONGO_EVENT, BOTH, BOTTOM, BOXED, BUTTON, CENTER, CHAR, CHECK, COLLAPSE_EVENT, CONTENT, DESCENDING, DETACHED, DIAGONAL, DOWN, DRAG, EXCLUSIVE, EXPAND_EVENT, FILL, FILLED, GREEN, HORIZONTAL, INSIDE, INVISIBLE, JAVA_VERSION, JAVAOS, JDK10, JDK11, LAYERS, LEFT, LOWERED, MAC, MULTIPLE, NETCASTER, NETSCAPE, NEVER, NONE, NT, OPTIONAL, OS_ARCH, OS_NAME, OS_VERSION, OUTLINE, PAGE_DOWN, PAGE_EVENT, PAGE_UP, PATTERN, PC, PICTURE, PLAIN, PROPORTIONAL, RADIO, RAISED, RED, REST_EVENT, RIGHT, ROUNDED, SCALE, SCROLLBAR, SCROLLING, SOLID, SQUARE, TEXT_CHANGED_EVENT, TOP, TOPLEFT, TRUNCATE, UNDERLINE, UNIX, UP, VERTICAL, WAKE_EVENT, WIN95, WINDOWS, WORD
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SparseDropDownMenu(SparseDropDownListBoxWidget user, int itemCount, boolean autoSize)
          Constructor that does not set the max number of visible items.
SparseDropDownMenu(SparseDropDownListBoxWidget user, int itemCount, boolean autoSize, int maxVisible)
          Constructor: Show a SparseDropDownMenu that belongs to the given widget.
 
Method Summary
 PopupMenuItemWidget getItem(int index)
          Get the item with the given index.
 int getItemCount()
          Get the number of items in this menu.
 int getItemHeight()
          Get the height of a menu item, based on the font: in a sparse dropdown menu every item has the same height.
protected  int getPopupHeight()
          The initial height of the popup menu.
 java.awt.Dimension getPreferredSize()
          Compute the best size for this menu.
 int[] getView()
          Get the index of the first and last visible item.
 boolean handleEvent(java.awt.Event evt)
          Handle events.
 int indexOf(PopupMenuItemWidget item)
          Return index of given item.
 void layout()
          Lay out the menu items.
 void select(int index)
          Select the item with the given index, that item will be visible afterwards: the content will be scrolled to that item.
 long tick(long tm, java.lang.Object arg)
          Take care of timer scrolls.
 void updateView()
          Update the view, which means adding and removing items as needed; this is done using the new view that the method getView() returns.
 
Methods inherited from class marimba.gui.DropDownMenu
fit, popup, selectNextItem, selectPreviousItem
 
Methods inherited from class marimba.gui.PopupMenu
add, add, addSeparator, addSeparator, clear, focusInterest, getCurrentItem, getItemFocus, getMaxVisible, getOwner, insert, insert, layoutContainer, nextItem, paint, popdown, popup, popup, preferredSize, previousItem, remove, remove, remove, select, selectNextItem, selectPreviousItem, setItemFocus, setMaxVisible, setMouseUpPopDown, setOwner
 
Methods inherited from class marimba.gui.PopupWidget
getPlayerPanel, isShowing, paramString, popup, postEvent, repaint, repaint, repaintParent, replace
 
Methods inherited from class marimba.gui.GroupWidget
getEditing, getEditor, getFillMode, getFillOptions, getLineMode, getLineOptions, getPattern, getPatternSource, getProperties, init, setEditing, setFillMode, setLineMode, setPattern, setProperties, update, updateArea, waitForPattern
 
Methods inherited from class marimba.gui.ContainerWidget
findInFocus, findWidget, firstInFocus, getChildProperties, getContent, newContent, nextInFocus, previousInFocus
 
Methods inherited from class marimba.gui.Widget
action, action, add, add, adjustFont, adjustFont, applyProperties, audioLoop, audioLoop, audioPlay, audioPlay, audioStop, audioStop, bounds, clearFocus, clearPopups, clone, contains, contains, createImage, createImage, currentFocus, destroy, disable, disable, enable, firstFocus, getAudioClip, getAudioClipAt, getBackground, getBounds, getCancelButton, getCursor, getDefaultButton, getDescription, getEncoding, getFocusColor, getFont, getFontMetrics, getForeground, getHilite, getImage, getKey, getKey, getKey, getLayoutMgr, getLocale, getLocation, getName, getParent, getPlayerFrame, getPresentation, getSelBackground, getSelFocusColor, getSelForeground, getSize, getText, getText, getTip, getTip, getTipFont, getValue, getValue, getWidget, getWidgetAt, getWidgetAt, getWidgetClass, getWidgetsAt, getWidgetsAt, getWidgetsAt, gotFocus, gotoPage, gotoPage, hasFocus, hide, imageUpdate, inheritFont, inside, inside, invalidate, isDisabled, isTransparent, isVisible, keyDown, keyUp, list, list, locateWidget, locateWidgets, locateWidgets, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, overlap, paint, paintAll, previousFocus, remove, remove, remove, removeAll, repaint, repaint, repaint, replace, replace, requestFocus, resetCursor, reshape, reshape, resize, resize, rmove, rscroll, scroll, setAttach, setBackground, setBounds, setBounds, setCursor, setDisabled, setEditor, setEncoding, setFont, setForeground, setHilite, setLayoutMgr, setLocale, setLocation, setName, setSize, setSize, setText, setText, setTip, setTipFont, setTransparent, setValue, setValue, setVisible, show, show, size, start, stop, sync, toBack, toBack, toFront, toFront, toString, validate
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

itemCount

protected int itemCount
The total number of items in this menu.

firstItem

protected int firstItem
The first item that is currently in the menu.

lastItem

protected int lastItem
The last item that is currently in the menu.
Constructor Detail

SparseDropDownMenu

public SparseDropDownMenu(SparseDropDownListBoxWidget user,
                          int itemCount,
                          boolean autoSize)
Constructor that does not set the max number of visible items.
Parameters:
autoSize - if false, the width of the widget is used.
itemsInfo - array containing index of first and last item and the total number of items

SparseDropDownMenu

public SparseDropDownMenu(SparseDropDownListBoxWidget user,
                          int itemCount,
                          boolean autoSize,
                          int maxVisible)
Constructor: Show a SparseDropDownMenu that belongs to the given widget. This sparse dropdownmenu asks the given widget for the visible choices using the itemsInfo by calling the method 'getData' of that widget.
Parameters:
autoSize - if false, the width of the choicewidget is used.
itemsInfo - array containing index of first and last item and the total number of items
Method Detail

getPopupHeight

protected int getPopupHeight()
The initial height of the popup menu.
Overrides:
getPopupHeight in class PopupMenu
See Also:
DropDownMenu.popup()

layout

public void layout()
Lay out the menu items.
Overrides:
layout in class PopupMenu

getPreferredSize

public java.awt.Dimension getPreferredSize()
Compute the best size for this menu.
Overrides:
getPreferredSize in class PopupMenu

getItemCount

public int getItemCount()
Get the number of items in this menu.
Overrides:
getItemCount in class PopupMenu

getItemHeight

public int getItemHeight()
Get the height of a menu item, based on the font: in a sparse dropdown menu every item has the same height.

getItem

public PopupMenuItemWidget getItem(int index)
Get the item with the given index.
Overrides:
getItem in class PopupMenu

indexOf

public int indexOf(PopupMenuItemWidget item)
Return index of given item. Return -1 if item is not found.
Overrides:
indexOf in class PopupMenu
See Also:
select(int)

select

public void select(int index)
Select the item with the given index, that item will be visible afterwards: the content will be scrolled to that item.
Overrides:
select in class PopupMenu
Following copied from class: marimba.gui.PopupMenu
See Also:
PopupMenu.current, PopupMenu.indexOf(marimba.gui.PopupMenuItemWidget), PopupMenu.add(java.lang.String)

tick

public long tick(long tm,
                 java.lang.Object arg)
Take care of timer scrolls.
Overrides:
tick in class PopupMenu
Following copied from class: marimba.gui.Widget
See Also:
TimerClient

getView

public int[] getView()
Get the index of the first and last visible item.
Returns:
array with two integers: the index of the first item and last item.

updateView

public void updateView()
Update the view, which means adding and removing items as needed; this is done using the new view that the method getView() returns.
See Also:
getView()

handleEvent

public boolean handleEvent(java.awt.Event evt)
Handle events.
Overrides:
handleEvent in class DropDownMenu
Following copied from class: marimba.gui.DropDownMenu
See Also:
DropDownMenu.user, PopupMenu.owner