ewe.io
Class SyncApp

java.lang.Object
  extended byewe.ui.ControlBase
      extended byewe.ui.Control
          extended byewe.ui.Container
              extended byewe.ui.Window
                  extended byewe.ui.MainWindow
                      extended byewe.ui.mApp
                          extended byewe.io.SyncApp
All Implemented Interfaces:
CellConstants, ControlConstants, EventListener, FieldListener, HasProperties, ImageRefresher, ISurface, Runnable, TimerProc, UIConstants, WindowConstants

public abstract class SyncApp
extends mApp

This is a class which does all the "hard" work to get the mobile and desktop sides of an application connected. It allows you to use the EweSync Emulator when developing and testing your application, and then move smoothly to the real EweSync. In order for it to work correctly you must follow these steps.

 1. Create a new directory for your application (e.g. MyApp).
 2. Create a classes subdirectory within this application (e.g. MyApp/classes)
 3. Place all your applications classes and packages within this classes directory.
 4. When running the desktop side of your application do:
 ewe /d ./ myDesktopAppClass
 5. When running the mobile side of your application do:
 ewe /d ./ /r myMobileAppClass
 

The '/r' option tells the ewe VM to act as if it were running on a mobile pc. You will have to ensure that the mobile and desktop applications do not conflict when running at the same time. Probably best done by keeping the data in different directories.

To synchronize over the Emulator you will have to write a class which inherits from SyncApp and then implement mobileConnected() and desktopConnected(). To run the synch app over the emulator you would run:

ewe /d ./ mySyncApp

Where mySyncApp has inherited from SyncApp. Running this will cause it to automatically run mySyncApp again, but this time with the '/r' option. Once both are running a connection will be made and the mobileConnected() method gets called on the app run with /r and the desktopConnected() gets called on the original app.

Once you are statisfied that the synchronization is working correctly on the desktop, you are ready to move it to the mobile and test the synchronization over a true Desktop-Mobile connection. To do this your mySyncApp class must set the "remoteApp" member in its constructor. This should be set to the full path of the location of the application ewe file on the mobile. This will get called when the sync application starts on the desktop.

Next create your ewe file to hold your application (e.g. MyApp.ewe). Put your ewe file in the application directory on the desktop. Then also put it on the mobile in the directory which you specified as in "remoteApp" described above.

Now, in order to synchronize, you must make sure that your mobile is connected and the true EweSync is running. In order to synchronize you must now run:

ewe mySyncApp MyApp.ewe

This should then connect across the EweSync connection. If there are any problems, an error message box will be displayed.


Nested Class Summary
 
Nested classes inherited from class ewe.ui.Window
Window.TaskBarIconInfo
 
Field Summary
protected  int connectTimeout
           
 boolean isMobile
           
protected  String remoteApp
           
protected  boolean remoteAppIsEwe
           
protected  String remoteParameters
           
protected  String serviceName
           
 boolean usingClasses
           
 
Fields inherited from class ewe.ui.mApp
appFrame, checkMonochrome, counterRotated, guiFont, lastEvent, mainApp, mainMethod, monoMode, myGraphics, platform, programArguments, ROTATE_CLOCKWISE, ROTATE_COUNTER_CLOCKWISE, ROTATE_NORMAL, rotated, runClass, runObject, taskbarIcon, taskbarWindow, tickTime, vmOptions, windowFlagsToClear, windowFlagsToSet, windowInitiallyVisible, windowRect, windowTitle
 
Fields inherited from class ewe.ui.MainWindow
defaultFont
 
Fields inherited from class ewe.ui.Window
_controlEvent, _keyEvent, _penEvent, _sipEvent, canDisplay, closeLock, contents, creationData, currentCursor, downPoint, dragAndDropCursor, dragAndDropData, dragAndDropSource, firstDisplay, inEventThread, inFront, lastWindow, wasPainted
 
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.fx.ISurface
IMAGE_SURFACE, PRINTERJOB_SURFACE, WINDOW_SURFACE
 
Fields inherited from interface ewe.ui.WindowConstants
FLAG_ALWAYS_ON_TOP, FLAG_CAN_MAXIMIZE, FLAG_CAN_MINIMIZE, FLAG_CAN_RESIZE, FLAG_DONT_CLEAR_BACKGROUND, FLAG_FULL_SCREEN, FLAG_HAS_CLOSE_BUTTON, FLAG_HAS_TASKBAR_ENTRY, FLAG_HAS_TITLE, FLAG_IS_DEFAULT_SIZE, FLAG_IS_ICONIZED, FLAG_IS_MODAL, FLAG_IS_VISIBLE, FLAG_MAIN_WINDOW_COUNTER_ROTATED, FLAG_MAIN_WINDOW_ROTATED, FLAG_MAXIMIZE, FLAG_MAXIMIZE_ON_PDA, FLAG_MINIMIZE, FLAG_RESTORE, FLAG_SHOW_SIP_BUTTON, FLAG_STATE_KNOWN, FLAG_VISIBLE_ON_TO_FRONT, GUI_FLAG_HAS_TASKBAR, GUI_FLAG_REVERSE_OK_CANCEL, INFO_ACCEPT_DROPPED_FILES, INFO_CLIENT_RECT, INFO_DROPPED_DATA, INFO_FLAGS_FOR_SIZE, INFO_FONT, INFO_GUI_FLAGS, INFO_NATIVE_WINDOW, INFO_PARENT_RECT, INFO_POSITION_IN_NATIVE_DRAWING_SURFACE, INFO_SCREEN_RECT, INFO_TASKBAR_ICON, INFO_TITLE, INFO_WINDOW_FLAGS, INFO_WINDOW_ICON, INFO_WINDOW_RECT, NATIVE_WINDOW_GET_CONTAINING_WINDOW, NATIVE_WINDOW_GET_DRAWING_SURFACE, OPTION_FLAG_CLEAR, OPTION_FLAG_SET, OPTION_TASKBAR_ICON_MODIFY_ICON, OPTION_TASKBAR_ICON_MODIFY_TIP, SPECIAL_MOUSE_CAPTURE, SPECIAL_MOUSE_MOVE, SPECIAL_MOUSE_RELEASE, SPECIAL_MOUSE_RESIZE, SPECIAL_RESTART_GUI, SPECIAL_ROTATE_SCREEN, STATE_MAXIMIZED, STATE_MINIMIZED, STATE_NORMAL, STATE_UNKNOWN
 
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
SyncApp()
           
 
Method Summary
protected abstract  void desktopConnected(Socket toMobile)
           
