ewe.ui
Class BasicList

java.lang.Object
  extended byewe.ui.ControlBase
      extended byewe.ui.Control
          extended byewe.ui.ChoiceControl
              extended byewe.ui.Menu
                  extended byewe.ui.BasicList
All Implemented Interfaces:
CellConstants, ControlConstants, EventListener, ImageRefresher, IndexSelectable, Intable, IScroll, ISimpleList, ScrollClient, TimerProc, UIConstants
Direct Known Subclasses:
mList, SimpleList

public abstract class BasicList
extends Menu
implements ISimpleList

This is an intermediate class which is the superclass for mList and for SimpleList. You should not use this class or inherit from this class yourself.

Inherit from mList to create a List that gets its items from a Vector of stored Strings or MenuItems. Note that this will use a lot of memory for very large lists.

Inherit from SimpleList to create a List that does not get its items from a Vector of stored Strings or MenuItems. SimpleList uses specific method calls to get the items which are to be displayed and these methods should be overridden to provide the most efficient method of item storage and retrieval.


Field Summary
protected  boolean amScrolling
           
 boolean multiSelect
          This specifies whether the list allows multiple selections or not.
static int OPTION_CURSOR_EXIT_DOWN
           
static int OPTION_CURSOR_EXIT_LEFT
           
static int OPTION_CURSOR_EXIT_RIGHT
           
static int OPTION_CURSOR_EXIT_UP
           
static int OPTION_SELECT_FIRST_ON_KEY_FOCUS
           
 int options
           
 boolean penSelectMode
          If this is true then pen presses act as if CONTROL is always pressed.
 
Fields inherited from class ewe.ui.Menu
autoSelectFirst, border3D, defaultBackground, defaultUseScrollBarSize, dontSearchForKeys, followPen, keepFrame, myFrame, parentMenu, popupController, pressedItem, use3DPopup, useScrollBarSize, wasSelected
 
Fields inherited from class ewe.ui.ChoiceControl
blockColor, blockSelected, calculateWidth, clipBuffer, container, dimRect, displayRows, dontAutoScroll, dropDownButton, dummyItem, firstItem, INDENT_ITEM_FLAG, indentDropItems, innerRect, isAList, isSingleLine, itemHeight, items, newClip, notifyDataChangeOnSelect, noWrapAround, selectedIndex, shortenItems, spacing, useMenuItems, xOffset, xShift
 
Fields inherited from class ewe.ui.Control
_debug, backGround, beforeRemoved, borderColor, borderStyle, borderWidth, children, columns, constraints, DoPaintMethod, dragging, dragResolution, dragTime, exitKeys, fieldTransfer, font, foreGround, haveNativePaint, height, holdDownPause, holdTick, hotKey, image, lastSelected, listeners, maxHeight, maxWidth, menuState, minHeight, minWidth, modifiers, MyClass, name, next, np, parent, penStatus, popupSound, popupSoundClip, preferredHeight, preferredWidth, prev, prompt, promptControl, rows, ss, standardBorder, standardEdge, startDragResolution, tags, tail, text, toolTip, width, x, y
 
Fields inherited from class ewe.ui.ControlBase
clipItems, clipObject, clipOwner, curPoint, currentPenEvent, debugControl, debugFlag, DidHoldDown, doubleBuffer, doubleClickTime, firstPress, globalDrawFlat, globalEditable, globalEnabled, globalPalmStyle, globalSmallControls, GotPenDown, PenIsOn, pressPoint, TAG_LAST_USER_DATA, TAG_USER_DATA, TAKE_FIRST_PRESS, unnamed, useNativeTextInput
 
Fields inherited from interface ewe.ui.IScroll
Higher, Horizontal, Lower, OPTION_INDICATOR_ONLY, PageHigher, PageLower, ScrollHigher, ScrollLower, TrackTo, Vertical
 
