waba.sys
Class Settings

java.lang.Object
  |
  +--waba.sys.Settings

public final class Settings
extends java.lang.Object

this class provides some preferences from PalmOS config and other Vm settings. All settings are read-only, unless otherwise specified. Changing their values may cause the VM to crash.


Field Summary
static boolean actionOnRelease
          When actionOnRelease is true (default), the IKeys.ACTION is dispatched when the user does a quick-press, and a IKeys.MENU is dispatched when the user holds the action for at least one second.
static java.lang.String appCreatorId
          Application creator ID.
static java.lang.String appPath
          The path from where the application is running from.
static java.lang.String appSecretKey
          Application defined secret key.
static java.lang.String appSettings
          Application defined settings.
static byte[] appSettingsBin
          Application defined settings, stored as a byte array.
static java.lang.String dataPath
          Specifies the directory where pdbs should be read/written.
static byte DATE_DMY
          Constant used in dateFormat: day month year
static byte DATE_MDY
          Constant used in dateFormat: month day year
static byte DATE_YMD
          Constant used in dateFormat: year month day
static byte dateFormat
          Can be one of the following constants: DATE_MDY, DATE_DMY, DATE_YMD; where m = month, d = day and y = year
static char dateSeparator
          The date char separator.
static boolean daylightSavings
          Returns true if the device is in daylight savings mode.
static char decimalSeparator
          The decimal separator for numbers
static java.lang.String deviceId
          Returns a device id that can be used to identify the device's name.
static byte Flat
          Defines a FLAT user interface style, like the ones used in Pocket PC 2003.
static boolean is24Hour
          True if the time format is 24 hour format or if it is the AM/PM format
static boolean isColor
          READ-ONLY variable that represents if the device supports color.
static boolean isHighColor
          Returns true if this device supports high or true color (or, in othe words, is not palletized).
static boolean keyboardFocusTraversable
          Defines if the arrow keys will be used to change the focus using the keyboard.
static boolean keypadOnly
          Returns true if this device has a keypad only (many SmartPhones have keypads only).
static int maxColors
          READ-ONLY variable that returns the number of colors supported by the device.
static boolean onDevice
          READ-ONLY variable that defines if were being runned in a handheld device or in a desktop computer.
static byte PalmOS
          Defines a PalmOS user interface style.
static boolean penless
          Deprecated. Use Settings.keyboardFocusTraversable instead.
static java.lang.String platform
          READ-ONLY variable that returns the current platform name.
static java.lang.String romSerialNumber
          Returns the ROM serial number for this device.
static int romVersion
          READ-ONLY variable that returns the ROM version of the device, like 0x02000000 or 0x03010000.
static int screenHeight
          READ-ONLY variable that represents the device's screen height
static int screenWidth
          READ-ONLY variable that represents the device's screen width
static boolean showSecrets
          Returns false if the PDA has a password and the user choosen to hide the secret records (via the Apps/Security/Current Privacy).
static char thousandsSeparator
          The thousands separator for numbers
static char timeSeparator
          The time char separator
static int timeZone
          Returns the timezone used for this device.
static byte uiStyle
          The uiStyle used to define the user interface style.
static boolean useExceptions
          Set this property to true to be able to use exceptions in the waba.* packages instead of checking for error codes of calling methods.
static java.lang.String userName
          READ-ONLY variable that returns the username of the user running the Virtual Machine.
static int version
          The version of the SuperWaba Virtual Machine.
static java.lang.String versionStr
          Returns the version in a string form, like "2.0b4r8"
static boolean virtualKeyboard
          True if this handheld has a virtual keyboard
static byte Vista
          Defines a Windows Vista user interface style.
static byte weekStart
          The week day start. 0 = sunday, 6 = saturday
static byte WinCE
          Defines a Windows CE user interface style.
 
Method Summary
static void setUIStyle(byte style)
          Changes the user interface style to the given one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateFormat

public static byte dateFormat
Can be one of the following constants: DATE_MDY, DATE_DMY, DATE_YMD; where m = month, d = day and y = year

dateSeparator

public static char dateSeparator
The date char separator.

weekStart

public static byte weekStart
The week day start. 0 = sunday, 6 = saturday

is24Hour

public static boolean is24Hour
True if the time format is 24 hour format or if it is the AM/PM format

timeSeparator

public static char timeSeparator
The time char separator

thousandsSeparator

public static char thousandsSeparator
The thousands separator for numbers

decimalSeparator

public static char decimalSeparator
The decimal separator for numbers

screenWidth

public static int screenWidth
READ-ONLY variable that represents the device's screen width

screenHeight

public static int screenHeight
READ-ONLY variable that represents the device's screen height

isColor

public static boolean isColor
READ-ONLY variable that represents if the device supports color.

maxColors

