Package totalcross.io.sync
Class Conduit
- java.lang.Object
-
- totalcross.ui.gfx.GfxSurface
-
- totalcross.ui.Control
-
- totalcross.ui.Container
-
- totalcross.ui.Window
-
- totalcross.ui.MainWindow
-
- totalcross.io.sync.Conduit
-
- All Implemented Interfaces:
MainClass
public abstract class Conduit extends MainWindow
This class allows you to automatically synchronize files between your device and the desktop. Currently it supports only WinCE and PalmOS devices, and desktops with Windows 2000+. It is also required that you have installed the synchronization software provided by the device manufacturer. (Refer to the TotalCross Companion for more details)This is the conduit's MainWindow. Two methods will be called at different times:
- doSync: when a synchronization begins.
- doConfig: when a setup (preferences) is asked by the user.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class totalcross.ui.Control
Control.TranslucentShape
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.StringconduitNameintsyncTargetDefines the target platform for synchronization.protected java.lang.StringtargetApplicationIdprotected java.lang.StringtargetAppPathstatic intTARGETING_ALLstatic intTARGETING_PALMOSstatic intTARGETING_WINCE-
Fields inherited from class totalcross.ui.MainWindow
firstTimer
-
Fields inherited from class totalcross.ui.Window
_controlEvent, _dragEvent, _focus, _keyEvent, _mouseEvent, _multiEvent, _penEvent, androidBorderThickness, beepIfOut, blocking, borderStyle, cancelPenUp, canDrag, dragThreshold, fadeOtherWindows, fadeValue, firstFocus, flickEnabled, focusOnPenUp, footerColor, footerH, gradientTitleEndColor, gradientTitleStartColor, headerColor, highlighted, highResPrepared, HORIZONTAL_GRADIENT, ignoreEventOfType, keyHook, lastShiftY, lastSwappedContainer, mainSwapContainer, menubar, multiTouching, needsPaint, NO_BORDER, ORIENTATION_INVERTED, ORIENTATION_LANDSCAPE, ORIENTATION_PORTRAIT, popped, RECT_BORDER, repaintOnSwap, robot, ROUND_BORDER, rTitle, sameBackgroundColor, shiftH, shiftY, SIP_BOTTOM, SIP_HIDE, SIP_SHOW, SIP_TOP, TAB_BORDER, TAB_ONLY_BORDER, tempTitle, title, titleAlign, titleColor, titleFont, titleGap, topMost, VERTICAL_GRADIENT, zStack
-
Fields inherited from class totalcross.ui.Container
alwaysEraseBackground, BACKGROUND_CYLINDRIC_SHADED, BACKGROUND_SHADED, BACKGROUND_SHADED_INV, BACKGROUND_SOLID, backgroundStyle, BORDER_LOWERED, BORDER_NONE, BORDER_RAISED, BORDER_ROUNDED, BORDER_SIMPLE, BORDER_TOP, borderColor, children, controlFound, finishedStart, ignoreOnAddAgain, ignoreOnRemove, insets, lastH, lastScreenWidth, lastW, npback, numChildren, started, tabOrder, tail, TRANSITION_CLOSE, TRANSITION_FADE, TRANSITION_NONE, TRANSITION_OPEN, TRANSITION_TIME, transitionEffect
-
Fields inherited from class totalcross.ui.Control
AFTER, alphaValue, appId, appObj, asContainer, asWindow, backColor, BEFORE, BOTTOM, BOTTOM_OF, BRIGHTER_BACKGROUND, callListenersOnAllTargets, CENTER, CENTER_OF, clearValueInt, clearValueStr, DARKER_BACKGROUND, DP, effect, enableUpdateScreen, esce, eventsEnabled, FILL, fillColor, FIT, floating, fm, fmH, focusHandler, focusLess, focusOnPenDown, focusTraversable, font, FONTSIZE, foreColor, height, ignoreInsets, isHighlighting, isTablet, KEEP, keepDisabled, keepEnabled, LEFT, next, nextTabControl, npParts, offscreen, offscreen0, onEventFirst, parent, PARENTSIZE, PARENTSIZEMAX, PARENTSIZEMIN, PREFERRED, prev, RANGE, repositionAllowed, RIGHT, RIGHT_OF, SAME, SCREENSIZE, SCREENSIZEMAX, SCREENSIZEMIN, setFont, setH, setRel, setW, setX, SETX_NOT_SET, setY, tempW, textShadowColor, TOP, translucentShape, transparentBackground, uiAdjustmentsBasedOnFontHeightIsSupported, uiAndroid, UICONST, uiFlat, uiHolo, uiMaterial, uiVista, visible, width, WILL_RESIZE, x, y
-
-
Constructor Summary
Constructors Constructor Description Conduit(java.lang.String conduitName, java.lang.String targetApplicationId, java.lang.String targetAppPath, byte style)Creates a conduit with a title and a border.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voiddoConfig()Called when the user wants to configure this conduit.protected abstract voiddoSync()Called when the synchronization is started.voidinitUI()A commandline parameter must be passed in order to invoke actions on this conduit:
/r{target platform} register conduit.
/u{target platform} unregister conduit.
/s{target platform} synchronize.
/c configure.
Where {target platform} may be one of the following:
p - targets PalmOS.
w - targets WinCE.
a - targets all supported platforms.static booleanisSyncingEnabled()Returns whether the conduit is enabled or not.static voidlog(java.lang.String text)When synchronizing Palm OS devices, logs the given text on the HotSync log.
When synchronizing Windows CE devices, the text is logged on the debug console instead.voidonEvent(Event e)Called to process key, pen, control and other posted events.protected voidonRegister()Called when the conduit is registered.protected voidonUnregister()Called when the conduit is unregistered.static voidsetConduitRect(int x, int y, int w, int h, boolean config)Sets the conduit's position and size when it is opened.static voidsetSyncingEnabled(boolean enable)Enables or disables the conduit execution.static voidyield()This method lets the conduit manager take a breath.-
Methods inherited from class totalcross.ui.MainWindow
_onMinimize, _onRestore, _onTimerTick, addTimer, addTimer, addTimer, addUpdateListener, appEnding, appStarting, exit, fillBackground, getClientRect, getCommandLine, getDefaultFont, getMainWindow, getScreenShot, initFirebaseInstanceIdService, initFirebaseMessagingService, isMainThread, minimize, onExit, onMinimize, onRestore, removeTimer, removeUpdateListener, restore, runOnMainThread, runOnMainThread, setDefaultFont, setRect, setUIStyle
-
Methods inherited from class totalcross.ui.Window
_doPaint, _postEvent, destroyZStack, drawHighlight, getBorderStyle, getClientRect, getDefaultDragThreshold, getFocus, getHighlighted, getPopupCount, getPreferredHeight, getPreferredWidth, getSafeAreaInsets, getTitleFont, getTopMost, handleFocusChangeKeys, isScreenShifted, isSipShown, isSipShown4D, isTopMost, isVisible, loadBehind, makeUnmovable, onClickedOutside, onPopup, onRobotKey, onUnpop, paintTitle, paintWindowBackground, popup, popupMenuBar, popupNonBlocking, postPopup, postPressedEvent, postUnpop, pumpEvents, removeFocus, repaintActiveWindows, resize, resizeHeight, resizeWidth, screenResized, setBorderStyle, setDeviceTitle, setFocus, setGrabPenEvents, setHighlighted, setMenuBar, setOrientation, setSIP, setTitle, setTitleFont, shiftScreen, swap, swapFocus, unpop, validate
-
Methods inherited from class totalcross.ui.Container
add, add, add, add, add, applyTransitionEffect, broadcastEvent, clear, fillBackground, findChild, findNearestChild, findNextFocusControl, getChildren, getChildrenCount, getFirstChild, getFocusableControls, getInsets, incLastX, incLastY, isPressed, moveFocusToNextControl, moveFocusToNextEditable, onAddAgain, onColorsChanged, onPaint, onRemove, onSwapFinished, paintChildren, remove, removeAll, setEnabled, setFocusTraversable, setHighlighting, setInsets, setNextTransitionEffect, setPressColor, setPressed, swapToTopmostWindow
-
Methods inherited from class totalcross.ui.Control
_onEvent, addEnabledStateListener, addFocusListener, addFontChangeHandler, addGridListener, addHandler, addHighlightListener, addKeyListener, addListContainerListener, addMouseListener, addMultiTouchListener, addPenListener, addPressListener, addPushNotificationListener, addSizeChangeHandler, addTimer, addTimer, addTimerListener, addValueChangeHandler, addWindowListener, bringToFront, changeHighlighted, contains, drawTranslucentBackground, getAbsoluteRect, getBackColor, getDoEffect, getEffectH, getEffectW, getEffectX, getEffectY, getEventListeners, getFont, getForeColor, getGap, getGraphics, getHeight, getNext, getParent, getParentWindow, getPos, getPressedEvent, getPrev, getRect, getSize, getTextShadowColor, getWidth, getX, getX2, getY, getY2, hadParentScrolled, handleGeographicalFocusChangeKeys, hasFocus, internalSetEnabled, intXYWH, isActionEvent, isChildOf, isDisplayed, isEnabled, isFloating, isInsideOrNear, isObscured, isVisibleAndInside, onBoundsChanged, onFontChanged, onWindowPaintFinished, post, postEvent, releaseScreenShot, removeEnabledStateListener, removeFocusListener, removeGridListener, removeHandler, removeHighlightListener, removeKeyListener, removeListContainerListener, removeMouseListener, removeMultiTouchListener, removePenListener, removePressListener, removePushNotificationListener, removeTimerListener, removeWindowListener, repaint, repaintNow, reposition, reposition, repositionChildren, requestFocus, resetSetPositions, resetStyle, safeRepaintNow, safeUpdateScreen, sendToBack, setBackColor, setBackForeColors, setDoEffect, setFloating, setFocusLess, setFont, setForeColor, setNinePatch, setNinePatch, setRect, setRect, setRect, setSet, setTextShadowColor, setTranslucent, setVisible, showTip, takeInitialScreenShot, takeScreenShot, translateFromOrigin, uiStyleChanged, updateScreen, updateTemporary, willOpenKeyboard
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface totalcross.MainClass
_postEvent
-
-
-
-
Field Detail
-
TARGETING_WINCE
public static final int TARGETING_WINCE
- See Also:
- Constant Field Values
-
TARGETING_PALMOS
public static final int TARGETING_PALMOS
- See Also:
- Constant Field Values
-
TARGETING_ALL
public static final int TARGETING_ALL
- See Also:
- Constant Field Values
-
syncTarget
public int syncTarget
Defines the target platform for synchronization. Note that changing this value has no effects.- See Also:
TARGETING_WINCE,TARGETING_PALMOS,TARGETING_ALL
-
conduitName
protected java.lang.String conduitName
-
targetApplicationId
protected java.lang.String targetApplicationId
-
targetAppPath
protected java.lang.String targetAppPath
-
-
Method Detail
-
initUI
public final void initUI()
A commandline parameter must be passed in order to invoke actions on this conduit:
/r{target platform} register conduit.
/u{target platform} unregister conduit.
/s{target platform} synchronize.
/c configure.
Where {target platform} may be one of the following:
p - targets PalmOS.
w - targets WinCE.
a - targets all supported platforms.
-
onEvent
public void onEvent(Event e)
Description copied from class:ControlCalled to process key, pen, control and other posted events.
-
log
public static void log(java.lang.String text)
When synchronizing Palm OS devices, logs the given text on the HotSync log.
When synchronizing Windows CE devices, the text is logged on the debug console instead.
-
yield
public static void yield()
This method lets the conduit manager take a breath. This is important, because the connection between the device and the desktop might be lost during long operations.
-
doSync
protected abstract void doSync()
Called when the synchronization is started. The whole synchronization done from this method.
-
doConfig
protected abstract void doConfig()
Called when the user wants to configure this conduit.
-
setSyncingEnabled
public static void setSyncingEnabled(boolean enable)
Enables or disables the conduit execution.Note that disabling a conduit is NOT the same as unregistering.
-
isSyncingEnabled
public static boolean isSyncingEnabled()
Returns whether the conduit is enabled or not.
-
setConduitRect
public static void setConduitRect(int x, int y, int w, int h, boolean config)Sets the conduit's position and size when it is opened. You can remove the window from screen by using a x value like 10000. Default values are -2,-2,240,320. You should call this method in the onRegister method, inherited by your conduit.
This is a sample that sets the screen size to be the same of "/scr palmhi" when running on the desktop:setConduitRect(-2,-2,320,320,false);
- Parameters:
x- Absolute position on screen, or -1 to use default, or -2 to center.y- Absolute position on screen, or -1 to use default, or -2 to center.w- The width of the window (usually 240 or 320)h- The height of the window (usually 320)config- If true, you are passing the bounds for when the config is being called; if false, is the bounds used when synchronizing.- Since:
- TotalCross 1.01
-
onRegister
protected void onRegister()
Called when the conduit is registered. Placeholder, does nothing by default.- Since:
- TotalCross 1.01
-
onUnregister
protected void onUnregister()
Called when the conduit is unregistered. Placeholder, does nothing by default.- Since:
- TotalCross 1.01
-
-