Package com.vaadin.ui

Examples of com.vaadin.ui.Window$CloseEvent


    }

    private Window createResizableWindow() {
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        Window w = new Window("Resize", layout);
        Label desc = new Label(
                "This is a new child window with a preset"
                        + " width, height and position. Resizing has not been"
                        + " disabled for this window. Additionally, this text label"
                        + " is intentionally too large to fit the window. You can resize or"
                        + " use the scrollbars to view different parts of the window content.");
        layout.addComponent(desc);

        // Set window position
        w.setPositionX(300);
        w.setPositionY(100);

        // Set window size
        w.setWidth(60, Unit.PIXELS);
        w.setHeight(60, Unit.PIXELS);

        // Don't disable resizing

        return w;
    }
View Full Code Here


    }

    private Window createResizableWindowWithHorizontalScrollbar() {
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        Window w = new Window("Resize", layout);
        Label desc = new Label(
                "This is a new child window with a preset"
                        + " width, height and position. Resizing has not been"
                        + " disabled for this window. Additionally, this text label"
                        + " is intentionally too large to fit the window. You can resize"
                        + " to view different parts of the window content.");
        // disable wrapping
        desc.setSizeUndefined();
        layout.addComponent(desc);

        // Set window position
        w.setPositionX(400);
        w.setPositionY(100);

        // Set window size
        w.setWidth(60, Unit.PIXELS);
        w.setHeight(60, Unit.PIXELS);

        // Don't disable resizing

        return w;
    }
View Full Code Here

public class WindowThemes extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        Window def = new Window("default", new Label("Some content"));
        def.setWidth("300px");
        def.setHeight("100%");
        addWindow(def);

        Window light = new Window("WINDOW_LIGHT", new Label("Some content"));
        light.setStyleName(Reindeer.WINDOW_LIGHT);
        light.setPositionX(300);
        light.setWidth("300px");
        light.setHeight("100%");
        addWindow(light);

        Window black = new Window("WINDOW_BLACK", new Label("Some content"));
        black.setStyleName(Reindeer.WINDOW_BLACK);
        black.setPositionX(600);
        black.setWidth("300px");
        black.setHeight("100%");
        addWindow(black);
    }
View Full Code Here

        openWindow();
    }

    private void openWindow() {
        Window w = new Window();
        w.setWidth("300px");
        w.setHeight("300px");
        w.center();

        Panel p = createPanel();
        p.setSizeFull();

        w.setContent(p);

        addWindow(w);
    }
View Full Code Here

    private static final long serialVersionUID = 1L;

    @SuppressWarnings("serial")
    @Override
    protected void setup(VaadinRequest request) {
        final Window window = new Window("Test window");
        addWindow(window);

        final Layout layout1 = new VerticalLayout();
        Button button1 = new Button("Button 1");
        layout1.addComponent(button1);

        final Layout layout2 = new VerticalLayout();
        Button button2 = new Button("Button 2");
        layout2.addComponent(button2);

        window.setContent(layout1);

        button1.addListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                window.setContent(layout2);
            }
        });

        button2.addListener(new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                window.setContent(layout1);
            }
        });
    }
View Full Code Here

                    @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);
View Full Code Here

    public void init() {
        mainWindow = new LegacyWindow("Resize test");
        setMainWindow(mainWindow);
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        subWindow = new Window("Sub window", layout);
        subWindow.setHeight("50%");
        subWindow.setWidth("50%");
        subWindow.center();
        layout.addComponent(new Label(LoremIpsum.get(1000)));
        getMainWindow().addWindow(subWindow);
View Full Code Here

    }

    @Override
    protected void setup() {
        final HorizontalLayout hl = new HorizontalLayout();
        autoWideWindow = new Window("Dialog - width by contents", hl);
        hl.setSizeUndefined();
        hl.addComponent(new TextField("Field 1"));
        hl.addComponent(new TextField("Field 2"));
        hl.addComponent(new Button("Add", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                hl.addComponent(createRemoveButton());

            }

        }));

        getMainWindow().addWindow(autoWideWindow);

        {
            VerticalLayout vl = new VerticalLayout();
            vl.setMargin(true);
            Window dialog = new Window("Dialog - undefined width", vl);
            vl.addComponent(new TextField("Field 1"));

            TextField tf2 = new TextField("Field 2");
            tf2.setWidth("500px");
            vl.addComponent(tf2);
            vl.addComponent(new Button("Ok"));

            dialog.center();
            getMainWindow().addWindow(dialog);
        }

        {
            VerticalLayout layout = new VerticalLayout();
            layout.setMargin(true);
            Window dialog = new Window("Dialog - width defined by content",
                    layout);
            layout.setHeight(null);
            layout.setWidth("100%");

            TextArea ta = new TextArea();
            ta.setValue("The textfield should fill the window (except margins)."
                    + "\n - Try to resize the window\n");
            ta.setRows(5);
            ta.setWidth("100%");
            layout.addComponent(ta);

            dialog.setPositionX(20);
            dialog.setPositionY(100);
            getMainWindow().addWindow(dialog);
        }

        {
            VerticalLayout layout = new VerticalLayout();
            layout.setMargin(true);
            Window dialog = new Window("Dialog - size defined by content",
                    layout);
            layout.setHeight("100%");
            layout.setWidth("100%");

            TextArea ta = new TextArea();
            ta.setValue("The textfield should fill the window (except margins)."
                    + "\n - Try to resize the window\n");
            ta.setWidth("100%");
            ta.setHeight("100%");
            ta.setRows(5);
            layout.addComponent(ta);

            dialog.setPositionX(20);
            dialog.setPositionY(300);
            getMainWindow().addWindow(dialog);
        }
    }
View Full Code Here

public class HugeWindowShouldBeClosable extends TestBase {

    @Override
    protected void setup() {
        Window w = new Window("Hueg");
        w.setWidth("2000px");
        w.setHeight("2000px");
        w.setPositionY(500);
        getMainWindow().addWindow(w);
    }
View Full Code Here

    @Override
    protected void setup(VaadinRequest request) {
        addComponent(new Button("Add window", new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                Window window = new Window();
                window.setPositionX(100 + 20 * windowCount);
                window.setPositionY(100 + 20 * windowCount);
                window.setHeight(200, Unit.PIXELS);
                window.setWidth(200, Unit.PIXELS);
                window.setContent(new Label("Window " + ++windowCount));
                addWindow(window);
                windows.add(window);
            }
        }));
        addComponent(new Button("Close window", new ClickListener() {
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Window$CloseEvent

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.