Package com.vaadin.ui

Examples of com.vaadin.ui.Layout$MarginHandler


    };
    private VerticalLayout messages = new VerticalLayout();

    @Override
    protected void setup() {
        Layout l = getLayout();

        TextField tf = new TextField("TextField");
        l.addComponent(tf);

        DateField df = new DateField("DateField");
        l.addComponent(df);

        ComboBox cb = new ComboBox("ComboBox");
        l.addComponent(cb);

        Button btn = new Button("Button");
        l.addComponent(btn);

        NativeButton nbtn = new NativeButton("NativeButton");
        l.addComponent(nbtn);

        CheckBox chkb = new CheckBox("CheckBox");
        l.addComponent(chkb);

        OptionGroup og = createOptionGroup("OptionGroup");
        og.setMultiSelect(false);
        l.addComponent(og);

        final OptionGroup ogm = createOptionGroup("OptionGroup (multiselect)");
        ogm.setMultiSelect(true);
        l.addComponent(ogm);

        btn.addListener(new ClickListener() {

            private int i;

            @Override
            public void buttonClick(ClickEvent event) {
                ogm.addItem("newItem" + i++);

            }
        });

        tf.addListener(focusListener);
        tf.addListener(blurListener);
        df.addListener(focusListener);
        df.addListener(blurListener);
        cb.addListener(focusListener);
        cb.addListener(blurListener);
        btn.addListener(focusListener);
        btn.addListener(blurListener);
        nbtn.addListener(focusListener);
        nbtn.addListener(blurListener);
        chkb.addListener(focusListener);
        chkb.addListener(blurListener);
        og.addListener(focusListener);
        og.addListener(blurListener);
        ogm.addListener(focusListener);
        ogm.addListener(blurListener);

        l.addComponent(messages);

    }
View Full Code Here


    private static final Object CAPTION = "caption";

    @Override
    public void init() {
        Layout mainLayout = new VerticalLayout();
        mainLayout.setSizeUndefined();
        setMainWindow(new LegacyWindow("main window", mainLayout));

        setTheme("tests-tickets");

        Tree t = new Tree();
        t.addContainerProperty(CAPTION, String.class, "");
        t.setItemCaptionPropertyId(CAPTION);
        t.addItem("Item 1").getItemProperty(CAPTION).setValue("Item 1");

        t.setSizeUndefined();
        t.setStyleName("redblueborders");
        mainLayout.addComponent(t);

    }
View Full Code Here

        addComponent(new Button("Remove first download button",
                new ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent event) {
                        Layout parent = (Layout) firstDownloadComponent
                                .getParent();
                        parent.removeComponent(firstDownloadComponent);
                    }
                }));
        addComponent(new Button(
                "Detach FileDownloader from first download button",
                new ClickListener() {
View Full Code Here

        main.setContent(testLayout());
        return main;
    }

    private Layout testLayout() {
        final Layout layout = new VerticalLayout();
        final Label label = new Label(
                "Instructions to reproduce:\n"
                        + "  - Open this application in two browser windows\n"
                        + "  - Click the Button in first Window\n"
                        + "  - Go to the second Window\n"
                        + "     - Click the arrow in the Select\n"
                        + "  --> The opened list correctly shows the new value but the old one is shown in the \"input\" part");
        label.setContentMode(ContentMode.PREFORMATTED);
        layout.addComponent(label);

        final Select select = new Select("Test Select");
        select.setWidth("100px");
        select.setImmediate(true);
        select.setNullSelectionAllowed(false);
        select.addItem("1");
        select.addItem("2");
        select.addItem("3");

        final ObjectProperty<String> valueProperty = new ObjectProperty<String>(
                "1", String.class);
        select.setPropertyDataSource(valueProperty);
        layout.addComponent(select);

        globalValue.addListener(new Property.ValueChangeListener() {
            @Override
            public void valueChange(Property.ValueChangeEvent event) {
                Object value = event.getProperty().getValue();
                valueProperty.setValue((null != value) ? value.toString()
                        : null);
            }
        });

        final Button changeValueButton = new Button("Change Value to 2");
        changeValueButton.addListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                globalValue.setValue("2");
            }
        });

        layout.addComponent(changeValueButton);

        return layout;
    }
