Package org.gwtoolbox.widget.client.button

Examples of org.gwtoolbox.widget.client.button.SimpleButton


                listBox.setHeight("100%");
                main.add(listBox);
                main.setCellHorizontalAlignment(listBox, VerticalPanel.ALIGN_CENTER);
                main.setCellHeight(listBox, "120px");

                final SimpleButton okButton = new SimpleButton("OK", new ClickHandler() {
                    public void onClick(ClickEvent event) {
                        dialog.hide();
                        int index = listBox.getSelectedIndex();
                        String coreName = listBox.getValue(index);
                    }
                });
                okButton.setEnabled(false);
                main.add(okButton);
                main.setCellHorizontalAlignment(okButton, VerticalPanel.ALIGN_CENTER);
                main.setCellHeight(okButton, "25px");

                listBox.addChangeHandler(new ChangeHandler() {
                    public void onChange(ChangeEvent event) {
                        okButton.setEnabled(listBox.getSelectedIndex() >= 0);
                    }
                });

                dialog.setWidget(main);
View Full Code Here


    public MessageBoxSample() {
        HorizontalPanel buttons = new HorizontalPanel();
        buttons.setSpacing(4);

        SimpleButton button = new SimpleButton("Show Error");
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                String title = "The Error";
                String message = "This is the content of the message and it's very long to see how it copes with it";
                MessageBox.show(NotificationType.ERROR, MessageBox.OptionType.OK, title, message, new MessageBox.OptionCallback() {
                    public void handle(MessageBox.Button button) {
                        GGrowl.showMessage("Continue Logic", "");
                    }
                });
            }
        });
        buttons.add(button);

        button = new SimpleButton("Show Warning");
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                String title = "The Warning";
                String message = "This is the content of the message and it's very long to see how it copes with it";
                MessageBox.show(NotificationType.WARNING, MessageBox.OptionType.OK, title, message, new MessageBox.OptionCallback() {
                    public void handle(MessageBox.Button button) {
                        GGrowl.showMessage("Continue Logic", "");
                    }
                });
            }
        });
        buttons.add(button);

        button = new SimpleButton("Show Tip");
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                String title = "The Tip";
                String message = "This is the content of the message and it's very long to see how it copes with it";
                MessageBox.show(NotificationType.TIP, MessageBox.OptionType.OK, title, message, new MessageBox.OptionCallback() {
                    public void handle(MessageBox.Button button) {
                        GGrowl.showMessage("Continue Logic", "");
                    }
                });
            }
        });
        buttons.add(button);

        button = new SimpleButton("Show Message");
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                String title = "The Message";
                String message = "This is the content of the message and it's very long to see how it copes with it";
                MessageBox.show(NotificationType.MESSAGE, MessageBox.OptionType.OK, title, message, new MessageBox.OptionCallback() {
                    public void handle(MessageBox.Button button) {
                        GGrowl.showMessage("Continue Logic", "");
                    }
                });
            }
        });
        buttons.add(button);

        button = new SimpleButton("Confirm");
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                String title = "Please Confirm";
                String message = "This is the content of the message and it's very long to see how it copes with it";
                MessageBox.show(NotificationType.MESSAGE, MessageBox.OptionType.OK_CANCEL, title, message, new MessageBox.OptionCallback() {
                    public void handle(MessageBox.Button button) {
                        String text = button == MessageBox.Button.OK ? "The user agreed" : "The user disagreed";
                        GGrowl.showMessage("Confirmation", text);
                    }
                });
            }
        });
        buttons.add(button);

        button = new SimpleButton("Yes/No/Cancel");
        button.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                String title = "Please Confirm";
                String message = "This is the content of the message and it's very long to see how it copes with it";
                MessageBox.show(NotificationType.MESSAGE, MessageBox.OptionType.YES_NO_CANCEL, title, message, new MessageBox.OptionCallback() {
                    public void handle(MessageBox.Button button) {
                        String text = button.name();
                        GGrowl.showMessage("Confirmation", text);
                    }
                });
            }
        });
