Package com.vaadin.ui

Examples of com.vaadin.ui.Window$CloseEvent


    @Override
    protected void setup() {
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        layout.setSizeFull();
        Window w = new Window("full sized window", layout);
        w.setWidth("2000px");
        w.setHeight("2000px");
        NativeButton b = new NativeButton("A large button");
        b.setSizeFull();
        layout.addComponent(b);

        getMainWindow().addWindow(w);
View Full Code Here


        for (int j = 0; j < 20; j++) {

            VerticalLayout layout = new VerticalLayout();
            layout.setMargin(true);
            Window window = new Window();
            window.setContent(layout);
            getMainWindow().addWindow(window);

            Button button1 = new Button("b1 (CTRL-C)");
            Button button2 = new Button("b2 (CTRL-V)");
View Full Code Here

        Button b = new Button("new", new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                VerticalLayout layout = new VerticalLayout();
                layout.setMargin(true);
                final Window win = new Window("Subwin", layout);
                layout.setWidth(null);
                win.center();
                win.setClosable(false);
                getMainWindow().addWindow(win);
                layout.addComponent(new Label("SPACE notifies, ESC closes."));

                win.addActionHandler(new Action.Handler() {

                    ShortcutAction esc = new ShortcutAction("Close",
                            ShortcutAction.KeyCode.ESCAPE, null);
                    ShortcutAction spc = new ShortcutAction("Space",
                            ShortcutAction.KeyCode.SPACEBAR, null);
View Full Code Here

    @Override
    protected void setup() {

        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        final Window window = new Window("Focus test window", layout);
        layout.setSizeUndefined();

        layout.addComponent(new TextField());
        window.addListener(new FocusListener() {
            @Override
            public void focus(FocusEvent event) {
                Notification.show("Focused window");
            }
        });

        window.addListener(new BlurListener() {
            @Override
            public void blur(BlurEvent event) {
                Notification.show("Blurred window");
            }
        });

        window.addActionHandler(new Handler() {

            private Action[] s = new Action[] { new ShortcutAction("^Save") };

            @Override
            public Action[] getActions(Object target, Object sender) {
                return s;
            }

            @Override
            public void handleAction(Action action, Object sender, Object target) {
                Notification.show("Action!");
            }
        });

        UI main = getLayout().getUI();

        main.addWindow(window);

        ((ComponentContainer) main.getContent()).addComponent(new TextField());

        Button button = new Button("Bring to front (should focus too)",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        window.bringToFront();
                    }
                });
        ((ComponentContainer) main.getContent()).addComponent(button);

        Window window2 = new Window("Another window for testing");
        main.addWindow(window2);
        window2.setPositionX(50);

    }
View Full Code Here

        Button openWindowButton = new Button("Open sub-window");
        openWindowButton.setId("opensub");
        openWindowButton.addListener(new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                Window sub = createClosableSubWindow("Sub-window");
                getMainWindow().addWindow(sub);
            }
        });

        addComponent(log);
View Full Code Here

    private Window createClosableSubWindow(final String title) {
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        layout.setSizeUndefined();
        final Window window = new Window(title, layout);
        window.setSizeUndefined();
        window.setClosable(true);

        Button closeButton = new Button("Close");
        closeButton.addListener(new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                event.getButton().findAncestor(Window.class).close();
            }
        });
        layout.addComponent(closeButton);

        Button removeButton = new Button("Remove from parent");
        removeButton.addListener(new ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                window.close();
            }
        });
        layout.addComponent(closeButton);

        window.addListener(new CloseListener() {
            @Override
            public void windowClose(CloseEvent e) {
                log.log("Window '" + title + "' closed");
            }
        });
View Full Code Here

    @Override
    protected void setup(VaadinRequest request) {
        // This is requires for the test
        setContent(null);

        Window window = new Window("window");
        addWindow(window);
    }
View Full Code Here

    @Override
    protected void setup() {
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        Window centered = new Window("A window", layout);
        centered.setSizeUndefined();
        layout.setSizeUndefined();
        centered.center();

        Label l = new Label("This window should be centered");
        l.setSizeUndefined();
        layout.addComponent(l);
View Full Code Here

    protected void setup() {
        setTheme("tests-tickets");
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        layout.setSizeUndefined();
        Window zoom = new Window("Image Preview", layout);
        zoom.setSizeUndefined();

        String res = "icons/EmbeddedInSubWindow-image.png";
        Embedded imagePreview = new Embedded(null, new ThemeResource(res));
        imagePreview.setSizeUndefined();

        layout.addComponent(imagePreview);
        zoom.setModal(true);
        zoom.setResizable(false);

        getMainWindow().addWindow(zoom);

    }
View Full Code Here

    @Override
    protected void setup() {
        VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        Window window = new Window("Sub window", layout);
        window.center();

        VerticalLayout vl = new VerticalLayout();
        vl.setWidth(null);
        Button b = new Button("A 100% wide button, invalid");
        b.setWidth("100%");
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.