Package net.rim.device.api.ui

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


                    new RichTextField("Waiting for location update...",
                            Field.NON_FOCUSABLE);
            add(instructions);

            // Menu Item to add the current location to the list of WayPoints
            final MenuItem markWayPoint =
                    new MenuItem(new StringProvider("Mark waypoint"), 0x230010,
                            0);
            markWayPoint.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
                 */
                public void execute(final ReadOnlyCommandMetadata metadata,
                        final Object context) {
                    GPSDemo.this.markPoint();
                }
            }));

            // Menu Item to view the marked WayPoints
            final MenuItem viewWayPoints =
                    new MenuItem(new StringProvider("View waypoints"),
                            0x230020, 1);
            viewWayPoints.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(new RichTextField(
                "Edit latitude, longitude and zoom level settings and select View Map from the menu.",
                Field.NON_FOCUSABLE));

        // Displays a map of a specified locaton.
        final MenuItem viewMapItem =
                new MenuItem(new StringProvider("View Map"), 0x230020, 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

        dataTemplate.useFixedHeight(true);

        add(_view);

        // Menu item to create a new meeting
        final MenuItem newMeetingItem =
                new MenuItem(new StringProvider("New Meeting"), 0x230010, 0);
        newMeetingItem.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 Meeting meeting = new Meeting();
                _uiApp.pushScreen(new MeetingScreen(meeting, -1, true));
            }
        }));

        viewItem = new MenuItem(new StringProvider("View"), 0x230020, 1);
        viewItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                displayMeeting(false);
            }
        }));

        editItem = new MenuItem(new StringProvider("Edit"), 0x230030, 2);
        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) {
                displayMeeting(true);
            }
        }));

        deleteItem = new MenuItem(new StringProvider("Delete"), 0x230040, 3);
        deleteItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                // Retrieve the highlighted Meeting object and remove it from
                // the
                // vector, then update the list field to reflect the change.
                final int i = _view.getRowNumberWithFocus();
                final String meetingName =
                        ((Meeting) _uiApp.getMeetings().elementAt(i))
                                .getField(Meeting.MEETING_NAME);
                final int result =
                        Dialog.ask(Dialog.DELETE, "Delete " + meetingName + "?");
                if (result == Dialog.YES) {
                    _model.removeRowAt(i);
                }
            }
        }));

        // Menu item to gain access to the controlled object
        final MenuItem retrieveItem =
                new MenuItem(new StringProvider("Access controlled object"),
                        0x230050, 0);
        retrieveItem.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

        vfm.add(_view);
        add(vfm);

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

        _deletePointAction =
                new MenuItem(new StringProvider("Delete"), 0x230020, 1);
        _deletePointAction.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
 
