Package net.rim.device.api.util

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


  private class BasicMenuItem extends MenuItem {
    private Runnable _action;

    public BasicMenuItem(String label, Runnable action) {
      super(new StringProvider(label), 0, 100);
      _action = action;
      setIcon(ImageFactory.createImage("img/search.png"));
    }
View Full Code Here


                        "Select 'View Map' from the menu.  The MapView object is set to Zoom Level 3. Location is Ottawa, ON, Canada at Latitude 45.42349, Longitude -75.69792");
        add(instructions);

        // Invokes BlackBerry Maps application using a MapView object
        final MenuItem viewMapItem =
                new MenuItem(new StringProvider("View Map"), 0x230010, 0);
        viewMapItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
 
View Full Code Here

                        0);
        _views[5].add(_views[6]);
        add(_views[5]);

        final MenuItem cancelItem =
                new MenuItem(new StringProvider("Cancel spinners "), 0x230020,
                        0);
        cancelItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    _views[i].getModel().cancel();
                }
            }
        }));

        final MenuItem resetItem =
                new MenuItem(new StringProvider("Reset spinners "), 0x230030, 0);
        resetItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    _views[i].getModel().reset();
                }
            }
        }));

        final MenuItem resumeItem =
                new MenuItem(new StringProvider("Resume spinners "), 0x230040,
                        0);
        resumeItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    _views[i].getModel().resume();
                }
            }
        }));

        final MenuItem delayedStop =
                new MenuItem(new StringProvider("Delayed start"), 0x230050, 0);
        delayedStop.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    final DelayedStart ds = new DelayedStart(_views[i]);
                    ds.start();
                }
            }
        }));

        final MenuItem delayedStart =
                new MenuItem(new StringProvider("Delayed stop"), 0x230060, 0);
        delayedStart.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                for (int i = _views.length - 1; i >= 0; --i) {
                    final DelayedStop ds = new DelayedStop(_views[i]);
                    ds.start();
                }
            }
        }));

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

         * @param iconResourcePath
         *            Location of icon resource
         */
        public MenuItemWithIcon(final String label, final int priority,
                final String iconResourcePath) {
            super(new StringProvider(label), 0x230100, priority);

            if (iconResourcePath != null) {
                // Retrieve the icon resource and add it to the menu item
                final EncodedImage encodedImage =
                        EncodedImage.getEncodedImageResource(iconResourcePath);
View Full Code Here

            /**
             * Creates a new DemoMenuItem object
             */
            DemoMenuItem(final String text, final int ordinal,
                    final int priority) {
                super(new StringProvider(text), ordinal, priority);
            }
View Full Code Here

        class ImageMenuItem extends MenuItem {
            /**
             * Creates a new MenuDemoMenuItem object
             */
            ImageMenuItem() {
                super(new StringProvider("Image menu item"), 0x230100, 0);

                // Create Image object from project resource
                final Bitmap bitmap = Bitmap.getBitmapResource("img.png");
                final Image image = ImageFactory.createImage(bitmap);

View Full Code Here

        _svg = (SVGSVGElement) _document.getDocumentElement();
        _scalableGraphics = ScalableGraphics.createInstance();

        // A menu item used to erase all elements on the screen
        final MenuItem eraseMenu =
                new MenuItem(new StringProvider("Erase Canvas"), 0x230010, 0);
        eraseMenu.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                // Reset the last x and y coordinates.
                _lastX = -1;
                _lastY = -1;

                // Remove all children from the svg node.
                SVGElement line = (SVGElement) _svg.getFirstElementChild();
                while (line != null) {
                    _svg.removeChild(line);
                    line = (SVGElement) _svg.getFirstElementChild();
                }

                // Indicate that the screen requires re-painting.
                invalidate();
            }
        }));

        // A menu item used to select a line color
        final MenuItem colourMenu =
                new MenuItem(new StringProvider("Change Colour"), 0x230020, 1);
        colourMenu.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 ColorChangeDialog dialog =
                        new ColorChangeDialog(_colorIndex);

                if (dialog.doModal() == Dialog.OK) {
                    _colorIndex = dialog.getColorIndex();
                    _color = dialog.getColor(_colorIndex);
                }
            }
        }));

        // A menu item used to select a line color
        final MenuItem widthMenu =
                new MenuItem(new StringProvider("Change Width"), 0x230030, 2);
        widthMenu.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
 
View Full Code Here

            add(new LabelField(strBuff.toString()));
            add(bitmapFieldScaled3);

            // Add a menu item to display an animation in a popup screen
            final MenuItem showAnimation =
                    new MenuItem(new StringProvider("Show Animation"),
                            0x230010, 0);
            showAnimation.setCommand(new Command(new CommandHandler() {
                /**
                 * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                 *      Object)
View Full Code Here

            paneManagerView.setController(controller);

            add(paneManagerView);

            final MenuItem myItem =
                    new MenuItem(new StringProvider("Switch View"), 0x230010, 0);
            myItem.setCommand(new Command(new SwitchViewCommandHandler(
                    paneManagerView, leftArrow, rightArrow, edgesFour)));
            addMenuItem(myItem);
        }
View Full Code Here

        initFields();
        _isVerizonField.setChangeListener(this);

        // 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)
             */
 
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.