View Full Code Here

    private Component createTestable(Class<?> c) {
        try {
            final LegacyApplication app = (LegacyApplication) c.newInstance();
            app.doInit(null);
            Layout lo = (Layout) app.getMainWindow().getContent();
            lo.setParent(null);
            return lo;
        } catch (final Exception e) {
            try {
                final CustomComponent cc = (CustomComponent) c.newInstance();
                cc.setSizeFull();
                return cc;
            } catch (final Exception e1) {
                e1.printStackTrace();
                VerticalLayout lo = new VerticalLayout();
                lo.addComponent(new Label(
                        "Cannot create application / custom component: "
                                + e1.toString()));

                Link l = new Link("Try opening via app runner",
                        new ExternalResource("../run/" + c.getName()));
                lo.addComponent(l);

                return lo;
            }
        }
    }
View Full Code Here

        }
        Command<Form, Alignment> footerComponentAlignmentCommand = new Command<Form, Alignment>() {

            @Override
            public void execute(Form c, Alignment value, Object data) {
                Layout l = c.getFooter();
                if (l instanceof AlignmentHandler) {
                    ((AlignmentHandler) l).setComponentAlignment(l
                            .getComponentIterator().next(), value);
                }

            }
        };
View Full Code Here

                            + event.getProperty().getValue());
                }
            });
        }

        Layout result = new VerticalLayout();
        result.addComponent(table);
        result.addComponent(clickLabel);
        result.addComponent(valueChangeLabel);
        return result;
    }
View Full Code Here

        addComponent(tt);

        tt.addContainerProperty("component", Component.class, "");
        tt.addContainerProperty("type", String.class, "bar");

        Layout l = new HorizontalLayout();
        l.addComponent(new Label("bar"));
        l.addComponent(new Label("bar"));
        tt.addItem(new Object[] { l, "HorizontalLayout" }, 1);

        l = new VerticalLayout();
        l.addComponent(new Label("baz"));
        l.addComponent(new Label("baz"));
        tt.addItem(new Object[] { l, "VerticalLayout" }, 2);

        Label lbl = new Label("<b>foo</b><br/><i>bar</i>");
        lbl.setContentMode(Label.CONTENT_XHTML);
        tt.addItem(new Object[] { lbl, "Label" }, 3);
View Full Code Here

public class ExpandAnimationsInChameleon extends TestBase {

    @Override
    protected void setup() {
        Layout grid = getGridLayout();

        TreeTable t = getTreeTable(null);
        grid.addComponent(t);

        t = getTreeTable("small");
        grid.addComponent(t);

        t = getTreeTable("big");
        grid.addComponent(t);

        t = getTreeTable("striped");
        grid.addComponent(t);

        t = getTreeTable("small striped");
        grid.addComponent(t);

        t = getTreeTable("big striped");
        grid.addComponent(t);

        t = getTreeTable("strong");
        grid.addComponent(t);

        t = getTreeTable("small strong");
        grid.addComponent(t);

        t = getTreeTable("big strong");
        grid.addComponent(t);

        t = getTreeTable("borderless");
        grid.addComponent(t);

        t = getTreeTable("striped");
        t.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
        t.setCaption(t.getCaption() + ", hidden headers");
        grid.addComponent(t);

        addComponent(grid);
    }
View Full Code Here

    public final static String labelID(int index) {
        return LABEL_ID + index;
    }

    private Tab addTab() {
        Layout content = new VerticalLayout();
        tabs.add(content);
        Label label = new Label("Tab " + index);
        label.setId(labelID(index));
        content.addComponent(label);
        content.addComponent(new TextField());
        Tab tab = ts.addTab(content, "Tab " + index, null);
        if (index == 2) {
            tab.setClosable(true);
        }
        if (index == 4) {
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Layout$MarginHandler

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.