Package org.gwtoolbox.widget.client.menu.item

Examples of org.gwtoolbox.widget.client.menu.item.CheckMenuItem$InternalCommand


        menubar.addItem("Edit", editMenu);

        Menu miscMenu = new Menu(true);
        menubar.addItem("Misc", miscMenu);

        final CheckMenuItem check2 = new CheckMenuItem("Option 2", true);
        final CheckMenuItem check1 = new CheckMenuItem("Enable Option 2", true);
        check1.setCommand(new Command() {
            public void execute() {
                check2.setEnabled(check1.isSelected());
            }
        });
        miscMenu.addItem(check1);
        check2.setCommand(new Command() {
            public void execute() {
View Full Code Here


        hsp.setSize("100%", "100%");
        panel.addTab("Tab 3", hsp);

        TabSpec tab4 = new TabSpec("tab4", "Tab 4", null, new Label("Confent for Tab 4"), false).setMenuBuilder(new MenuBuilder() {
            public void build(Menu menu) {
                CheckMenuItem item = new CheckMenuItem("Disable", !panel.isTabEnabled("tab4"));
                item.addListener(new MenuItemSelectionListener() {
                    public void selectionChanged(SelectionMenuItem item) {
                        panel.setTabEnabled("tab4", !item.isSelected());
                    }
                });
                menu.addItem(item);
            }
        });
View Full Code Here

        Menu columnsMenu = new Menu(true);
        for (int i = 0; i < columns.length; i++) {
            final int index = i;
            Column column = columns[i];
            if (column.supports(Column.Feature.HIDABLE)) {
                final CheckMenuItem item = new CheckMenuItem(column.getName(), column.isShownByDefault());
                item.setCommand(new Command() {
                    public void execute() {
                        setColumnVisible(index, item.isSelected());
                        popup.hide();
                    }
                });
                columnsMenu.addItem(item);
            }
        }

        popup = new MenuPopup(true);
        popup.getMenu().addItem("sortAsc", "Sort Asc", new Command() {
            public void execute() {
                int columnIndex = menuPopupContext.getColumnIndex();
                sortByColumn(columnIndex, true);
            }
        }).setIconStyleName("Sort-menu-icon-asc");
        popup.getMenu().addItem("sortDesc", "Sort Desc", new Command() {
            public void execute() {
                int columnIndex = menuPopupContext.getColumnIndex();
                sortByColumn(columnIndex, false);
            }
        }).setIconStyleName("Sort-menu-icon-desc");
        popup.addSubMenu("Columns", columnsMenu).setIconStyleName("Columns-menu-icon");
        popup.setSubMenuPopupPositionCallback(new Menu.DefaultSubMenuPositionCallback() {
            @Override
            public void setPosition(Popup popup, int popupWidth, int popupHeight, Menu menubar, MenuItemBase item) {
                int right = popupWidth + menubar.getAbsoluteLeft() + menubar.getOffsetWidth() - 1;
                if (right < Window.getClientWidth()) {
                    super.setPosition(popup, popupWidth, popupHeight, menubar, item);
                } else {
                    int left = menubar.getAbsoluteLeft() - popupWidth + 1;
                    int top = item.getAbsoluteTop();
                    popup.setPopupPosition(left, top);
                }
            }
        });
View Full Code Here

TOP

Related Classes of org.gwtoolbox.widget.client.menu.item.CheckMenuItem$InternalCommand

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.