Package net.rim.device.api.command

Examples of net.rim.device.api.command.Command


       
        user_message.setChangeListener(centre_text_listener);
        last_aids.setChangeListener(centre_text_listener);

        mi_kill.setCommandContext(this);
        mi_kill.setCommand(new Command(new KillCommand()));
        addMenuItem(mi_kill);

        mi_settings.setCommandContext(this);
        mi_settings.setCommand(new Command(new SettingsCommand()));
        addMenuItem(mi_settings);

        try {
            if(nfc_service.isNfcEnabled()) {
                nfc_led = new BitmapField(bmp_nfc_led_on);
View Full Code Here


    public StartGameScreen() {
        super(Field.USE_ALL_HEIGHT | Field.USE_ALL_WIDTH | Field.FIELD_HCENTER | Field.FIELD_VCENTER);
       
        mi_about.setCommandContext(this);
        mi_about.setCommand(new Command(new AboutCommand()));
        addMenuItem(mi_about);

        AbsoluteFieldManager abmgr = new AbsoluteFieldManager();
        new_game_screen = BitmapFactory.getNewGameScreen();
        Background bg_new_game = BackgroundFactory.createBitmapBackground(new_game_screen);
View Full Code Here

            e.printStackTrace();
            Utilities.log("XXXX NfcSnepResponder Exception on obtaining NDEFPushManager: " + e.getMessage());
        }
       
        _miStop.setCommandContext(this);
        _miStop.setCommand(new Command(new StopCommand(this)));

        _miStart.setCommandContext(this);
        _miStart.setCommand(new Command(new StartCommand(this)));

        Font default_font = Font.getDefault();
        _headingFont = default_font.derive(Font.BOLD, 24);

        _heading.setText("Event Log (newest items first)");
View Full Code Here

            emulateSmartCard();
        } else {
            emulateReader();
        }
        mi_stop.setCommandContext(this);
        mi_stop.setCommand(new Command(new StopCommand(this)));
        addMenuItem(mi_stop);

        mi_start.setCommandContext(this);
        mi_start.setCommand(new Command(new StartCommand(this)));

        Font default_font = Font.getDefault();
        heading_font = default_font.derive(Font.BOLD, 24);

        heading.setText("Event Log (newest items first)");
View Full Code Here

        icon = new BitmapField(sc_icon);
        icon_row.add(icon);
        icon_row.add(new LabelField(" - emulating smart card"));
        add(icon_row);
        mi_response.setCommandContext(this);
        mi_response.setCommand(new Command(new ResponseTextCommand()));
        addMenuItem(mi_response);
        startEmulationOfISO14443ATarget();

    }
View Full Code Here

        int width = Display.getWidth();
        int height = Display.getHeight();
        uiconfig = UiConfigFactory.getUiConfig(width, height);
       
        mi_about.setCommandContext(this);
        mi_about.setCommand(new Command(new AboutCommand()));
        addMenuItem(mi_about);


        Bitmap blank_unfocused = BitmapFactory.getBlankUnfocused();
        Bitmap blank_focused = BitmapFactory.addStateIndicator(blank_unfocused, Constants.FOCUSED_COLOUR);