Fields inherited from interface ewe.ui.UIConstants
BDR_DOTTED, BDR_INNER, BDR_NOBORDER, BDR_OUTER, BDR_OUTLINE, BDR_RAISEDINNER, BDR_RAISEDOUTER, BDR_SUNKENINNER, BDR_SUNKENOUTER, BF_BOTTOM, BF_BOTTOMLEFT, BF_BOTTOMRIGHT, BF_BUTTON, BF_DIAGONAL, BF_DIAGONAL_ENDBOTTOMLEFT, BF_DIAGONAL_ENDBOTTOMRIGHT, BF_DIAGONAL_ENDTOPLEFT, BF_DIAGONAL_ENDTOPRIGHT, BF_EXACT, BF_FLAT, BF_LEFT, BF_MIDDLE, BF_MONO, BF_PALM, BF_RECT, BF_RIGHT, BF_SOFT, BF_SQUARE, BF_TOP, BF_TOPLEFT, BF_TOPRIGHT, EDGE_BUMP, EDGE_ETCHED, EDGE_RAISED, EDGE_SUNKEN
 
Fields inherited from interface ewe.ui.CellConstants
BORDER, BOTTOM, CELLFLAG, CELLMASK, CENTER, CONTROLMASK, DONTCHANGE, DONTFILL, DONTSTRETCH, EAST, FILL, FIXEDSIZE, GROW, HCENTER, HCONTRACT, HEXPAND, HFILL, HGROW, HSHRINK, HSTRETCH, INITIALLY_CLOSED, INITIALLY_MINIMIZED, INITIALLY_PREFERRED_SIZE, INSETS, LEFT, MAXIMUMSIZE, MINIMUMSIZE, NORTH, NORTHEAST, NORTHWEST, PREFERREDSIZE, RECT, RIGHT, SHRINK, SOUTH, SOUTHEAST, SOUTHWEST, SPAN, STRETCH, TEXTSIZE, TOP, VCENTER, VCONTRACT, VEXPAND, VFILL, VGROW, VSHRINK, VSTRETCH, WEST
 
Fields inherited from interface ewe.ui.ControlConstants
All, AlwaysEnabled, AlwaysRecalculateSizes, ByDeferredMouse, ByDeferredPen, ByFrameChange, ByKeyboard, ByMouse, ByPen, ByRequest, CalculatedSizes, Disabled, DisablePopupMenu, DisplayOnly, Down, DrawFlat, Flag, ForceResize, HasData, Invisible, KeepImage, KeepSIP, Left, MakeMenuAtLeastAsWide, Maximize, Minimize, MouseSensitive, NoFocus, NotAnEditor, NotEditable, PaintDataOnly, PaintOutsideOnly, PenTransparent, PreferredSizeOnly, Right, SendUpKeyEvents, SendUpPenEvents, ShowSIP, ShrinkToNothing, SmallControl, SpecialBackground, TakeControlEvents, TakesKeyFocus, Transparent, Up, WantDrag, WantHoldDown
 
Fields inherited from interface ewe.fx.ImageRefresher
KEEP_VISIBLE
 
Constructor Summary
BasicList()
           
BasicList(int rows, int columns, boolean multi)
           
 
Method Summary
protected  boolean allowNotOnMeSelection()
           
protected  void calculateSizes()
          Override this to calculate the preferred, minimum and maximum size of your control.
 int countListItems()
          Count the number of list items.
 int countSelectedIndexes()
          Returns the number of items that are currently selected.
 void dragged(DragContext dc)
          This is called during the drag operation.
abstract  Object[] getListItems()
          Get all the list items.
 ScrollablePanel getScrollablePanel()
           
abstract  int getSelectedIndex(int selectedIndexIndex)
          This returns one of the selected index.
abstract  int[] getSelectedIndexes()
          Get a list of all the currently selected items as an array of indexes.
 void gotFocus(int how)
           
