Package net.rim.device.api.command

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


        add(_view);

        readRoots(ROOT);

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

        _backItem = new MenuItem(new StringProvider("Go Back"), 0x230020, 1);
        _backItem.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


     * MenuItem class to display a contact's phone number
     */
    private class ViewPhoneMenuItem extends MenuItem {
        public ViewPhoneMenuItem() {
            super(new StringProvider("View Phone"), 0x230020, 0);
            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

     * MenuItem to link a LinkableContact to a BlackBerryContact
     */
    private class LinkToContactMenuItem extends MenuItem {
        public LinkToContactMenuItem() {
            super(new StringProvider("Link To BlackBerry Contact"), 0x230030, 0);
            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

     * MenuItem to unlink a LinkableContact
     */
    private class UnlinkContactMenuItem extends MenuItem {
        public UnlinkContactMenuItem() {
            super(new StringProvider("Unlink Contact"), 0x230060, 0);
            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

        _testField = new TestField("Test Field: ", "");
        add(_testField);

        _spellCheckItem =
                new MenuItem(new StringProvider("Spell check"), 0x230010, 1);
        _spellCheckItem.setCommand(new Command(new CommandHandler() {
            /**
             * Checks the spelling in the TestField.
             *
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                if (_testField.getText().length() == 0) {
                    Dialog.alert("Test field cannot be empty");
                } else {
                    _app.spellCheck(_testField);
                }
            }
        }));

        _learnWordItem =
                new MenuItem(new StringProvider("Learn word"), 0x230020, 1);
        _learnWordItem.setCommand(new Command(new CommandHandler() {
            /**
             * Learns the word in the TestField.
             *
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                if (_testField.getText().length() == 0) {
                    Dialog.alert("Test field cannot be empty");
                } else {
                    _app.learnWord(_testField.getText());
                }
            }
        }));

        _learnCorrectionItem =
                new MenuItem(new StringProvider("Learn correction"), 0x230030,
                        2);
        _learnCorrectionItem.setCommand(new Command(new CommandHandler() {
            /**
             * Shows the user a list of possible corrections for the word in the
             * TestField.
             *
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
View Full Code Here

        _keywordFilterField = _app.getKeywordFilterField();

        // MenuItem to add a country to the list
        final MenuItem addElementItem =
                new MenuItem(new StringProvider("Add country"), 0x230010, 0);
        addElementItem.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

        /**
         * Creates a new SelectContactAction object
         */
        private SelectContactAction() {
            super(new StringProvider("Select Contact"), 0x230010, 0);
            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

        }

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

        _playRecording =
                new MenuItem(new StringProvider("Play recording"), 0x230020, 0);
        _playRecording.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 the playback screen from the chosen video source
                VideoPlaybackScreen playbackScreen;

                if (_recordToStream) {
                    playbackScreen =
                            new VideoPlaybackScreen(new ByteArrayInputStream(
                                    _outStream.toByteArray()));
                } else {
                    playbackScreen = new VideoPlaybackScreen(_videoFile);
                }

                // Hide the video feed since we cannot display video from the
                // camera
                // and video from a file at the same time.
                _videoControl.setVisible(false);
                _displayVisible = false;

                UiApplication.getUiApplication().pushScreen(playbackScreen);

            }
        }));

        _reset =
                new MenuItem(new StringProvider("Reset recording"), 0x230030, 0);
        _reset.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 {
                    _recordControl.reset();
                } catch (final Exception e) {
                    VideoRecordingDemo.errorDialog("RecordControl#reset threw "
                            + e.toString());
                }
            }
        }));

        _showDisplay =
                new MenuItem(new StringProvider("Show display"), 0x230040, 0);
        _showDisplay.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _videoControl.setVisible(true);
                _displayVisible = true;
            }
        }));

        _hideDisplay =
                new MenuItem(new StringProvider("Hide display"), 0x230050, 0);
        _hideDisplay.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _videoControl.setVisible(false);
                _displayVisible = false;
            }
        }));

        _startRecord =
                new MenuItem(new StringProvider("Start recording"), 0x230060, 0);
        _startRecord.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                startRecord();
            }
        }));

        _stopRecord =
                new MenuItem(new StringProvider("Stop recording"), 0x230070, 0);
        _stopRecord.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                stopRecord();
            }
        }));

        _toggleFlash =
                new MenuItem(new StringProvider("Toggle flash"), 0x230080, 0);
        _toggleFlash.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                int newMode;
                switch (_flashControl.getMode()) {
                case FlashControl.OFF:
                    newMode = FlashControl.FORCE;
                    break;
                default:
                    newMode = FlashControl.OFF;
                }

                try {
                    _flashControl.setMode(newMode);
                } catch (final Exception e) {
                }
            }
        }));

        _chooseImageEffect =
                new MenuItem(new StringProvider("Choose effect"), 0x230090, 0);
        _chooseImageEffect.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

        /**
         * Creates a new AddContactAction object
         */
        private AddContactAction() {
            super(new StringProvider("Add New Contact"), 0x230020, 1);
            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

            add(_view);

            // Menu item that deletes all the phone number records.
            _deleteAllItem =
                    new MenuItem(new StringProvider("Delete All"), 0x230010, 0);
            _deleteAllItem.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.