Package org.gwtoolbox.widget.client.button

Examples of org.gwtoolbox.widget.client.button.SimpleMenuButton$Callback


    public SimpleMenuButtonSample() {

        HorizontalPanel buttons = new HorizontalPanel();

        SimpleMenuButton button = new SimpleMenuButton("Vertical Menu", true);
        Menu menu = button.getMenu();
        menu.addItem("Item 1", new Command() {
            public void execute() {
                showMessage("Item 1 was clicked");
            }
        });
        menu.addItem("Item 2", new Command() {
            public void execute() {
                showMessage("Item 2 was clicked");
            }
        });

        Menu subMenu = new Menu(true);
        subMenu.addItem("Item 3", new Command() {
            public void execute() {
                showMessage("Item 3 was clicked");
            }
        });
        menu.addItem("Sub Menu", subMenu);
        buttons.add(button);

        addGap(buttons, "20px");

        button = new SimpleMenuButton("Horizontal Menu", false);
        menu = button.getMenu();
        menu.addItem("Item 1", new Command() {
            public void execute() {
                showMessage("Item 1 was clicked");
            }
        });
        menu.addItem("Item 2", new Command() {
            public void execute() {
                showMessage("Item 2 was clicked");
            }
        });

        subMenu = new Menu(true);
        subMenu.addItem("Item 3", new Command() {
            public void execute() {
                showMessage("Item 3 was clicked");
            }
        });
        menu.addItem("Sub Menu", subMenu);
        buttons.add(button);

        addGap(buttons, "20px");

        SimpleButton sb = new SimpleButton(WidgetImages.Instance.get().icon_CubeBlue().createImage());
        button = new SimpleMenuButton(sb, true);
        menu = button.getMenu();
        menu.addItem("Item 4", new Command() {
            public void execute() {
                showMessage("Item 1 was clicked");
            }
        });
        menu.addItem("Item 5", new Command() {
            public void execute() {
                showMessage("Item 2 was clicked");
            }
        });
        buttons.add(button);

        addGap(buttons, "40px");

        sb = new SimpleButton(WidgetImages.Instance.get().icon_CubeBlue().createImage());
        final SimpleMenuButton smb = new SimpleMenuButton(sb, true);
        buttons.add(smb);

        addGap(buttons, "20px");
        SimpleButton addItemBtn = new SimpleButton("Add Item", new ClickHandler() {
            public void onClick(ClickEvent event) {
                smb.getMenu().addItem("Item 4", new Command() {
                    public void execute() {
                        showMessage("Item 1 was clicked");
                    }
                });
            }
        });
        buttons.add(addItemBtn);

        addGap(buttons, "20px");
        SimpleButton removeItemBtn = new SimpleButton("Remove Items", new ClickHandler() {
            public void onClick(ClickEvent event) {
                smb.getMenu().clearItems();
            }
        });
        buttons.add(removeItemBtn);

       
View Full Code Here


            tools.add(button);
            return button;
        }

        public SimpleMenuButton addMenuButton(Tool tool, MenuBuilder menuBuilder) {
            SimpleMenuButton button = new SimpleMenuButton(new ToolButton(tool), true);
            button.addStyleName("TitleBar-tool");
            DOM.setStyleAttribute(button.getElement(), "marginLeft", "3px");
            menuBuilder.build(button.getMenu());
            tools.add(button);
            return button;
        }
View Full Code Here

                PushButton pbutton = new PushButton(WidgetImages.Instance.get().tableHeaderButton().createImage());
                pbutton.setStyleName("nostyle");
                pbutton.getUpHoveringFace().setImage(WidgetImages.Instance.get().tableHeaderButton_Hover().createImage());
                pbutton.setWidth("15px");
                pbutton.setHeight("100%");
                button = new SimpleMenuButton(pbutton, true);
                button.addCloseHandler(new CloseHandler<Popup>() {
                    public void onClose(CloseEvent<Popup> basicPopup2CloseEvent) {
                        updateUI();
                    }
                });
View Full Code Here

            tools.setCellVerticalAlignment(button, HorizontalPanel.ALIGN_MIDDLE);
            return button;
        }

        public SimpleMenuButton addMenuButton(Tool tool, MenuBuilder menuBuilder) {
            SimpleMenuButton button = new SimpleMenuButton(new ToolButton(tool), true);
            DOM.setStyleAttribute(button.getElement(), "marginLeft", "3px");
            menuBuilder.build(button.getMenu());
            tools.add(button);
            tools.setCellWidth(button, "25px");
            tools.setCellHeight(button, "100%");
            tools.setCellHorizontalAlignment(button, HorizontalPanel.ALIGN_CENTER);
            tools.setCellVerticalAlignment(button, HorizontalPanel.ALIGN_MIDDLE);
View Full Code Here

TOP

Related Classes of org.gwtoolbox.widget.client.button.SimpleMenuButton$Callback

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.