Package org.gwtoolbox.widget.client.menu

Examples of org.gwtoolbox.widget.client.menu.MenuBuilder


    public void reset() {
        tabs.clear();
        tabs.setShowDefaultContextMenu(true);
        tabs.setHideTabBarWithSingleTab(false);
        TabSpec tab1 = new TabSpec("tab1", "Tab 1", null, new HTML("This tab has a custom context menu!!!"), false);
        tab1.setMenuBuilder(new MenuBuilder() {
            public void build(Menu menu) {
                menu.addItem("Custom Action", new Command() {
                    public void execute() {
                        Window.alert("Custom Action was clicked");
                    }
View Full Code Here


        panel.addToggleTool(PanelLayout.ToggleTools.PIN, new ToggleHandler() {
            public void onToggle(ToggleEvent event) {
                Window.alert("Pin tool is " + (event.getState() ? "up" : "down"));
            }
        });
        panel.addMenuTool(PanelLayout.Tools.ADD, new MenuBuilder() {
            public void build(Menu menu) {
                menu.addItem("Action 1", new Command() {
                    public void execute() {
                        Window.alert("Action 1 was executed");
                    }
View Full Code Here

        hsp.setRightWidget(new Label("Right"));
        hsp.setSplitPosition("25%");
        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());
View Full Code Here

                    }
                });
            }
        });

        contentPanel.addMenuTool(ContentPanel.Tools.GEAR, new MenuBuilder() {
            public void build(Menu menu) {
                menu.addItem("Item 1", new Command() {
                    public void execute() {
                    }
                });
View Full Code Here

                        setStyleName(closeButtonElement, "tab-close-button-hover", false);
                    }
                });
            }

            final MenuBuilder menuBuilder = tabSpec.getMenuBuilder();
            if (menuBuilder != null || showDefaultContextMenu) {

                ContextMenuHandler handler = new ContextMenuHandler() {
                    public void onContextMenu(final com.google.gwt.dom.client.Element element, final int x, final int y) {
                        final MenuPopup menu = new MenuPopup(true);

                        if (showDefaultContextMenu) {
                            if (!isSelected()) {
                                menu.addItem("Select", new Command() {
                                    public void execute() {
                                        select();
                                    }
                                }).setEnabled(enabled);
                            }
                            if (closeButtonElement != null) {
                                menu.addItem("Close", new Command() {
                                    public void execute() {
                                        handleOnClose();
                                    }
                                }).setEnabled(enabled);
                            }
                            menu.addItem("Close Others", new Command() {
                                public void execute() {
                                    handleCloseOthers();
                                }
                            }).setEnabled(enabled);
                        }

                        if (menuBuilder != null) {
                            if (showDefaultContextMenu) {
                                menu.addSeparator();
                            }
                            menuBuilder.build(menu.getMenu());
                        }
                        menu.setPopupPositionAndShow(new Popup.PositionCallback() {
                            public void setPosition(int offsetWidth, int offsetHeight) {
                                menu.setPopupPosition(element.getAbsoluteLeft() + x, element.getAbsoluteTop() + y);
                            }
View Full Code Here

    public MenuBuilder getMenuBuilder(final OldDataGrid grid) {
        if (!sortable && !groupable) {
            return null;
        }
        MenuBuilder builder = new MenuBuilder() {
            public void build(Menu menu) {
                if (sortable) {
                    menu.addItem("Sort Asc.", new Command() {
                        public void execute() {
                            grid.sort(fieldName, true);
View Full Code Here

        int index = 0;
        for (Column column : columnSpec.getColumns()) {
            table.setHeaderText(index, column.getName());
            table.getHeaderFormatter().setHorizontalAlignment(index, column.getHorizontalAlignment());
            table.getHeaderFormatter().setSortable(index, column.isSortable());
            MenuBuilder menuBuilder = column.getMenuBuilder(this);
            if (menuBuilder != null) {
                table.getHeaderFormatter().setMenuBar(index, menuBuilder);
            }
            String width = column.getWidth();
            if (width != null) {
View Full Code Here

                    public void onMouseOut(Event event) {
                        setStyleName(closeButtonElement, "tab-close-button-hover", false);
                    }
                });
            }
            final MenuBuilder menuBuilder = tabSpec.getMenuBuilder();
            if (menuBuilder != null) {
                addContextMenuListener(tabElement, new ContextMenuHandler() {
                    public void onContextMenu(final com.google.gwt.dom.client.Element element, final int x, final int y) {
                        final MenuPopup menu = new MenuPopup(true);
                        menuBuilder.build(menu.getMenu());
                        menu.setPopupPositionAndShow(new Popup.PositionCallback() {
                        public void setPosition(int offsetWidth, int offsetHeight) {
                            menu.setPopupPosition(element.getAbsoluteLeft() + x, element.getAbsoluteTop() + y);
                        }
                    });
View Full Code Here

TOP

Related Classes of org.gwtoolbox.widget.client.menu.MenuBuilder

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.