Class API


  extended by API

public class API

This class contains constants and functions that available on scripts globally, without any prefix.


Field Summary
static int AM
          Calendar 12-hour clock: morning
static int AM_PM
          Calendar field
static int ANIMATION_LINEAR
          Animation, linear interpolation
static int ANIMATION_QUAD
          Animation, quad interpolation
static int ANIMATION_SINE
          Animation, sine interpolation
static int ANY
          Input flags: Any input allowed
static int APRIL
          Calendar month of year
static int AUGUST
          Calendar month of year
static int BASELINE
          Vertical alignment flag
static int BLURRED
          Implicit action: Called by the system when focus leaves the widget
static int BOTTOM
          Vertical alignment flag
static int BROWSER_FAILED
          Phone does not support given url (protocol) or user declined the security prompt.
static int BROWSER_LATER
          Phone does not support multi-tasking, browser is opened after WidSets client is closed.
static int BROWSER_OK
          Browser was opened successfully.
static int CHANNEL_CLOSED
          Status code for channel handling.
static int CHANNEL_INFO_UPDATED
          Status code for channel handling.
static int CHANNEL_JOINED
          Status code for channel handling.
static int CHANNEL_LEFT
          Status code for channel handling.
static int CHANNEL_NOT_FOUND
          Status code for channel handling.
static int CHANNEL_OPENED
          Status code for channel handling.
static int CHANNEL_PROTOCOL_MISMATCH
          Status code for channel handling.
static int DATE
          Calendar field
static int DAY_OF_MONTH
          Calendar field
static int DAY_OF_WEEK
          Calendar field
static int DECEMBER
          Calendar month of year
static int DECIMAL
          Input flags: Field is number
static int DIMMED
          Shell and Popup flag: Indicates that a dimming layer should be applied on background before painting.
static int EMAILADDR
          Input flags: Field is email address
static int FACE_MONOSPACE
          Face of Font
static int FACE_PROPORTIONAL
          Face of Font
static int FACE_SYSTEM
          Face of Font
static int FEBRUARY
          Calendar month of year
static int FOCUS_CHANGED
          Implicit action: focused Component has changed
static int FOCUSABLE
          Component flag: Component is focusable
static int FOCUSED
          Implicit action: Called by the system when the focus enters the widget
static int FORMAT_DATE
          Calendar Format date as string according to current locale
static int FORMAT_DATETIME
          Calendar Format date and time as string according to current locale
static int FORMAT_TIME
          Calendar Format time as string according to current locale
static int FRIDAY
          Calendar day of week
static int HCENTER
          Horizontal alignment flag
static int HEXPAND
          Flag that only affects Components that have been placed on Flow and has preferredWidth = 0.
static int HLIMIT
          Flag that only affects Components that have been placed on Flow and has preferredWidth = 0.
static int HOUR
          Calendar field
static int HOUR_OF_DAY
          Calendar field
static int INITIAL_CAPS_SENTENCE
          Input flags: Suggests that first character of first word of sentence ought to be capitalized
static int INITIAL_CAPS_WORD
          Input flags: Suggests that first character of each word ought to be capitalized
static int IS_BINARY
          Value type: byte[]
static int IS_BINDING
          Value type: key-to-value binding
static int IS_BOOLEAN
          Value type: boolean
static int IS_INT
          Value type: int
static int IS_LIST
          Value type: Value[]
static int IS_NULL
          Value type: null
static int IS_STRING
          Value type: String
static int ITEM_CANCEL
          Implicit action: contents of an NativeInput has not changed
static int ITEM_CHANGED
          Implicit action: contents of an Component has changed
static int JANUARY
          Calendar month of year
static int JULY
          Calendar month of year
static int JUNE
          Calendar month of year
static int KEY_BACK
          Key code: Back/Cancel soft key
static int KEY_BACKSPACE
          Key code: backspace
static int KEY_CR
          Key code: carriage return
static int KEY_DELETE
          Key code: delete
static int KEY_DOWN
          Key code: down arrow
static int KEY_ENTER
          Key code: line feed
static int KEY_ESC
          Key code: escape
static int KEY_FIRE
          Key code: fire
static int KEY_LEFT
          Key code: left arrow
static int KEY_OK
          Key code: OK soft key
static int KEY_PRESSED
          Key action type: key was pressed.
static int KEY_RELEASED
          Key action type: key was released.
static int KEY_REPEATED
          Key action type: key was repeated.
static int KEY_RIGHT
          Key code: right arrow
static int KEY_TAB
          Key code: tabulator
static int KEY_UP
          Key code: up arrow
static int LEFT
          Horizontal alignment flag
static int LINEFEED
          Component flag: Component is followed by a linefeed
static int MARCH
          Calendar month of year
static int MARK_READ
          Explicit action: Called by the system suggesting that all the "items" on widget should be marked read, if applicable
static int MATH_SCALE
          Scale of integer math (32768).
static int MAY
          Calendar month of year
static int MEMBER_JOINED
          Status code for membership handling.
static int MEMBER_LEFT
          Status code for membership handling.
static int MEMBER_UPDATED
          Status code for membership handling.
static int MILLISECOND
          Calendar field
static int MINUTE
          Calendar field
static int MONDAY
          Calendar day of week
static int MONTH
          Calendar field
static int NON_PREDICTIVE
          Input flags: Non predictive input mode should be used
static int NOVEMBER
          Calendar month of year
static int NUMERIC
          Input flags: Numeric input allowed
static int OCTOBER
          Calendar month of year
static int ONE_LINE
          Input flags: Input field does not expand beyound one line
static int OPAQUE
          Shell and Popup flag: Indicates that shell is fully opaque and therefore the underlying shell need not be painted as a background.
static int OPEN_HELP
          Explicit action: Called by the system suggesting that widget should load and show widget specific help page.
static int OPEN_HOME
          Explicit action: Called by the system suggesting that widget should open it's home page
static int OPEN_LINK
          Implicit action: user has activated an link
static int OPEN_MENU
          Implicit action: menu is to be opened.
static int OPEN_SETTINGS
          Explicit action: Called by the system suggesting that widget should open it's settings for editing
static int PASSWORD
          Input flags: Blind input (typed text shown as '*')
static int PHONENUMBER
          Input flags: Field is phone number
static int PM
          Calendar 12-hour clock: evening
static int RIGHT
          Horizontal alignment flag
static int SATURDAY
          Calendar day of week
static int SECOND
          Calendar field
static int SEND_WIDGET
          Explicit action: Called by the system suggesting that widget should be sent to other user
static int SENSITIVE
          Input flags: Indicates that the text entered is sensitive data that the implementation must never store for later use
static int SEPTEMBER
          Calendar month of year
static int SHELL_CLOSED
          Implicit action: Shell has been popped from shell stack.
static int SHELL_OPENED
          Implicit action: Shell has been pushed and computed on shell stack
static int SIZE_LARGE
          Size of Font
static int SIZE_MEDIUM
          Size of Font
static int SIZE_SMALL
          Size of Font
static int SOFTKEY_BACK
          Back/Cancel soft key indicator.
static int SOFTKEY_MIDDLE
          Middle soft key indicator.
static int SOFTKEY_OK
          OK soft key indicator.
static int STYLE_BOLD
          Style of Font
static int STYLE_ITALIC
          Style of Font
static int STYLE_PLAIN
          Style of Font
static int STYLE_UNDERLINED
          Style of Font
static int SUNDAY
          Calendar day of week
static int THURSDAY
          Calendar day of week
static int TOP
          Vertical alignment flag
static int TUESDAY
          Calendar day of week
static int URL
          Input flags: Field is URL
static int VCENTER
          Vertical alignment flag
static int VIEWPORT_CHANGED
          Implicit action: Viewport of Scrollable has changed.
