ewe.ui
Class SimpleList

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

public abstract class SimpleList
extends BasicList

This is the base class for creating a List control that represents a list of data that is not necessarily stored in a Vector. This should be used when the list data is large and it would be memory inefficient to keep the entire list in memory.

You create a SimpleList by implementing specific key methods, which are used to determine the number of items, and what String should be used to represent a particular item.

This List avoids ever having to traverse the entire list of data for any operation, and so should work properly for any size list.


Field Summary
protected static Point buff
           
protected  RangeList selectedItems
           
 
Fields inherited from class ewe.ui.BasicList
amScrolling, multiSelect, OPTION_CURSOR_EXIT_DOWN, OPTION_CURSOR_EXIT_LEFT, OPTION_CURSOR_EXIT_RIGHT, OPTION_CURSOR_EXIT_UP, OPTION_SELECT_FIRST_ON_KEY_FOCUS, options, penSelectMode
 
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
SimpleList()
           
SimpleList(int rows, int columns, boolean multi)
           
 
Method Summary
 void changeItem(int index, Object newText)
          This repaints the item at the particular index.
 int countSelectedIndexes()
          Returns the number of items that are currently selected.
abstract  String getDisplayItem(int idx)
          Return the String used to represent the item at a particular index on screen.
 MenuItem getItemAt(int idx)
           
abstract  int getItemCount()
          Get the number of items in the list.
 Object getListItem(int idx)
          Get the Object at the list index.
 Object[] getListItems()
          Get all the list items.
abstract  Object getObjectAt(int idx)
          Return an Object representing the item at a particular index.
 int getSelectedIndex(int selectedIndexIndex)
          This returns one of the selected index.
 int[] getSelectedIndexes()
          Get a list of all the currently selected items as an array of indexes.
 Object getSelectedItem()
           
 boolean isSelected(int index)
          Checks if an item is selected.
 int itemsSize()
          This returns getItemCount().
 void listChanged()
           
 void selectAll(boolean select)
          This either selects all the items (select == true) or none of the items (select = false).
 void selectItem(int index, boolean selected)
          Select or deselect a particular item.
 void selectItems(int start, int end, boolean selected)
          Select or deselect a range of items.
 void setListItems(Object[] items)
          Set the list items.
 void setSelectedIndexes(int[] all)
          Set which indexes should be selected.
 
Methods inherited from class ewe.ui.BasicList
allowNotOnMeSelection, calculateSizes, countListItems, dragged, getScrollablePanel, gotFocus, onKeyEvent, penClicked, penDoubleClicked, penPressed, penReleased, pressedNewSelected, releasedOnNothing, selectAndView
 
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, changeModifiers, checkOnlyOne, deleteItem, doPaint, doPaintData, findItem, findKeyed, getBlockColor, getDataRect, getDisplayRows, getDisplayString, getInt, getItemHeight, getItemToAdd, getMenuHeight, getMenuWidth, getScreenRows, getText, indexOf, insertItemAt, itemIsVisible, make, makeItemVisible, makeVisible, modifyItems, notifySelection, paintBox, paintItem, paintItem, refresh, removeAll, repaintItem, select, select, selectItem, 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
itemIsVisible, makeItemVisible, updateItems
 
Methods inherited from interface ewe.data.IndexSelectable
select
 
Methods inherited from interface ewe.ui.ScrollClient
getServer, setServer
 

Field Detail

selectedItems

protected RangeList selectedItems

buff

protected static Point buff
Constructor Detail

SimpleList

public SimpleList()

SimpleList

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

getDisplayItem

public abstract String getDisplayItem(int idx)
Return the String used to represent the item at a particular index on screen.

Parameters:
idx - The index of the item to display.
Returns:
A String used to represent the item at a particular index on screen.

getListItem

public Object getListItem(int idx)
Description copied from interface: ISimpleList
Get the Object at the list index.


getObjectAt

public abstract Object getObjectAt(int idx)
Return an Object representing the item at a particular index. This can be any type of Object. It is not used for display purposes - getDisplayItem is used for this.

Parameters:
idx - The index of the item to retrieve.
Returns:
An Object used to represent the item at a particular index.

getItemCount

public abstract int getItemCount()
Get the number of items in the list.

Returns:
the number of items in the list.

itemsSize

public int itemsSize()
This returns getItemCount().

Overrides:
itemsSize in class ChoiceControl

getItemAt

public MenuItem getItemAt(int idx)
Overrides:
getItemAt in class ChoiceControl

getSelectedItem

public Object getSelectedItem()
Overrides:
getSelectedItem in class ChoiceControl

listChanged

public void listChanged()

selectItems

public void selectItems(int start,
                        int end,
                        boolean selected)
Select or deselect a range of items.

Overrides:
selectItems in class ChoiceControl
Parameters:
start - The first item in the range (inclusive).
end - The last item in the range (inclusive).
selected - true to select the items, false to remve the items.

selectItem

public void selectItem(int index,
                       boolean selected)
Select or deselect a particular item.

Overrides:
selectItem in class ChoiceControl
Parameters:
index - The item to select or deselect.
selected - true to select the item, false to deselect it.

countSelectedIndexes

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

Specified by:
countSelectedIndexes in interface IndexSelectable
Overrides:
countSelectedIndexes in class BasicList

getSelectedIndexes

public 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
Specified by:
getSelectedIndexes in class BasicList

isSelected

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

Specified by:
isSelected in interface IndexSelectable
Specified by:
isSelected in class BasicList

selectAll

public void selectAll(boolean select)
Description copied from class: BasicList
This either selects all the items (select == true) or none of the items (select = false).

Specified by:
selectAll in class BasicList

setSelectedIndexes

public void setSelectedIndexes(int[] all)
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
Specified by:
setSelectedIndexes in class BasicList

getSelectedIndex

public 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
Specified by:
getSelectedIndex in class BasicList

changeItem

public void changeItem(int index,
                       Object newText)
This repaints the item at the particular index.

Overrides:
changeItem in class ChoiceControl

getListItems

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

Specified by:
getListItems in interface ISimpleList
Specified by:
getListItems in class BasicList

setListItems

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

Specified by:
setListItems in interface ISimpleList
Specified by:
setListItems in class BasicList