Package com.vaadin.ui

Examples of com.vaadin.ui.Window


    @Override
    public void init() {
        final GridLayout layout = new GridLayout(1, 3);
        layout.setWidth("100%");
        layout.setMargin(false);
        setMainWindow(new Window(this.title, layout));
       
        final BeanContainer<String, Task> beans = new BeanContainer<String, Task>(Task.class);
        beans.setBeanIdProperty("id");

        final Form form = new Form();
View Full Code Here


        Button b = new Button("Open", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                Window centered = new Window("A window", new Label(
                        "Centered window"));
                centered.center();
                getMainWindow().addWindow(centered);
            }
        });
        layout.addComponent(b, 0, 0);

        b = new Button("Open", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                Window centered = new Window("A window", new Label(
                        "Centered window"));
                centered.center();
                getMainWindow().addWindow(centered);
            }
        });
        layout.addComponent(b, 1, 1);

        b = new Button("Open", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                Window centered = new Window("A window", new Label(
                        "Centered window"));
                centered.center();
                getMainWindow().addWindow(centered);
            }
        });
        layout.addComponent(b, 2, 2);
View Full Code Here

    @Override
    protected void setup(VaadinRequest request) {
        VerticalLayout verticalLayout = new VerticalLayout();
        verticalLayout.setHeight("10000px");

        Window window = new Window("Caption");

        VerticalLayout layout = new VerticalLayout();
        layout.setWidth("300px");
        layout.setHeight("300px");
        window.setContent(layout);

        addWindow(window);

        window.setModal(true);

        addComponent(verticalLayout);
    }
View Full Code Here

    private int windowCount = 0;
    private ComboBox addWindowAgain;

    private Window createNewWindow() {
        final Window w = new Window("Window " + (++windowCount));
        final VerticalLayout content = new VerticalLayout();
        w.setContent(content);
        w.setData(windowCount);
        w.setWidth("200px");
        w.setHeight("300px");
        w.setPositionX(200);
        w.setPositionY(200);
        final NativeButton maximize = new NativeButton("Maximize");
        Button.ClickListener listener = new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                if (w.getWindowMode() == WindowMode.MAXIMIZED) {
                    w.setWindowMode(WindowMode.NORMAL);
                    maximize.setCaption("Maximize");
                } else {
                    w.setWindowMode(WindowMode.MAXIMIZED);
                    maximize.setCaption("Restore");
                }
            }

        };
        maximize.addClickListener(listener);
        ((ComponentContainer) w.getContent()).addComponent(maximize);

        w.addWindowModeChangeListener(new WindowModeChangeListener() {

            @Override
            public void windowModeChanged(WindowModeChangeEvent event) {
                WindowMode state = (event.getWindow().getWindowMode());
                if (state == WindowMode.NORMAL) {
                    w.setCaption("Window " + w.getData() + " Normal");
                    maximize.setCaption("Maximize");
                } else if (state == WindowMode.MAXIMIZED) {
                    w.setCaption("Window " + w.getData() + " Maximized");
                    maximize.setCaption("Restore");
                }
            }
        });
        final CheckBox resizeable = new CheckBox("Resizeable");
        resizeable.setValue(w.isResizable());
        resizeable.addValueChangeListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                w.setResizable(resizeable.getValue());
            }
        });
        ((ComponentContainer) w.getContent()).addComponent(resizeable);
        final CheckBox closeable = new CheckBox("Closeable");
        closeable.setValue(w.isClosable());
        closeable.addValueChangeListener(new ValueChangeListener() {

            @Override
            public void valueChange(ValueChangeEvent event) {
                w.setClosable(closeable.getValue());
            }
        });
        ((ComponentContainer) w.getContent()).addComponent(closeable);
        NativeButton contentFull = new NativeButton("Set Content Size Full",
                new Button.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        w.getContent().setSizeFull();
                    }
                });
        contentFull.setWidth("100%");
        ((ComponentContainer) w.getContent()).addComponent(contentFull);

        NativeButton center = new NativeButton("Center");
        center.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                w.center();
            }
        });
        ((ComponentContainer) w.getContent()).addComponent(center);

        w.addCloseListener(new CloseListener() {

            @Override
            public void windowClose(CloseEvent e) {
                Item item = addWindowAgain.addItem(w);
                addWindowAgain.setItemCaption(w, "Window "
                        + w.getData().toString());
            }
        });

        return w;
    }
View Full Code Here

public class WindowWithInvalidCloseListener extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        Window w = new Window("Close me");
        w.addCloseListener(new CloseListener() {

            @Override
            public void windowClose(CloseEvent e) {
                throw new RuntimeException(
                        "Close listener intentionally failed");
View Full Code Here

public class SubwindowDraggability extends TestBase {

    @Override
    protected void setup() {
        final Window draggableSubWindow = new Window("Draggable sub window");
        draggableSubWindow.setHeight("300px");
        final Window fixedSubWindow = new Window("Fixed sub window");
        fixedSubWindow.setHeight("200px");
        fixedSubWindow.setDraggable(false);

        fixedSubWindow.center();
        getMainWindow().addWindow(draggableSubWindow);
        getMainWindow().addWindow(fixedSubWindow);

        Button b = new Button("Swap", new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                boolean b = draggableSubWindow.isDraggable();

                draggableSubWindow.setDraggable(!b);
                fixedSubWindow.setDraggable(b);

            }

        });
        addComponent(b);
View Full Code Here

        return 4362;
    }

    @Override
    protected void setup() {
        Window smallWindow = getSmallWindow("Top:200");

        smallWindow.setPositionY(200);
        getMainWindow().addWindow(smallWindow);
        smallWindow = getSmallWindow("Left:200");
        smallWindow.setPositionX(200);
        getMainWindow().addWindow(smallWindow);

        smallWindow = getSmallWindow("50/50");
        smallWindow.setPositionX(50);
        smallWindow.setPositionY(50);
        getMainWindow().addWindow(smallWindow);

    }
View Full Code Here

        getMainWindow().addWindow(smallWindow);

    }

    private Window getSmallWindow(String caption) {
        Window window2 = new Window(caption);
        window2.setWidth("100px");
        window2.setHeight("50px");
        return window2;
    }
View Full Code Here

                        WindowClickEvents.this.click("Main window layout",
                                event);
                    }
                });
        layout.setMargin(true);
        Window centered = new Window("A window with a click listener", layout);
        centered.addListener(new ClickListener() {

            @Override
            public void click(ClickEvent event) {
                WindowClickEvents.this.click("Sub window", event);
            }

        });
        centered.setSizeUndefined();
        layout.setSizeUndefined();
        centered.center();

        Label l = new Label("This window is centered");
        l.setSizeUndefined();
        Button b = new Button(
                "Clicking here should not produce a layout click event");
View Full Code Here

public class TablePageLengthCalculation extends TestBase {

    @Override
    public void setup() {

        Window window = new Window();
        window.setCaption("usermanagement");
        window.center();
        window.setWidth(40, Window.UNITS_PERCENTAGE);
        window.setHeight(40, Window.UNITS_PERCENTAGE);
        window.setModal(true);
        getMainWindow().addWindow(window);

        TabSheet tab = new TabSheet();
        tab.setSizeFull();

        tab.addTab(new TableView(), "users", null);
        tab.addTab(new TableView(), "groups", null);

        window.setContent(tab);
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Window

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.