Class 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.

    • Field Detail

      • conduitName

        protected java.lang.String conduitName
      • targetApplicationId

        protected java.lang.String targetApplicationId
      • targetAppPath

        protected java.lang.String targetAppPath
    • Constructor Detail

      • Conduit

        public Conduit​(java.lang.String conduitName,
                       java.lang.String targetApplicationId,
                       java.lang.String targetAppPath,
                       byte style)
        Creates a conduit with a title and a border. This is the only constructor that your MainWindow class may call.
    • 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.
        Overrides:
        initUI in class Container
      • onEvent

        public void onEvent​(Event e)
        Description copied from class: Control
        Called to process key, pen, control and other posted events.
        Overrides:
        onEvent in class Control
        Parameters:
        e - the event to process
        See Also:
        Event, KeyEvent, PenEvent
      • 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