Package com.vaadin.ui

Examples of com.vaadin.ui.CheckBox


        final VerticalLayout main = new VerticalLayout();

        main.addComponent(new Label(
                "Click the button to create a new inline window."));

        final CheckBox asModal = new CheckBox("As modal");
        main.addComponent(asModal);

        final Button create = new Button("Create a new window",
                new ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        VerticalLayout layout = new VerticalLayout();
                        layout.setMargin(true);
                        Window w = new Window("Testing Window", layout);

                        if (asModal.getValue().booleanValue()) {
                            w.setModal(true);
                        }

                        AbstractSelect s1 = new OptionGroup();
                        s1.setCaption("1. Select output format");
View Full Code Here


                log.log("Field value: " + textField.getValue());
            }
        });
        button.setClickShortcut(KeyCode.ESCAPE);

        final CheckBox inputPromptSelection = new CheckBox("Input prompt");
        inputPromptSelection.setImmediate(true);
        inputPromptSelection.addListener(new ValueChangeListener() {
            @Override
            public void valueChange(ValueChangeEvent event) {
                if (event.getProperty().getValue() == Boolean.TRUE) {
                    textField.setInputPrompt("Input prompt");
                } else {
                    textField.setInputPrompt(null);
                }
                log.log("Set input prompt: " + textField.getInputPrompt());
            }
        });
        inputPromptSelection.setImmediate(true);

        addComponent(textField);
        addComponent(button);
        addComponent(inputPromptSelection);
        addComponent(log);
View Full Code Here

                columnField.setValue(String.valueOf(event.getPropertyId()));
                log.log("Clicked on footer: " + event.getPropertyId());
            }
        });

        CheckBox immediateCheckbox = new CheckBox("Immediate");
        immediateCheckbox.setImmediate(true);
        immediateCheckbox.setValue(table.isImmediate());
        immediateCheckbox.addListener(new Property.ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                table.setImmediate((Boolean) event.getProperty().getValue());
            }
        });

        CheckBox columnReorderingCheckbox = new CheckBox(
                "Column reordering allowed");
        columnReorderingCheckbox.setImmediate(true);
        columnReorderingCheckbox.setValue(table.isColumnReorderingAllowed());
        columnReorderingCheckbox
                .addListener(new Property.ValueChangeListener() {

                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        table.setColumnReorderingAllowed((Boolean) event
View Full Code Here

    protected void setup(VaadinRequest request) {
        final OptionGroup optionGroup = new OptionGroup("test field",
                Collections.singletonList("Option"));
        optionGroup.setNewItemsAllowed(true);

        final CheckBox readOnlyCheckbox = new CheckBox("read-only");
        readOnlyCheckbox.setImmediate(true);
        readOnlyCheckbox
                .addValueChangeListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(Property.ValueChangeEvent event) {
                        optionGroup.setReadOnly(readOnlyCheckbox.getValue());
                    }
                });
        readOnlyCheckbox.setValue(Boolean.TRUE);

        addComponent(optionGroup);
        addComponent(readOnlyCheckbox);
    }
View Full Code Here

public class ExtraWindowShownWaiAria extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        final CheckBox modal = new CheckBox("Modal dialog");
        modal.setTabIndex(7);
        final CheckBox additionalDescription = new CheckBox(
                "Additional Description");
        final CheckBox tabStop = new CheckBox(
                "Prevent leaving window with Tab key");
        final CheckBox tabOrder = new CheckBox("Change Taborder");
        final TextField prefix = new TextField("Prefix: ");
        final TextField postfix = new TextField("Postfix: ");

        final TextField topTabStopMessage = new TextField(
                "Top Tab Stop Message");
        final TextField bottomTabStopMessage = new TextField(
                "Bottom Tab Stop Message");

        Button simple = new Button("Open Alert Dialog",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        CssLayout layout = new CssLayout();

                        final Window w = new Window("Sub window", layout);
                        w.center();
                        w.setModal(modal.getValue());
                        w.setAssistiveRole(WindowRole.ALERTDIALOG);
                        w.setAssistivePrefix(prefix.getValue());
                        w.setAssistivePostfix(postfix.getValue());

                        Label description1 = new Label("Simple alert dialog.");
                        layout.addComponent(description1);

                        if (!additionalDescription.getValue()) {
                            w.setAssistiveDescription(description1);
                        } else {
                            Label description2 = new Label(
                                    "Please select what to do!");
                            layout.addComponent(description2);

                            w.setAssistiveDescription(description1,
                                    description2);
                        }

                        w.setTabStopEnabled(tabStop.getValue());
                        w.setTabStopTopAssistiveText(topTabStopMessage
                                .getValue());
                        w.setTabStopBottomAssistiveText(bottomTabStopMessage
                                .getValue());

                        Button close = new Button("Close",
                                new Button.ClickListener() {
                                    @Override
                                    public void buttonClick(ClickEvent event) {
                                        w.close();
                                    }
                                });
                        layout.addComponent(close);
                        Button iconButton = new Button("A button with icon");
                        iconButton.setIcon(new ThemeResource(
                                "../runo/icons/16/ok.png"));
                        layout.addComponent(iconButton);

                        event.getButton().getUI().addWindow(w);
                        iconButton.focus();

                        if (tabOrder.getValue()) {
                            close.setTabIndex(5);
                        }
                    }

                });
        getLayout().addComponent(simple);

        Button complex = new Button("Open Entry Dialog",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        FormLayout form = new FormLayout();

                        final Window w = new Window("Form Window", form);
                        w.center();
                        w.setModal(modal.getValue());
                        w.setAssistivePrefix(prefix.getValue());
                        w.setAssistivePostfix(postfix.getValue());

                        Label description1 = new Label(
                                "Please fill in your data");
                        form.addComponent(description1);

                        if (!additionalDescription.getValue()) {
                            w.setAssistiveDescription(description1);
                        } else {
                            Label description2 = new Label(
                                    "and press the button save.");
                            form.addComponent(description2);

                            w.setAssistiveDescription(description1,
                                    description2);
                        }

                        w.setTabStopEnabled(tabStop.getValue());
                        w.setTabStopTopAssistiveText(topTabStopMessage
                                .getValue());
                        w.setTabStopBottomAssistiveText(bottomTabStopMessage
                                .getValue());

                        TextField name = new TextField("Name:");
                        form.addComponent(name);

                        form.addComponent(new TextField("Address"));

                        Button saveButton = new Button("Save",
                                new Button.ClickListener() {
                                    @Override
                                    public void buttonClick(ClickEvent event) {
                                        w.close();
                                    }
                                });
                        form.addComponent(saveButton);

                        event.getButton().getUI().addWindow(w);
                        name.focus();

                        if (tabOrder.getValue()) {
                            name.setTabIndex(5);
                        }
                    }
                });
        getLayout().addComponent(complex);
