ewe.ui
Class ListEditor

java.lang.Object
  extended byewe.ui.ControlBase
      extended byewe.ui.Control
          extended byewe.ui.Container
              extended byewe.ui.Canvas
                  extended byewe.ui.Panel
                      extended byewe.ui.CellPanel
                          extended byewe.ui.FormBase
                              extended byewe.ui.Form
                                  extended byewe.ui.Editor
                                      extended byewe.ui.ListEditor
All Implemented Interfaces:
CellConstants, ControlConstants, EventListener, FieldListener, HasProperties, ImageRefresher, IScroll, LayoutManager, ScrollClient, TimerProc, UIConstants

public class ListEditor
extends Editor


Field Summary
static IImage bottomIcon
           
 boolean confirmDelete
           
 MenuItem contextMenuItem
           
 Editor defaultEditor
           
static int DELETE_BUTTON
           
 MenuItem deleteMenu
           
 Editor display
           
static IImage downIcon
           
static int EDIT_BUTTON
           
static IImage editIcon
           
 Editor editor
           
 boolean editorOnTop
           
 String itemName
          This is the name of the item being edited.
 Vector items
          These are the items being edited.
 mList list
          This is the list of items.
 int listColumns
           
 int listRows
           
 String listTitle
           
 Object model
           
static int NEW_BUTTON
           
 MenuItem newMenu
           
static int TOOL_BUTTON
           
 MenuItem toolMenuItem
           
 Menu toolsMenu
           
static int TOPBOTTOM_BUTTONS
           
static IImage topIcon
           
static int UPDOWN_BUTTONS
           
static IImage upIcon
           
 boolean useSplittablePanel
           
 boolean vSplit
          If a splittable panel is used, this says if the two sections are vertically layed out.
 
Fields inherited from class ewe.ui.Editor
coroutineStackSize, currentEvent, DoDataTransfer, fieldListeners, fieldsWillNotBeAdded, myObject, objectClass, sampleObject, transfers
 
Fields inherited from class ewe.ui.Form
acceptsDroppedFiles, apply, back, buttons, BUTTONS_TO_SOFT_KEY_FIRST_BUTTON_SEPARATE, BUTTONS_TO_SOFT_KEY_MENU_ALWAYS, BUTTONS_TO_SOFT_KEY_USE_FIRST_SOFT_KEY, buttonsPanel, buttonsPerRow, cancel, deflt, dismantleOnClose, exitButtonDefined, exitSystemOnClose, exitValue, firstFocus, formFrame, globalIcon, handle, hasTopBar, keepFrame, moveable, no, noBorder, ok, pl, reset, resizable, resizeOnSIP, taskbarIcon, title, titleCancel, titleControls, titleOK, topControls, untitledTitle, windowFlagsToClear, windowFlagsToSet, windowIcon, windowTitle, yes
 
Fields inherited from class ewe.ui.FormBase
BACKB, CANCELB, close, cross, defaultShowOptions, DEFCANCELB, DEFOKB, EXIT_IDBACK, EXIT_IDCANCEL, EXIT_IDNO, EXIT_IDOK, EXIT_IDYES, IDBACK, IDCANCEL, IDNO, IDOK, IDYES, MBB, MBNONE, MBOK, MBOKCANCEL, MBYESNO, MBYESNOCANCEL, NOB, OKB, stop, tick, tools, YESB
 
Fields inherited from class ewe.ui.CellPanel
autoSpan, equalHeights, equalWidths, layout, mySplitter, nextSplitter, quickRecalculate
 
Fields inherited from class ewe.ui.Panel
all, backgroundImage, calculated, childListeners, defaultAddToMeCellConstraints, defaultTags, grid, lastAdded, layoutManager, made, noInsets, stretchFirstColumn, stretchFirstRow, stretchLastColumn, stretchLastRow, titleGap
 
Fields inherited from class ewe.ui.Canvas
isFullScrollClient, origin, scrollPercent, virtualSize
 
Fields inherited from class ewe.ui.Container
closedFocus, cycleFocus, dontAutoScroll, dontFocusOnChildren
 
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.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.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.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
ListEditor()
           
ListEditor(LiveData forWhat, int display, int editor, int defaultEditor, boolean vertical, int buttons)
           
