|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
public interface Script
This interface specifies the callbacks that system may call on widget script. All callbacks are optional.
It is imperative that all callbacks finish in timely manner as otherwise the normal application execution is severely crippled.
| Method Summary | |
|---|---|
void |
actionPerformed(Shell shell,
Component source,
int action)
Called when specified action has occurred. |
void |
closeWidget()
Called when last script-created maximized shell is popped. |
Component |
createElement(String viewName,
String elementId,
Style style,
Object context)
Callback to create user interface element for view. |
Menu |
getMenu(Shell shell,
Component focused)
Called when user has requested menu to be opened. |
MenuItem |
getSoftKey(Shell shell,
Component focused,
int key)
Called when system wants to get a binding for soft key. |
Object |
handleMessage(String service,
Object argument)
This privileged operation is used when java code wishes to interact with integrated "core" widget. |
boolean |
keyAction(Component source,
int op,
int code)
Called when key event has occurred. |
void |
messageReceived(String service,
Object argument,
ResponseCallback callback)
Called when inter widget communication request has been received. |
void |
onFailure(Object state,
String errorMessage)
Called when server call has failed. |
void |
onSuccess(Object state,
Value returnValue)
Called when server call has finished successfully. |
Shell |
openWidget()
Called when the user opens the widget from the dashboard. |
Shell |
openWidgetItem(Value context,
String text,
ByteArray icon)
Called when the user has clicked on active standby item. |
void |
paint(Component c,
Graphics g,
Style style,
int width,
int height)
Called when custom component should be painted. |
void |
parametersChanged()
Called when widget parameters are changed either from server side or client side. |
void |
startWidget()
Called when the widget instance is created and started. |
void |
stopWidget()
Called when the widget execution is fully stopped. |
void |
timerEvent(Timer timer)
Called then scheduled timer is executed. |
void |
updateReceived(String service,
Value argument)
Called when asynchronous notification has been received from server indicating that something has changed on the service associated with this widget. |
void |
updateWidget()
Called when widget should update it's contents. |
| Method Detail |
|---|
void actionPerformed(Shell shell,
Component source,
int action)
FOCUS_CHANGED)
shell - Source shellsource - Source componentaction - Action codeComponent.setAction(int),
Component.getAction(),
Menu,
MenuItem,
OPEN_MENU,
FOCUS_CHANGED,
ITEM_CHANGED,
OPEN_LINK,
SHELL_OPENED,
SHELL_CLOSED,
VIEWPORT_CHANGED,
FOCUSED,
BLURRED,
ActionCallback
Menu getMenu(Shell shell,
Component focused)
shell - Source shellfocused - Source component
Menu object, or null if no menu is available.OPEN_MENU,
Menu,
MenuItem,
MenuCallback
MenuItem getSoftKey(Shell shell,
Component focused,
int key)
shell - Source shellfocused - Source componentkey - Either SOFTKEY_OK,
SOFTKEY_MIDDLE or
SOFTKEY_BACKMenuItem,
SoftKeyCallback
boolean keyAction(Component source,
int op,
int code)
source - Currently focused componentop - Operation that has occurred:
KEY_PRESSED,
KEY_RELEASED,
KEY_REPEATEDcode - unicode value of key (>=0) or special key code
(<0) for other keys
true if key event was consumed and should
not be processed anywhere elseKEY_UP,
KEY_DOWN,
KEY_LEFT,
KEY_RIGHT,
KEY_FIRE,
KEY_ESC,
KEY_ENTER,
KEY_CR,
KEY_DELETE,
KEY_BACKSPACE,
KEY_TAB,
KEY_OK,
KEY_BACK
Component createElement(String viewName,
String elementId,
Style style,
Object context)
createView(String, Object)
and referred view contains script actions.
viewName - Name of view being created, same as
name in createView(String, Object)elementId - Id of elementstyle - Style for elementcontext - Same as parameter context passed to
createView(String, Object)
null is not
recommended.void startWidget()
void stopWidget()
void updateWidget()
Called when widget should update it's contents. Typically this might involve in calling the server and fetching some content.
This function is always invoked after client has connected to server and widgets has been loaded and verified to be up-to-date.
void updateReceived(String service,
Value argument)
Called when asynchronous notification has been received from server indicating that something has changed on the service associated with this widget.
If this function is not implemented, the updateWidget()
will be called instead.
service - Name of serviceargument - Notification argumentShell openWidget()
null if there is no user interface.
If the null is returned the widget can still open
the user interface by itself.
Shell openWidgetItem(Value context,
String text,
ByteArray icon)
openWidget() is used instead.
context - Widget specific contexttext - Text shown on active standby screenicon - Icon shown on active standby screen
null if there is no user interface.
If the null is returned the widget can still open
the user interface by itself.void closeWidget()
void timerEvent(Timer timer)
timer - Scheduled timer objectschedule(long),
schedule(long,long),
Timer,
Timer.cancel(),
TimerCallback
void paint(Component c,
Graphics g,
Style style,
int width,
int height)
c - Instance of custom componentg - Graphics contextstyle - Style to usewidth - Width of the available areaheight - Height of the available areaPaintCallback,
Callbacks
void onSuccess(Object state,
Value returnValue)
Called when server call has finished successfully. Server calls are
made with call(Object, String, String, Value) or
call(Object, String, String, Value, SuccessCallback, FailureCallback)
state - State object given with call(Object, String, String, Value)returnValue - the return value from serverSuccessCallback,
Callbacks
void onFailure(Object state,
String errorMessage)
Called when server call has failed. Server calls are
made with call(Object, String, String, Value) or
call(Object, String, String, Value, SuccessCallback, FailureCallback)
state - State object given with call(Object, String, String, Value)errorMessage - error message of exceptionFailureCallback,
Callbacks
void messageReceived(String service,
Object argument,
ResponseCallback callback)
service - Name of service being calledargument - Argument for servicecallback - Optional callback for sending response back,
null callback indicates that
caller do not wish to receive response.
Object handleMessage(String service,
Object argument)
void parametersChanged()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||