public static int maxColors
READ-ONLY variable that returns the number of colors supported by the device.

onDevice

public static boolean onDevice
READ-ONLY variable that defines if were being runned in a handheld device or in a desktop computer. Note that under Win32, onDevice is true.

romVersion

public static int romVersion
READ-ONLY variable that returns the ROM version of the device, like 0x02000000 or 0x03010000. In desktop, return the oldest version of the destination platform where SuperWaba can run.

platform

public static java.lang.String platform
READ-ONLY variable that returns the current platform name. The possible return values are: Java, PalmOS, PalmOS/SDL, WindowsCE, PocketPC, MS_SmartPhone, Win32, Symbian, Linux, Posix

userName

public static java.lang.String userName
READ-ONLY variable that returns the username of the user running the Virtual Machine. Because of Java's security model, this method will return null when called in a Java applet. This method will also return null under most WinCE devices (that will be fixed in a future release). In Windows 32, this will return the currently logged in user.

appSettingsBin

public static byte[] appSettingsBin
Application defined settings, stored as a byte array. If you set the value of this app to something other than null, the VM will save it when exiting and load it when restarting. Under PalmOS, the value is stored in the unsaved preferrences database, which is not backupped during hot-sync. Use this to save small amount of data, up to 2 or 4 kb maximum. At desktop, a file named settings4crtr.pdb stores the appSettingsBin for the current running SW programs. Here's a sample of how to use it:
  if (Settings.appSettingsBin == null)
  {
     add(new Label("empty"),CENTER,CENTER);
     ByteArrayStream bas = new ByteArrayStream(100);
     DataStream ds = new DataStream(bas);
     ds.writeDouble(1234.567);
     Settings.appSettingsBin = bas.getCopy();
  }
  else
  {
     ByteArrayStream bas = new ByteArrayStream(Settings.appSettingsBin);
     DataStream ds = new DataStream(bas);
     double d = ds.readDouble();
     add(new Label("d = "+Convert.toString(d,3)),CENTER,CENTER);
     Settings.appSettingsBin = null;
  }         
 

appSettings

public static java.lang.String appSettings
Application defined settings. If you set the value of this app to something other than null, the VM will save it when exiting and load it when restarting. Under PalmOS, the value is stored in the unsaved preferrences database, which is not backupped during hot-sync. Use this to save small strings, up to 2 or 4 kb maximum. At desktop, a file named settings4crtr.pdb stores the appSettings for the current running SW programs.

appSecretKey

public static java.lang.String appSecretKey
Application defined secret key. If you set the value of this app to something other than null, the VM will save it when exiting and load it when restarting. Under PalmOS, the value is stored in the saved preferrences database, which is backupped during hotsync. Use this to save small strings, up to 2 or 4 kb maximum. At desktop, a file named settings4crtr.pdb stores the appSettings for the current running SW programs. The String is stored in the saved preferrences with a creator id different of your application's (but calculated based in it), so it will never be deleted and will be restored even after a hard-reset.

In Windows CE, the key is stored in the registry.


appCreatorId

public static java.lang.String appCreatorId
Application creator ID. In desktop, it returns the automatically created Creator ID. In device, it will return the same or the one specified with /c option argument in Warp.

uiStyle

public static byte uiStyle
The uiStyle used to define the user interface style. It must be set by calling Settings.setUIStyle. The possible values are WinCE (default) and PalmOS.

version

public static int version
The version of the SuperWaba Virtual Machine. The major version is base 100. For example, version 1.0 has value 100. version 4 has a version value of 400. A beta 0.8 VM will have version 80. ps: Waba 1.0G will return 1.01. SuperWaba = 110 (1.1) and beyond.

versionStr

public static java.lang.String versionStr
Returns the version in a string form, like "2.0b4r8"

WinCE

public static final byte WinCE
Defines a Windows CE user interface style. Used in the uiStyle member. Note for grayscale devices: that WinCE user interfaces looks better with bright (non-white) background

PalmOS

public static final byte PalmOS
Defines a PalmOS user interface style. Used in the uiStyle member. Note for grayscale devices: PalmOS user interfaces looks better with white background

Flat

public static final byte Flat
Defines a FLAT user interface style, like the ones used in Pocket PC 2003. Used in the uiStyle member.

Vista

public static final byte Vista
Defines a Windows Vista user interface style. Used in the uiStyle member.

DATE_MDY

public static final byte DATE_MDY
Constant used in dateFormat: month day year

DATE_DMY

public static final byte DATE_DMY
Constant used in dateFormat: day month year

DATE_YMD

public static final byte DATE_YMD
Constant used in dateFormat: year month day

daylightSavings

public static boolean daylightSavings
Returns true if the device is in daylight savings mode. Note that this is not available in all devices. Only works in desktop, WinCE and Palm OS 4.0 or newer devices; in other devices will always return false.
Since:
SuperWaba 3.4