static int VISIBLE
          Component flag: Component is visible
static int WEDNESDAY
          Calendar day of week
static int WIDGET_CLOSED
          Explicit action: Sent to dashboard indicating that the widget has been closed
static int WRAP
          Component flag: Automatic linefeed as necessary
static int YEAR
          Calendar field
 
Method Summary
 int abs(int i)
          Returns the absolute value of an int value.
 long abs(long i)
          Returns the absolute value of an long value.
 void call(Object state, String service, String action, Value argument)
          Calls a server side service.
 void call(Object state, String service, String action, Value argument, SuccessCallback onSuccess, FailureCallback onFailure)
          Calls a server side service.
 void call(Object state, String serviceVersionAction, Value argument, SuccessCallback onSuccess, FailureCallback onFailure)
          Calls a server side service anonymously.
 void callSerially(Runnable runnable)
          Executes specified operation later, by placing it into the user interface event queue.
 int cos(int a)
          Returns the trigonometric cosine of an angle.
 View createMaximizedView(String name, Object context)
          Deprecated. Use createView(String, Object) instead
 View createMinimizedView(String name, Object context)
           
 View createView(String name, Object context)
          Creates a view according to view specification on widget.xml file of this widget.
 long currentTimeMillis()
          Returns the current time in milliseconds.
 ByteArray decodeHex(String string)
          Decodes specified string into ByteArray, assuming it contains hexadecimal notation.
 String decodeString(ByteArray array, String encoding)
          Construct a new String by converting the specified array of bytes using the specified character encoding.
 void dumpTree(Component c)
          Prints component-tree of given component.
 String encodeHex(ByteArray array)
          Encodes specified array into hexadecimal notation.
 ByteArray encodeString(String string, String encoding)
          Converts the specified String into bytes according to the specified character encoding, storing the result into a new byte array.
 String encodeURL(String string)
          Encodes the specified string using url encoding.
 void flushScreen(boolean repaintAll)
          Repaints whole UI or selected components.
 String format$(String format)
          Creates a formatted string according to C-style %conventions.
 List getAvailableTimeZones()
          Gets all the available IDs supported.
 Config getConfig()
          Returns widget's config.
 TimeZone getDefaultTimeZone()
          Gets the default TimeZone for this host.
  int, int getDisplaySize()
          Returns total size of display, including menu-button area.
 Font getFont(int face, int style, int size)
          Returns the font object according to given parameters.
 Image getImage(ByteArray data)
          Creates an image from supplied .png encoded data.
 Image getImage(Store store, String name)
          Creates an image from .png encoded data stored under given name at Store.
 Image getImage(String name)
          Creates an image according the .png stored on client .jar.
  long, long getMemoryUsage()
          Returns the current memory usage of system.
 Flow getMinimizedView()
          Returns the current minimized view of this widget.
 String getParameter(String name)
          Returns the current value of given parameter.
 Map getParameters()
          Returns a map containing all parameters for this widget.
 Picture getPicture(String url)
          Loads image from url specified and displays it as a Picture.
 Picture getPicture(String url, int boundx, int boundy, String format)
          Loads image from url specified and displays it as a Picture.
 Player getPlayer(ByteArray data, String contentType, int volume)
          Creates Player for playing sound.
 Player getPlayer(String sound, int volume)
          Return handle to sound player that can be used to play and stop playing multiple times.
 String getProperty(String name)
          Returns a system property with given name.
 ByteArray getResource(String name)
          Returns the named widget resource as ByteArray.
  int, int getScreenSize()
          Returns size of the current maximized screen, excluding menu-button area.
 Map getServices()
          Returns a map containing all service specifications for this Widget.
 List getShells()
          Returns a list containing all shells belonging to this widget.
 Store getStore()
          Returns the persistent storage for this Widget.
 Style getStyle(String name)
          Returns the named style from stylesheet of this Widget.
 Style getStyle(String primary, String secondary)
          Returns the named style from stylesheet of this Widget.
 TimeZone getTimeZone(String id)
          Gets the TimeZone for the given ID.
 String getUsername()
          Returns the username.
 String getVersion()
          Returns the version of the client taken from the MIDlet-Version parameter of jad file.
 long getWidgetID()
          Returns the id of widget, returned from dabo/get service call.
 String getWidgetName()
          Returns the name of widget, returned from dabo/get service call.
 String getWidgetName(int id)
          Returns the name of widget with given id.
 boolean isDashboardVisible()
          Checks if the dashboard is currently visible.
 boolean isOnline()
          Returns the current online state of client.
 boolean isRegistered()
          Returns if user if registered or not.
 boolean isSupported(String feature)
          Checks if specified feature is supported by client/platform.
 boolean isUsingHTTP()
          Returns true, if HTTP protocol is used between client and server, instead of socket connection.
 int max(int i, int j)
          Returns the greater of two int values.
 long max(long i, long j)
          Returns the greater of two long values.
 int min(int i, int j)
          Returns the smaller of two int values.
 long min(long i, long j)
          Returns the smaller of two long values.
 int morphColor(int sourceColor, int targetColor, int progress)
          Morphs color from source to target.
 Value NULL()
          Value: IS_NULL
 int openBrowser(String url)
          Tries to open phone's web browser to given url.
 void openChannel(String id, ChannelCallback channelCallback)
          Joins existing public or private channel.
 void openChannel(String name, String protocol, Value info, int timeout, ChannelCallback channelCallback)
          Obtains handle to public channel, creating it if it does not exists already.
 void openPrivateChannel(String protocol, Value info, int timeout, ChannelCallback channelCallback)
          Creates private, unnamed channel on server.
 Value operator_array()
          Operator to handle [] expression.
 Value operator_bind(Value a, Value b)
          Operator to handle key-to-value binding expression (key=>value)
 boolean operator_cast_boolean(Value v)
          Cast from Value to boolean
 ByteArray operator_cast_ByteArray(Value v)
          Cast from Value to ByteArray
 int operator_cast_int(Value v)
          Cast from Value to int
 long operator_cast_long(Value v)
          Cast from Value to long
 String operator_cast_String(ByteArray a)
          Cast from ByteArray to String
 Value operator_cast_Value(boolean z)
          Cast from boolean to Value
 Value operator_cast_Value(ByteArray a)
          Cast from ByteArray to Value
 Value operator_cast_Value(int i)
          Cast from int to Value
 Value operator_cast_Value(List l)
          Cast from List to Value
 Value operator_cast_Value(long j)
          Cast from long to Value
 Value operator_cast_Value(String s)
          Cast from String to Value
  boolean, Component operator_next(Component a, int var)
          foreach support for Component
  boolean, int operator_next(IntArray a, int var)
          foreach support for IntArray
  boolean, Object operator_next(List a, int var)
          foreach support for List
  boolean, Object operator_next(Map a, int var)
          foreach support for Map
  boolean, Value operator_next(Value a, int var)
          foreach support for Value
 void operator_start(Component a, int var)
          foreach support for Component
 void operator_start(IntArray a, int var)
          foreach support for IntArray
 void operator_start(List a, int var)
          foreach support for List
 void operator_start(Map a, int var)
          foreach support for Map
 void operator_start(Value a, int var)
          foreach support for Value
 boolean parseBoolean(String str)
          Parses the string argument as boolean.
 long parseFloat(String str, int fraction)
          Parses the string argument as floating point number.
 int parseInt(String str, int radix)
          Parses the string argument as a signed integer in the radix specified by the second argument.
 long parseLong(String str, int radix)
          Parses the string argument as a signed long in the radix specified by the second argument.
 int parseSize(String expr, int parentSize)
          Parses size expression used on <view> elements at widget XML specification.
 void playNotifySound(boolean force)
          Plays notify sound assigned to this widget (if any).
 void playSound(String sound, int volume)
          Plays the sound once to the end, and releases resources.
 void popShell(Shell shell)
          Pops a Shell from shell stack.
 void printf$(String format)
          Prints out formatted string to log.
 void pushShell(Shell shell)
          Pushes a Shell onto shell stack.
 int random(int max)
          Returns a pseudo-random number between on zero (inclusive) and max (exclusive)
 Timer schedule(long delay)
          Spawns a timer that will be executed after delay milliseconds has passed.
 Timer schedule(long delay, long period)
          Schedules a timer for repeated fixed-delay execution, beginning after the specified delay.
 Timer schedule(long delay, long period, TimerCallback callback)
          Schedules a timer for repeated fixed-delay execution, beginning after the specified delay.
 Timer schedule(long delay, TimerCallback callback)
          Spawns a timer that will be executed after delay milliseconds has passed.
 void setBubble(Image image, String message)
          Shows short informative message on bubble.
 void setMinimizedView(Flow view)
          Sets the minimized appearance of this Widget.
 boolean setParameter(String name, Value value)
          Sets new value to a widget parameter.
 boolean setParameters(Value params)
          Sets multiple parameters at the same time.
 void setUpdated(boolean isUpdated)
          Enables or disables updated state of widget.
 int sin(int a)
          Returns the trigonometric sine of an angle.
 void slideIn(int x, int y, int w, int h, Shell shell)
          Pushes a Shell onto shell stack.
 void slideOut(int x, int y, int w, int h, Shell shell)
          Removes a Shell removes shell stack.
 String toString(int i, int radix)
          Returns a string representation of the first argument in the radix specified by the second argument.
 String toString(long i, int radix)
          Returns a string representation of the first argument in the radix specified by the second argument.
 
Methods inherited from
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

YEAR

public static final int YEAR
Calendar field

See Also:
Constant Field Values

MONTH

public static final int MONTH
Calendar field

See Also:
Constant Field Values

DATE

public static final int DATE
Calendar field

See Also:
Constant Field Values

DAY_OF_MONTH

public static final int DAY_OF_MONTH
Calendar field

See Also:
Constant Field Values

DAY_OF_WEEK

public static final int DAY_OF_WEEK
Calendar field

See Also:
Constant Field Values

AM_PM

public static final int AM_PM
Calendar field

See Also:
Constant Field Values

HOUR

public static final int HOUR
Calendar field

See Also:
Constant Field Values

HOUR_OF_DAY

public static final int HOUR_OF_DAY
Calendar field

See Also:
Constant Field Values

MINUTE

public static final int MINUTE
Calendar field

See Also:
Constant Field Values

SECOND

public static final int SECOND
Calendar field

See Also:
Constant Field Values

MILLISECOND

public static final int MILLISECOND
Calendar field

See Also:
Constant Field Values

SUNDAY

public static final int SUNDAY
Calendar day of week

See Also:
Constant Field Values

MONDAY

public static final int MONDAY
Calendar day of week

See Also:
Constant Field Values

TUESDAY

public static final int TUESDAY
Calendar day of week

See Also:
Constant Field Values

WEDNESDAY

public static final int WEDNESDAY
Calendar day of week

See Also:
Constant Field Values

THURSDAY

public static final int THURSDAY
Calendar day of week

See Also:
Constant Field Values

FRIDAY

public static final int FRIDAY
Calendar day of week

See Also:
Constant Field Values

SATURDAY

public static final int SATURDAY
Calendar day of week

See Also:
Constant Field Values

JANUARY

public static final int JANUARY
Calendar month of year

See Also:
Constant Field Values

FEBRUARY

public static final int FEBRUARY
Calendar month of year

See Also:
Constant Field Values

MARCH

public static final int MARCH
Calendar month of year

See Also:
Constant Field Values

APRIL

public static final int APRIL
Calendar month of year

See Also:
Constant Field Values

MAY

public static final int MAY
Calendar month of year

See Also:
Constant Field Values

JUNE

public static final int JUNE
Calendar month of year

See Also:
Constant Field Values

JULY

public static final int JULY
Calendar month of year

See Also:
Constant Field Values

AUGUST

public static final int AUGUST
Calendar month of year

See Also:
Constant Field Values

SEPTEMBER

public static final int SEPTEMBER
Calendar month of year

See Also:
Constant Field Values

OCTOBER

public static final int OCTOBER
Calendar month of year

See Also:
Constant Field Values

NOVEMBER

public static final int NOVEMBER
Calendar month of year

See Also:
Constant Field Values

DECEMBER

public static final int DECEMBER
Calendar month of year

See Also:
Constant Field Values

AM

public static final int AM
Calendar 12-hour clock: morning

See Also:
Constant Field Values

PM

public static final int PM
Calendar 12-hour clock: evening

See Also:
Constant Field Values

FORMAT_DATE

public static final int FORMAT_DATE
Calendar Format date as string according to current locale

See Also:
Constant Field Values

FORMAT_TIME

public static final int FORMAT_TIME
Calendar Format time as string according to current locale

See Also:
Constant Field Values

FORMAT_DATETIME

public static final int FORMAT_DATETIME
Calendar Format date and time as string according to current locale

See Also:
Constant Field Values

IS_NULL

public static final int IS_NULL
Value type: null

See Also:
Constant Field Values

IS_BOOLEAN

public static final int IS_BOOLEAN
Value type: boolean

See Also:
Constant Field Values

IS_INT

public static final int IS_INT
Value type: int

See Also:
Constant Field Values

IS_STRING

public static final int IS_STRING
Value type: String

See Also:
Constant Field Values

IS_LIST

public static final int IS_LIST
Value type: Value[]

See Also:
Constant Field Values

IS_BINDING

public static final int IS_BINDING
Value type: key-to-value binding

See Also:
Constant Field Values

IS_BINARY

public static final int IS_BINARY
Value type: byte[]

See Also:
Constant Field Values

MATH_SCALE

public static final int MATH_SCALE
Scale of integer math (32768). Divide the result of math function with this value to get normalized result:

int angle = ...;
int x = (100 * cos(angle)) / MATH_SCALE; //-100..100

See Also:
sin(int), cos(int), Constant Field Values

ANY

public static final int ANY
Input flags: Any input allowed

See Also:
Constant Field Values

NUMERIC

public static final int NUMERIC
Input flags: Numeric input allowed

See Also:
Constant Field Values

PASSWORD

public static final int PASSWORD
Input flags: Blind input (typed text shown as '*')

See Also:
Constant Field Values

ONE_LINE

public static final int ONE_LINE
Input flags: Input field does not expand beyound one line

See Also:
Constant Field Values

EMAILADDR

public static final int EMAILADDR
Input flags: Field is email address

See Also:
Constant Field Values

PHONENUMBER

public static final int PHONENUMBER
Input flags: Field is phone number

See Also:
Constant Field Values

URL

public static final int URL
Input flags: Field is URL

See Also:
Constant Field Values

DECIMAL

public static final int DECIMAL
Input flags: Field is number

See Also:
Constant Field Values

SENSITIVE

public static final int SENSITIVE
Input flags: Indicates that the text entered is sensitive data that the implementation must never store for later use

See Also:
Constant Field Values

NON_PREDICTIVE

public static final int NON_PREDICTIVE
Input flags: Non predictive input mode should be used

See Also:
Constant Field Values

INITIAL_CAPS_WORD

public static final int INITIAL_CAPS_WORD
Input flags: Suggests that first character of each word ought to be capitalized

See Also:
Constant Field Values

INITIAL_CAPS_SENTENCE

public static final int INITIAL_CAPS_SENTENCE
Input flags: Suggests that first character of first word of sentence ought to be capitalized

See Also:
Constant Field Values

OPEN_MENU

