|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--waba.sys.Vm
Vm contains various system level methods.
This class contains methods to copy arrays, obtain a timestamp, sleep and get platform and version information.
Field Summary | |
static boolean |
actionEqualsMenu
Internal use only |
static int |
interceptSystemKey
Only available at desktop. used internally. |
static int |
SK_ACTION
used as constant that can be 'or'ed in the interceptSystemKeys method. |
static int |
SK_ALL
used as constant that can be 'or'ed in the interceptSystemKeys method. |
static int |
SK_CALC
used as constant that can be 'or'ed in the interceptSystemKeys method |
static int |
SK_FIND
used as constant that can be 'or'ed in the interceptSystemKeys method |
static int |
SK_HARD1
used as constant that can be 'or'ed in the interceptSystemKeys method. |
static int |
SK_HARD2
used as constant that can be 'or'ed in the interceptSystemKeys method. |
static int |
SK_HARD3
used as constant that can be 'or'ed in the interceptSystemKeys method. |
static int |
SK_HARD4
used as constant that can be 'or'ed in the interceptSystemKeys method. |
static int |
SK_LAUNCH
used as constant that can be 'or'ed in the interceptSystemKeys method |
static int |
SK_NONE
used as constant that can be 'or'ed in the interceptSystemKeys method |
static int |
SK_PAGE_DOWN
This one also can be used in the getSystemKeysPressed method. |
static int |
SK_PAGE_LEFT
used as constant that can be 'or'ed in the interceptSystemKeys method. |
static int |
SK_PAGE_RIGHT
used as constant that can be 'or'ed in the interceptSystemKeys method. |
static int |
SK_PAGE_UP
This one also can be used in the getSystemKeysPressed method. |
Method Summary | |
static boolean |
attachLibrary(String name)
Attaches a library to this application instance. |
static boolean |
attachNativeLibrary(String name)
Attaches a native library to this application instance (only works at device). |
static void |
clipboardCopy(String s)
copies the specific string to the clipboard |
static String |
clipboardPaste()
gets the last string from the clipboard. if none, returns "". |
static boolean |
copyArray(Object srcArray,
int srcStart,
Object dstArray,
int dstStart,
int length)
Copies the elements of one array to another array. |
static void |
debug(String s)
sends a text to the "SuperWaba Debug Console" memo, preceeded with the current time stamp and followed by a line feed. |
static int |
exec(String command,
String args,
int launchCode,
boolean wait)
Executes a command. |
static void |
gc()
Calls the Garbage Collector. |
static int |
getDeviceFreeMemory()
returns the free memory in the device. |
static int |
getSystemKeysPressed()
Gets the current keys being pressed. |
static int |
getTimeElapsed(int now,
int before)
Deprecated. The wrapping will only occur after more than 12 days of continuous program run. Since this is something unlike to occur in a PDA, you can safely subtract one timeStamp by the other. This method will be removed in further releases, so if your program can run without exiting for more than 12 days, copy this method to your program and use it. |
static int |
getTimeStamp()
Returns a time stamp in milliseconds. |
static void |
interceptSystemKeys(int keys)
Specify which system keys to intercept. use the SK_xxx constants ored together. eg: interceptSystemKeys(HARD1 | HARD2 | FIND) . |
static int |
setDeviceAutoOff(int seconds)
Sets the device's "auto-off" time. |
static void |
sleep(int millis)
Causes the VM to pause execution for the given number of milliseconds. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
toString,
wait,
wait |
Field Detail |
public static final int SK_PAGE_UP
public static final int SK_PAGE_DOWN
public static final int SK_HARD1
public static final int SK_HARD2
public static final int SK_HARD3
public static final int SK_HARD4
public static final int SK_LAUNCH
public static final int SK_FIND
public static final int SK_CALC
public static final int SK_ACTION
public static final int SK_ALL
public static final int SK_NONE
public static final int SK_PAGE_LEFT
public static final int SK_PAGE_RIGHT
public static int interceptSystemKey
public static boolean actionEqualsMenu
Method Detail |
public static boolean copyArray(Object srcArray, int srcStart, Object dstArray, int dstStart, int length)
srcArray
- the array to copy elements fromsrcStart
- the starting position in the source arraydstArray
- the array to copy elements todstStart
- the starting position in the destination arraylength
- the number of elements to copypublic static int getTimeElapsed(int now, int before)
public static int getTimeStamp()
public static int exec(String command, String args, int launchCode, boolean wait)
As an example, the following call could be used to run the command "scandir /p mydir" under Java, Win32 or WinCE:
int result = Vm.exec("scandir", "/p mydir", 0, true);This example executes the Scribble program under PalmOS:
Vm.exec("Scribble", null, 0, false);This example executes the web clipper program under PalmOS, telling it to display a web page by using launchCode 54 (CmdGoToURL).
Vm.exec("Clipper", "http://www.yahoo.com", 54, true);The args parameter passed to this method is the arguments string to pass to the program being executed.
The launchCode parameter is only used under PalmOS. Under PalmOS, it is the launch code value to use when the Vm calls SysUIAppSwitch(). If 0 is passed, the default launch code (CmdNormalLaunch) is used to execute the program.
The wait parameter passed to this method determines whether to execute the command asynchronously. If false, then the method will return without waiting for the command to complete execution. If true, the method will wait for the program to finish executing and the return value of the method will be the value returned from the application under Java, Win32 and WinCE.
Under PalmOS, the wait parameter is ignored since executing another program terminates the running program.
Note: this method kills all running threads.
command
- the command to executeargs
- command argumentslaunchCode
- launch code for PalmOS applicationswait
- whether to wait for the command to complete execution before returningpublic static int setDeviceAutoOff(int seconds)
public static void sleep(int millis)
millis
- time to sleep in millisecondspublic static int getDeviceFreeMemory()
public static void gc()
public static void interceptSystemKeys(int keys)
interceptSystemKeys(HARD1 | HARD2 | FIND)
. You can also use SK_ALL or SK_NONE as parameter. Note that the constants differ from the ones in IKeys. in the event handler, you must check for the IKeys values (eg: IKeys.HARD1).public static void debug(String s)
public static void clipboardCopy(String s)
public static String clipboardPaste()
public static boolean attachLibrary(String name)
Note: this method only attaches SuperWaba Local Extension Libraries, ie, files that have the app's creator id and type 'SWAX'. You may also specify another creator id to the name by adding it like "name.crtr". This make possible the use of a local library in another programs (eg: libA used by progB and progC). In the dekstop you must use "name.crtr", otherwise the library will not be loaded.
After a library is added, its file cannot be modified.
To see what libraries are in the device, you can use Catalog.listCatalogs() and check the files that has type 'SWAX'.
At the desktop, you may attach a library to load an image stored in a Catalog.
public static boolean attachNativeLibrary(String name)
public static int getSystemKeysPressed()
SK_PAGE_UP
,
SK_PAGE_DOWN
,
SK_PAGE_LEFT
,
SK_PAGE_RIGHT
,
SK_ACTION
,
SK_HARD1
,
SK_HARD2
,
SK_HARD3
,
SK_HARD4
,
interceptSystemKeys(int)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |