Package net.rim.device.api.ui

Examples of net.rim.device.api.ui.MenuItem


        _status = new EditField();
        add(_status);

        // Menu item to attach a picture to the MMS
        final MenuItem attachPicture =
                new MenuItem(new StringProvider("Attach Picture"), 0x230010, 0);
        attachPicture.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _app.attach(MMSDemo.PICTURE);
            }
        }));

        // Menu item to attach an audio file to the MMS
        final MenuItem attachAudio =
                new MenuItem(new StringProvider("Attach Audio"), 0x230020, 1);
        attachAudio.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _app.attach(MMSDemo.AUDIO);
            }
        }));

        // Menu item to send the MMS
        final MenuItem sendMenuItem =
                new MenuItem(new StringProvider("Send"), 0x230030, 3);
        sendMenuItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                // Send MMS on non-event thread
                final Thread t = new Thread() {
                    public void run() {
                        _app.sendMMS(_addressField, _subjectField,
                                _messageField);
                    }
                };
                t.start();
            }
        }));

        _removeAttachment =
                new MenuItem(new StringProvider("Remove Attachment"), 0x230040,
                        4);
        _removeAttachment.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
View Full Code Here


        // Add the TableView to the screen
        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)
             */
 
View Full Code Here

        add(separator);
        _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.
 
View Full Code Here

        // Obtain a reference to the UiApplication's KeywordFilterField
        _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

        if (filePath == null) {
            throw new NullPointerException("File path can not be null");
        }

        _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)
             */
 
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)
                 */
 
View Full Code Here

    /**
     * Creates a new EventScreen object
     */
    public EventScreen() {
        final MenuItem saveMenuItem =
                new MenuItem(new StringProvider("Save Event"), 0x230020, 1);
        saveMenuItem.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 successful display message and close screen.
                if (onSave()) {
                    Dialog.alert("Event was saved successfully");
                    UiApplication.getUiApplication().pushScreen(
                            new EventScreen());
                    onClose();
                }
            }
        }));
        ;

        _invitees = new Vector();
        // MenuItem for adding an invite field to the create screen
        final MenuItem inviteContactMenuItem =
                new MenuItem(new StringProvider("Invite Contact"), 0x230010, 0);
        inviteContactMenuItem.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

        _contentField = new EditField("", _memo.getField(Memo.MEMO_CONTENT));
        add(_contentField);

        // Menu item to save the displayed memo
        final MenuItem saveItem =
                new MenuItem(new StringProvider("Save"), 0x230020, 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

    /**
     * Creates a new ContactScreen object
     */
    public ContactScreen() {
        final MenuItem saveMenuItem =
                new MenuItem(new StringProvider("Save Contact"), 0x230010, 5);
        saveMenuItem.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 < fields.length; ++i) {
            add(fields[i]);
        }

        // Menu item to edit this screen's memo.
        final MenuItem editItem =
                new MenuItem(new StringProvider("Edit Memo"), 100, 100);
        editItem.setCommand(new Command(new CommandHandler() {

            /**
             * Pushes an edit screen to the display stack, passing it the memo
             * to edit. Upon returning from the edit screen, the view screen is
             * popped as well. The user is returned to the main screen.
View Full Code Here

TOP

Related Classes of net.rim.device.api.ui.MenuItem

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.