Package net.rim.device.api.ui

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


        setTitle("Folders View Screen");

        _currentFolder = currentFolder;

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


    /**
     * @see MainScreen#makeMenu(Menu, int)
     */
    protected void makeMenu(final Menu menu, final int instance) {
        final MenuItem save =
                new MenuItem(new StringProvider("Save"), 0x230010, 0);
        save.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

                // add
                // an item to or delete the category.
                final Category category = (Category) cookie;
                menu.add(new AddItem(category.getId(), category.getName(),
                        currentNode));
                final MenuItem separator = MenuItem.separator(0);
                menu.add(separator);
                menu.add(new DeleteCategory(category));

                // Add menu item to add a new category
                menu.add(new AddCategory());
            } else if (cookie instanceof String) {
                // Currently highlighted node is an item node, allow user to add
                // an item to the parent category or delete the highlighted
                // item.
                final int parentNode = _treeField.getParent(currentNode);
                final Object parentCookie = _treeField.getCookie(parentNode);
                final Category parentCategory = (Category) parentCookie;
                menu.add(new OpenItem());
                menu.add(new AddItem(parentCategory.getId(), parentCategory
                        .getName(), parentNode));
                menu.add(new DeleteItem(currentNode));

                // Add menu item to add a new category
                final MenuItem addCategory = new AddCategory();
                addCategory.setOrdinal(0x10000); // Inserts separator
                menu.add(addCategory);
            }
        } else {
            // Tree field is empty, start by allowing the addition of a new
            // category
View Full Code Here

    /**
     * Creates a new HTTPDemo object
     */
    public HTTPDemo() {
        _fetchMenuItem = new MenuItem(new StringProvider("Fetch"), 0x230010, 0);
        _fetchMenuItem.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                // Don't execute on a blank url.
                if (_url.getText().length() > 0) {
                    if (!_connectionThread.isStarted()) {
                        fetchPage(_url.getText());
                    } else {
                        createNewFetch(_url.getText());
                    }
                }
            }
        }));

        _clearContent =
                new MenuItem(new StringProvider("Clear Content"), 0x230020, 3);
        _clearContent.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _content.setText("<content>");
            }
        }));

        _fetchHTTPSPage =
                new MenuItem(new StringProvider("Fetch Sample HTTPS Page"),
                        0x230030, 2);
        _fetchHTTPSPage.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 (!_connectionThread.isStarted()) {
                    // Menu items are executed on the event thread, therefore we
                    // can edit the
                    // URL field in place.
                    _url.setText(SAMPLE_HTTPS_PAGE);
                    fetchPage(SAMPLE_HTTPS_PAGE);
                } else {
                    createNewFetch(_url.getText());
                }
            }
        }));

        _wapStackOption =
                new MenuItem(new StringProvider("Use Wap Stack"), 0x230040, 4);
        _wapStackOption.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
            public void execute(final ReadOnlyCommandMetadata metadata,
                    final Object context) {
                _useWapStack = !_useWapStack; // Toggle the wap stack option
            }
        }));

        _wapStackOptionScreen =
                new MenuItem(new StringProvider("Wap Options"), 0x230050, 5);
        _wapStackOptionScreen.setCommand(new Command(new CommandHandler() {
            /**
             * @see net.rim.device.api.command.CommandHandler#execute(ReadOnlyCommandMetadata,
             *      Object)
             */
 
View Full Code Here

    public WapOptionsScreen(final UiApplication app) {
        super();
        _this = this;
        _app = app;

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