Package net.rim.device.api.util

Examples of net.rim.device.api.util.StringProvider


         */
        protected void makeMenu(final Menu menu, final int instance) {
            if (HomeScreen.supportsIcons()) {
                final MenuItem setIconItem =
                        new MenuItem(
                                new StringProvider("Set Home Screen Icon"),
                                0x230010, 0);
                setIconItem.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 Bitmap bitmap =
                                Bitmap.getBitmapResource("img/logo_blue.jpg");
                        HomeScreen.updateIcon(bitmap);
                    }
                }));
                menu.add(setIconItem);

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


        add(_rtf);

        // Closes the screen
        final MenuItem closeSP =
                new MenuItem(new StringProvider("Close serial port"), 0x230010,
                        0);
        closeSP.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                close();
            }
        }));

        // Displays the DTR line's state
        final MenuItem dtr =
                new MenuItem(new StringProvider("Get DTR"), 0x230020, 1);
        dtr.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 {
                    Status.show("DTR: " + _port.getDtr());
                } catch (final IOException ioex) {
                    Status.show("");
                    BluetoothDemo
                            .errorDialog("BluetoothSerialPort#getDtr() threw "
                                    + ioex.toString());
                }
            }
        }));

        // Turns DSR on
        final MenuItem dsrOn =
                new MenuItem(new StringProvider("DSR on"), 0x230030, 2);
        dsrOn.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                Status.show("DSR on");
                try {
                    _port.setDsr(true);
                } catch (final IOException ioex) {
                    Status.show("");
                    BluetoothDemo
                            .errorDialog("BluetoothSerialPort#setDsr(boolean) threw "
                                    + ioex.toString());
                }
            }
        }));

        // Turns DSR off
        final MenuItem dsrOff =
                new MenuItem(new StringProvider("DSR off"), 0x230040, 3);
        dsrOff.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                Status.show("DSR off");
                try {
                    _port.setDsr(false);
                } catch (final IOException ioex) {
                    Status.show("");
                    BluetoothDemo
                            .errorDialog("BluetoothSerialPort#setDsr(boolean) threw "
                                    + ioex.toString());
                }
            }
        }));

        // Enables loop back
        final MenuItem enableLoopback =
                new MenuItem(new StringProvider("Enable loopback"), 0x230050, 4);
        enableLoopback.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _loopback = true;
            }
        }));

        // Disables loop back
        final MenuItem disableLoopback =
                new MenuItem(new StringProvider("Disable loopback"), 0x230060,
                        5);
        disableLoopback.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _loopback = false;
            }
        }));

        // Sends 1kb of information to the other device
        final MenuItem send1k =
                new MenuItem(new StringProvider("Send 1k"), 0x230070, 6);
        send1k.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
 
View Full Code Here

             *            The index of the participant to delete
             * @param field
             *            The field in which the participant is displayed
             */
            public DeleteParticipant(final int index, final Field field) {
                super(new StringProvider("Delete Participant"), 0x230030, 110);
                _index = index;
                _field = field;
                this.setCommand(new Command(new CommandHandler() {
                    /**
                     * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
View Full Code Here

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

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

                add((Field) fields.elementAt(i));
            }

            // Menu item to edit the displayed CallLog
            final MenuItem editItem =
                    new MenuItem(new StringProvider("Edit"), 0x230010, 110);
            editItem.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
                 */
 
View Full Code Here

    public void inquiryCompleted(final int discType) {
        delete(_statusField);
        add(_view);

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

    public AccelerometerDemo() {
        if (AccelerometerSensor.isSupported()) {

            // Menu item to start the ball moving
            _startMenuItem =
                    new MenuItem(new StringProvider("Start"), 0x230010, 0);
            _startMenuItem.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 (_thread == null) {
                        // Start drawing
                        _thread = new DrawThread();
                        _thread.start();
                    }
                }
            }));

            // Menu item to stop the ball moving
            _stopMenuItem =
                    new MenuItem(new StringProvider("Stop"), 0x230010, 0);
            _stopMenuItem.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
                 */
 
View Full Code Here

                add((Field) fields.elementAt(i));
            }

            // Menu itme to save the current phone log
            final MenuItem saveItem =
                    new MenuItem(new StringProvider("Save"), 0x230010, 100);
            saveItem.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
                 */
 
View Full Code Here

        private final class AddParticipant extends MenuItem {
            /**
             * Create a new AddParticipant object
             */
            public AddParticipant() {
                super(new StringProvider("Add Participant"), 0x230020, 100);
                this.setCommand(new Command(new CommandHandler() {
                    /**
                     * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                     *      Object)
                     */
 
View Full Code Here

     */
    private final class View extends MenuItem {
        private final int _index;

        private View(final int index) {
            super(new StringProvider("View"), 0x230020, 1);
            _index = index;
            this.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
View Full Code Here

TOP

Related Classes of net.rim.device.api.util.StringProvider

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.