ewe.ui
Class AppForm

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.AppForm
All Implemented Interfaces:
CellConstants, ControlConstants, EventListener, FieldListener, HasProperties, ImageRefresher, IScroll, LayoutManager, ScrollClient, TimerProc, UIConstants
Direct Known Subclasses:
HtmlViewer, Notepad

public class AppForm
extends Editor

An AppForm is usually the best Form to use as your application's main Form. Especially when running on a mobile/PDA device. It provides an easy way to put together Menu Bars, Toolbars, and TabbedPanels in a way that is "device aware". That is to say, if your application is running on a PocketPC, it will place these controls on the bottom, in line with the SIP button (which is placed on the bottom right). When running on other platforms, these controls will be placed on the top.

After creating the AppForm add your controls, if any, to the "menus", "tools", "tabs" and "data" containers as necessary.


Field Summary
 MenuItem chosenMenuItem
          This will be used to determine which menu item was chosen.
 CellPanel data
          Put the data in here.
protected  boolean isAutoExpandingTabs
           
 MenuBar menus
          Place your menus here.
static int SHOW_EXIT_BUTTON
           
static int SHOW_NEW_BUTTON
           
static int SHOW_OPEN_BUTTON
           
static int SHOW_SAVE_AS_BUTTON
           
static int SHOW_SAVE_BUTTON
           
 mTabbedPanel tabs
          This is the tabbed panel (if selected in the constructor).
 CellPanel tools
          Place your tool buttons here.
 
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, 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
AppForm()
          Create a new AppForm() with no tabbed panels.
AppForm(boolean useTabs, boolean autoExpandingTabs)
          Create an AppForm that can optionally use tabs.
AppForm(Object objectToEdit)
          Create an AppForm that does not use tabs and is setup to edit a particular Object.
AppForm(Object objectToEdit, boolean useTabs, boolean autoExpandingTabs)
          Create an AppForm that can optionally use tabs.
AppForm(Object objectToEdit, boolean useTabs, boolean autoExpandingTabs, boolean placeMenuAndTools)
          Create an AppForm that can optionally use tabs.
 
Method Summary
 Card addExpandingTool(Control tool, IImage icon, String tabName)
           
 Card addExpandingTool(Control tool, String iconName, Object maskOrColor, String tabName)
           
 PullDownMenu addStandardFileMenu()
          This creates the file menu and adds it to the "menus" menu bar.
 PullDownMenu addStandardFileMenu(int toolButtons, String documentType)
          This creates the file menu and adds it to the "menus" menu bar, and places requested tools in the tools tool bar.
 mButton addToolButton(String fieldName, IImage icon, String toolTip, boolean addToTools)
          Create a tool button (one with an icon only, no text label) and optionally add it to the "tools" bar.
 mButton addToolButton(String iconName, Object maskOrColor, String toolTip)
          Create a tool button (one with an icon only, no text label) and add it to the "tools" bar.