ListEditor(Object forWhat, boolean vertical, int buttons)
           
 
Method Summary
 void action(FieldTransfer ft, Editor ed)
          This implements the action() method in FieldListener.
 void action(String name, Editor ed)
          This gets called by action(FieldTransfer ft,Editor ed) and by fieldChanged(FieldTransfer ft,Editor ed) if the field changed is a menu item.
protected  mButton addButton(CellPanel addTo, boolean vertical, IImage mi, String title, String field)
           
protected  mButton addButton(CellPanel addTo, boolean vertical, String image, String title, String field)
           
 void doAddNew(Object toAdd)
          This adds a new item as if the user had pressed the New Item button.
 void doAddNew(Object toAdd, int index, boolean doNotify)
          This adds a new item as if the user had pressed the New Item button.
 void doDelete(int idx, boolean doNotify)
           
 void doEdit(int idx)
           
 void doStandardSetup(boolean verticalToolBar, int buttons, Editor toDisplay, Editor toEdit, Editor defaultEditor)
           
protected  boolean execEditor(Object toEdit, Editor editor)
           
 void fieldChanged(FieldTransfer ft, Editor ed)
          This implements the fieldChanged() method in FieldListener.
 void fieldEvent(FieldTransfer ft, Editor ed, Object event)
          This implements fieldEvent() in FieldListener.
 void getData(Object obj)
          Get the list of items.
 Editor getEditor(Object ld, int editor)
           
 Object getItem(int index)
          Get the item at the specified index.
 int getItemCount()
          Get the number of items.
 String getNameFor(Object item)
          Get the name for the item.
 Object getNewObject()
           
 CellPanel getToolBar(boolean vertical, int buttons)
           
 Object getToPutInList(Object item)
           
 void itemsChanged(boolean doNotify, int select)
           
static void main(String[] args)
           
 void make(boolean reMake)
          This is used to "make" the control before being displayed.
 void nameChanged(int idx)
          This should be called if an item has its display name changed.
protected  void newSelected(int idx)
           
 void setData(Object what)
          Set the list of items.
protected  void shift(int idx, int dx)
           
 void shown()
           
 
Methods inherited from class ewe.ui.Editor
addExternalField, addExternalField, addField, addField, addField, canExit, dataChanged, dataChanged, dismantle, enableScrolling, fieldChanged, findControlFor, findFields, findFieldTransfer, findFieldTransfer, findFieldTransfer, fireFieldChanged, fireFieldEvent, fireFieldEvent, formClosing, fromControls, fromControls, fromControls, fromControls, getFileSaver, handleTransferError, modifyFields, onControlEvent, onDataChangeEvent, postEditorEvent, setFields, setFileSaver, setObject, toControls, toControls, toControls, toControls, transfer, transfer
 
Methods inherited from class ewe.ui.Form
_getSetField, addButton, addTabbedPanel, addToolbar, buttonsToMenu, buttonsToSoftKeyBar, buttonsToSoftKeyBar, cancelWait, checkButtons, close, closeAll, closeForTransfer, closeForTransfer, continueWait, createMenuItem, createMenuItem, createMenuItem, createWindow, defaultTitleTo, doButtons, doShowExec, exec, exec, exec, exec, exec, exec, exec, exec, exec, execute, execute, execute, exit, filesDropped, formShown, gatherButtons, getButton, getFirstFocus, getFormFrame, getProperties, getSoftKeyBarFor, getTopmostForm, handleAction, handleAction, hasExitButton, makeButtonForForm, makeButtonForForm, makeDefaultButton, makeDefaultButton, makeFrame, makeMenuItemForForm, makeMenuItemForForm, makeSoftKeys, makeSoftKeys, mb, menuItemSelected, modifyForSmartPhone, onEvent, onSoftKey, placeCancelOnLeft, removeSoftKeyBarFor, setOKCancel, setSoftKeyBarFor, setSoftKeyBarForAll, setTitle, setTopLevelTitle, setupFrame, show, show, show, show, show, show, showWait, stopFormHandle, toolsOnBottom, waitUntilClosed, waitUntilClosed, waitUntilClosed, waitUntilClosed, waitUntilPainted
 
Methods inherited from class ewe.ui.CellPanel
calculateSizes, makeLayoutGrid, relayout, relayoutMe, removeAll, reShow, resize, resizeTo
 
Methods inherited from class ewe.ui.Panel
add, addChildListener, addDirectly, addLast, addLast, addNext, addNext, addNext, doBackground, doBorder, endRow, getControlTag, getPreferredSize, getSubControls, isEmpty, layout, remove, removeChildListener, sendToChildListeners, setText
 