timeZone

public static int timeZone
Returns the timezone used for this device. This is the number of hours away from GMT (E.g.: for Brazil it will return -3). Only works in desktop, WinCE and Palm OS 4.0 or newer devices; in other devices will always return 0.
Since:
SuperWaba 3.4

virtualKeyboard

public static boolean virtualKeyboard
True if this handheld has a virtual keyboard

dataPath

public static java.lang.String dataPath
Specifies the directory where pdbs should be read/written. Used in desktop when:
  1. Running under Win32 VM. Can be specified anywhere.
  2. Running under JDK, as application (java.exe). Can also be specified with the /dataPath commandline parameter.
Some warnings:
Since:
SuperWaba 4.11 (Win32) and 2.0beta4 (JDK)

romSerialNumber

public static java.lang.String romSerialNumber
Returns the ROM serial number for this device. Important!: don't rely only on this information to uniquely identify a device! Its very easy to change this number, and it won't be available in all devices. It will contain null if unavailable, such as in Windows CE 2.11 devices, Palm OS < 3.0, and even some Palm OS 5 devices, like Treo 6xx.

Note: this was correctly tested; you can ensure that your Palm OS device has or not a serial number pressing App/Info/Version: the serial number will appear in the top; if nothing appears, it means that the device doesn't has a serial number. If it appears but nothing is returned from here, it means that the device has a non-standard function that retrieves the serial number, and thus we don't support it.

Since:
SuperWaba 4.21

showSecrets

public static boolean showSecrets
Returns false if the PDA has a password and the user choosen to hide the secret records (via the Apps/Security/Current Privacy). Returns true in all other cases. Specific for Palm OS (Windows CE does not let the user hide records). This can be used to let the Operating System do the login for a program that requires privacy.
Since:
SuperWaba 4.21

isHighColor

public static boolean isHighColor
Returns true if this device supports high or true color (or, in othe words, is not palletized).
Since:
SuperWaba 4.21

penless

public static boolean penless
Deprecated. Use Settings.keyboardFocusTraversable instead.

Returns true if this device has no pen. When this occurs, the MainWindow's constructor sets keyboardFocusTraversable to true.
Since:
SuperWaba 5.5

keypadOnly

public static boolean keypadOnly
Returns true if this device has a keypad only (many SmartPhones have keypads only). On such devices, presses in the 1-9 and *# pops up the KeyPad class (used in phones without alpha keys). You can set keypadOnly to enable/disable the the KeyPad popup. The disabling occurs everytime a non-digit is pressed.
Since:
SuperWaba 5.7

keyboardFocusTraversable

public static boolean keyboardFocusTraversable
Defines if the arrow keys will be used to change the focus using the keyboard. Note that some controls will behave differently. It will be true for pen less devices, and it may be changed if your application wants to use it.
Since:
SuperWaba 5.5

deviceId

public static java.lang.String deviceId
Returns a device id that can be used to identify the device's name. For Palm OS devices, see: http://www.mobilegeographics.com/dev/devices.php and http://homepage.mac.com/alvinmok/palm/codenames.html. For Pocket PC devices, it will return the device's name. For Win32 VM, it will return the computer name. If the device can't be identified, it will contain null.

useExceptions

public static boolean useExceptions
Set this property to true to be able to use exceptions in the waba.* packages instead of checking for error codes of calling methods. Note that all new exceptions extend the java.lang.Error, which is an UNCHECKED EXCEPTION. In this way, it is not explicitly required by the compiler to do a try/catch in your code, maintaining compatibility with older versions, but the exception may be thrown anyway.
Since:
SuperWaba 5.8

appPath

public static java.lang.String appPath
The path from where the application is running from. In Palm OS devices, it will be null. This is the default location where the Catalogs are created. This is a read-only property: changing it will have no effect.
See Also:
dataPath
Since:
SuperWaba 5.81

actionOnRelease

public static boolean actionOnRelease
When actionOnRelease is true (default), the IKeys.ACTION is dispatched when the user does a quick-press, and a IKeys.MENU is dispatched when the user holds the action for at least one second. Set this to false on games only, when you want to dispatch the ACTION event when the key is pressed, otherwise it will be impossible to open the menu in penless devices.
Since:
SuperWaba 5.82
Method Detail

setUIStyle

public static void setUIStyle(byte style)
Changes the user interface style to the given one. This method must be called in the MainWindow's constructor. E.g.:
 public class Foo extends MainWindow
 {
    public Foo()
    {
       super("Hi bar",TAB_ONLY_BORDER);
       waba.sys.Settings.setUIStyle(waba.sys.Settings.FLAT);
 
Parameters:
style - Can be PalmOS, WinCE or Flat. If PalmOS, uses a white background.
Since:
SuperWaba 5.05