ewe.ui
Class SaveableEditor
java.lang.Object
ewe.ui.ControlBase
ewe.ui.Control
ewe.ui.Container
ewe.ui.Canvas
ewe.ui.Panel
ewe.ui.CellPanel
ewe.ui.FormBase
ewe.ui.Form
ewe.ui.Editor
ewe.ui.SaveableEditor
- All Implemented Interfaces:
- CellConstants, ControlConstants, EventListener, FieldListener, HasProperties, ImageRefresher, IScroll, LayoutManager, ScrollClient, TimerProc, UIConstants
- public class SaveableEditor
- extends Editor
A SaveableEditor is designed to hold another editor and then allow you to open and
save to disk the object being edited. There are two ways to use a SaveableEditor:
The simplest way is to use the constructor SaveableEditor(LiveData ld,boolean isList).
This constructor creates a SaveableEditor that has full file functionality using an editor
returned by ld.getEditor(0) (the object's default editor). If isList is true, then a
ListEditor will be used and you will be able to edit and save a complete list of the data.
This method works in exactly the same way as if you had run the command line:
ewe ewe.ui.SaveableEditor -list mypackage.MyObjectName
The other way to use a SaveableEditor is to extend it and in the constructor, after calling the
super class constructor, you do the following:
- You place either the "fileButtons" bar in the editor or the "fileMenu" pull-down menu
in the editor.
- You set the default file extension in the file saver by calling saver.setDefaultFileType("*.mask","Description")
or you replace the saver.
If you call processArgs() it will process the command line arguments, which allows for the automatic loading
of a data value.
| 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, YESB |
| 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.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.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 |
|
Constructor Summary |
SaveableEditor(LiveData ld)
This calls SaveableEditor(LiveData model,Editor editor) with a null editor. |
SaveableEditor(LiveData ld,
boolean isList)
This is the constructor to use to produce a default implementation of SaveableEditor. |
SaveableEditor(LiveData model,
Editor editor)
This method calls the setup(LiveData model,Editor editor) method. |
SaveableEditor(LiveData model,
int whichEditor)
This calls SaveableEditor(model, model.getEditor(whichEditor)). |
|
Method Summary |
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. |
void |
addFileControls(boolean buttonsOnTop)
If the screen is big this will add the file buttons to either the top or bottom of the editor. |
void |
addFileControls(CellPanel whereIfBig,
CellPanel whereIfSmall,
boolean menuOnly)
This adds the File controls. |
void |
defaultSetup(LiveData ld,
boolean isList)
|
static void |
main(String[] args)
|
void |
processArgs()
|
protected void |
setup(LiveData model,
Editor editor)
This will build the fileMenu menu and the fileButtons toolbar, but does not add them
into the SaveableEditor - you must do that yourself. |
| Methods inherited from class ewe.ui.Editor |
action, addExternalField, addExternalField, addField, addField, addField, canExit, dataChanged, dataChanged, dismantle, enableScrolling, fieldChanged, fieldChanged, fieldEvent, findControlFor, findFields, findFieldTransfer, findFieldTransfer, findFieldTransfer, fireFieldChanged, fireFieldEvent, fireFieldEvent, formClosing, fromControls, fromControls, fromControls, fromControls, getData, getFileSaver, handleTransferError, make, modifyFields, onControlEvent, onDataChangeEvent, postEditorEvent, setData, setFields, setFileSaver, setObject, shown, 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.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 |
model
public LiveData model
edited
public Editor edited
fileButtons
public CellPanel fileButtons
fileMenu
public PullDownMenu fileMenu
fileItem
public MenuItem fileItem
top
public CellPanel top
- This gets added to the top of the editor, before the main editor. It is initially empty, you can add to it
if you want.
tools
public CellPanel tools
contents
public CellPanel contents
SaveableEditor
public SaveableEditor(LiveData ld,
boolean isList)
- This is the constructor to use to produce a default implementation of SaveableEditor.
This implementation provides functionality for New, Open, Save, Save As and Exit.
After using this constructor you do not need to call any more SaveableEditor methods in order
to create a useable editor.
- Parameters:
ld - the LiveData object to edit.isList - set this true if you wish to edit a list of the data instead of just one.
SaveableEditor
public SaveableEditor(LiveData model,
int whichEditor)
- This calls SaveableEditor(model, model.getEditor(whichEditor)). After calling this method
you will have to add the fileMenu and/or the fileButtons as you need.
- Parameters:
model - the LiveData object to edit.
SaveableEditor
public SaveableEditor(LiveData ld)
- This calls SaveableEditor(LiveData model,Editor editor) with a null editor.
- Parameters:
ld - the LiveData object to edit.
SaveableEditor
public SaveableEditor(LiveData model,
Editor editor)
- This method calls the setup(LiveData model,Editor editor) method. setup()
will build the fileMenu menu and the fileButtons toolbar, but does not add them
into the SaveableEditor - you must do that yourself. Additionally, the editor itself
is not added into the SaveableEditor.
- Parameters:
model - the LiveData object to edit.editor - an editor for the model to use.
defaultSetup
public void defaultSetup(LiveData ld,
boolean isList)
setup
protected void setup(LiveData model,
Editor editor)
- This will build the fileMenu menu and the fileButtons toolbar, but does not add them
into the SaveableEditor - you must do that yourself. Additionally, the editor itself
is not added into the SaveableEditor.
- Parameters:
model - the LiveData object to edit.editor - an editor for the model to use.
processArgs
public void processArgs()
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
addFileControls
public void addFileControls(CellPanel whereIfBig,
CellPanel whereIfSmall,
boolean menuOnly)
- This adds the File controls. If the screen is big the buttons will
be added to whereIfBig, otherwise the menu will be added to whereIfSmall. If menuOnly
is true then only the menu will be added at the whereIfBig location, not the buttons.
addFileControls
public void addFileControls(boolean buttonsOnTop)
- If the screen is big this will add the file buttons to either the top or bottom of the editor. If the screen
is not big, the file menu will be added to the title bar.
main
public static void main(String[] args)