public static final int OPEN_MENU
Implicit action: menu is to be opened. This action is never passed to the callbacks, instead it is caught by the system

See Also:
Constant Field Values

FOCUS_CHANGED

public static final int FOCUS_CHANGED
Implicit action: focused Component has changed

See Also:
Constant Field Values

ITEM_CHANGED

public static final int ITEM_CHANGED
Implicit action: contents of an Component has changed

See Also:
Constant Field Values

ITEM_CANCEL

public static final int ITEM_CANCEL
Implicit action: contents of an NativeInput has not changed

See Also:
Constant Field Values

OPEN_LINK

public static final int OPEN_LINK
Implicit action: user has activated an link

See Also:
Constant Field Values

SHELL_OPENED

public static final int SHELL_OPENED
Implicit action: Shell has been pushed and computed on shell stack

See Also:
Constant Field Values

SHELL_CLOSED

public static final int SHELL_CLOSED
Implicit action: Shell has been popped from shell stack.

See Also:
Constant Field Values

VIEWPORT_CHANGED

public static final int VIEWPORT_CHANGED
Implicit action: Viewport of Scrollable has changed.

See Also:
Constant Field Values

FOCUSED

public static final int FOCUSED
Implicit action: Called by the system when the focus enters the widget

See Also:
Constant Field Values

BLURRED

public static final int BLURRED
Implicit action: Called by the system when focus leaves the widget

See Also:
Constant Field Values

MARK_READ

public static final int MARK_READ
Explicit action: Called by the system suggesting that all the "items" on widget should be marked read, if applicable

See Also:
Constant Field Values

OPEN_SETTINGS

public static final int OPEN_SETTINGS
Explicit action: Called by the system suggesting that widget should open it's settings for editing

See Also:
Constant Field Values

OPEN_HOME

public static final int OPEN_HOME
Explicit action: Called by the system suggesting that widget should open it's home page

See Also:
Constant Field Values

OPEN_HELP

public static final int OPEN_HELP
Explicit action: Called by the system suggesting that widget should load and show widget specific help page. Note that if help is not specified in widget.xml and this action is fired an error message will be shown to the user.

See Also:
Constant Field Values

SEND_WIDGET

public static final int SEND_WIDGET
Explicit action: Called by the system suggesting that widget should be sent to other user

See Also:
Constant Field Values

WIDGET_CLOSED

public static final int WIDGET_CLOSED
Explicit action: Sent to dashboard indicating that the widget has been closed

See Also:
Constant Field Values

KEY_PRESSED

public static final int KEY_PRESSED
Key action type: key was pressed.

See Also:
Script.keyAction(Component, int, int), Constant Field Values

KEY_RELEASED

public static final int KEY_RELEASED
Key action type: key was released.

See Also:
Script.keyAction(Component, int, int), Constant Field Values

KEY_REPEATED

public static final int KEY_REPEATED
Key action type: key was repeated.

See Also:
Script.keyAction(Component, int, int), Constant Field Values

KEY_UP

public static final int KEY_UP
Key code: up arrow

See Also:
Constant Field Values

KEY_DOWN

public static final int KEY_DOWN
Key code: down arrow

See Also:
Constant Field Values

KEY_LEFT

public static final int KEY_LEFT
Key code: left arrow

See Also:
Constant Field Values

KEY_RIGHT

public static final int KEY_RIGHT
Key code: right arrow

See Also:
Constant Field Values

KEY_FIRE

public static final int KEY_FIRE
Key code: fire

See Also:
Constant Field Values

KEY_ESC

public static final int KEY_ESC
Key code: escape

See Also:
Constant Field Values

KEY_ENTER

public static final int KEY_ENTER
Key code: line feed

See Also:
Constant Field Values

KEY_CR

public static final int KEY_CR
Key code: carriage return

See Also:
Constant Field Values

KEY_DELETE

public static final int KEY_DELETE
Key code: delete

See Also:
Constant Field Values

KEY_BACKSPACE

public static final int KEY_BACKSPACE
Key code: backspace

See Also:
Constant Field Values

KEY_TAB

public static final int KEY_TAB
Key code: tabulator

See Also:
Constant Field Values

KEY_OK

public static final int KEY_OK
Key code: OK soft key

See Also:
Constant Field Values

KEY_BACK

public static final int KEY_BACK
Key code: Back/Cancel soft key

See Also:
Constant Field Values

SOFTKEY_OK

public static final int SOFTKEY_OK
OK soft key indicator.

See Also:
Script.getSoftKey(Shell, Component, int), Constant Field Values

SOFTKEY_MIDDLE

public static final int SOFTKEY_MIDDLE
Middle soft key indicator.

See Also:
Script.getSoftKey(Shell, Component, int), Constant Field Values

SOFTKEY_BACK

public static final int SOFTKEY_BACK
Back/Cancel soft key indicator.

See Also:
Script.getSoftKey(Shell, Component, int), Constant Field Values

FOCUSABLE

public static final int FOCUSABLE
Component flag: Component is focusable

See Also:
Constant Field Values

VISIBLE

public static final int VISIBLE
Component flag: Component is visible

See Also:
Constant Field Values

LINEFEED

public static final int LINEFEED
Component flag: Component is followed by a linefeed

See Also:
Constant Field Values

WRAP

public static final int WRAP
Component flag: Automatic linefeed as necessary

See Also:
Constant Field Values

OPAQUE

public static final int OPAQUE
Shell and Popup flag: Indicates that shell is fully opaque and therefore the underlying shell need not be painted as a background. By default the OPAQUE is enabled for Shell and disabled for Popup.

See Also:
Constant Field Values

DIMMED

public static final int DIMMED
Shell and Popup flag: Indicates that a dimming layer should be applied on background before painting. This flag is only meaningful is OPAQUE flag is not set.

See Also:
Constant Field Values

HEXPAND

public static final int HEXPAND
Flag that only affects Components that have been placed on Flow and has preferredWidth = 0. HEXPAND instructs the Flow to grant the flagged component all the remaining space on the current line.

See Also:
Constant Field Values

HLIMIT

public static final int HLIMIT
Flag that only affects Components that have been placed on Flow and has preferredWidth = 0. HLIMIT instructs the Flow to limit the granted width of Component so that it does not grow over the remaining space on current line.

See Also:
Constant Field Values

BASELINE

public static final int BASELINE
Vertical alignment flag

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Vertical alignment flag

See Also:
Constant Field Values

HCENTER

public static final int HCENTER
Horizontal alignment flag

See Also:
Constant Field Values

LEFT

public static final int LEFT
Horizontal alignment flag

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Horizontal alignment flag

See Also:
Constant Field Values

TOP

public static final int TOP
Vertical alignment flag

See Also:
Constant Field Values

VCENTER

public static final int VCENTER
Vertical alignment flag

See Also:
Constant Field Values

STYLE_PLAIN

public static final int STYLE_PLAIN
Style of Font

See Also:
Constant Field Values

STYLE_BOLD

public static final int STYLE_BOLD
Style of Font

See Also:
Constant Field Values

STYLE_ITALIC

public static final int STYLE_ITALIC
Style of Font

See Also:
Constant Field Values

STYLE_UNDERLINED

public static final int STYLE_UNDERLINED
Style of Font

See Also:
Constant Field Values

SIZE_SMALL

public static final int SIZE_SMALL
Size of Font

See Also:
Constant Field Values

SIZE_MEDIUM

public static final int SIZE_MEDIUM
Size of Font

See Also:
Constant Field Values

SIZE_LARGE

public static final int SIZE_LARGE
Size of Font

See Also:
Constant Field Values

FACE_SYSTEM

public static final int FACE_SYSTEM
Face of Font

See Also:
Constant Field Values

FACE_MONOSPACE

