Package com.vaadin.ui

Examples of com.vaadin.ui.PopupView


    public void init() {
        final LegacyWindow main = new LegacyWindow();
        setMainWindow(main);

        final Button remover = new Button("Remove PopupView");
        final PopupView pv = new PopupView(new PopupView.Content() {
            @Override
            public String getMinimizedValueAsHTML() {
                return "PopupView";
            }
View Full Code Here


            public Component getPopupComponent() {
                return new TextField("Edit foo", prop);
            }
        };

        PopupView pe = new PopupView(content);
        pe.setDescription("Click to edit");
        panelLayout.addComponent(pe);

        // Second test component
        PopupView pe2 = new PopupView("fooLabel", new Label("Foooooooooo..."));
        pe2.setDescription("Click to view");
        panelLayout.addComponent(pe2);

        // Third test component
        final ObjectProperty<StringBuffer> prop2 = new ObjectProperty<StringBuffer>(
                new StringBuffer("Text for button"));

        class myButton extends Button {
            public myButton() {
                super("Reverse the property");
                this.addListener(new Button.ClickListener() {
                    @Override
                    public void buttonClick(Button.ClickEvent event) {
                        StringBuffer getContents = prop2.getValue();
                        getContents.reverse();

                    }
                });
            }
        }

        VerticalLayout panel2Layout = new VerticalLayout();
        panel2Layout.setMargin(true);
        final Panel panel2 = new Panel("Editor with a button", panel2Layout);
        panel2Layout.addComponent(new myButton());
        PopupView.Content content2 = new PopupView.Content() {
            @Override
            public String getMinimizedValueAsHTML() {
                return String.valueOf(prop2.getValue());
            }

            @Override
            public Component getPopupComponent() {
                return panel2;
            }
        };

        PopupView p3 = new PopupView(content2);
        panelLayout.addComponent(p3);

        // Fourth test component
        VerticalLayout panel3Layout = new VerticalLayout();
        panel3Layout.setMargin(true);
        final Panel panel3 = new Panel("Editor popup for a property",
                panel3Layout);
        TextField tf2 = new TextField("TextField for editing a property");
        final ObjectProperty<String> op = new ObjectProperty<String>(
                "This is property text.");
        tf2.setPropertyDataSource(op);
        panel3Layout.addComponent(tf2);
        PopupView.Content content3 = new PopupView.Content() {

            @Override
            public String getMinimizedValueAsHTML() {
                return String.valueOf(op.getValue());
            }

            @Override
            public Component getPopupComponent() {
                return panel3;
            }

        };
        PopupView p4 = new PopupView(content3);
        panelLayout.addComponent(p4);

        // Fifth test component
        Table table = new Table("Table for testing purposes");
        for (int i = 0; i < 5; i++) {
            table.addContainerProperty("" + (i + 1), String.class, "");
        }
        table.addContainerProperty("" + 6, PopupView.class, null);
        table.addContainerProperty("" + 7, PopupView.class, null);
        table.setPageLength(20);
        for (int i = 0; i < 1000; i++) {

            final InlineDateField df = new InlineDateField("", new Date());
            PopupView pp = new PopupView(new PopupView.Content() {
                @Override
                public String getMinimizedValueAsHTML() {
                    return String.valueOf(df.getValue());
                }

                @Override
                public Component getPopupComponent() {
                    return df;
                }
            });
            final int lineNum = i;
            PopupView pp2 = new PopupView(new PopupView.Content() {

                TextField tf = new TextField("Editor for line " + lineNum,

                "Try to edit the contents for this textfield on line "
                        + lineNum
View Full Code Here

        t.addItem(new Object[] { "Foo", createPopupView() }, "foo");
        addComponent(t);
    }

    private PopupView createPopupView() {
        PopupView pv = new PopupView("Click me", createContent());
        return pv;
    }
View Full Code Here

import com.vaadin.ui.PopupView.PopupVisibilityListener;

public class PopupViewListeners extends AbstractListenerMethodsTest {
    public void testPopupVisibilityListenerAddGetRemove() throws Exception {
        testListenerAddGetRemove(PopupView.class, PopupVisibilityEvent.class,
                PopupVisibilityListener.class, new PopupView("", new Label()));
    }
View Full Code Here

    @Override
    protected void setup() {
        final ComboBox cb1 = new ComboBox();
        cb1.setWidth("260px");
        // cb.focus();
        PopupView pv1 = new PopupView("<u>1. expected (click)</u>", cb1);
        getLayout().addComponent(pv1);

        final ComboBox cb2 = new ComboBox();
        cb2.setWidth("260px");
        PopupView pv2 = new PopupView("<u>2. focused (click)</u>", cb2);
        pv2.addListener(new PopupVisibilityListener() {

            @Override
            public void popupVisibilityChange(PopupVisibilityEvent event) {
                cb2.focus();
            }
View Full Code Here

public class ComboboxInPopupViewWithItems extends TestBase {

    @Override
    protected void setup() {
        addComponent(new TextArea("Some component"));
        addComponent(new PopupView(new PopupContent()));

    }
View Full Code Here

        addComponent(ts);
    }

    private PopupView createPopupView(final Component content) {
        PopupView pv = new PopupView(new Content() {

            @Override
            public String getMinimizedValueAsHTML() {
                return "foo";
            }

            @Override
            public Component getPopupComponent() {
                return content;
            }

        });
        pv.setCaption("A popup view");
        return pv;
    }
View Full Code Here

        Label content = new Label(
                "Lorem ipsum dolor sit amet, consectetur adipiscing elit.");
        content.setWidth("200px");

        PopupView pw = new PopupView("Click me!", content);
        l.addComponent(pw);

        return l;
    }
View Full Code Here

        HorizontalLayout row = new HorizontalLayout();
        row.addStyleName("wrapping");
        row.setSpacing(true);
        addComponent(row);

        PopupView pv = new PopupView(new Content() {
            @Override
            public Component getPopupComponent() {
                return new VerticalLayout() {
                    {
                        setMargin(true);
                        setWidth("300px");
                        addComponent(new Label(
                                "Fictum,  deserunt mollit anim laborum astutumque! Magna pars studiorum, prodita quaerimus."));
                    }
                };
            }

            @Override
            public String getMinimizedValueAsHTML() {
                return "Click to view";
            }
        });
        row.addComponent(pv);
        pv.setHideOnMouseOut(true);
        pv.setCaption("Hide on mouse-out");

        pv = new PopupView(new Content() {
            int count = 0;

            @Override
            public Component getPopupComponent() {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {

                }
                return new VerticalLayout() {
                    {
                        setMargin(true);
                        addComponent(new Label(
                                "<h3>Thanks for waiting!</h3><p>You've opened this popup <b>"
                                        + ++count + " time"
                                        + (count > 1 ? "s" : " only")
                                        + "</b>.</p>", ContentMode.HTML));
                    }
                };
            }

            @Override
            public String getMinimizedValueAsHTML() {
                return "Show slow loading content";
            }
        });
        row.addComponent(pv);
        pv.setHideOnMouseOut(false);
        pv.setCaption("Hide on click-outside");
    }
View Full Code Here

    @Override
    protected void setup(VaadinRequest request) {
        FormLayout layout = new FormLayout();
        addComponent(layout);
        Label label = new Label("Label");
        PopupView popup = new PopupView("Popup short text", label);
        popup.setCaption("Popup Caption:");
        layout.addComponent(popup);
    }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.PopupView

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.