Package net.rim.device.api.command

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


        _rdsTextField.setLabel("RDS: ");

        _logTextField = new TextField(Field.NON_FOCUSABLE);
        _logTextField.setLabel("Log: ");

        _playButton.setCommand(new Command(new CommandHandler() {
            public void execute(final ReadOnlyCommandMetadata data,
                    final Object context) {
                // Check whether the Player has already been started
                if (_fmRadioDemoPlayer.getPlayerState() == Player.STARTED) {
                    _fmRadioDemoPlayer.switchRbds(false);
                    _fmRadioDemoPlayer.stopPlayer();
                    _playButton.setLabel("Play");
                } else {
                    _fmRadioDemoPlayer.startPlayer();
                    _fmRadioDemoPlayer.switchRbds(true);
                    _playButton.setLabel("Stop");
                }
            }
        }));

        _seekDownButton.setCommand(new Command(new CommandHandler() {
            public void execute(final ReadOnlyCommandMetadata data,
                    final Object context) {
                try {
                    final int frequency =
                            stringToFrequency(_frequencyTextField.getText());
                    _fmRadioDemoPlayer.seek(frequency, false);
                    _frequencyTextField
                            .setText(frequencyToString(_fmRadioDemoPlayer
                                    .getFrequency()));
                } catch (final NumberFormatException n) {
                    // If the TextField cannot be parsed as a valid frequency,
                    // set the TextField text to a valid frequency.
                    _frequencyTextField
                            .setText(frequencyToString(INITIAL_FREQUENCY));
                }
            }
        }));

        _seekUpButton.setCommand(new Command(new CommandHandler() {
            public void execute(final ReadOnlyCommandMetadata data,
                    final Object context) {
                try {
                    final int frequency =
                            stringToFrequency(_frequencyTextField.getText());
                    _fmRadioDemoPlayer.seek(frequency, true);
                    _frequencyTextField
                            .setText(frequencyToString(_fmRadioDemoPlayer
                                    .getFrequency()));
                } catch (final NumberFormatException n) {
                    // If the TextField cannot be parsed as a valid frequency,
                    // set the TextField text to a valid frequency.
                    _frequencyTextField
                            .setText(frequencyToString(INITIAL_FREQUENCY));
                }
            }
        }));

        _increaseRSSIButton.setCommand(new Command(new CommandHandler() {
            public void execute(final ReadOnlyCommandMetadata data,
                    final Object context) {
                // Increase the internally stored value
                // for RSSI that is used for seeking.
                _fmRadioDemoPlayer.increaseRSSI();
                _rssiLabel.setText(_fmRadioDemoPlayer.getRSSI());
            }
        }));

        _decreaseRSSIButton.setCommand(new Command(new CommandHandler() {
            public void execute(final ReadOnlyCommandMetadata data,
                    final Object context) {
                // Decrease the internally stored value
                // for RSSI that is used for seeking.
                _fmRadioDemoPlayer.decreaseRSSI();
                _rssiLabel.setText(_fmRadioDemoPlayer.getRSSI());
            }
        }));

        _setFrequencyButton.setCommand(new Command(new CommandHandler() {
            public void execute(final ReadOnlyCommandMetadata data,
                    final Object context) {
                try {
                    final String text = _frequencyTextField.getText();
                    if (text.indexOf(".") > -1) {
View Full Code Here


            }

            // Menu item to edit the displayed CallLog
            final MenuItem editItem =
                    new MenuItem(new StringProvider("Edit"), 0x230010, 110);
            editItem.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 (AccelerometerSensor.isSupported()) {

            // Menu item to start the ball moving
            _startMenuItem =
                    new MenuItem(new StringProvider("Start"), 0x230010, 0);
            _startMenuItem.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 (_thread == null) {
                        // Start drawing
                        _thread = new DrawThread();
                        _thread.start();
                    }
                }
            }));

            // Menu item to stop the ball moving
            _stopMenuItem =
                    new MenuItem(new StringProvider("Stop"), 0x230010, 0);
            _stopMenuItem.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

            }

            // Menu itme to save the current phone log
            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

            /**
             * Create a new AddParticipant object
             */
            public AddParticipant() {
                super(new StringProvider("Add Participant"), 0x230020, 100);
                this.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

        private final int _index;

        private View(final int index) {
            super(new StringProvider("View"), 0x230020, 1);
            _index = index;
            this.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

            public DeleteParticipant(final int index, final Field field) {
                super(new StringProvider("Delete Participant"), 0x230030, 100);

                _index = index;
                _field = field;
                this.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

        private final int _index;

        private Edit(final int index) {
            super(new StringProvider("Edit"), 0x230030, 2);
            _index = index;
            this.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

        private final int _index;

        private Delete(final int index) {
            super(new StringProvider("Delete"), 0x230040, 3);
            _index = index;
            this.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

     * A menu item to delete all records in the list field
     */
    private final class DeleteAll extends MenuItem {
        private DeleteAll() {
            super(new StringProvider("Delete All"), 0x230050, 4);
            this.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.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.