Package net.rim.device.api.command

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


        for (int i = 0; i < _pictureFileNames.size(); i++) {
            _picturesList.add((String) _pictureFileNames.elementAt(i));
        }

        _picturesList.setCommand(new Command(new CommandHandler() {
            /**
             * @see CommandHandler#execute(ReadOnlyCommandMetadata, Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                setImage();
            }
        }));

        add(vfm);

        final SeparatorField separator = new SeparatorField();
        separator.setPadding(50, 0, 0, 0);
        add(separator);
        add(new LabelField("Add shortcut to the home screen",
                Field.FIELD_HCENTER));
        add(new SeparatorField());

        _homeScreenLocationPicker = HomeScreenLocationPicker.create();
        add(_homeScreenLocationPicker);

        // Create a button to add a shortcut to this screen on the home screen
        _shortcutButton =
                new ButtonField("Add shortcut", Field.FIELD_HCENTER
                        | ButtonField.CONSUME_CLICK);
        _shortcutButton.setChangeListener(new FieldChangeListener() {
            public void fieldChanged(final Field field, final int context) {
                addShortcut();
            }
        });

        add(_shortcutButton);

        _setHomeScreenImage =
                new MenuItem(new StringProvider("Set as Home Screen Image"),
                        0x230010, 0);
        _setHomeScreenImage.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                setImage();
            }
        }));

        _addHomeScreenShortCut =
                new MenuItem(new StringProvider("Add Shortcut"), 0x230020, 1);
        _addHomeScreenShortCut.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


         *            this menu item will invoke a connection to
         */
        DeviceMenuItem(final String text, final BluetoothSerialPortInfo info) {
            super(new StringProvider(text), 0x230020, 20);
            _info = info;
            this.setCommand(new Command(new CommandHandler() {
                /**
                 * Invokes the connection to the device associated with the
                 * Bluetooth Serial Port information stored in this object.
                 *
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
View Full Code Here

            }

            // Create a menu item to save the new call
            final MenuItem saveItem =
                    new MenuItem(new StringProvider("Save"), 0x230010, 100);
            saveItem.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

        for (int i = 0; i < numFields; ++i) {
            add((Field) fields.elementAt(i));
        }

        _editItem = new MenuItem(new StringProvider("Edit"), 0x230010, 0);
        _editItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                /* outer. */makeEditScreen();
            }
        }));

        _saveItem = new MenuItem(new StringProvider("Save"), 0x230010, 0);
        _saveItem.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

            }

            // Create a menu item to save the new call
            final MenuItem saveItem =
                    new MenuItem(new StringProvider("Save"), 0x230010, 100);
            saveItem.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

            for (int i = 0; i < _pictureDirectoryURLs.size(); i++) {
                _list.add((String) _pictureDirectoryURLs.elementAt(i));
            }

            // Set the list to display when a list item is activated
            _list.setCommand(new Command(new CommandHandler() {
                /**
                 * @see CommandHandler#execute(ReadOnlyCommandMetadata, Object)
                 */
                public void execute(final ReadOnlyCommandMetadata metadata,
                        final Object context) {
View Full Code Here

        // Closes the screen
        final MenuItem closeSP =
                new MenuItem(new StringProvider("Close serial port"), 0x230010,
                        0);
        closeSP.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                close();
            }
        }));

        // Displays the DTR line's state
        final MenuItem dtr =
                new MenuItem(new StringProvider("Get DTR"), 0x230020, 1);
        dtr.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                try {
                    Status.show("DTR: " + _port.getDtr());
                } catch (final IOException ioex) {
                    Status.show("");
                    BluetoothDemo
                            .errorDialog("BluetoothSerialPort#getDtr() threw "
                                    + ioex.toString());
                }
            }
        }));

        // Turns DSR on
        final MenuItem dsrOn =
                new MenuItem(new StringProvider("DSR on"), 0x230030, 2);
        dsrOn.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                Status.show("DSR on");
                try {
                    _port.setDsr(true);
                } catch (final IOException ioex) {
                    Status.show("");
                    BluetoothDemo
                            .errorDialog("BluetoothSerialPort#setDsr(boolean) threw "
                                    + ioex.toString());
                }
            }
        }));

        // Turns DSR off
        final MenuItem dsrOff =
                new MenuItem(new StringProvider("DSR off"), 0x230040, 3);
        dsrOff.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                Status.show("DSR off");
                try {
                    _port.setDsr(false);
                } catch (final IOException ioex) {
                    Status.show("");
                    BluetoothDemo
                            .errorDialog("BluetoothSerialPort#setDsr(boolean) threw "
                                    + ioex.toString());
                }
            }
        }));

        // Enables loop back
        final MenuItem enableLoopback =
                new MenuItem(new StringProvider("Enable loopback"), 0x230050, 4);
        enableLoopback.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _loopback = true;
            }
        }));

        // Disables loop back
        final MenuItem disableLoopback =
                new MenuItem(new StringProvider("Disable loopback"), 0x230060,
                        5);
        disableLoopback.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _loopback = false;
            }
        }));

        // Sends 1kb of information to the other device
        final MenuItem send1k =
                new MenuItem(new StringProvider("Send 1k"), 0x230070, 6);
        send1k.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

            if (HomeScreen.supportsIcons()) {
                final MenuItem setIconItem =
                        new MenuItem(
                                new StringProvider("Set Home Screen Icon"),
                                0x230010, 0);
                setIconItem.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 Bitmap bitmap =
                                Bitmap.getBitmapResource("img/logo_blue.jpg");
                        HomeScreen.updateIcon(bitmap);
                    }
                }));
                menu.add(setIconItem);

                final MenuItem setRolloverItem =
                        new MenuItem(new StringProvider("Set Rollover Icon"),
                                0x230020, 1);
                setRolloverItem.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

        _statusField = new RichTextField(Field.NON_FOCUSABLE);
        add(_statusField);

        final MenuItem infoScreen =
                new MenuItem(new StringProvider("Info Screen"), 0x230010, 1);
        infoScreen.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

        add(_view);

        final MenuItem connectToDevice =
                new MenuItem(new StringProvider("Connect to Device"), 0x230020,
                        0);
        connectToDevice.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

TOP

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

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.