Examples of CssLayout


Examples of com.vaadin.ui.CssLayout

        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()) {
View Full Code Here

Examples of com.vaadin.ui.CssLayout

public class TooltipHandlingWhenNotDefined extends TestBase {

    @Override
    protected void setup() {

        CssLayout wrapperLayout = new CssLayout();
        wrapperLayout.setWidth("100%");

        Label label = new Label("Can I has the tooltip?", Label.CONTENT_XHTML);
        label.setId("tooltipLabel");
        label.setDescription("Good! Tooltip works!");
        label.setSizeUndefined();
        wrapperLayout.addComponent(label);

        DragAndDropWrapper wrapper = new DragAndDropWrapper(wrapperLayout);
        wrapper.setWidth("100%");
        wrapper.setDragStartMode(DragStartMode.WRAPPER);
View Full Code Here

Examples of com.vaadin.ui.CssLayout

    protected void setup(VaadinRequest request) {
        {
            final Panel p = new Panel("Drag here");
            addComponent(p);

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

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

Examples of com.vaadin.ui.CssLayout

public class OverlayTouchScrolling extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {

        final CssLayout green = new CssLayout();
        green.setSizeFull();
        final CssLayout layout = new CssLayout() {
            @Override
            protected String getCss(Component c) {
                return "background:green;";
            }
        };
        layout.setSizeFull();
        layout.addComponent(green);
        setContent(layout);

        Button button = new Button("Tap me with a touch device");
        button.addClickListener(new Button.ClickListener() {
            @Override
View Full Code Here

Examples of com.vaadin.ui.CssLayout

    private Component makeOtherComponentWrapper(DragStartMode componentOther) {
        VerticalLayout parent = new VerticalLayout();
        parent.setWidth("200px");
        parent.setSpacing(true);

        CssLayout header = new CssLayout();
        header.addComponent(new Label("Drag start mode : COMPONENT_OTHER"));
        header.setSizeUndefined();

        DragAndDropWrapper wrapper = new DragAndDropWrapper(header);
        wrapper.setDragStartMode(DragStartMode.COMPONENT_OTHER);
        wrapper.setDragImageComponent(parent);
        wrapper.setId("label" + "COMPONENT_OTHER");
View Full Code Here

Examples of com.vaadin.ui.CssLayout

    private Component[] children = new Component[] { new Label("A"),
            new Label("B"), new Label("C"), new Label("D") };

    @Test
    public void moveComponentsBetweenLayouts() {
        CssLayout layout1 = new CssLayout();
        CssLayout layout2 = new CssLayout();

        layout1.addComponent(children[0]);
        layout1.addComponent(children[1]);

        layout2.addComponent(children[2]);
        layout2.addComponent(children[3]);

        layout2.addComponent(children[1], 1);
        assertOrder(layout1, new int[] { 0 });
        assertOrder(layout2, new int[] { 2, 1, 3 });

        layout1.addComponent(children[3], 0);
        assertOrder(layout1, new int[] { 3, 0 });
        assertOrder(layout2, new int[] { 2, 1 });

        layout2.addComponent(children[0]);
        assertOrder(layout1, new int[] { 3 });
        assertOrder(layout2, new int[] { 2, 1, 0 });

        layout1.addComponentAsFirst(children[1]);
        assertOrder(layout1, new int[] { 1, 3 });
View Full Code Here

Examples of com.vaadin.ui.CssLayout

        assertOrder(layout2, new int[] { 2, 0 });
    }

    @Test
    public void shuffleChildComponents() {
        CssLayout layout = new CssLayout();

        for (int i = 0; i < children.length; ++i) {
            layout.addComponent(children[i], i);
        }

        assertOrder(layout, new int[] { 0, 1, 2, 3 });

        // Move C from #2 to #1
        // Exhibits defect #7668
        layout.addComponent(children[2], 1);
        assertOrder(layout, new int[] { 0, 2, 1, 3 });

        // Move C from #1 to #4 (which becomes #3 when #1 is erased)
        layout.addComponent(children[2], 4);
        assertOrder(layout, new int[] { 0, 1, 3, 2 });

        // Keep everything in place
        layout.addComponent(children[1], 1);
        assertOrder(layout, new int[] { 0, 1, 3, 2 });

        // Move D from #2 to #0
        layout.addComponent(children[3], 0);
        assertOrder(layout, new int[] { 3, 0, 1, 2 });

        // Move A from #1 to end (#4 which becomes #3)
        layout.addComponent(children[0]);
        assertOrder(layout, new int[] { 3, 1, 2, 0 });

        // Keep everything in place
        layout.addComponent(children[0]);
        assertOrder(layout, new int[] { 3, 1, 2, 0 });

        // Move C from #2 to #0
        layout.addComponentAsFirst(children[2]);
        assertOrder(layout, new int[] { 2, 3, 1, 0 });

        // Keep everything in place
        layout.addComponentAsFirst(children[2]);
        assertOrder(layout, new int[] { 2, 3, 1, 0 });
    }
View Full Code Here

Examples of com.vaadin.ui.CssLayout

        assertOrder(layout, new int[] { 2, 3, 1, 0 });
    }

    @Test
    public void testConstructorWithComponents() {
        Layout layout = new CssLayout(children);
        assertOrder(layout, new int[] { 0, 1, 2, 3 });
    }
View Full Code Here

Examples of com.vaadin.ui.CssLayout

        assertOrder(layout, new int[] { 0, 1, 2, 3 });
    }

    @Test
    public void testAddComponents() {
        CssLayout layout = new CssLayout();
        layout.addComponents(children);
        assertOrder(layout, new int[] { 0, 1, 2, 3 });

        Label extra = new Label("Extra");
        layout.addComponents(extra);
        assertSame(extra, layout.getComponent(4));

        layout.removeAllComponents();
        layout.addComponents(children[3], children[2], children[1], children[0]);
        assertOrder(layout, new int[] { 3, 2, 1, 0 });
    }
View Full Code Here

Examples of com.vaadin.ui.CssLayout

public class CssLayoutRemoveComponentWithCaption extends TestBase {

    @Override
    protected void setup() {
        final CssLayout layout = new CssLayout();
        final TextField tf = new TextField("Caption");
        Button b = new Button("Remove field and add new", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                layout.removeComponent(tf);
                addComponent(new TextField("new field"));

            }

        });
        layout.addComponent(tf);
        layout.addComponent(b);

        addComponent(layout);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.