View Full Code Here

            // Initialize the camera features menus
            buildFocusModeMenuItems();
            buildSceneModeMenuItems();

            _turnOffAutoFocusMenuItem =
                    new MenuItem(new StringProvider("Turn Off Auto-Focus"),
                            0x230020, 0);
            _turnOffAutoFocusMenuItem.setCommand(new Command(
                    new CommandHandler() {
                        /**
                         * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                         *      Object)
                         */
                        public void execute(
                                final ReadOnlyCommandMetadata metadata,
                                final Object context) {
                            try {
                                if (_efc != null) {
                                    _efc.stopAutoFocus();
                                } else {
                                    CameraDemo
                                            .errorDialog("ERROR: Focus control not initialized.");
                                }
                            } catch (final Exception e) {
                                CameraDemo.errorDialog("ERROR " + e.getClass()
                                        + ":  " + e.getMessage());
                            }
                        }
                    }));

            _turnOnAutoFocusMenuItem =
                    new MenuItem(new StringProvider("Turn on Auto-Focus"),
                            0x230020, 0);
            _turnOnAutoFocusMenuItem.setCommand(new Command(
                    new CommandHandler() {
                        /**
                         * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                         *      Object)
                         */
                        public void execute(
                                final ReadOnlyCommandMetadata metadata,
                                final Object context) {
                            try {
                                if (_efc != null) {
                                    _efc.startAutoFocus();
                                } else {
                                    CameraDemo
                                            .errorDialog("ERROR: Focus control not initialized.");
                                }
                            } catch (final Exception e) {
                                CameraDemo.errorDialog("ERROR " + e.getClass()
                                        + ":  " + e.getMessage());
                            }
                        }
                    }));

            final MenuItem encodingMenuItem =
                    new MenuItem(new StringProvider("Encoding Settings"),
                            0x230010, 0);
            encodingMenuItem.setCommand(new Command(new CommandHandler() {
                /**
                 * @see CommandHandler#execute(ReadOnlyCommandMetadata, Object)
                 */
                public void execute(final ReadOnlyCommandMetadata metadata,
                        final Object context) {
View Full Code Here

            // Use a Vector to store each of the focus (sub)menu items
            final Vector focusMenuItems = new Vector();

            // Check for fixed focus mode support
            if (_efc.isFocusModeSupported(EnhancedFocusControl.FOCUS_MODE_FIXED)) {
                final MenuItem enableFixedFocus =
                        new MenuItem(new StringProvider(
                                "Enable Fixed Auto Focus"), 0x230010, 0);
                enableFixedFocus.setCommand(new Command(new CommandHandler() {
                    /**
                     * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                     *      Object)
                     */
                    public void execute(final ReadOnlyCommandMetadata metadata,
                            final Object context) {
                        final EnhancedFocusControl efc =
                                (EnhancedFocusControl) _player
                                        .getControl("net.rim.device.api.amms.control.camera.EnhancedFocusControl");
                        efc.setFocusMode(EnhancedFocusControl.FOCUS_MODE_FIXED);
                    };
                }));

                focusMenuItems.addElement(enableFixedFocus);
            }

            // Check for continuous focus mode support
            if (_efc.isFocusModeSupported(EnhancedFocusControl.FOCUS_MODE_CONTINUOUS)) {
                final MenuItem enableContinuousAutoFocus =
                        new MenuItem(new StringProvider(
                                "Enable Continuous Auto Focus"), 0x230020, 0);
                enableContinuousAutoFocus.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                final EnhancedFocusControl efc =
                                        (EnhancedFocusControl) _player
                                                .getControl("net.rim.device.api.amms.control.camera.EnhancedFocusControl");
                                efc.setFocusMode(EnhancedFocusControl.FOCUS_MODE_CONTINUOUS);
                            };
                        }));

                focusMenuItems.addElement(enableContinuousAutoFocus);
            }

            // Check for single shot focus mode support
            if (_efc.isFocusModeSupported(EnhancedFocusControl.FOCUS_MODE_SINGLESHOT)) {
                final MenuItem enableSingleShotAutoFocus =
                        new MenuItem(new StringProvider(
                                "Enable Single Shot Auto Focus"), 0x230030, 0);
                enableSingleShotAutoFocus.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
 
View Full Code Here

        /**
         * Creates a new USBScreen object
         */
        private USBScreen() {
            // Connects through a GCF USB connection
            final MenuItem connectGCF =
                    new MenuItem(new StringProvider("Connect (GCF)"), 0x230010,
                            0);
            connectGCF.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
                 */
                public void execute(final ReadOnlyCommandMetadata metadata,
                        final Object context) {
                    // Cleanup the old thread if present
                    onExit();

                    _usbThread = new GCFUsbThread();
                    connect();
                }
            }));
            /*
             * Connects through a low level USB connection.
             */
            final MenuItem connectLowLevel =
                    new MenuItem(new StringProvider("Connect (low level)"),
                            0x230020, 1);
            connectLowLevel.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

            final Vector sceneModeMenuItems = new Vector();

            // Check for auto scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_AUTO)) {
                final MenuItem enableSceneModeAuto =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: AUTO"), Integer.MAX_VALUE,
                                0);
                enableSceneModeAuto.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_AUTO);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeAuto);
            }

            // Check for beach scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_BEACH)) {
                final MenuItem enableSceneModeBeach =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: BEACH"), Integer.MAX_VALUE,
                                0);
                enableSceneModeBeach.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_BEACH);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeBeach);
            }

            // Check for face detection scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_FACEDETECTION)) {
                final MenuItem enableSceneModeFaceDetection =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: FACE DETECTION"),
                                Integer.MAX_VALUE, 0);
                enableSceneModeFaceDetection.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_FACEDETECTION);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeFaceDetection);
            }

            // Check for landscape scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_LANDSCAPE)) {
                final MenuItem enableSceneModeLandscape =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: LANDSCAPE"),
                                Integer.MAX_VALUE, 0);
                enableSceneModeLandscape.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_LANDSCAPE);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeLandscape);
            }

            // Check for macro scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_MACRO)) {
                final MenuItem enableSceneModeMacro =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: MACRO"), Integer.MAX_VALUE,
                                0);
                enableSceneModeMacro.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_MACRO);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeMacro);
            }

            // Check for night scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_NIGHT)) {
                final MenuItem enableSceneModeNight =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: NIGHT"), Integer.MAX_VALUE,
                                0);
                enableSceneModeNight.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_NIGHT);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeNight);
            }

            // Check for party scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_PARTY)) {
                final MenuItem enableSceneModeParty =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: PARTY"), Integer.MAX_VALUE,
                                0);
                enableSceneModeParty.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_PARTY);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeParty);
            }

            // Check for portrait scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_PORTRAIT)) {
                final MenuItem enableSceneModePortrait =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: PORTRAIT"),
                                Integer.MAX_VALUE, 0);
                enableSceneModePortrait.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_PORTRAIT);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModePortrait);
            }

            // Check for snow scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_SNOW)) {
                final MenuItem enableSceneModeSnow =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: SNOW"), Integer.MAX_VALUE,
                                0);
                enableSceneModeSnow.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_SNOW);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeSnow);
            }

            // Check for sport scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_SPORT)) {
                final MenuItem enableSceneModeSport =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: SPORT"), Integer.MAX_VALUE,
                                0);
                enableSceneModeSport.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
                            public void execute(
                                    final ReadOnlyCommandMetadata metadata,
                                    final Object context) {
                                featureControl
                                        .setSceneMode(FeatureControl.SCENE_MODE_SPORT);
                            };
                        }));

                sceneModeMenuItems.addElement(enableSceneModeSport);
            }

            // Check for text scene mode support
            if (featureControl
                    .isSceneModeSupported(FeatureControl.SCENE_MODE_TEXT)) {
                final MenuItem enableSceneModeText =
                        new MenuItem(new StringProvider(
                                "Enable Scene Mode: TEXT"), Integer.MAX_VALUE,
                                0);
                enableSceneModeText.setCommand(new Command(
                        new CommandHandler() {
                            /**
                             * @see CommandHandler#execute(ReadOnlyCommandMetadata,
                             *      Object)
                             */
 
View Full Code Here

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

        _message = new StringBuffer();

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

        _statusField =
                new LabelField(
                        "Open the menu to download or upload attachments",
                        Field.NON_FOCUSABLE);
        add(_statusField);
        final MenuItem downloadItem =
                new MenuItem(new StringProvider("Download Attachments"),
                        0x230010, 0);
        downloadItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _statusField.setText("");
                if (_action.getMessages()) {
                    try {
                        _action.download(Dialog.ask(Dialog.D_YES_NO,
                                "Download only png and msword attachments?") == Dialog.NO);
                    } catch (final IOException ex) {
                        AttachmentDemo
                                .errorDialog("DownloadManager.download() threw "
                                        + ex.toString());
                    }
                } else {
                    displayStatus("Mailbox is empty.");
                }
            }
        }));
        final MenuItem uploadItem =
                new MenuItem(new StringProvider("Send Attachment"), 0x230020, 1);
        uploadItem.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.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.