Methods inherited from class ewe.ui.Canvas
canGo, canScreenScroll, checkScrolls, doScroll, fixOrigin, getActual, getBuffer, getCurrent, getDisplayedSize, getMySize, getPercent, getScrollablePanel, getScrollClient, getVisible, getVisibleArea, needScrollBar, onScroll, onSetOrigin, reduceClip, scroll, scroll, scrollToVisible, setOrigin, updateScrollServer
 
Methods inherited from class ewe.ui.Container
_paintChildren, add, containerHasFocus, dismantle, doHotKey, findChild, focusFirst, focusFirst, focusOnContainer, focusOnData, getChildren, getChildrenBackwards, getNextKeyFocus, gotFocus, lostFocus, repaintDataNow, takeFocus, takePromptControl
 
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, doActionKey, doMenu, dontAcceptDrop, doPaint, doPaintChildren, doPaintChildren, doPaintChildren, doPaintData, doPaintData, doShowMenu, dragged, exitEntry, fillBackground, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getBackground, getClipboardMenu, getClipObject, getControlBuffer, getControlBuffer, getDataRect, getDataToCopy, getDataToDragAndDrop, getDim, getDisplayText, getDragAndDropContext, getFont, getFontMetrics, getFontMetrics, getForeground, getFrame, getFrameOrContainer, getGraphics, getImage, getLastSelected, getLocation, getMaximumSize, getMenu, getMinimumSize, getModifiers, getNext, getParent, getPasswordCharacter, getPosInFrame, getPosInParent, getPreferredSize, getPrompt, getPromptText, getRect, getRect, getServer, getSize, getSizes, getTag, getText, getToolTip, getWindow, hasModifier, hasPopupFormAttached, hasTag, inheritModifiers, isChildOf, isModal, isOnMe, isSomeonesHotKey, makeFrameTopMost, makeHot, menuIsActive, modify, modifyAll, modifyAll, notifyAction, notifyDataChange, notifyDataChange, notNative_doPaintChildren, oldButWorksDoPaintChildren, oldPaintChildren, oldPostEvent, onKeyEvent, onLabelPenEvent, onPaint, onPenEvent, paintBackground, paintChildren, penClicked, penDoubleClicked, penHeld, penPressed, penReleased, penRightReleased, popupBeep, popupMenuClosed, popupMenuEvent, popupMenuEvent, postEvent, recalculatePreferredSize, redisplay, refresh, removeListener, removeTimer, repaint, repaintNow, repaintNow, repaintNow, requestPaint, requestResizeTo, resetRect, 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, standardOnKeyEvent, startDragAndDrop, startDragAndDrop, startDragging, stopDragging, takeData, takeFromClipboard, 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.ui.ScrollClient
getServer, setServer
 

Field Detail

items

public Vector items
These are the items being edited.


confirmDelete

public boolean confirmDelete

upIcon

public static IImage upIcon

downIcon

public static IImage downIcon

topIcon

public static IImage topIcon

bottomIcon

public static IImage bottomIcon

editIcon

public static IImage editIcon

model

public Object model

itemName

public String itemName
This is the name of the item being edited.


list

public mList list
This is the list of items.


UPDOWN_BUTTONS

public static final int UPDOWN_BUTTONS
See Also:
Constant Field Values

TOPBOTTOM_BUTTONS

public static final int TOPBOTTOM_BUTTONS
See Also:
Constant Field Values

DELETE_BUTTON

public static final int DELETE_BUTTON
See Also:
Constant Field Values

NEW_BUTTON

public static final int NEW_BUTTON
See Also:
Constant Field Values

EDIT_BUTTON

public static final int EDIT_BUTTON
See Also:
Constant Field Values

TOOL_BUTTON

public static final int TOOL_BUTTON
See Also:
Constant Field Values

listTitle

public String listTitle

toolsMenu

public Menu toolsMenu

newMenu

public MenuItem newMenu

deleteMenu

public MenuItem deleteMenu

toolMenuItem

public MenuItem toolMenuItem

contextMenuItem

public MenuItem contextMenuItem

vSplit

public boolean vSplit
If a splittable panel is used, this says if the two sections are vertically layed out.


display

public Editor display

editor

public Editor editor

defaultEditor

public Editor defaultEditor

useSplittablePanel