abstract  boolean isSelected(int index)
          Checks if an item is selected.
 void onKeyEvent(KeyEvent ev)
           
 void penClicked(Point p)
          Called if the Pen or Mouse button is quickly pressed and released.
 void penDoubleClicked(Point where)
          Called if the Pen or Mouse button is double clicked on the Control.
 void penPressed(Point p)
          Called when the Pen or Mouse button is pressed on the control.
 void penReleased(Point p)
          Called when the Pen or Mouse button is released on the control.
protected  void pressedNewSelected(int oldSel)
           
protected  void releasedOnNothing()
           
abstract  void selectAll(boolean select)
          This either selects all the items (select == true) or none of the items (select = false).
 boolean selectAndView(int row)
          This selects the item at the specified row (index) exclusively and then ensures that it is visible.
abstract  void setListItems(Object[] items)
          Set the list items.
abstract  void setSelectedIndexes(int[] indexes)
          Set which indexes should be selected.
 
Methods inherited from class ewe.ui.Menu
canGo, canScreenScroll, close, doActionKey, doDropMenu, doMenu, doScroll, exec, getActual, getCarrierFrame, getCarrierFrame, getCurrent, getItemRect, getMenuWidth, getTextRect, getVisible, needScrollBar, noMenu, onEvent, onPenEvent, postEvent, postEventNormally, selectNewItem, trySubMenu, updateItems, whichItem
 
Methods inherited from class ewe.ui.ChoiceControl
addItem, addItems, addSection, centerSelected, changeItem, changeModifiers, checkOnlyOne, deleteItem, doPaint, doPaintData, findItem, findKeyed, getBlockColor, getDataRect, getDisplayRows, getDisplayString, getInt, getItemAt, getItemHeight, getItemToAdd, getMenuHeight, getMenuWidth, getScreenRows, getSelectedItem, getText, indexOf, insertItemAt, itemIsVisible, itemsSize, make, makeItemVisible, makeVisible, modifyItems, notifySelection, paintBox, paintItem, paintItem, refresh, removeAll, repaintItem, select, select, selectItem, selectItem, selectItems, selectNext, selectOrUnselect, selectPrev, setData, setInt, setText, trySelectItem
 
Methods inherited from class ewe.ui.Control
acceptsData, activate, addListener, addTimer, amOnTopFrame, calculateTextSize, cancelCut, cancelHoldDown, canEdit, chainDataChange, change, checkClipboardOperations, checkExitKey, checkMenu, checkMenuKey, checkModifiers, checkPenTransparent, clearTag, clipboardToString, clipboardTransfer, closeMenu, contains, contains, createGraphics, dataAccepted, dataBeingRemoved, dataDraggedOff, dataDraggedOver, dataDraggedOver, dataDroppedOn, dataTransferCancelled, deactivate, defaultTo, doAction, doBackground, doBorder, doHotKey, dontAcceptDrop, doPaintChildren, doPaintChildren, doPaintChildren, doPaintData, doShowMenu, exitEntry, fillBackground, formClosing, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getBackground, getChildren, getChildrenBackwards, getClipboardMenu, getClipObject, getControlBuffer, getControlBuffer, getDataToCopy, getDataToDragAndDrop, getDim, getDisplayText, getDragAndDropContext, getFont, getFontMetrics, getFontMetrics, getForeground, getFrame, getFrameOrContainer, getGraphics, getImage, getLastSelected, getLocation, getMaximumSize, getMenu, getMinimumSize, getModifiers, getNext, getNextKeyFocus, getParent, getPasswordCharacter, getPosInFrame, getPosInParent, getPreferredSize, getPrompt, getPromptText, getRect, getRect, getServer, getSize, getSizes, getSubControls, getTag, getToolTip, getWindow, hasModifier, hasPopupFormAttached, hasTag, inheritModifiers, isChildOf, isModal, isOnMe, isSomeonesHotKey, lostFocus, makeFrameTopMost, makeHot, menuIsActive, modify, modifyAll, modifyAll, notifyAction, notifyDataChange, notifyDataChange, notNative_doPaintChildren, oldButWorksDoPaintChildren, oldPaintChildren, oldPostEvent, onControlEvent, onLabelPenEvent, onPaint, paintBackground, paintChildren, penHeld, penRightReleased, popupBeep, popupMenuClosed, popupMenuEvent, popupMenuEvent, recalculatePreferredSize, redisplay, removeListener, removeTimer, repaint, repaintDataNow, repaintNow, repaintNow, repaintNow, requestPaint, requestResizeTo, resetRect, resizeTo, restore, scrollAndRepaint, sendToListeners, set, setBorder, setCell, setClipObject, setControl, setCursor, setFixedSize, setFont, setHotKey, setHotKey, setLocation, setMaximumSize, setMenu, setMinimumSize, setPreferredSize, setPromptControl, setRect, setRect, setServer, setTag, setTags, setTextSize, setToolTip, show, shown, standardOnKeyEvent, startDragAndDrop, startDragAndDrop, startDragging, stopDragging, takeData, takeFocus, takeFromClipboard, takePromptControl, testDim, ticked, toClipboard, toField, toField, toString, toTextData, transferPenPress, transferPenPress, tryDragAndDrop, tryNext, tryStartMenu, updateData, willAcceptDrop, willShowFrame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode
 