View Full Code Here

    private Dialog dialog;

    public DialogSample() {

        SimpleButton openButton = new SimpleButton("Open Dialog", new ClickHandler() {
            public void onClick(ClickEvent event) {

                if (dialog != null) {
                    dialog.hide();
                    dialog = null;
View Full Code Here

        panel.setHeight("100%");
        DOM.setStyleAttribute(panel.getElement(), "borderBottom", "1px solid blue");

        HorizontalPanel hp = new HorizontalPanel();

        SimpleButton button = new SimpleButton("Remove Tab 1", new ClickHandler() {
            public void onClick(ClickEvent event) {
                panel.removeTab("Tab 1");
            }
        });
        hp.add(button);

        addGap(hp, "10px");

        button = new SimpleButton("Clear Tabs", new ClickHandler() {
            public void onClick(ClickEvent event) {
                panel.clear();
            }
        });
        hp.add(button);

        addGap(hp, "10px");

        button = new SimpleButton("Add Tab...", new ClickHandler() {
            public void onClick(ClickEvent event) {
                String tabName = Window.prompt("Enter the tab name", "");
                if (tabName != null) {
                    TabSpec tabSpec = new TabSpec(tabName, tabName, null, new Label("This is the content of '" + tabName + "'"), true);
                    panel.addTab(tabSpec);
                }
            }
        });
        hp.add(button);

        addGap(hp, "10px");

        button = new SimpleButton("Add Tab (Auto)", new ClickHandler() {
            public void onClick(ClickEvent event) {
                String tabName = "Tab " + (panel.getTabCount() + 1);
                GWT.log(tabName, null);
                panel.addTab(tabName, new Label("This is the content of '" + tabName + "'"));
                if (panel.getTabCount() % 2 == 0) {
                    panel.setTabEnabled(tabName, false);
                }
            }
        });
        hp.add(button);

        addGap(hp, "10px");

        button = new SimpleButton("Enable Tab 4", new ClickHandler() {
            public void onClick(ClickEvent event) {
                panel.setTabEnabled("tab4", true);
            }
        });
        hp.add(button);
View Full Code Here


        final Label messageLabel = new Label();
        DOM.setStyleAttribute(messageLabel.getElement(), "marginTop", "10px");

        SimpleButton singleModelButton = new SimpleButton("Set Single Line Selection", new ClickHandler() {
            public void onClick(ClickEvent event) {
                SingleRowSelectionModel model = new SingleRowSelectionModel();
                model.addListener(new SingleRowSelectionModel.Listener() {
                    public void selectionCleared() {
                        messageLabel.setText("Selection cleared.");
                    }

                    public void rowSelected(int row, SingleRowSelection selection) {
                        messageLabel.setText("selected row " + row);
                    }
                });
                grid.setSelectionModel(model);
            }
        });

        SimpleButton multiModelButton = new SimpleButton("Set Multi-Line Selection", new ClickHandler() {
            public void onClick(ClickEvent event) {
                MultiRowSelectionModel model = new MultiRowSelectionModel();
                model.addListener(new MultiRowSelectionModel.Listener() {
                    public void selectionCleared() {
                        messageLabel.setText("Selection cleared.");
                    }

                    public void rowSelected(int row, MultiRowSelection model) {
                        messageLabel.setText("Selected rows: " + StringUtils.collectionToDelimetedString(model.getSelectedRows(), ", "));
                    }

                    public void rowUnselected(int row, MultiRowSelection model) {
                        messageLabel.setText("Selected rows: " + StringUtils.collectionToDelimetedString(model.getSelectedRows(), ", "));
                    }
                });
                grid.setSelectionModel(model);
            }
        });

        SimpleButton clearModelButton = new SimpleButton("Clear Selection Model", new ClickHandler() {
            public void onClick(ClickEvent event) {
                grid.clearSelectionModel();
            }
        });

        SimpleButton sortByAgeButton = new SimpleButton("Sort By Age (asc)", new ClickHandler() {
            public void onClick(ClickEvent event) {
                grid.sortByColumn("age", true);
            }
        });

        SimpleButton sortByAgeDescButton = new SimpleButton("Sort By Age (desc)", new ClickHandler() {
            public void onClick(ClickEvent event) {
                grid.sortByColumn("age", false);
            }
        });
View Full Code Here

        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

     *
     * @return created button
     */
    private SimpleButton customWidthButton() {
        Image icon = WidgetImages.Instance.get().icon_Printer().createImage();
        SimpleButton button = new SimpleButton("Button custom width", icon, new ClickHandler() {
            public void onClick(ClickEvent event) {
                showMessage("Custom width button was clicked");
            }
        });
        button.setWidth("250px");
        return button;
    }
View Full Code Here

        EmailFormRenderer renderer = GWT.create(EmailFormRenderer.class);
        Widget formPanel = renderer.render(form);
        formPanel.setWidth("300px");

        SimpleButton validateButton = new SimpleButton("Validate", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.submit(new SubmitHandler.Adapter() {
                    public void success(Record record) {
                        StringBuilder sb = new StringBuilder();
                        for (Map.Entry<String, Object> entry : record.getAllValues().entrySet()) {
                            sb.append(entry.getKey()).append(" = ").append(entry.getValue()).append("\n");
                        }
                        Window.alert(sb.toString());
                    }
                });
            }
        });

        SimpleButton sendButton = new SimpleButton("Send", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.submit(new SubmitHandler.Adapter() {
                    public void success(Record record) {
                        StringBuilder sb = new StringBuilder();
                        for (Map.Entry<String, Object> entry : record.getAllValues().entrySet()) {
                            sb.append(entry.getKey()).append(" = ").append(entry.getValue()).append("\n");
                        }
                        Window.alert(sb.toString());
                    }
                });
            }
        });

        SimpleButton clearButton = new SimpleButton("Clear", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.reset();
            }
        });
View Full Code Here

        main.add(top);
        main.setCellWidth(top, "100%");

        addGap(main, "20px");

        SimpleButton highlightButton = new SimpleButton("Highlight All Females");
        highlightButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                grid.setRowDecorator(new RecordRowDecorator<Record>() {
                    public void decorateRow(int row, Record record, BasicTable.BasicTableRowFormatter rowFormatter) {
                        if (record.getValue("gender") == Gender.FEMALE) {
                            rowFormatter.addStyleName(row, "row-highlight");
                        }
                    }
                });
            }
        });
        SimpleButton clearHighlightButton = new SimpleButton("Clear Hightlighting");
        clearHighlightButton.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent clickEvent) {
                grid.clearRowDecorator();
            }
        });
        main.add(LayoutUtils.hBuilder().add(highlightButton).addGap("20px").add(clearHighlightButton).getPanel());

        addGap(main, "20px");

        SimpleButton groupButton = new SimpleButton("Group By Gender");
        groupButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                FieldGroup group = new FieldGroup("Gender", "gender");
                group.setShowCounts(true);
                grid.setGroupBy(group);
            }
        });
        SimpleButton clearGroupingButton = new SimpleButton("Clear Grouping");
        clearGroupingButton.addClickListener(new ClickListener() {
            public void onClick(Widget sender) {
                grid.setGroupBy(null);
            }
        });
        main.add(LayoutUtils.hBuilder().add(groupButton).addGap("20px").add(clearGroupingButton).getPanel());

        addGap(main, "20px");

        SimpleButton singleSelectionButton = new SimpleButton("Set Single Selection Model");
        singleSelectionButton.addClickListener(new ClickListener() {
            public void onClick(Widget widget) {
                applySingleSelection(grid, selectionPane);
                selectionPane.setVisible(true);
            }
        });
        SimpleButton multiSelectionButton = new SimpleButton("Set Multi Selection Model");
        multiSelectionButton.addClickListener(new ClickListener() {
            public void onClick(Widget widget) {
                applyMultiSelection(grid, selectionPane);
                selectionPane.setVisible(true);
            }
        });
        SimpleButton clearSelectionButton = new SimpleButton("Clear Selection Model");
        clearSelectionButton.addClickListener(new ClickListener() {
            public void onClick(Widget widget) {
                grid.clearSelectionModel();
                selectionPane.setVisible(false);
            }
        });
View Full Code Here

        render.setLineGap(10);
        render.setHints(labelWidth("50px"));
        Widget formPanel = render.render(form);
        formPanel.setWidth("300px");

        SimpleButton validateButton = new SimpleButton("Validate", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.submit(new SubmitHandler.Adapter() {
                    public void success(Record record) {
                        StringBuilder sb = new StringBuilder();
                        for (Map.Entry<String, Object> entry : record.getAllValues().entrySet()) {
                            sb.append(entry.getKey()).append(" = ").append(entry.getValue()).append("\n");
                        }
                        Window.alert(sb.toString());
                    }
                });
            }
        });

        SimpleButton sendButton = new SimpleButton("Send", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.submit(new SubmitHandler.Adapter() {
                    public void success(Record record) {
                        StringBuilder sb = new StringBuilder();
                        for (Map.Entry<String, Object> entry : record.getAllValues().entrySet()) {
                            sb.append(entry.getKey()).append(" = ").append(entry.getValue()).append("\n");
                        }
                        Window.alert(sb.toString());
                    }
                });
            }
        });

        SimpleButton clearButton = new SimpleButton("Clear", new ClickHandler() {
            public void onClick(ClickEvent event) {
                form.reset();
            }
        });
View Full Code Here

TOP

Related Classes of org.gwtoolbox.widget.client.button.SimpleButton

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.