Package net.rim.device.api.script

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


    public void contactsJoined(BBMPlatformConnection connection, BBMPlatformContactList contactList, String cookie, int type) {
        this.waitForConnDelivery();
       
        try {
            final ScriptableFunction callback = (ScriptableFunction) _connObj.getField(ConnectionObject.EVENT_ON_USERS_JOINED);
            final Object[] args = new Object[] {
                Util.contactListToArray(contactList),
                ConstantsUtil.getContactJoinedTypeStr(type),
                cookie,
            };
View Full Code Here


    public void dataReceived(BBMPlatformConnection connection, BBMPlatformContact contact, BBMPlatformData data) {
        this.waitForConnDelivery();
       
        try {
            final ScriptableFunction callback = (ScriptableFunction) _connObj.getField(ConnectionObject.EVENT_ON_DATA);
            final Object[] args = new Object[] {
                new BBMPlatformUser(contact),
                data.getDataAsString(),
            };
            Util.dispatchCallback(callback, args);
View Full Code Here

    public void broadcastDataReceived(BBMPlatformSession session, BBMPlatformContact sender, BBMPlatformData data) {
        _connListenerImpl.waitForConnDelivery();
       
        final SessionObject sessionObj = (SessionObject)_connListenerImpl.getConnectionObject();
        try {
            final ScriptableFunction callback = (ScriptableFunction) sessionObj.getField(SessionObject.EVENT_ON_BROADCAST_DATA);
            final Object[] args = new Object[] {
                new BBMPlatformUser(sender),
                data.getDataAsString(),
            };
            Util.dispatchCallback(callback, args);
View Full Code Here

    public void contactsRemoved(BBMPlatformSession session, BBMPlatformContact removedBy, BBMPlatformContactList contactList) {
        _connListenerImpl.waitForConnDelivery();
       
        final SessionObject sessionObj = (SessionObject)_connListenerImpl.getConnectionObject();
        try {
            final ScriptableFunction callback = (ScriptableFunction) sessionObj.getField(SessionObject.EVENT_ON_USERS_REMOVED);
            final Object[] args = new Object[] {
                new BBMPlatformUser(removedBy),
                Util.contactListToArray(contactList),
            };
            Util.dispatchCallback(callback, args);
View Full Code Here

            return new Boolean( true );
        } else if( args.length != PARAMS_MAX ) {
            return UNDEFINED;
        } else {
            final ScriptableFunction sf = (ScriptableFunction) args[ 0 ];
            final int index = ( (Integer) args[ 1 ] ).intValue();

            if( isCBIndexValid( index ) ) {
                setListenerByIndex( sf, index );
View Full Code Here

    private void InvokeScriptableCallback( final int callbackIndex, final int callid ) {
        InvokeScriptableCallback( callbackIndex, callid, NO_FAILURE );
    }

    private void InvokeScriptableCallback( final int callbackIndex, final int callid, final int reason ) {
        final ScriptableFunction callback = getListenerByIndex( callbackIndex );

        if( callback != null ) {
            ( (UiApplication) _uiApplicationWeakReference.get() ).invokeLater( new Runnable() {
                public void run() {
                    try {
                        new Thread( new Runnable() {
                            public void run() {
                                try {
                                    final Integer callidObj = new Integer( callid );
                                    callback.invoke( null, ( reason == NO_FAILURE ? new Object[] { callidObj } : new Object[] {
                                            callidObj, new Integer( reason ) } ) );
                                } catch( final Exception e ) {
                                }
                            }
                        } ).start();
View Full Code Here

     * @see blackberry.core.ScriptableFunctionBase#execute(Object, Object[])
     */
    public Object execute( Object thiz, Object[] args ) throws Exception {
        boolean allowMultiple = ( (Boolean) args[ 0 ] ).booleanValue();
        Scriptable choices = (Scriptable) args[ 1 ];
        ScriptableFunction callback = (ScriptableFunction) args[ 2 ];

        int numChoices = choices.getElementCount();
        String[] labels = new String[ numChoices ];
        boolean[] enabled = new boolean[ numChoices ];
        boolean[] selected = new boolean[ numChoices ];
View Full Code Here

     * @see blackberry.core.ScriptableFunctionBase#execute(Object, Object[])
     */
    public Object execute(Object thiz, Object[] args) throws Exception {
        String type = (String) args[0];
        Scriptable options = (Scriptable) args[1];
        ScriptableFunction callback = (ScriptableFunction) args[2] ;
       
        String value = (String)options.getField("value");
        String min = (String)options.getField("min");
        String max = (String)options.getField("max");
       
View Full Code Here

    /**
     * @see blackberry.core.ScriptableFunctionBase#execute(Object, Object[])
     */
    public Object execute( Object thiz, Object[] args ) throws Exception {
        int initialColor = stringToColor( (String) args[ 0 ] );
        ScriptableFunction callback = (ScriptableFunction) args[ 1 ];

        // create dialog
        Runnable dr = DialogRunnableFactory.getColorPickerRunnable( initialColor, callback );

        // queue
View Full Code Here

            throw new IllegalArgumentException();
        }
        // default choice
        final int defaultChoice = DialogNamespace.getDefaultChoice( type );
        //callback function
        ScriptableFunction callback = (ScriptableFunction) args[ 2 ];
       
        Runnable dr = DialogRunnableFactory.getStandardAskRunnable(message, type, defaultChoice, global, callback);
        // queue
        UiApplication.getUiApplication().invokeLater(dr);
        // return value
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.