protected abstract  void mobileConnected(Socket toDesktop)
           
 void run()
           
 
Methods inherited from class ewe.ui.mApp
action, addFont, cancelTimer, canClose, canExit, changeMonoMode, closeMobileApp, doPaint, fieldChanged, fieldEvent, findFont, findFont, fontsChanged, fullSetup, getFonts, getGraphics, isLocked, onEvent, onStart, requestTick, requestTimer, rotateScreen, runApplet, runApplet, setRect, setRunObject, setup, setupFonts, setupMainWindow, show, showStartMessage, sizeToFit, startup, tryExit
 
Methods inherited from class ewe.ui.MainWindow
_onTimerTick, _setTimerInterval, addTimer, exit, getFontMetrics, getMainWindow, onExit, removeTimer
 
Methods inherited from class ewe.ui.Window
_doPaint, _postEvent, _textEvent, applicationToFront, appResized, beginDragAndDrop, beginDragAndDrop, captureAppKeys, centerWindow, centerWindow, checkSipCoverage, clearQueuedMoves, clearWindowFlags, close, closeWindow, create, createNativeWindow, damageRect, doPostEvent, doPostEvent, doSpecialOp, enterNativeDialog, exitNativeDialog, getActiveWindow, getContainingWindow, getFocus, getGuiInfo, getInfo, getNativeWindow, getOpenWindows, getProperties, getState, getTitle, getWindowFlags, getWindowRect, handleNativeMessage, handleSipEvent, iconPressed, inNativeInput, isCreated, mobileWindowEvent, nativeGetGuiInfo, nextMouseIsMove, releaseMouseCapture, resizeTo, setFocus, setIcon, setInfo, setState, setText, setTitle, setWindowFlags, setWindowRect, shutdown, shutdownAll, supportsMultiple, textInput, toFront, transferPenPress, tryWindow, waitUntilPainted, wantToHandle, windowToFront
 
Methods inherited from class ewe.ui.Container
_paintChildren, add, addDirectly, containerHasFocus, dismantle, dismantle, doHotKey, findChild, focusFirst, focusFirst, focusOnContainer, focusOnData, getChildren, getChildrenBackwards, getFirstFocus, getNextKeyFocus, gotFocus, lostFocus, remove, removeAll, repaintDataNow, scrollToVisible, takeFocus, takePromptControl
 
Methods inherited from class ewe.ui.Control
acceptsData, activate, addListener, addTimer, amOnTopFrame, calculateSizes, 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, doBackground, doBorder, doMenu, dontAcceptDrop, doPaintChildren, doPaintChildren, doPaintChildren, doPaintData, doPaintData, doShowMenu, dragged, exitEntry, fillBackground, formClosing, fromClipboard, fromField, fromField, getAllDescendants, getAllSubControls, getBackground, getClipboardMenu, getClipObject, getControlBuffer, getControlBuffer, getDataRect, getDataToCopy, getDataToDragAndDrop, getDim, getDisplayText, getDragAndDropContext, getFont, 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, getSubControls, getTag, getText, getToolTip, getWindow, hasModifier, hasPopupFormAttached, hasTag, inheritModifiers, isChildOf, isModal, isOnMe, isSomeonesHotKey, make, makeFrameTopMost, makeHot, menuIsActive, modify, modifyAll, modifyAll, notifyAction, notifyDataChange, notifyDataChange, notNative_doPaintChildren, oldButWorksDoPaintChildren, oldPaintChildren, oldPostEvent, onControlEvent, onKeyEvent, onLabelPenEvent, onPaint, onPenEvent, paintBackground, paintChildren, penClicked, penDoubleClicked, penHeld, penPressed, penReleased, penRightReleased, popupBeep, popupMenuClosed, popupMenuEvent, popupMenuEvent, postEvent, recalculatePreferredSize, redisplay, refresh, removeListener, 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, setServer, setTag, setTags, setTextSize, setToolTip, show, shown, 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
 

Field Detail

isMobile

public boolean isMobile

usingClasses

public boolean usingClasses

remoteAppIsEwe

protected boolean remoteAppIsEwe

remoteApp

protected String remoteApp

remoteParameters

protected String remoteParameters

connectTimeout

protected int connectTimeout

serviceName

protected String serviceName
Constructor Detail

SyncApp

public SyncApp()
Method Detail

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class mApp

mobileConnected

protected abstract void mobileConnected(Socket toDesktop)

desktopConnected

protected abstract void desktopConnected(Socket toMobile)