public static final int FACE_MONOSPACE
Face of Font

See Also:
Constant Field Values

FACE_PROPORTIONAL

public static final int FACE_PROPORTIONAL
Face of Font

See Also:
Constant Field Values

CHANNEL_OPENED

public static final int CHANNEL_OPENED
Status code for channel handling.

See Also:
ChannelCallback, Constant Field Values

CHANNEL_JOINED

public static final int CHANNEL_JOINED
Status code for channel handling.

See Also:
ChannelCallback, Constant Field Values

CHANNEL_LEFT

public static final int CHANNEL_LEFT
Status code for channel handling.

See Also:
ChannelCallback, Constant Field Values

CHANNEL_CLOSED

public static final int CHANNEL_CLOSED
Status code for channel handling.

See Also:
ChannelCallback, Constant Field Values

CHANNEL_NOT_FOUND

public static final int CHANNEL_NOT_FOUND
Status code for channel handling.

See Also:
ChannelCallback, Constant Field Values

CHANNEL_PROTOCOL_MISMATCH

public static final int CHANNEL_PROTOCOL_MISMATCH
Status code for channel handling.

See Also:
ChannelCallback, Constant Field Values

CHANNEL_INFO_UPDATED

public static final int CHANNEL_INFO_UPDATED
Status code for channel handling.

See Also:
ChannelCallback, Constant Field Values

MEMBER_JOINED

public static final int MEMBER_JOINED
Status code for membership handling.

See Also:
MemberCallback, Constant Field Values

MEMBER_LEFT

public static final int MEMBER_LEFT
Status code for membership handling.

See Also:
MemberCallback, Constant Field Values

MEMBER_UPDATED

public static final int MEMBER_UPDATED
Status code for membership handling.

See Also:
MemberCallback, Constant Field Values

ANIMATION_LINEAR

public static final int ANIMATION_LINEAR
Animation, linear interpolation

Since:
3.0.0
See Also:
Constant Field Values

ANIMATION_QUAD

public static final int ANIMATION_QUAD
Animation, quad interpolation

Since:
3.0.0
See Also:
Constant Field Values

ANIMATION_SINE

public static final int ANIMATION_SINE
Animation, sine interpolation

Since:
3.0.0
See Also:
Constant Field Values

BROWSER_OK

public static final int BROWSER_OK
Browser was opened successfully.

Since:
3.0.0
See Also:
openBrowser(String), Constant Field Values

BROWSER_LATER

public static final int BROWSER_LATER
Phone does not support multi-tasking, browser is opened after WidSets client is closed.

Since:
3.0.0
See Also:
openBrowser(String), Constant Field Values

BROWSER_FAILED

public static final int BROWSER_FAILED
Phone does not support given url (protocol) or user declined the security prompt.

Since:
3.0.0
See Also:
openBrowser(String), Constant Field Values
Method Detail

NULL

public Value NULL()
Value: IS_NULL


toString

public String toString(int i,
                       int radix)
Returns a string representation of the first argument in the radix specified by the second argument.

Parameters:
i - a intto be converted to a string.
radix - the radix to use in the string representation.
Returns:
a string representation of the argument in the specified radix.

toString

public String toString(long i,
                       int radix)
Returns a string representation of the first argument in the radix specified by the second argument.

Parameters:
i - a longto be converted to a string.
radix - the radix to use in the string representation.
Returns:
a string representation of the argument in the specified radix.

parseInt

public int parseInt(String str,
                    int radix)
Parses the string argument as a signed integer in the radix specified by the second argument. The characters in the string must all be digits of the specified radix except that the first character may be an ASCII minus sign '-' indicate a negative value. The resulting integer value is returned.

Parameters:
str - the String containing the integer representation to be parsed
radix - the radix to be used while parsing s.
Returns:
the integer represented by the string argument in the specified radix.

parseLong

public long parseLong(String str,
                      int radix)
Parses the string argument as a signed long in the radix specified by the second argument. The characters in the string must all be digits of the specified radix except that the first character may be an ASCII minus sign '-' indicate a negative value. The resulting integer value is returned.

Parameters:
str - the String containing the integer representation to be parsed
radix - the radix to be used while parsing s.
Returns:
the long integer represented by the string argument in the specified radix.

parseBoolean

public boolean parseBoolean(String str)
Parses the string argument as boolean. If the string value is "true" returned value will be true, in all other cases it will be false.

Parameters:
str - the to be parsed
Returns:
boolean value

parseFloat

public long parseFloat(String str,
                       int fraction)
Parses the string argument as floating point number. Supplied string must conform the following regular expression:
[+-]?[0-9]*([.][0-9]*)?([eE][-+]?[0-9]+)?
Examples:
  • parseFloat("1", 4) = 1000
  • parseFloat("1.234", 4) = 1234
  • parseFloat("1.234", 4) = 1234
  • parseFloat("1.234e2", 4) = 12340000

Parameters:
str - Textual presentation of floating point number
fraction - Number of significant numbers in fraction.
Returns:
Long integer parsed from string so that the fraction is represented in the fraction lower digits.
Since:
2.0.0

operator_start

public void operator_start(IntArray a,
                           int var)
foreach support for IntArray


operator_next

public   boolean, int operator_next(IntArray a,
                                                int var)
foreach support for IntArray


operator_start

public void operator_start(Value a,
                           int var)
foreach support for Value


operator_next

public   boolean, Value operator_next(Value a,
                                                  int var)
foreach support for Value


operator_start

public void operator_start(List a,
                           int var)
foreach support for List


operator_next

public   boolean, Object operator_next(List a,
                                                   int var)
foreach support for List


operator_start

public void operator_start(Map a,
                           int var)
foreach support for Map


operator_next

public   boolean, Object operator_next(Map a,
                                                   int var)
foreach support for Map


operator_array

public Value operator_array()
Operator to handle [] expression.

Returns:
new Value instance of type IS_LIST

operator_bind

public Value operator_bind(Value a,
                           Value b)
Operator to handle key-to-value binding expression (key=>value)

Returns:
new Value instance of type IS_BINDING

operator_cast_Value

public Value operator_cast_Value(boolean z)
Cast from boolean to Value


operator_cast_Value

public Value operator_cast_Value(int i)
Cast from int to Value


operator_cast_Value

public Value operator_cast_Value(long j)
Cast from long to Value


operator_cast_Value

public Value operator_cast_Value(String s)
Cast from String to Value


operator_cast_Value

public Value operator_cast_Value(List l)
Cast from List to Value


operator_cast_Value

public Value operator_cast_Value(ByteArray a)
Cast from ByteArray to Value


operator_cast_String

public String operator_cast_String(ByteArray a)
Cast from ByteArray to String


operator_cast_boolean

public boolean operator_cast_boolean(Value v)
Cast from Value to boolean


operator_cast_int

public int operator_cast_int(Value v)
Cast from Value to int


operator_cast_long

public long operator_cast_long(Value v)
Cast from Value to long


operator_cast_ByteArray

public ByteArray operator_cast_ByteArray(Value v)
Cast from Value to ByteArray


abs

public int abs(int i)
Returns the absolute value of an int value.


abs

public long abs(long i)
Returns the absolute value of an long value.


min

public int min(int i,
               int j)
Returns the smaller of two int values.


max

public int max(int i,
               int j)
Returns the greater of two int values.


min

public long min(long i,
                long j)
Returns the smaller of two long values.


max

public long max(long i,
                long j)
Returns the greater of two long values.


sin

public int sin(int a)
Returns the trigonometric sine of an angle. Due to the lack of floats on CLDC 1.1 the sine is returned as integer falling on range of java's short value. Dividing with constant MATH_SCALE normalizes it to [-1..1] range.