Methods inherited from interface ewe.data.ISimpleList
getListItem, itemIsVisible, makeItemVisible, updateItems
 
Methods inherited from interface ewe.data.IndexSelectable
select
 
Methods inherited from interface ewe.ui.ScrollClient
getServer, setServer
 

Field Detail

amScrolling

protected boolean amScrolling

multiSelect

public boolean multiSelect
This specifies whether the list allows multiple selections or not.


penSelectMode

public boolean penSelectMode
If this is true then pen presses act as if CONTROL is always pressed.


options

public int options

OPTION_CURSOR_EXIT_UP

public static final int OPTION_CURSOR_EXIT_UP
See Also:
Constant Field Values

OPTION_CURSOR_EXIT_DOWN

public static final int OPTION_CURSOR_EXIT_DOWN
See Also:
Constant Field Values

OPTION_CURSOR_EXIT_LEFT

public static final int OPTION_CURSOR_EXIT_LEFT
See Also:
Constant Field Values

OPTION_CURSOR_EXIT_RIGHT

public static final int OPTION_CURSOR_EXIT_RIGHT
See Also:
Constant Field Values

OPTION_SELECT_FIRST_ON_KEY_FOCUS

public static final int OPTION_SELECT_FIRST_ON_KEY_FOCUS
See Also:
Constant Field Values
Constructor Detail

BasicList

public BasicList()

BasicList

public BasicList(int rows,
                 int columns,
                 boolean multi)
Method Detail

allowNotOnMeSelection

protected boolean allowNotOnMeSelection()
Overrides:
allowNotOnMeSelection in class Menu

dragged

public void dragged(DragContext dc)
Description copied from class: Control
This is called during the drag operation. It is also called by default by the startDragging() method if you do not override it.

Overrides:
dragged in class Menu

releasedOnNothing

protected void releasedOnNothing()

penPressed

public void penPressed(Point p)
Description copied from class: Control
Called when the Pen or Mouse button is pressed on the control. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

Overrides:
penPressed in class Menu

penReleased

public void penReleased(Point p)
Description copied from class: Control
Called when the Pen or Mouse button is released on the control. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

Overrides:
penReleased in class Menu

penClicked

public void penClicked(Point p)
Description copied from class: Control
Called if the Pen or Mouse button is quickly pressed and released. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

By default this method simply calls the penReleased() method.

Overrides:
penClicked in class Control
Parameters:
p - The point on the Control where the pen was clicked.

penDoubleClicked