View Full Code Here

        subWindow.setWidth("50%");
        subWindow.center();
        layout.addComponent(new Label(LoremIpsum.get(1000)));
        getMainWindow().addWindow(subWindow);

        lazyMode = new CheckBox("Lazy resize");
        lazyMode.setImmediate(true);
        lazyMode.addListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                setLazy(lazyMode.getValue());
            }
        });

        resizeListenerCheckBox = new CheckBox("Resize listener");
        resizeListenerCheckBox.setImmediate(true);
        resizeListenerCheckBox.addListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                if (resizeListenerCheckBox.getValue()) {
                    subWindow.addListener(resizeListener);
                    mainWindow.addListener(browserWindowResizeListener);
                } else {
                    subWindow.removeListener(resizeListener);
                    mainWindow.removeListener(browserWindowResizeListener);
                }

            }

        });
        immediateCheckBox = new CheckBox("Windows immediate");
        immediateCheckBox.setImmediate(true);
        immediateCheckBox.addListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
View Full Code Here

            final DragAndDropWrapper dnd = new DragAndDropWrapper(layout);
            dnd.setId("ddwrapper-1");
            p.setContent(dnd);

            final CheckBox enabled = new CheckBox("Enabled", true);
            addComponent(enabled);
            enabled.setImmediate(true);
            enabled.addListener(new ValueChangeListener() {

                @Override
                public void valueChange(ValueChangeEvent event) {
                    dnd.setEnabled(enabled.booleanValue());
                }
            });

            dnd.setDropHandler(new DropHandler() {

                @Override
                public AcceptCriterion getAcceptCriterion() {
                    return AcceptAll.get();
                }

                @Override
                public void drop(DragAndDropEvent event) {
                    layout.addComponent(new Label("You dropped something!"));
                }
            });

            dnd.setDragStartMode(DragStartMode.COMPONENT);
        }

        {
            final Panel p = new Panel("Drag here");
            addComponent(p);

            final CssLayout layout = new CssLayout();
            layout.setId("csslayout-2");
            layout.setHeight("100px");

            final DragAndDropWrapper dnd = new DragAndDropWrapper(layout);
            dnd.setId("ddwrapper-2");
            p.setContent(dnd);

            final CheckBox enabled = new CheckBox("Enabled", true);
            addComponent(enabled);
            enabled.setImmediate(true);
            enabled.addListener(new ValueChangeListener() {

                @Override
                public void valueChange(ValueChangeEvent event) {
                    dnd.setEnabled(enabled.booleanValue());
                }
            });

            dnd.setDropHandler(new DropHandler() {

                @Override
                public AcceptCriterion getAcceptCriterion() {
                    return AcceptAll.get();
                }

                @Override
                public void drop(DragAndDropEvent event) {
                    layout.addComponent(new Label("You dropped something!"));
                }
            });

            dnd.setDragStartMode(DragStartMode.COMPONENT);
        }

        {
            final Table tbl = new Table();
            tbl.addContainerProperty("column", String.class,
                    "drag/drop to/from here");
            for (int i = 0; i < 5; i++) {
                tbl.addItem();
            }
            addComponent(tbl);
            tbl.setDragMode(TableDragMode.ROW);
            tbl.setDropHandler(new DropHandler() {

                @Override
                public AcceptCriterion getAcceptCriterion() {
                    return AcceptAll.get();
                }

                @Override
                public void drop(DragAndDropEvent event) {
                    tbl.getItem(tbl.addItem()).getItemProperty("column")
                            .setValue("You dropped something");
                }
            });
            final CheckBox enabled = new CheckBox("Enabled", true);
            addComponent(enabled);
            enabled.setImmediate(true);
            enabled.addListener(new ValueChangeListener() {

                @Override
                public void valueChange(ValueChangeEvent event) {
                    tbl.setEnabled(enabled.booleanValue());
                }
            });
        }
    }
View Full Code Here

            // activate & deactivate filtering
            filterString = new TextField("Filter string:", "1");
            vl.addComponent(filterString);

            final CheckBox cb = new CheckBox("Filter on value");
            cb.addListener(new ValueChangeListener() {

                @Override
                public void valueChange(ValueChangeEvent event) {
                    container.removeAllContainerFilters();
                    if (((CheckBox) event.getProperty()).getValue()) {
                        container.addContainerFilter("value", filterString
                                .getValue().toString(), false, false);
                    }
                }
            });
            cb.setImmediate(true);
            vl.addComponent(cb);

            nextLabel = new Label();
            nextLabel.setCaption("Next id: " + nextToAdd);
            vl.addComponent(nextLabel);
View Full Code Here

        final Button btn = new Button();
        btn.setId("button");
        btn.setIcon(ICON, "initial alt text");
        addComponent(btn);

        final CheckBox enable = new CheckBox("Enable alt text", true);
        enable.setImmediate(true);
        enable.addValueChangeListener(new Property.ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                if (enable.booleanValue()) {
                    btn.setIconAlternateText("alt text");
                } else {
                    btn.setIconAlternateText("");
                }
            }
View Full Code Here

        // activate & deactivate filtering
        filterString = new TextField("Filter string:", "1");
        vl.addComponent(filterString);

        final CheckBox cb = new CheckBox("Filter");
        cb.addListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                container.removeAllContainerFilters();
                if (((CheckBox) event.getProperty()).getValue()) {
                    container.addContainerFilter("column1", filterString
                            .getValue().toString(), false, false);
                }
            }
        });
        cb.setImmediate(true);
        vl.addComponent(cb);

        nextLabel = new Label();
        nextLabel.setCaption("Next id: " + nextToAdd);
        vl.addComponent(nextLabel);
View Full Code Here

TOP

Related Classes of com.vaadin.ui.CheckBox

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.