Package net.rim.device.api.command

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


        // A MenuItem to start the diagnostic test
        final MenuItem startTestItem =
                new MenuItem(new StringProvider("Start Test"), 0x300010, 0);
        ;
        startTestItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                // Format the UI for output
                showOutputFields();

                // Begin test
                if (_locThread != null) {
                    if (!_locThread.isStopped()) {
                        _locThread.stop();
                    }
                }

                _log.setText("");
                log("Extended GPS API test starting");
                log("Device: " + DeviceInfo.getDeviceName());
                log("Device Software: " + DeviceInfo.getSoftwareVersion());
                log("Carrier: " + RadioInfo.getCurrentNetworkName());

                _locThread = new LocationThread();
                _locThread.start();
            }
        }));
        addMenuItem(startTestItem);
        _stopTestItem =
                new MenuItem(new StringProvider("Stop Test"), 0x300020, 1);
        _stopTestItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                // Stop the thread
                log("Stopping test");
                _locThread.stop();
                _locThread = null;
            }
        }));
        addMenuItem(_stopTestItem);

        // A MenuItem to display the help dialog
        final MenuItem helpItem =
                new MenuItem(new StringProvider("Help"), 0x300030, 2);
        helpItem.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


        buffer.append("Allow Zooming");

        final MenuItem zoomItem =
                new MenuItem(new StringProvider(buffer.toString()), 0x230010, 0);
        zoomItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _restrictedMapAction.toggleZooming();
            }

        }));
        menu.add(zoomItem);

        // Reset buffer
        buffer.setLength(0);

        if (_restrictedMapAction.isPanningAllowed()) {
            buffer.append(Characters.CHECK_MARK).append(' ');
        }

        buffer.append("Allow Panning");

        final MenuItem setCenterItem =
                new MenuItem(new StringProvider(buffer.toString()), 0x230020, 1);
        setCenterItem.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 SaveMenuItem object
         */
        private SaveMenuItem() {
            super(new StringProvider("Save"), 0x230010, 5);
            this.setCommand(new Command(new CommandHandler() {

                /**
                 * Saves the contact and closes this screen
                 *
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
View Full Code Here

        add(_statusField);

        // This menu item provides an alternative to clicking the send button
        final MenuItem sendItem =
                new MenuItem(new StringProvider("Send"), 0x230010, 0);
        sendItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                handleSend();
            }
        }));

        // This menu item provides an alternative to clicking the clear button
        final MenuItem clearItem =
                new MenuItem(new StringProvider("Clear"), 0x230020, 0);
        clearItem.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

        // Store the UiApplication for use in refreshing the message list field
        _uiApplication = UiApplication.getUiApplication();

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

                final Folder currentFolder =
                        ((Message) getSelectedItem()).getFolder();

                final FoldersViewScreen foldersViewScreen =
                        new FoldersViewScreen(currentFolder);
                UiApplication.getUiApplication().pushScreen(foldersViewScreen);
            }
        }));

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

        /**
         * Default constructor
         */
        private SaveMenuItem() {
            super(new StringProvider("Save"), 0x230010, 5);
            this.setCommand(new Command(new CommandHandler() {
                /**
                 * Saves and closes this screen.
                 *
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
View Full Code Here

                        "Add Bcc: ", "Bcc: ");

        // MenuItem to save a message
        final MenuItem saveMenuItem =
                new MenuItem(new StringProvider("Save Message"), 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 the save is completed, then
                                            // discard this screen
                if (onSave()) {
                    close();
                } else
                // If the message could not be saved, alert the user
                {
                    UiApplication.getUiApplication().invokeLater(
                            new Runnable() {
                                public void run() {
                                    Dialog.alert("Message could not be saved");
                                }
                            });
                }
            }
        }));

        // MenuItem to send a message
        final MenuItem sendMenuItem =
                new MenuItem(new StringProvider("Send Message"), 0x230010, 0);
        sendMenuItem.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 populate the list field
     */
    private final class Populate extends MenuItem {
        private Populate() {
            super(new StringProvider("Populate"), 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

        /**
         * Creates a new SimulateLmmLow object
         */
        private SimulateLmmLow() {
            super(new StringProvider("Simulate LMM Low"), 0x330000, 5);
            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

        /**
         * Creates a new SimulateLmmMedium object
         */
        private SimulateLmmMedium() {
            super(new StringProvider("Simulate LMM Medium"), 0x330010, 6);
            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.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.