Package net.rim.device.api.command

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


        // Menu item to initiate outgoing call with the selected line
        final MenuItem _callWithSelectedLineMenuItem =
                new MenuItem(new StringProvider("Call With Selected Line"),
                        0x230010, 0);
        _callWithSelectedLineMenuItem.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 String text = _basicEditField.getText();
                        if (text == null || text.trim().length() == 0) {
                            Dialog.alert("Please enter phone number");
                        } else {
                            final Choice choice =
                                    (Choice) _choiceField
                                            .getChoice(_choiceField
                                                    .getSelectedIndex());
                            try {
                                // If the selected line is not currently active,
                                // the
                                // following method call will set it as active
                                // as
                                // well as place the call.
                                Phone.initiateCall(choice.getLineId(), text);
                            } catch (final RadioException re) {
                                PhoneMultiLineDemo
                                        .messageDialog("Phone.initiateCall(int, String) threw "
                                                + re.toString());
                            }
                        }
                    }
                }));
        addMenuItem(_callWithSelectedLineMenuItem);

        final MenuItem _switchLineMenuItem =
                new MenuItem(new StringProvider("Switch To The Selected Line"),
                        0x230020, 1);
        _switchLineMenuItem.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


        }

        // Represents a menu item for saving the screen's memo.
        final MenuItem saveMenuItem =
                new MenuItem(new StringProvider("Save Memo"), 0x230010, 100);
        saveMenuItem.setCommand(new Command(new CommandHandler() {

            /**
             * Attempts to save the screen's data to its associated memo. If
             * successful, the edit screen is popped from the display stack.
             *
 
View Full Code Here

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

        final MenuItem infoScreen =
                new MenuItem(new StringProvider("Info Screen"), 0x230010, 0);
        infoScreen.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

        protected void makeMenu(final Menu menu, final int instance) {
            if (_infoField.getTextLength() > 0) {
                final MenuItem copyContents =
                        new MenuItem(new StringProvider("Copy Contents"),
                                0x230010, 0);
                copyContents.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 ScriptableMenuItem(final String label,
                final ScriptableFunction function) {
            super(new StringProvider(label), 0x230010, 0);
            _function = function;
            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

            // Create menu item for adding a new phone call log
            _addPhoneCallLog =
                    new MenuItem(new StringProvider("Add Phone Call"),
                            0x230010, 0);
            _addPhoneCallLog.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
                 */
                public void execute(final ReadOnlyCommandMetadata metadata,
                        final Object context) {
                    PhoneLogsDemo.this.pushScreen(new AddPhoneCallLogScreen());
                }
            }));

            // Create menu item for adding a new conference phone call log
            _addConferencePhoneCallLog =
                    new MenuItem(new StringProvider("Add Conference Call"),
                            0x230020, 1);
            _addConferencePhoneCallLog.setCommand(new Command(
                    new CommandHandler() {
                        /**
                         * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                         *      Object)
                         */
                        public void execute(
                                final ReadOnlyCommandMetadata metadata,
                                final Object context) {
                            PhoneLogsDemo.this
                                    .pushScreen(new AddConferencePhoneCallLogScreen());
                        }
                    }));

            // Create menu item for deleting all call logs in a folder
            _deleteAllItem =
                    new MenuItem(new StringProvider("Delete All"), 0x230030,
                            130);
            _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

                    // Create menu item to view the currently selected call
                    final MenuItem viewItem =
                            new MenuItem(new StringProvider("View"), 0x230010,
                                    100);
                    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) {
                            PhoneLogsDemo.this
                                    .pushScreen(new ViewCallLogScreen(callLog,
                                            tableRef.getSelectedIndex(),
                                            tableRef.getModel()));
                        }
                    }));
                    menu.add(viewItem);

                    // Create menu item to edit the currently selected call
                    final MenuItem editItem =
                            new MenuItem(new StringProvider("Edit"), 0x230020,
                                    110);
                    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) {
                            PhoneLogsDemo.this
                                    .pushScreen(new EditCallLogScreen(callLog,
                                            tableRef.getSelectedIndex(),
                                            tableRef.getModel()));
                        }
                    }));
                    menu.add(editItem);

                    // Create menu item to delete the currently selected call
                    final MenuItem deleteItem =
                            new MenuItem(new StringProvider("Delete"),
                                    0x230030, 120);
                    deleteItem.setCommand(new Command(new CommandHandler() {
                        /**
                         * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                         *      Object)
                         */
                        public void execute(
View Full Code Here

            }

            final MenuItem listenItem =
                    new MenuItem(new StringProvider("Listen for connections"),
                            0x230010, 0);
            listenItem.setCommand(new Command(new CommandHandler() {
                /**
                 * Launches a connection waiting screen.
                 *
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
View Full Code Here

        for (int i = 0; i < _pictureFileNames.size(); i++) {
            _picturesList.add((String) _pictureFileNames.elementAt(i));
        }

        _picturesList.setCommand(new Command(new CommandHandler() {
            /**
             * @see CommandHandler#execute(ReadOnlyCommandMetadata, Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                setImage();
            }
        }));

        add(vfm);

        final SeparatorField separator = new SeparatorField();
        separator.setPadding(50, 0, 0, 0);
        add(separator);
        add(new LabelField("Add shortcut to the home screen",
                Field.FIELD_HCENTER));
        add(new SeparatorField());

        _homeScreenLocationPicker = HomeScreenLocationPicker.create();
        add(_homeScreenLocationPicker);

        // Create a button to add a shortcut to this screen on the home screen
        _shortcutButton =
                new ButtonField("Add shortcut", Field.FIELD_HCENTER
                        | ButtonField.CONSUME_CLICK);
        _shortcutButton.setChangeListener(new FieldChangeListener() {
            public void fieldChanged(final Field field, final int context) {
                addShortcut();
            }
        });

        add(_shortcutButton);

        _setHomeScreenImage =
                new MenuItem(new StringProvider("Set as Home Screen Image"),
                        0x230010, 0);
        _setHomeScreenImage.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                setImage();
            }
        }));

        _addHomeScreenShortCut =
                new MenuItem(new StringProvider("Add Shortcut"), 0x230020, 1);
        _addHomeScreenShortCut.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

         *            this menu item will invoke a connection to
         */
        DeviceMenuItem(final String text, final BluetoothSerialPortInfo info) {
            super(new StringProvider(text), 0x230020, 20);
            _info = info;
            this.setCommand(new Command(new CommandHandler() {
                /**
                 * Invokes the connection to the device associated with the
                 * Bluetooth Serial Port information stored in this object.
                 *
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
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.