public boolean useSplittablePanel

editorOnTop

public boolean editorOnTop

listRows

public int listRows

listColumns

public int listColumns
Constructor Detail

ListEditor

public ListEditor()

ListEditor

public ListEditor(LiveData forWhat,
                  int display,
                  int editor,
                  int defaultEditor,
                  boolean vertical,
                  int buttons)

ListEditor

public ListEditor(Object forWhat,
                  boolean vertical,
                  int buttons)
Method Detail

getEditor

public Editor getEditor(Object ld,
                        int editor)

setData

public void setData(Object what)
Set the list of items. The what parameter must be a Vector or an Object[]. If it is a Vector, then the "items" field is set to it - otherwise a new Vector is created to hold all the elements of the array and that is assigned to "items".

Overrides:
setData in class Editor

getData

public void getData(Object obj)
Get the list of items. The what parameter must be a Vector. The Vector is first cleared and then all the items in the "items" field is copied into it.

Overrides:
getData in class Editor

getItemCount

public int getItemCount()
Get the number of items.


getItem

public Object getItem(int index)
Get the item at the specified index.

Parameters:
index - The index of the item to get.
Returns:
The item at the index.

getNameFor

public String getNameFor(Object item)
Get the name for the item. By default if it is a LiveData, it will return getName(), otherwise it will return item.toString();


getToPutInList

public Object getToPutInList(Object item)

make

public void make(boolean reMake)
Description copied from class: Control
This is used to "make" the control before being displayed. This is usually only overridden by containers.

Overrides:
make in class Editor

addButton

protected mButton addButton(CellPanel addTo,
                            boolean vertical,
                            String image,
                            String title,
                            String field)

addButton

protected mButton addButton(CellPanel addTo,
                            boolean vertical,
                            IImage mi,
                            String title,
                            String field)

getToolBar

public CellPanel getToolBar(boolean vertical,
                            int buttons)

doStandardSetup

public void doStandardSetup(boolean verticalToolBar,
                            int buttons,
                            Editor toDisplay,
                            Editor toEdit,
                            Editor defaultEditor)

itemsChanged

public void itemsChanged(boolean doNotify,
                         int select)

newSelected

protected void newSelected(int idx)

shown

public void shown()
Overrides:
shown in class Editor

getNewObject

public Object getNewObject()

nameChanged

public void nameChanged(int idx)
This should be called if an item has its display name changed.


doDelete

public void doDelete(int idx,
                     boolean doNotify)

execEditor

protected boolean execEditor(Object toEdit,
                             Editor editor)

doEdit

public void doEdit(int idx)

doAddNew

public void doAddNew(Object toAdd,
                     int index,
                     boolean doNotify)
This adds a new item as if the user had pressed the New Item button.

Parameters:
toAdd - The object to add.
index - The index to put the new object in. If it is -1 then it is added to the end.
doNotify - If this is true then a standard DataChanged event is generated.

doAddNew

public void doAddNew(Object toAdd)
This adds a new item as if the user had pressed the New Item button.

Parameters:
toAdd - The object to add.

shift

protected void shift(int idx,
                     int dx)

action

public void action(FieldTransfer ft,
                   Editor ed)
Description copied from class: Editor
This implements the action() method in FieldListener. By default it calls action(String name,Editor ed)

Specified by:
action in interface FieldListener
Overrides:
action in class Editor

action

public void action(String name,
                   Editor ed)
Description copied from class: Editor
This gets called by action(FieldTransfer ft,Editor ed) and by fieldChanged(FieldTransfer ft,Editor ed) if the field changed is a menu item. By default it will look for a method called void _action(Editor ed) and if it finds it, it will be executed.

Overrides:
action in class Editor

fieldEvent

public void fieldEvent(FieldTransfer ft,
                       Editor ed,
                       Object event)
Description copied from class: Editor
This implements fieldEvent() in FieldListener. By default it does nothing.

Specified by:
fieldEvent in interface FieldListener
Overrides:
fieldEvent in class Editor

fieldChanged

public void fieldChanged(FieldTransfer ft,
                         Editor ed)
Description copied from class: Editor
This implements the fieldChanged() method in FieldListener. If the field is of type MenuItem then action(String fieldName,Editor ed) method is called - where fieldName is set to be the "action" value for the MenuItem.

Specified by:
fieldChanged in interface FieldListener
Overrides:
fieldChanged in class Editor

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception