Package net.rim.device.api.ui

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


        /**
         * @see net.rim.device.api.ui.Field#getContextMenu()
         */
        public ContextMenu getContextMenu() {
            final ContextMenu contextMenu = ContextMenu.getInstance();
            contextMenu.setTarget(this);
            makeContextMenu(contextMenu);
            return contextMenu;
        }
View Full Code Here


         * data.
         *
         * @return The newly-created context menu
         */
        public ContextMenu getContextMenu() {
            final ContextMenu contextMenu = super.getContextMenu();

            if (getSize() > 0) {
                final int index = getSelectedIndex();
                contextMenu.addItem(new View(index));
                contextMenu.addItem(new Edit(index));
                contextMenu.addItem(new Delete(index));
                contextMenu.addItem(new DeleteAll());
                contextMenu.addItem(new SimulateLmmLow());
                contextMenu.addItem(new SimulateLmmMedium());
                contextMenu.addItem(new SimulateLmmHigh());
            }

            if (getSize() < /* outer. */MAX_RECORDS) {
                contextMenu.addItem(new Populate());
            }

            return contextMenu;
        }
View Full Code Here

    private class DemoListField extends ListField {
        /**
         * @see ListField#getContextMenu()
         */
        public ContextMenu getContextMenu() {
            final ContextMenu menu = super.getContextMenu();

            if (_displayables != null && !isEmpty()) {
                menu.clear();

                final int i = getSelectedIndex();

                final Object element = _displayables.elementAt(i);

                if (element instanceof UnifiedSearchDemoEntity) {
                    final UnifiedSearchDemoEntity item =
                            (UnifiedSearchDemoEntity) element;
                    final UiAction action = item.getUiActions(null, null);

                    if (action != null) {
                        // Add the appropriate UiAction to the context menu
                        final MenuItem performActionItem =
                                new MenuItem(new StringProvider(action
                                        .toString()), 0x230010, 0);
                        performActionItem.setCommand(new Command(
                                new CommandHandler() {
                                    /**
                                     * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
                                     *      Object)
                                     */
                                    public
                                            void
                                            execute(final ReadOnlyCommandMetadata metadata,
                                                    final Object context) {
                                        action.performAction(item);
                                    }
                                }));
                        menu.addItem(performActionItem);
                    }
                }
            }

            return menu;
View Full Code Here

TOP

Related Classes of net.rim.device.api.ui.ContextMenu

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.