Parameters:
a - an angle, in degrees.
Returns:
the sine of the argument, given as integer between [-32768..32767]
See Also:
MATH_SCALE

cos

public int cos(int a)
Returns the trigonometric cosine of an angle. Due to the lack of floats on CLDC 1.1 the cosine is returned as integer falling on range of java's short value. Dividing with constant MATH_SCALE normalizes it to [-1..1] range.

Parameters:
a - an angle, in degrees.
Returns:
the cosine of the argument, given as integer between [-32768..32767]
See Also:
MATH_SCALE

format$

public String format$(String format)
Creates a formatted string according to C-style %conventions.
 [%]([0-9]+[:$])[+]?[-]?[0_ ]?[0-9]*[box]?[zcidjls]

 $ or : Preceding number is treated as argument index (starts from 1)
 +     Show sign of integer
 -     Left justify
 ' '   Use space padding
 _     Use underscore padding  
 0     Use zero padding (if before other numbers)
 0-9   Width of field
 z     boolean argument ("true" or "false")
 b     format integer as binary (radix=2)
 o     format integer as octal (radix=8)
 x     format integer as hexadecimal (radix=16)
 c     char argument
 i,d   integer argument
 j,l   long argument
 s     object argument
 

Parameters:
format - Format string
See Also:
printf$(String)

printf$

public void printf$(String format)
Prints out formatted string to log.

Parameters:
format - Format string
See Also:
format$(String)

currentTimeMillis

public long currentTimeMillis()
Returns the current time in milliseconds. Note that while the unit of time of the return value is a millisecond, the granularity of the value depends on the underlying operating system and may be larger. For example, many operating systems measure time in units of tens of milliseconds.

Returns:
the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

random

public int random(int max)
Returns a pseudo-random number between on zero (inclusive) and max (exclusive)

Parameters:
max - Upper limit of random (exclusive)

schedule

public Timer schedule(long delay)
Spawns a timer that will be executed after delay milliseconds has passed.

When executed the system calls void timerEvent(Timer timer) function on widget script.

Parameters:
delay - delay in milliseconds before task is to be executed.
See Also:
Timer, Timer.cancel()

schedule

public Timer schedule(long delay,
                      long period)
Schedules a timer for repeated fixed-delay execution, beginning after the specified delay. Subsequent executions take place at approximately regular intervals separated by the specified period.

When executed the system calls void timerEvent(Timer timer) function on widget script.

Parameters:
delay - delay in milliseconds before task is to be executed.
period - time in milliseconds between successive task executions.
See Also:
Timer, Timer.cancel()

schedule

public Timer schedule(long delay,
                      TimerCallback callback)
Spawns a timer that will be executed after delay milliseconds has passed.

When executed the system calls the supplied callback function.

Parameters:
delay - delay in milliseconds before task is to be executed.
callback - Callback function
See Also:
Timer, Timer.cancel()

schedule

public Timer schedule(long delay,
                      long period,
                      TimerCallback callback)
Schedules a timer for repeated fixed-delay execution, beginning after the specified delay. Subsequent executions take place at approximately regular intervals separated by the specified period.

When executed the system calls the supplied callback function.

Parameters:
delay - delay in milliseconds before task is to be executed.
period - time in milliseconds between successive task executions.
callback - Callback function
See Also:
Timer, Timer.cancel()

getProperty

public String getProperty(String name)
Returns a system property with given name. This method will call both java.lang.System.getProperty() and javax.microedition.midlet.MIDLet.getProperty(). param name Name of property


getShells

public List getShells()
Returns a list containing all shells belonging to this widget. First element of array is the first shell on stack and last element is the top-most (possibly currently visible) shell.

Returns:
List of Shells.
Since:
2.0.0

pushShell

public void pushShell(Shell shell)
Pushes a Shell onto shell stack. Following actions occur:
  1. Layout of Shell is computed
  2. First focusable component is focused (unless already focused somewhere)
  3. Shell is placed on shell stack
  4. SHELL_OPENED event is fired
  5. User interface is repainted

Parameters:
shell - Shell to show
See Also:
Script.actionPerformed(Shell, Component, int)

popShell

public void popShell(Shell shell)
Pops a Shell from shell stack. Following actions occur:
  1. Shell is removed from shell stack
  2. SHELL_CLOSED event is fired
  3. User interface is repainted

Parameters:
shell - Shell to remove
See Also:
Script.actionPerformed(Shell, Component, int)

slideIn

public void slideIn(int x,
                    int y,
                    int w,
                    int h,
                    Shell shell)
Pushes a Shell onto shell stack. Shell appears in animated fashion so that it seems to "grow" from given region on screen (region does not need to be actually visible).

Follow example demonstrates how to "fly-in" the new shell from right:

Shell shell = ...;
 int w, int h = getScreenSize();
 slideIn(w, 0, w, h, shell);

Parameters:
x - X-coordinate of origin region
y - Y-coordinate of origin region
w - width of origin region
h - height of origin region
shell - Shell to show
See Also:
pushShell(Shell)

slideOut

public void slideOut(int x,
                     int y,
                     int w,
                     int h,
                     Shell shell)
Removes a Shell removes shell stack. Shell disappears in animated fashion so that it seems to "shrink" into given region on screen (region does not need to be actually visible).

Parameters:
x - X-coordinate of origin region
y - Y-coordinate of origin region
w - width of origin region
h - height of origin region
shell - Shell to remove
See Also:
popShell(Shell)

flushScreen

public void flushScreen(boolean repaintAll)
Repaints whole UI or selected components. Individual components are added to repaint queue by calling the Component.repaint(boolean) method. Repainting does not occur during the call of this function, instead it instructs the system to repaint the screen as soon as possible.

Parameters:
repaintAll - if true whole UI is repainted, otherwise only those components selected for repaint

dumpTree

public void dumpTree(Component c)
Prints component-tree of given component. Useful when debugging component misbehaviours.

Parameters:
c - Component to debug

setBubble

public void setBubble(Image image,
                      String message)
Shows short informative message on bubble. Bubble is visible for about five seconds. Bubbles are queued: new message will overwrite the previous if it's still active.

Parameters:
image - Optional image to show along with message
message - Message to show

operator_start

public void operator_start(Component a,
                           int var)
foreach support for Component


operator_next

public   boolean, Component operator_next(Component a,
                                                      int var)
foreach support for Component


getWidgetName

public String getWidgetName()
Returns the name of widget, returned from dabo/get service call.

Returns:
name of widget

getWidgetID

public long getWidgetID()
Returns the id of widget, returned from dabo/get service call.

Returns:
id of widget

getImage

public Image getImage(String name)
Creates an image according the .png stored on client .jar. This method always returns an (informative) image even if loading fails for some reason.

Parameters:
name - Name of image to load
Returns:
Instance of Image

getImage

public Image getImage(ByteArray data)
Creates an image from supplied .png encoded data. This method always returns an (informative) image even if loading fails for some reason.

Parameters:
data - .png encoded data
Returns:
Instance of Image

getImage

public Image getImage(Store store,
                      String name)
Creates an image from .png encoded data stored under given name at Store. This method always returns an (informative) image even if loading fails for some reason.

Parameters:
store - Store to use
name - Name of record at Store
Returns:
Instance of Image

getFont

public Font getFont(int face,
                    int style,
                    int size)
Returns the font object according to given parameters.

Parameters:
face - Face of font, either FACE_SYSTEM, FACE_MONOSPACE or FACE_PROPORTIONAL
style - Style of font, combination of STYLE_PLAIN, STYLE_BOLD, STYLE_ITALIC and STYLE_UNDERLINED
size - Size of font, either SIZE_SMALL, SIZE_MEDIUM, SIZE_LARGE
Returns:
Instance of font - this method never returns null

getStyle

