Package net.rim.device.api.script

Examples of net.rim.device.api.script.ScriptableFunction


     * Removes a message listener.
     *
     * @return The <code>ScripableFunction</code> to be executed.
     */
    public ScriptableFunction remove() {
        return new ScriptableFunction() {
            public Object invoke( Object self, Object[] args ) {
                if( listener == null ) {
                    return Boolean.FALSE;
                }
                listener = null;
View Full Code Here


    public BBMPlatformContextListenerImpl(BBMPlatformNamespace platform) {
        _platform = platform;
    }

    public void accessChanged(boolean isAccessAllowed, int code) {
        final ScriptableFunction callback;
        try {
            callback = (ScriptableFunction) _platform.getField(BBMPlatformNamespace.EVENT_ON_ACCESS_CHANGED);
        } catch(Exception e1){
            return;
        }
View Full Code Here

       
        Util.dispatchCallback(callback, args);
    }

    public void appInvoked(int reason, Object param, Presence user) {
        final ScriptableFunction callback;
        try {
            callback = (ScriptableFunction) _platform.getField(BBMPlatformNamespace.EVENT_ON_APP_INVOKED);
        } catch(Exception e1){
            return;
        }
View Full Code Here

    /**
     * @see blackberry.core.ScriptableFunctionBase#execute(Object, Object[])
     */
    public Object execute( Object thiz, Object[] args ) throws Exception {
        ScriptableFunction callback = (ScriptableFunction) args[ 0 ];
        ScriptableFunction onCloseCallback = null;
        ScriptableFunction onErrorCallback = null;

        if( args.length >= 2 ) {
            onCloseCallback = (ScriptableFunction) args[ 1 ];
        }

View Full Code Here

     */
    private class SetPersonalMessage extends ScriptableFunctionBase {

        protected Object execute(Object thiz, Object[] args) throws Exception {
            final String message =                            (String) args[0];
            final ScriptableFunction onComplete = (ScriptableFunction) args[1];
           
            Dispatcher.getInstance().dispatch(new DispatchableEvent(null) {
                protected void dispatch() {
                    boolean result;
                    try {
                        result = ((UserProfile) _presence).setPersonalMessage(message);
                    } catch(Exception e) {
                        Util.logError("UserProfile#setPersonalMessage() threw " + e);
                        result = false;
                    }
                    try {
                        onComplete.invoke( null, new Object[] { new Boolean(result) });
                    } catch(Exception e) {
                        // do nothing
                    }
                }
            });
View Full Code Here

    private class SetStatus extends ScriptableFunctionBase {

        protected Object execute(Object thiz, Object[] args) throws Exception {
            final String status =                             (String) args[0];
            final String statusMessage =                      (String) args[1];
            final ScriptableFunction onComplete = (ScriptableFunction) args[2];
            final int statusInt = BBMPlatformUser.statusToInt(status);
           
            Dispatcher.getInstance().dispatch(new DispatchableEvent(null) {
                protected void dispatch() {
                    boolean result;
                    try {
                        result = ((UserProfile) _presence).setStatus(statusInt, statusMessage);
                    } catch(Exception e) {
                        Util.logError("UserProfile#setStatus() threw " + e);
                        result = false;
                    }
                    try {
                        onComplete.invoke( null, new Object[] { new Boolean(result) });
                    } catch(Exception e) {
                        // do nothing
                    }
                }
            });
View Full Code Here

     */
    private class SetDisplayPic extends ScriptableFunctionBase {

        protected Object execute(Object thiz, Object[] args) throws Exception {
            final String displayPicURI = (String) args[0];
            final ScriptableFunction onComplete = (ScriptableFunction) args[1];
            final Bitmap displayPic = Util.requestBitmap(displayPicURI);
           
            Dispatcher.getInstance().dispatch(new DispatchableEvent(null) {
                protected void dispatch() {
                    boolean result;
                    try {
                        result = ((UserProfile) _presence).setDisplayPicture(displayPic);
                    } catch(Exception e) {
                        Util.logError("UserProfile#setDisplayPicture() threw " + e);
                        result = false;
                    }
                    try {
                        onComplete.invoke( null, new Object[] { new Boolean(result) });
                    } catch(Exception e) {
                        // do nothing
                    }
                }
            });
View Full Code Here

        int maxQueueCap = 0;
        Object maxQueueCapObj = obj.getField( KEY_MAX_QUEUE_CAP );
        if( maxQueueCapObj != UNDEFINED ) {
            maxQueueCap = ( (Integer) maxQueueCapObj ).intValue();
        }
        ScriptableFunction onData = (ScriptableFunction) args[ 1 ];
        ScriptableFunction onRegister = (ScriptableFunction) args[ 2 ];
        ScriptableFunction onSimChange = (ScriptableFunction) args[ 3 ];
        PushService.getInstance().openBISPushChannel( port, appId, serverUrl, wakeUpPage, maxQueueCap, onData, onRegister,
                onSimChange );
        return UNDEFINED;
    }
View Full Code Here

    /**
     * @see blackberry.core.ScriptableFunctionBase#execute(Object, Object[])
     */
    public Object execute( Object thiz, Object[] args ) throws Exception {
        String path = (String) args[ 0 ];
        ScriptableFunction completeCallback = null;
        ScriptableFunction onErrorCallback = null;

        if( args.length >= 2 ) {
            completeCallback = (ScriptableFunction) args[ 1 ];
        }

View Full Code Here

        public void userUpdated(UserProfile user, int eventType) {
            invokeOnUpdate(SelfNamespace.getInstance(),  eventType);
        }
       
        private void invokeOnUpdate(Scriptable user, int eventType) {
            final ScriptableFunction callback;
            try {
                callback = (ScriptableFunction) _wFields.getField(EVENT_ON_UPDATE);
            } catch(Exception e) {
                return;
            }
View Full Code Here

TOP

Related Classes of net.rim.device.api.script.ScriptableFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.