View Full Code Here

        add(instructions);

        // Invokes BlackBerry Maps application using a MapView object
        final MenuItem viewMapItem =
                new MenuItem(new StringProvider("View Map"), 0x230010, 0);
        viewMapItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

            rowObjects[YEAR] = year;
            rowObjects[INTERFACES] = interfaces;
            richList.add(rowObjects);
        }

        richList.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

     */
    void addMenuItems(final MainScreen mainScreen) {
        final MenuItemWithIcon appendUnreadMessage =
                new MenuItemWithIcon("Append Unread Message", 0,
                        "img/sm_add_message.png");
        appendUnreadMessage.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                // Create a new message
                final DemoMessage message = new DemoMessage();
                message.setSender("John Smith");
                message.setSubject("Hello from John");
                message.setMessage("Hello Chris. Do you know that you can get a BlackBerry Smartphone cheaper through the Message List Demo Store?");
                message.setReceivedTime(System.currentTimeMillis());
                message.setPreviewPicture(CommunicationSimulatorThread
                        .getRandomPhotoImage());

                // Store message
                final MessageListDemoStore messageStore =
                        MessageListDemoStore.getInstance();
                synchronized (messageStore) {
                    messageStore.addInboxMessage(message);
                }

                Dialog.alert("Unread message was added to inbox");

                // Notify folder
                final ApplicationMessageFolder inboxFolder =
                        messageStore.getInboxFolder();
                inboxFolder.fireElementAdded(message, true);
            }
        }));
        mainScreen.addMenuItem(appendUnreadMessage);

        final MenuItemWithIcon appendOpenedMessage =
                new MenuItemWithIcon("Append Opened Message", 1,
                        "img/sm_add_message.png");
        appendOpenedMessage.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                // Create a new message
                final DemoMessage message = new DemoMessage();
                message.setSender("Maria Rosevelt");
                message.setSubject("How have you been?");
                message.setMessage("Hi Chris. I haven't seen you in ages.  Let's do lunch!");
                message.setReceivedTime(System.currentTimeMillis() - 2 * 24
                        * 60 * 60 * 1000L);
                message.setPreviewPicture(CommunicationSimulatorThread
                        .getRandomPhotoImage());
                message.markRead();

                // Store message
                final MessageListDemoStore messageStore =
                        MessageListDemoStore.getInstance();
                synchronized (messageStore) {
                    messageStore.addInboxMessage(message);
                }

                Dialog.alert("Opened message was added to inbox");

                // Notify folder
                messageStore.getInboxFolder().fireElementAdded(message);
            }
        }));
        mainScreen.addMenuItem(appendOpenedMessage);

        final MenuItemWithIcon appendMessagesInBulk =
                new MenuItemWithIcon("Append Messages in Bulk", 2,
                        "sm_add_messages_bulk");
        appendMessagesInBulk.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                final MessageListDemoStore messageStore =
                        MessageListDemoStore.getInstance();
                synchronized (messageStore) {
                    for (int i = 1; i <= MAX_MSGS; i++) {
                        // Create a new message
                        final DemoMessage message = new DemoMessage();
                        message.setSender("Mark Duval");
                        message.setSubject(i + " of " + MAX_MSGS);
                        message.setMessage("Please pick up milk and bread on the way home.");
                        message.setReceivedTime(System.currentTimeMillis());
                        message.setPreviewPicture(CommunicationSimulatorThread
                                .getRandomPhotoImage());

                        // Store message in the runtime store
                        messageStore.addInboxMessage(message);
                    }

                    // Notify folder
                    final ApplicationMessageFolder inboxFolder =
                            messageStore.getInboxFolder();
                    inboxFolder.fireReset(true);
                }

                Dialog.alert("Bulk messages were added to inbox");
            }
        }));
        mainScreen.addMenuItem(appendMessagesInBulk);

        final MenuItemWithIcon startCommunicationThread =
                new MenuItemWithIcon("Start Communication Thread", 3,
                        "sm_start_auto");
        startCommunicationThread.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                if (_commThread != null) {
                    Dialog.alert("Communication thread already running");
                    return;
                }

                _commThread = new CommunicationSimulatorThread();
                _commThread.start();

                Dialog.alert("Communication thread started successfully.\n After dismissing this dialog, press the End (red phone) key and"
                        + " open the Messages application from the home screen.");
            }
        }));
        mainScreen.addMenuItem(startCommunicationThread);

        final MenuItemWithIcon stopCommunicationThread =
                new MenuItemWithIcon("Stop Communication Thread", 4,
                        "sm_stop_auto");
        stopCommunicationThread.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                if (_commThread == null) {
                    Dialog.alert("Communication thread is not running");
                    return;
                }
                _commThread.stopRunning();
                _commThread = null;
                Dialog.alert("Communication thread stopped.");
            }
        }));
        mainScreen.addMenuItem(stopCommunicationThread);

        final MenuItemWithIcon viewMessagesInMessageList =
                new MenuItemWithIcon("View Messages In Message List", 5,
                        "sm_open_messages_app");
        viewMessagesInMessageList.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

        // Set the controller focus policy to highlight rows
        tableController.setFocusPolicy(TableController.ROW_FOCUS);

        // Set the behaviour of the controller when a table item is clicked
        tableController.setCommand(new Command(new CommandHandler() {
            /**
             * @see CommandHandler#execute(ReadOnlyCommandMetadata, Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
View Full Code Here

TOP

Related Classes of net.rim.device.api.command.Command

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.