public Style getStyle(String name)
Returns the named style from stylesheet of this Widget. If the style is missing a new, plain style is created under the name and returned.

Parameters:
name - Name of style to return
Returns:
Style instance

getStyle

public Style getStyle(String primary,
                      String secondary)
Returns the named style from stylesheet of this Widget. This method first tries primary style and if it is missing the secondary is used. If the secondary style is missing as well, a new, plain style is created under the primary and returned.

Parameters:
primary - Primary style to return
secondary - Secondary style to return
Returns:
Style instance

getParameter

public String getParameter(String name)
Returns the current value of given parameter.

Parameters:
name - Name of parameter
Returns:
Value of parameter, or null if it doesn't exist

getParameters

public Map getParameters()
Returns a map containing all parameters for this widget.

Returns:
Map of parameters, String to Value mappings.

getServices

public Map getServices()
Returns a map containing all service specifications for this Widget.

Returns:
Map of services, String to Value mappings.

createView

public View createView(String name,
                       Object context)
Creates a view according to view specification on widget.xml file of this widget. Calling this function may cause the Script.createElement(String, String, Style, Object) being called if the view contains script actions.

Parameters:
name - Name of view to create
context - Context object, will be passed to Script.createElement(String, String, Style, Object) callback.

createMinimizedView

public View createMinimizedView(String name,
                                Object context)

createMaximizedView

public View createMaximizedView(String name,
                                Object context)
Deprecated. Use createView(String, Object) instead


setMinimizedView

public void setMinimizedView(Flow view)
Sets the minimized appearance of this Widget.

Parameters:
view - Widget appearance
See Also:
getMinimizedView(), createView(String, Object)

getMinimizedView

public Flow getMinimizedView()
Returns the current minimized view of this widget.

See Also:
setMinimizedView(Flow), getMinimizedView(), createView(String, Object)

getStore

public Store getStore()
Returns the persistent storage for this Widget.


isOnline

public boolean isOnline()
Returns the current online state of client.

Returns:
current online state

call

public void call(Object state,
                 String service,
                 String action,
                 Value argument)
Calls a server side service. When the response arrives the Script.onSuccess(Object, Value) or Script.onFailure(Object, String) is called.

Parameters:
state - State object to support call, it is passed success and failure callbacks.
service - Name of service to call
action - Name of action to call
argument - Argument to action

call

public void call(Object state,
                 String service,
                 String action,
                 Value argument,
                 SuccessCallback onSuccess,
                 FailureCallback onFailure)
Calls a server side service. When the response arrives the provided success or failure function is called. If provided function is null the generic Script.onSuccess(Object, Value) or Script.onFailure(Object, String) is called instead.

Parameters:
state - State object to support call, it is passed success and failure callbacks.
service - Name of service to call
action - Name of action to call
argument - Argument to action
onSuccess - Success callback
onFailure - Failure callback

call

public void call(Object state,
                 String serviceVersionAction,
                 Value argument,
                 SuccessCallback onSuccess,
                 FailureCallback onFailure)
Calls a server side service anonymously. Differs from call(Object, String, String, Value) and call(Object, String, String, Value, SuccessCallback, FailureCallback) so that services doesn't have to be declared in widget.xml in order to call them.

Parameters:
state - State object to support call, it is passed success and failure callbacks.
serviceVersionAction - Composite of service name, service version and action. For example image/1/geturl
argument - Argument to action
onSuccess - Success callback
onFailure - Failure callback
See Also:
call(Object, String, String, Value, SuccessCallback, FailureCallback)

getUsername

public String getUsername()
Returns the username. Same name is used when logging in the web side.


isRegistered

public boolean isRegistered()
Returns if user if registered or not. Note that returned value will be always false if client has not been online during this session.


getVersion

public String getVersion()
Returns the version of the client taken from the MIDlet-Version parameter of jad file.


isUsingHTTP

public boolean isUsingHTTP()
Returns true, if HTTP protocol is used between client and server, instead of socket connection. This might be the case if operator/phone denies socket connection (opening socket throws SecurityException).


getWidgetName

public String getWidgetName(int id)
Returns the name of widget with given id.

Parameters:
id - id of widget.

getMemoryUsage

public   long, long getMemoryUsage()
Returns the current memory usage of system.

Returns:
tuple containing (totalMemory, usedMemory)

getScreenSize

public   int, int getScreenSize()
Returns size of the current maximized screen, excluding menu-button area. The value returned may change if the phone supports multiple and/or turning displays.

Returns:
tuple containing (width, height)

getDisplaySize

public   int, int getDisplaySize()
Returns total size of display, including menu-button area. The value returned may change if the phone supports multiple and/or turning displays.

Returns:
tuple containing (width, height)

playNotifySound

public void playNotifySound(boolean force)
Plays notify sound assigned to this widget (if any). Usually this is done when widget receives new content from server. When client goes online for first time in session and receives new content this notify sound should not be played. Sounds can be changed from widget options, if alert.sound (number) and alert.volume (number) widgetparameters are defined in widget.xml file.

Parameters:
force - forces sound to be played even if widget had not been notified for new content by server.

getPlayer

public Player getPlayer(String sound,
                        int volume)
