Package net.rim.device.api.script

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


   
    private class PickUsersFunction extends ScriptableFunctionBase {

        protected Object execute(Object thiz, Object[] args) throws Exception {
            final Scriptable options =                    (Scriptable) args[0];
            final ScriptableFunction onComplete = (ScriptableFunction) args[1];
           
            // title is optional. default = null
            final String title;
            final Object titleObj = options.getField("title");
            if(titleObj.equals(UNDEFINED)) {
View Full Code Here


    } // PickUsersFunction
   
    private class StartBBMChatFunction extends ScriptableFunctionBase {

        protected Object execute(Object thiz, Object[] args) throws Exception {
            final ScriptableFunction onComplete = (ScriptableFunction) args[0];
            final String message =                            (String) args[1];
           
            if(args.length == 2) {
                // Need to launch on another thread since the Contact Picker dialog blocks
                UiApplication.getUiApplication().invokeLater(new Runnable() {
View Full Code Here

        }
    } // StartBBMChatFunction
   
    private class InviteToBBMFunction extends ScriptableFunctionBase {
        protected Object execute(Object thiz, Object[] args) throws Exception {
            final ScriptableFunction onComplete = (ScriptableFunction) args[0];       
            final Scriptable scriptInvitations =          (Scriptable) args[1];
            final BBMInvitationRequest[] invitations = this.scriptInvitesToJava(scriptInvitations);
            this.validateInvitations(invitations);
           
            Dispatcher.getInstance().dispatch(new DispatchableEvent(null) {
                protected void dispatch() {
                    try {
                        _uiService.inviteToBBM(invitations);
                    } catch(Exception e) {
                        Util.logError("UIService#inviteToBBM(BBMInvitationRequest[]) threw " + e);
                    }
                    try {
                        onComplete.invoke(null, null);
                    } catch(Exception e) {
                        // do nothing
                    }
                }
            });
View Full Code Here

        }
    } // InviteToBBMFunction
   
    private class InviteToDownloadFunction extends ScriptableFunctionBase {
        protected Object execute(Object thiz, Object[] args) throws Exception {
            final ScriptableFunction onComplete = (ScriptableFunction) args[0];
           
            UiApplication.getUiApplication().invokeLater(new Runnable() {
                public void run() {
                    MessagingService msgService = BBMPlatformNamespace.getInstance().getMessagingService();
                    final int result = msgService.sendDownloadInvitation();
                   
                    Dispatcher.getInstance().dispatch(new DispatchableEvent(null) {
                        protected void dispatch() {
                            // Convert to WW result object
                            final Object resultObj;
                            if(result == IOErrorCode.DOWNLOAD_INVITATION_LIMIT_REACHED) {
                                resultObj = "limitreached";
                            } else {
                                resultObj = UNDEFINED;
                            }
                           
                            try {
                                onComplete.invoke(null, new Object[] { resultObj });
                            } catch(Exception e) {
                                // do nothing
                            }
                        }
                    });
View Full Code Here

        }
    } // InviteToDownloadFunction
   
    private class InviteToBBMConnFunction extends ScriptableFunctionBase {
        protected Object execute(Object thiz, Object[] args) throws Exception {
            final ScriptableFunction onComplete = (ScriptableFunction) args[0];
           
            // Connection object is optional
            final ConnectionObject connObj;
            if(args.length >= 2) {
                connObj = (ConnectionObject) args[1];
            } else {
                connObj = null;
            }
           
            // Invite from all open connections
            if(connObj == null) {
                Dispatcher.getInstance().dispatch(new DispatchableEvent(null) {
                    protected void dispatch() {
                        _uiService.inviteToBBM();
                        try {
                            onComplete.invoke(null, null);
                        } catch(Exception e) {
                            // do nothing
                        }
                    }
                });
            // Invite from a specific connection
            } else {
                final BBMPlatformConnection conn = ((ConnectionObject) connObj).getConnection();
                Dispatcher.getInstance().dispatch(new DispatchableEvent(null) {
                    protected void dispatch() {
                        _uiService.inviteToBBM(conn);
                        try {
                            onComplete.invoke(null, null);
                        } catch(Exception e) {
                            // do nothing
                        }
                    }
                });
View Full Code Here

    private class SendFileFunction extends ScriptableFunctionBase {
       
        protected Object execute(Object thiz, Object[] args) throws Exception {
            final String fileURI =                           (String) args[0];
            final String comment =                           (String) args[1];
            final ScriptableFunction onFailure = (ScriptableFunction) args[2];
           
            final BBMPlatformNamespace bbmpNpsc = BBMPlatformNamespace.getInstance();
            final MessagingService msgService = bbmpNpsc.getMessagingService();
            final MessagingServiceListenerImpl msgServiceListener = bbmpNpsc.getMessagingServiceListener();
           
View Full Code Here

    private static class ShareContentFunction extends ScriptableFunctionBase {

        protected Object execute(Object thiz, Object[] args) throws Exception {
            final String content =                            (String) args[0];
            final String description =                        (String) args[1];
            final ScriptableFunction onComplete = (ScriptableFunction) args[2];
            final Object options;
            if(args.length >= 4) {
                options = args[3];
            } else {
                options = null;
View Full Code Here

   
    private class RequestUserPermissionFunction extends ScriptableFunctionBase {
       
        protected Object execute(Object thiz, Object[] args) throws Exception {
           
            final ScriptableFunction onComplete = (ScriptableFunction) args[0];
           
            UiApplication.getUiApplication().invokeLater(new Runnable() {
                public void run() {
                    UiApplication.getUiApplication().invokeLater(new Runnable() {
                       public void run() {
View Full Code Here

   
    private class ShowOptionsFunction extends ScriptableFunctionBase {
       
        protected Object execute(Object thiz, Object[] args) throws Exception {
           
            final ScriptableFunction onComplete = (ScriptableFunction) args[0];
           
            UiApplication.getUiApplication().invokeLater(new Runnable() {
                public void run() {
                    UiApplication.getUiApplication().invokeLater(new Runnable() {
                       public void run() {
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 onSimChange = (ScriptableFunction) args[ 2 ];
        PushService.getInstance().openBESPushChannel( port, wakeUpPage, maxQueueCap, onData, onSimChange );
        return UNDEFINED;
    }
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.