public void penDoubleClicked(Point where)
Description copied from class: Control
Called if the Pen or Mouse button is double clicked on the Control. This is called by the onPenEvent(PenEvent ev) method.

Within this method you can use the Control.currentPenEvent value to find out more about the PenEvent that caused this - including any modifiers (e.g. SHIFT keys) or determine if the left or right mouse button was pressed.

By default this method simply calls the penClicked() method.

Overrides:
penDoubleClicked in class Control
Parameters:
where - The point on the Control where the pen was double-clicked.

pressedNewSelected

protected void pressedNewSelected(int oldSel)
Overrides:
pressedNewSelected in class Menu

selectAll

public abstract void selectAll(boolean select)
This either selects all the items (select == true) or none of the items (select = false).


setSelectedIndexes

public abstract void setSelectedIndexes(int[] indexes)
Description copied from interface: IndexSelectable
Set which indexes should be selected. Any items not in this array will be deselected if they are currently selected. So if you call this with an int array of zero elements, this will have the effect of deselecting all indexes.

Specified by:
setSelectedIndexes in interface IndexSelectable
Parameters:
indexes - an array of integer indexes to be set as the selection.

getSelectedIndex

public abstract int getSelectedIndex(int selectedIndexIndex)
Description copied from interface: IndexSelectable
This returns one of the selected index. Say a list has items 2, 5 and 11 selected. Then calling countSelectedIndexes() will return a value of 3 - indicating 3 items are selected. Calling this method with indexOfSelectedIndex being 0 will return the value 2 which is the index of the first selected item. Calling this method with indexOfSelectedIndex being 1 will return the value 5 and calling with a parameter of 2 will return the value 11.

Specified by:
getSelectedIndex in interface IndexSelectable
Parameters:
selectedIndexIndex - which of the selected indexes to return.
Returns:
one of the selected indexes.

getSelectedIndexes

public abstract int[] getSelectedIndexes()
Description copied from interface: IndexSelectable
Get a list of all the currently selected items as an array of indexes. If no items are selected this will return an integer array with zero elements.

Specified by:
getSelectedIndexes in interface IndexSelectable
Returns:
a list of all the currently selected items as an array of indexes.

isSelected

public abstract boolean isSelected(int index)
Description copied from interface: IndexSelectable
Checks if an item is selected.

Specified by:
isSelected in interface IndexSelectable
Overrides:
isSelected in class ChoiceControl

countSelectedIndexes

public int countSelectedIndexes()
Description copied from interface: IndexSelectable
Returns the number of items that are currently selected.

Specified by:
countSelectedIndexes in interface IndexSelectable
Returns:
the number of items that are currently selected.

selectAndView

public boolean selectAndView(int row)
This selects the item at the specified row (index) exclusively and then ensures that it is visible.

Parameters:
row - The row to select exclusively.
Returns:
true always.

countListItems

public int countListItems()
Description copied from interface: ISimpleList
Count the number of list items.

Specified by:
countListItems in interface ISimpleList

getListItems

public abstract Object[] getListItems()
Description copied from interface: ISimpleList
Get all the list items.

Specified by:
getListItems in interface ISimpleList

setListItems

public abstract void setListItems(Object[] items)
Description copied from interface: ISimpleList
Set the list items.

Specified by:
setListItems in interface ISimpleList

calculateSizes

protected void calculateSizes()
Description copied from class: Control
Override this to calculate the preferred, minimum and maximum size of your control. This is only called once unless the modifier flag AlwaysRecalculateSizes is true. During the calculation you will set the variables preferredWidth, preferredHeight, etc. directly.

Overrides:
calculateSizes in class ChoiceControl

getScrollablePanel

public ScrollablePanel getScrollablePanel()

gotFocus

public void gotFocus(int how)
Overrides:
gotFocus in class Control

onKeyEvent

public void onKeyEvent(KeyEvent ev)
Overrides:
onKeyEvent in class Menu