Return handle to sound player that can be used to play and stop playing multiple times. Currently supported sound formats are Aac (.aac), Midi (.mid), MP3 (.mp3) and Wav (.wav). WidSets client come with some pre-installed sounds (legacy support), following resource names do work
  • "2" - Guiro (midi)
  • "3" - Maracas (midi)
  • "4" - Scale (midi)
  • "5" - Tweet (midi)
  • "6" - Exclamation (midi)
  • "7" - Kannel (midi) In addition resource "1" will play phones vibrator for duration of volume * 15 milliseconds. Note 0, Remember to close Player handle, and set references to it null after you are done. Note 1, File extension is used to map correct content type, so make sure you use ones listed above. Note 2, In Nokia phones you need to have Alert Sounds on from your current profile in order to hear Java/WidSets sounds. Note 3, Opening of Input dialog, stops sounds that are being played at the time.

    Parameters:
    sound - Name of sound to use. Name of widget resource defined in widget.xml as binary resource.
    volume - Volume to use, must be in range 0..100.
    Returns:
    handle that a can be used to play this sound. Returns null if sound resource was not found or there are errors in playing.
    See Also:
    Player

  • getPlayer

    public Player getPlayer(ByteArray data,
                            String contentType,
                            int volume)
    Creates Player for playing sound.

    Parameters:
    data - Sound data.
    contentType - Content type of data, audio/mpeg for example.
    volume - Volume to use, must be in range 0..100.
    Returns:
    handle that a can be used to play this sound. Returns null if sound data was malformed, format not supported by this phone or WidSets application setting "Alerts" is "No".
    See Also:
    getPlayer(String, int), Player

    playSound

    public void playSound(String sound,
                          int volume)
    Plays the sound once to the end, and releases resources.

    Parameters:
    sound -
    volume -
    See Also:
    getPlayer(String, int), Player

    setUpdated

    public void setUpdated(boolean isUpdated)
    Enables or disables updated state of widget. Widget being updated means that it has new content that user hasn't yet seen. System will automatically disable updated mode when widget is opened in maximized mode.

    Parameters:
    isUpdated - true if widget has updated content

    getTimeZone

    public TimeZone getTimeZone(String id)
    Gets the TimeZone for the given ID.

    Parameters:
    id - the ID for a TimeZone, either an abbreviation such as "GMT", or a full name such as "America/Los_Angeles". The only time zone ID that is required to be supported is "GMT".
    Returns:
    the specified TimeZone, or null if the given ID cannot be understood.

    getDefaultTimeZone

    public TimeZone getDefaultTimeZone()
    Gets the default TimeZone for this host. The source of the default TimeZone may vary with implementation.

    Returns:
    a default TimeZone.

    getAvailableTimeZones

    public List getAvailableTimeZones()
    Gets all the available IDs supported.

    Returns:
    an array of String IDs.

    setParameter

    public boolean setParameter(String name,
                                Value value)
    Sets new value to a widget parameter. Parameter is set to client immediately. Prompts user to go online if in offline mode, in order to change parameter on server-side also. Note that if client isn't brought to online mode within this session the parameter change is lost and old server-side value is synchronized when going online next time.

    Parameters:
    name - name of parameter being set
    value - new value of the parameter
    Returns:
    true if parameter update was successful, false if named parameter is not defined for this widget or if value was of wrong type

    setParameters

    public boolean setParameters(Value params)
    Sets multiple parameters at the same time. Parameters are set to client immediately. Prompts user to go online if in offline mode, in order to change parameters on server-side also. Note that if client isn't brought to online mode within this session the parameter changes are lost and old server-side values are synchronized when going online next time.

    Parameters:
    params - Value-list of string-value bindings
    Returns:
    trueif parameters update was successful, false if some named parameter was not defined for this widget or if values were of wrong type

    getConfig

    public Config getConfig()
    Returns widget's config. That is all widget parameters and their prototypes.


    decodeString

    public String decodeString(ByteArray array,
                               String encoding)
    Construct a new String by converting the specified array of bytes using the specified character encoding. The length of the new String is a function of the encoding, and hence may not be equal to the length of the byte array.

    Parameters:
    array - The bytes to be converted into characters
    encoding - The name of a supported character encoding
    Returns:
    Decoded string, or null if decoding failed.

    encodeString

    public ByteArray encodeString(String string,
                                  String encoding)
    Converts the specified String into bytes according to the specified character encoding, storing the result into a new byte array.

    Parameters:
    string - String to encode
    encoding - The name of a supported character encoding
    Returns:
    Encoded byte array, or null if encoding failes

    encodeHex

    public String encodeHex(ByteArray array)
    Encodes specified array into hexadecimal notation.

    Parameters:
    array - Array to be encoded
    Returns:
    String containing array in hexadecimal notation

    decodeHex

    public ByteArray decodeHex(String string)
    Decodes specified string into ByteArray, assuming it contains hexadecimal notation.

    Parameters:
    string - String to be encoded
    Returns:
    Decoded byte array

    encodeURL

    public String encodeURL(String string)
    Encodes the specified string using url encoding. Before encoding is applied string is converted into UTF-8 character encoding.

    Parameters:
    string - String to encode
    Returns:
    Encoded string

    parseSize

    public int parseSize(String expr,
                         int parentSize)
    Parses size expression used on <view> elements at widget XML specification.

    Parameters:
    expr - Size expression (no spaces allowed)
    parentSize - Size of parent, needed if '%' expressions are used.

    getPicture

    public Picture getPicture(String url)
    Loads image from url specified and displays it as a Picture. Default boundaries are mobile screen dimensions - 10 pixels. Default format is jpeg.

    Parameters:
    url - Url to the image resource in the Internet
    Returns:
    Picture component containing the image (or place holder image)
    See Also:
    getPicture(String, int, int, String)

    getPicture

    public Picture getPicture(String url,
                              int boundx,
                              int boundy,
                              String format)
    Loads image from url specified and displays it as a Picture. This is a shortcut for using the image-service. Calling the function will return right away and a place holder image is shown during the time the image is being loaded from the Internet, when image arrives and it is valid the place holder is replaced with the actual image and component layout is re-calculated and repaint. If the loading fails (image not found or something else) a broken place holder is shown instead. Place holders are static images that come with the client. Url to the original image is stored in the data field of the Picture reference returned, and it can be fetched using Component.getData(). When images are resized to match the boundaries proportions are kept as is. Scaling is only done downwards, so if original is smaller than boundaries it is passed as is. Possible format for images are png8, png24 and jpeg. It doesn't matter which format the original image is, as long as normal Java JRE can read it in, basically PNG, GIF, JPEG should at least be ok. Note. That image loading is initiated only if client is online when this function is called, if client is not online just a static place holder image will be shown, and even when client goes online after that the loading won't start.

    Parameters:
    url - Url to the image resource in the Internet
    boundx - Maximum width of the image returned
    boundy - Maximum height of the image returned
    format - Format of the image returned by server
    Returns:
    Picture component containing the image (or place holder image)

    getResource

    public ByteArray getResource(String name)
    Returns the named widget resource as ByteArray.

    Parameters:
    name - Name of resource
    Returns:
    Resource as byte array or null if there is no such resource
    Since:
    2.0.0

    openChannel

    public void openChannel(String id,
                            ChannelCallback channelCallback)
    Joins existing public or private channel.

    Parameters:
    id - Channel id
    channelCallback - Callback for obtaining the channel instance
    Since:
    2.0.0

    openChannel

    public void openChannel(String name,
                            String protocol,
                            Value info,
                            int timeout,
                            ChannelCallback channelCallback)
    Obtains handle to public channel, creating it if it does not exists already. Channels are used to broadcast information between widgets on channel and also directly from widget to widget.

    Parameters:
    name - Name of public channel
    protocol - Name of "protocol" used on this channel
    info - Context dependent info structure, cannot be null.
    timeout - Timeout (seconds) after which the channel is closed when no members are present. Note that actual effective timeout can be slightly larger than number provided here.
    channelCallback - Callback for obtaining the channel instance
    Since:
    2.0.0

    openPrivateChannel

    public void openPrivateChannel(String protocol,
                                   Value info,
                                   int timeout,
                                   ChannelCallback channelCallback)
    Creates private, unnamed channel on server. Channels are used to broadcast information between widgets on channel and also directly from member to member.

    Parameters:
    protocol - Name of "protocol" used on this channel
    info - Context dependent channel info structure, cannot be null.
    timeout - Timeout (seconds) after which the channel is closed when not members are present. Note that actual effective timeout can be slightly larger than number provided here.
    channelCallback - Callback for obtaining the channel instance
    Since:
    2.0.0

    callSerially

    public void callSerially(Runnable runnable)
    Executes specified operation later, by placing it into the user interface event queue.

    Parameters:
    runnable - Operation to run
    Since:
    2.0.0

    morphColor

    public int morphColor(int sourceColor,
                          int targetColor,
                          int progress)
    Morphs color from source to target.

    Parameters:
    sourceColor - Source color for transition
    targetColor - Target color for transition
    progress - Progress of transition in range of [0..1000]
    Returns:
    Morphed color value
    Since:
    3.0.0

    isDashboardVisible

    public boolean isDashboardVisible()
    Checks if the dashboard is currently visible.


    isSupported

    public boolean isSupported(String feature)
    Checks if specified feature is supported by client/platform. Possible features include:
    • camera: Camera component
    • sound: Sound access
    • video: Video streaming
    • files: File system access
    • sms: SMS sending
    • location: Geographic location provider
    • activestandby: Nokia Series 40 active standby integration

    Parameters:
    feature -
    Returns:
    Since:
    3.0.0

    openBrowser

    public int openBrowser(String url)
    Tries to open phone's web browser to given url.

    Note some older phones might close WidSets client, web browser, crash or something between those if it runs out of memory while loading/rendering web content.

    If phone does not support multi-tasking, BROWSER_LATER is returned, and browser is opened after WidSets client is closed.

    Content-types likely to be supported by phones are WML, HTML, GIF/PNG/JPEG images, AAC/Midi/MP3/WAV sounds, 3GP videos, RTSP streamed videos, PDF documents. Some types might be opened by separate program rather than embedded in browser.

    Parameters:
    url - Url to be opened
    Returns:
    BROWSER_OK, BROWSER_LATER or BROWSER_FAILED
    Since:
    3.0.0