static void getStandardFileCommands(Vector menuItems, Vector toolButtons, String documentType, Editor ed)
          The order these come in are "New","Open","Save","Save As","Exit" (with a separator MenuItem in between "Save As" and "Exit".
static Menu setupStandardFileCommands(Editor editor, int toolButtons, CellPanel toolLocation, String documentType)
          This creates the menu but does NOT add it to the Menu bar.
 Menu setupStandardFileCommands(int toolButtons, CellPanel toolLocation, String documentType)
          This creates the menu but does NOT add it to the Menu bar.
 
Methods inherited from class ewe.ui.Editor
action, 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, main, 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.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

menus

public MenuBar menus
Place your menus here.


tools

public CellPanel tools
Place your tool buttons here.


tabs

public mTabbedPanel tabs
This is the tabbed panel (if selected in the constructor).


data

public CellPanel data
Put the data in here.


chosenMenuItem

public MenuItem chosenMenuItem
This will be used to determine which menu item was chosen.


isAutoExpandingTabs

protected boolean isAutoExpandingTabs

SHOW_NEW_BUTTON

public static final int SHOW_NEW_BUTTON
See Also:
Constant Field Values

SHOW_OPEN_BUTTON

public static final int SHOW_OPEN_BUTTON
See Also:
Constant Field Values

SHOW_SAVE_BUTTON

public static final int SHOW_SAVE_BUTTON
See Also:
Constant Field Values

SHOW_SAVE_AS_BUTTON

public static final int SHOW_SAVE_AS_BUTTON
See Also:
Constant Field Values

SHOW_EXIT_BUTTON

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

AppForm

public AppForm()
Create a new AppForm() with no tabbed panels.


AppForm

public AppForm(Object objectToEdit)
Create an AppForm that does not use tabs and is setup to edit a particular Object.

Parameters:
objectToEdit - The object that will be edited.

AppForm

public AppForm(boolean useTabs,
               boolean autoExpandingTabs)
Create an AppForm that can optionally use tabs. If it does you can optionally specify auto-expanding tabs. The menus and tools controls will be created and automatically placed in the Form.

Parameters:
useTabs - set this true if you want to use tabs.
autoExpandingTabs - set this true if you want the tabs to be auto expanding.

AppForm

public AppForm(Object objectToEdit,
               boolean useTabs,
               boolean autoExpandingTabs)
Create an AppForm that can optionally use tabs. If it does you can optionally specify auto-expanding tabs. The menus and tools controls will be created and automatically placed in the Form.

Parameters:
objectToEdit - The object that will be edited - this can be null.
useTabs - set this true if you want to use tabs.
autoExpandingTabs - set this true if you want the tabs to be auto expanding.

AppForm

public AppForm(Object objectToEdit,
               boolean useTabs,
               boolean autoExpandingTabs,
               boolean placeMenuAndTools)
Create an AppForm that can optionally use tabs. If it does you can optionally specify auto-expanding tabs.

Parameters:
objectToEdit - The object that will be edited - this can be null.
useTabs - set this true if you want to use tabs.
autoExpandingTabs - set this true if you want the tabs to be auto expanding.
placeMenuAndTools - if this is true the menu and tools will be placed in the Form, otherwise they will be created but not added in - you must add it in somewhere yourself.
Method Detail

getStandardFileCommands

public static void getStandardFileCommands(Vector menuItems,
                                           Vector toolButtons,
                                           String documentType,
                                           Editor ed)
The order these come in are "New","Open","Save","Save As","Exit" (with a separator MenuItem in between "Save As" and "Exit".


addToolButton

public mButton addToolButton(String fieldName,
                             IImage icon,
                             String toolTip,
                             boolean addToTools)
Create a tool button (one with an icon only, no text label) and optionally add it to the "tools" bar.

Parameters:
fieldName - The name of the field for the button. If this is not null it will be added as a field of this AppForm. If it is null you will have to add it somewhere else.
icon - The icon for the button.
toolTip - The tool tip for the button.
addToTools - if this is true and "tools" is not null this will cause it to be added to tools.
Returns:
the button created.

addToolButton

public mButton addToolButton(String iconName,
                             Object maskOrColor,
                             String toolTip)
Create a tool button (one with an icon only, no text label) and add it to the "tools" bar.

Parameters:
iconName - The name of the icon. The ImageCache will be searched for it first.
maskOrColor - An optional mask Image name or transparent color for the image.
toolTip - the tip for the button.
Returns:
the created mButton.

addExpandingTool

public Card addExpandingTool(Control tool,
                             String iconName,
                             Object maskOrColor,
                             String tabName)
                      throws IllegalStateException
Throws:
IllegalStateException

addExpandingTool

public Card addExpandingTool(Control tool,
                             IImage icon,
                             String tabName)
                      throws IllegalStateException
Throws:
IllegalStateException

setupStandardFileCommands

public static Menu setupStandardFileCommands(Editor editor,
                                             int toolButtons,
                                             CellPanel toolLocation,
                                             String documentType)
This creates the menu but does NOT add it to the Menu bar. It also places the requested tool buttons in the toolLocation CellPanel.

Parameters:
editor - The Editor being added to.
toolButtons - A set of SHOW_XXX_BUTTON values ORed together.
toolLocation - The CellPanel to hold the tool buttons.
documentType - The name of the document.
Returns:
The Menu that you can add to the AppForms menu bar (or place it elsewhere).

setupStandardFileCommands

public Menu setupStandardFileCommands(int toolButtons,
                                      CellPanel toolLocation,
                                      String documentType)
This creates the menu but does NOT add it to the Menu bar. It also places the requested tool buttons in the toolLocation CellPanel.

Parameters:
toolButtons - A set of SHOW_XXX_BUTTON values ORed together.
toolLocation - The CellPanel to hold the tool buttons.
documentType - The name of the document.
Returns:
The Menu that you can add to the AppForms menu bar (or place it elsewhere).

addStandardFileMenu

public PullDownMenu addStandardFileMenu(int toolButtons,
                                        String documentType)
This creates the file menu and adds it to the "menus" menu bar, and places requested tools in the tools tool bar.

Parameters:
toolButtons - A set of SHOW_XXX_BUTTON values ORed together.
documentType - The name of the document.
Returns:
A PullDownMenu representing the File menu within the toolbar.

addStandardFileMenu

public PullDownMenu addStandardFileMenu()
This creates the file menu and adds it to the "menus" menu bar.

Returns:
A PullDownMenu representing the File menu within the toolbar.