Package net.rim.device.api.ui

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


    super.makeContextMenu(contextMenu);
    ListFieldCallback callback = getCallback();
    final int selectedIndex = getSelectedIndex();
    final PinInfo item = (PinInfo) callback.get(this, selectedIndex);
    if (item.mIsHotp) {
      MenuItem hotpItem = new MenuItem(sResources, COUNTER_PIN, 0, 0) {
        public void run() {
          AuthenticatorScreen screen = (AuthenticatorScreen) getScreen();
          String user = item.mUser;
          String pin = screen.computeAndDisplayPin(user, selectedIndex, true);
          item.mPin = pin;
          invalidate(selectedIndex);
        }
      };
      contextMenu.addItem(hotpItem);
    }

    MenuItem copyItem = new MenuItem(sResources, COPY_TO_CLIPBOARD, 0, 0) {
      public void run() {
        Clipboard clipboard = Clipboard.getClipboard();
        clipboard.put(item.mPin);

        String message = sResources.getString(COPIED);
        Dialog.inform(message);
      }
    };
    MenuItem deleteItem = new MenuItem(sResources, DELETE, 0, 0) {
      public void run() {
        String message = (sResources.getString(DELETE_MESSAGE) + "\n" + item.mUser);
        int defaultChoice = Dialog.NO;
        if (Dialog.ask(Dialog.D_YES_NO, message, defaultChoice) == Dialog.YES) {
          AccountDb.delete(item.mUser);
          AuthenticatorScreen screen = (AuthenticatorScreen) getScreen();
          screen.refreshUserList();
        }
      }
    };

    contextMenu.addItem(copyItem);
    if (item.mIsHotp) {
      MenuItem checkCodeItem = new MenuItem(sResources, CHECK_CODE_MENU_ITEM, 0, 0) {
        public void run() {
          pushScreen(new CheckCodeScreen(item.mUser));
        }
      };
      contextMenu.addItem(checkCodeItem);
View Full Code Here


  /**
   * {@inheritDoc}
   */
  protected void makeMenu(Menu menu, int instance) {
    super.makeMenu(menu, instance);
    MenuItem enterKeyItem = new MenuItem(sResources, ENTER_KEY_MENU_ITEM, 0, 0) {
      public void run() {
        pushScreen(new EnterKeyScreen());
      }
    };
    MenuItem termsItem = new MenuItem(sResources, TERMS_MENU_ITEM, 0, 0) {
      public void run() {
        BrowserSession session = Browser.getDefaultSession();
        session.displayPage(TERMS_URL);
      }
    };
    MenuItem privacyItem = new MenuItem(sResources, PRIVACY_MENU_ITEM, 0, 0) {
      public void run() {
        BrowserSession session = Browser.getDefaultSession();
        session.displayPage(PRIVACY_URL);
      }
    };
    menu.add(enterKeyItem);
    if (!isTimerSet()) {
      MenuItem refreshItem = new MenuItem(sResources, REFRESH_MENU_ITEM, 0, 0) {
        public void run() {
          refreshUserList();
        }
      };
      menu.add(refreshItem);
    }
    if (mUpdateAvailable) {
      MenuItem updateItem = new MenuItem(sResources, UPDATE_NOW, 0, 0) {
        public void run() {
          BrowserSession session = Browser.getDefaultSession();
          session.displayPage(Build.DOWNLOAD_URL);
          mStatusText.setText("");
        }
View Full Code Here

            return _ordinal;
        } else if( name.equals( FIELD_ISDEFAULT ) ) {
            // Get the screen that currently owns the BrowserField
            MainScreen screen = (MainScreen) MenuExtension.getBrowserField().getScreen();

            MenuItem mi = screen.getDefaultMenuItem( Menu.INSTANCE_DEFAULT );
            if( mi == null ) {
                return Boolean.FALSE;
            }
            return new Boolean( mi.equals( _menuItem ) );
        }

        return super.getField( name );
    }
View Full Code Here

    };
    new Thread(exec).start();
  }

  protected void makeMenu(Menu menu, int type) {
    menu.add(new MenuItem(OmniLinkBBClient.getString(OmniLinkClientResource.CATEGORY_REFRESH), 110, 10) {     
      public void run() {
        displayCategory(selectedCategory);
      }
    });
    super.makeMenu(menu, type);
View Full Code Here

                ActivityIndicatorFactory.createActivityIndicator(0, bitmap, 5,
                        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)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

                new LabelField(
                        "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)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

            model.setController(controller);
            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

        _document = _image.getDocument();
        _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)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

            strBuff.append(" - FILTER_BOX");
            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)
                 */
                public void execute(final ReadOnlyCommandMetadata metadata,
View Full Code Here

            buffer.append(Characters.CHECK_MARK).append(' ');
        }

        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

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.