Example usage for com.vaadin.ui Layout addComponent

List of usage examples for com.vaadin.ui Layout addComponent

Introduction

In this page you can find the example usage for com.vaadin.ui Layout addComponent.

Prototype

public void addComponent(Component c);

Source Link

Document

Adds the component into this container.

Usage

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private Layout getPanelPreviews() {
    Layout grid = getPreviewLayout("Panels");

    Panel panel = new DemoPanel("Panel");
    panel.setIcon(new ThemeResource("../runo/icons/16/document.png"));
    grid.addComponent(panel);

    panel = new DemoPanel();
    grid.addComponent(panel);//from   www  .j  av  a2s .c o  m

    panel = new DemoPanel("Borderless Panel");
    panel.setStyleName(BennuTheme.PANEL_BORDERLESS);
    grid.addComponent(panel);

    panel = new DemoPanel();
    panel.setStyleName(BennuTheme.PANEL_BORDERLESS);
    grid.addComponent(panel);

    panel = new DemoPanel("Light panel");
    panel.setStyleName(BennuTheme.PANEL_LIGHT);
    panel.setIcon(new ThemeResource("../runo/icons/16/document.png"));
    grid.addComponent(panel);

    panel = new DemoPanel();
    panel.setStyleName(BennuTheme.PANEL_LIGHT);
    grid.addComponent(panel);

    panel = new DemoPanel("Borderless Light");
    panel.addStyleName(BennuTheme.PANEL_BORDERLESS);
    panel.addStyleName(BennuTheme.PANEL_LIGHT);
    grid.addComponent(panel);

    panel = new DemoPanel();
    panel.addStyleName(BennuTheme.PANEL_BORDERLESS);
    panel.addStyleName(BennuTheme.PANEL_LIGHT);
    grid.addComponent(panel);

    return grid;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private Layout getSplitPreviews() {
    Layout grid = getPreviewLayout("Split panels");

    AbstractSplitPanel panel = new VerticalSplitPanel();
    panel.setWidth("230px");
    panel.setHeight("130px");
    grid.addComponent(panel);

    panel = new VerticalSplitPanel();
    panel.setWidth("230px");
    panel.setHeight("130px");
    panel.setStyleName("small");
    grid.addComponent(panel);/*from  www.  j a  v  a2  s .  c  om*/

    panel = new HorizontalSplitPanel();
    panel.setWidth("230px");
    panel.setHeight("130px");
    grid.addComponent(panel);

    panel = new HorizontalSplitPanel();
    panel.setWidth("230px");
    panel.setHeight("130px");
    panel.setStyleName("small");
    grid.addComponent(panel);

    return grid;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

private Layout getDateFieldPreviews() {
    Layout grid = getPreviewLayout("Date fields");

    Date dateValue = null;/*from www. java 2s.co m*/
    try {
        dateValue = new SimpleDateFormat("yyyyMMdd", Locale.US).parse("20110101");
    } catch (ParseException e) {
        e.printStackTrace();
    }

    DateField date = new DateField();
    date.setValue(dateValue);
    date.setResolution(DateField.RESOLUTION_MIN);
    grid.addComponent(date);

    date = new DateField("Small date");
    date.setValue(dateValue);
    date.setResolution(DateField.RESOLUTION_YEAR);
    date.setStyleName("small");
    grid.addComponent(date);

    date = new DateField("Big date");
    date.setValue(dateValue);
    date.setResolution(DateField.RESOLUTION_MONTH);
    date.setStyleName("big");
    grid.addComponent(date);

    date = new InlineDateField("Inline date");
    date.setValue(dateValue);
    date.setResolution(DateField.RESOLUTION_DAY);
    grid.addComponent(date);

    date = new InlineDateField("Inline date, year resolution");
    date.setValue(dateValue);
    date.setResolution(DateField.RESOLUTION_MONTH);
    grid.addComponent(date);

    return grid;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

Layout getTabsheetPreviews() {
    Layout grid = getPreviewLayout("Tab sheets");

    TabSheet tabs = new DemoTabsheet(false);
    grid.addComponent(tabs);

    tabs = new DemoTabsheet(true);
    grid.addComponent(tabs);/*from  w  ww .  j a v a2 s.com*/

    tabs = new DemoTabsheet(false);
    tabs.setStyleName("borderless");
    grid.addComponent(tabs);

    tabs = new DemoTabsheet(true);
    tabs.setStyleName("borderless open-only-closable");
    grid.addComponent(tabs);

    return grid;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

Layout getAccordionPreviews() {
    Layout grid = getPreviewLayout("Accordions");

    Accordion tabs = new DemoAccordion(false);
    grid.addComponent(tabs);

    // tabs = new DemoAccordion(true);
    // grid.addComponent(tabs);

    tabs = new DemoAccordion(false);
    tabs.setStyleName("borderless");
    grid.addComponent(tabs);/*  w ww. j  ava 2  s  .co  m*/

    tabs = new DemoAccordion(true);
    tabs.setStyleName("opaque");
    grid.addComponent(tabs);

    tabs = new DemoAccordion(true);
    tabs.setStyleName("opaque borderless");
    grid.addComponent(tabs);

    return grid;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

Layout getSliderPreviews() throws ValueOutOfBoundsException {
    Layout grid = getPreviewLayout("Sliders");

    Slider s = new Slider();
    s.setWidth("200px");
    s.setValue(50);/*  ww  w.  j  a va  2s . co m*/
    grid.addComponent(s);

    s = new Slider();
    s.setOrientation(Slider.ORIENTATION_VERTICAL);
    s.setHeight("70px");
    s.setValue(50);
    grid.addComponent(s);

    return grid;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

Layout getTablePreviews() {
    Layout grid = getPreviewLayout("Tables");

    Table t = getDemoTable(null);/*from   w  w w . j a v a2 s.  co  m*/
    grid.addComponent(t);

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

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

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

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

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

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

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

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

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

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

    t = getDemoTable("tstyle1");
    grid.addComponent(t);
    t = getDemoTable("tstyle2");
    grid.addComponent(t);
    t = getDemoTable("tstyle3");
    grid.addComponent(t);

    return grid;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

Layout getSelectPreviews() {
    Layout grid = getPreviewLayout("Selects");

    ComboBox combo = new ComboBox();
    addSelectItems(combo, true, 100);/*w w  w .j  a  v  a 2  s.com*/
    grid.addComponent(combo);

    combo = new ComboBox();
    addSelectItems(combo, true, 100);
    combo.setStyleName("small");
    grid.addComponent(combo);

    combo = new ComboBox();
    addSelectItems(combo, true, 100);
    combo.setStyleName("big");
    grid.addComponent(combo);

    combo = new ComboBox();
    addSelectItems(combo, false, 5);
    combo.setStyleName("search");
    combo.setInputPrompt("Search combo");
    grid.addComponent(combo);

    combo = new ComboBox();
    addSelectItems(combo, false, 5);
    combo.setStyleName("small search");
    combo.setInputPrompt("Small search combo");
    grid.addComponent(combo);

    combo = new ComboBox();
    addSelectItems(combo, false, 5);
    combo.setStyleName("big search");
    combo.setInputPrompt("Big search combo");
    grid.addComponent(combo);

    NativeSelect s = new NativeSelect();
    addSelectItems(s, true, 10);
    grid.addComponent(s);

    s = new NativeSelect();
    addSelectItems(s, true, 10);
    s.setStyleName("small");
    grid.addComponent(s);

    s = new NativeSelect();
    addSelectItems(s, true, 10);
    s.setStyleName("big");
    grid.addComponent(s);

    combo = new ComboBox();
    addSelectItems(combo, false, 5);
    combo.setInputPrompt("Just click me");
    combo.setStyleName("select-button");
    // Must always specify width
    combo.setWidth("150px");
    grid.addComponent(combo);
    combo.setDescription(combo.getDescription()
            + "<br><strong>You must always specify an explicit width for a combobox with this style, otherwise it will not work</strong>");

    return grid;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

Layout getProgressIndicatorPreviews() {
    Layout grid = getPreviewLayout("Progress Indicators");

    ProgressIndicator pi = new ProgressIndicator(0.5f);
    pi.setPollingInterval(100000000);/*from   w w w. ja  v a  2  s .co m*/
    pi.setCaption("Normal");
    grid.addComponent(pi);

    pi = new ProgressIndicator(0.5f);
    pi.setPollingInterval(100000000);
    pi.setCaption("ProgressIndicator.setStyleName(\"small\")");
    pi.setStyleName("small");
    grid.addComponent(pi);

    pi = new ProgressIndicator(0.5f);
    pi.setPollingInterval(100000000);
    pi.setCaption("ProgressIndicator.setStyleName(\"big\")");
    pi.setStyleName("big");
    grid.addComponent(pi);

    pi = new ProgressIndicator(0.5f);
    pi.setPollingInterval(100000000);
    pi.setIndeterminate(true);
    pi.setCaption("Indeterminate, style \"bar\"");
    pi.setStyleName("bar");
    grid.addComponent(pi);

    pi = new ProgressIndicator(0.5f);
    pi.setPollingInterval(100000000);
    pi.setIndeterminate(true);
    pi.setCaption("Indeterminate, style \"small bar\"");
    pi.setStyleName("small bar");
    grid.addComponent(pi);

    pi = new ProgressIndicator(0.5f);
    pi.setPollingInterval(100000000);
    pi.setIndeterminate(true);
    pi.setCaption("Indeterminate, style \"big bar\"");
    pi.setStyleName("big bar");
    grid.addComponent(pi);

    pi = new ProgressIndicator(0.5f);
    pi.setPollingInterval(100000000);
    pi.setCaption("Indeterminate, default style");
    pi.setIndeterminate(true);
    grid.addComponent(pi);

    pi = new ProgressIndicator(0.5f);
    pi.setPollingInterval(100000000);
    pi.setCaption("Indeterminate, style \"big\"");
    pi.setStyleName("big");
    pi.setIndeterminate(true);
    grid.addComponent(pi);

    pi = new ProgressIndicator(0.5f);
    pi.setPollingInterval(100000000);
    pi.setCaption("Disabled");
    pi.setEnabled(false);
    grid.addComponent(pi);

    pi = new ProgressIndicator(0.5f);
    pi.setPollingInterval(100000000);
    pi.setCaption("Indeterminate bar disabled");
    pi.setIndeterminate(true);
    pi.setStyleName("bar");
    pi.setEnabled(false);
    grid.addComponent(pi);

    return grid;
}

From source file:module.pandabox.presentation.PandaBox.java

License:Open Source License

Layout getTreePreviews() {
    Layout grid = getPreviewLayout("Trees");
    tree = new Tree();
    tree.setImmediate(true);// w w w  . j av  a 2  s.c  o  m
    // we'll use a property for caption instead of the item id ("value"),
    // so that multiple items can have the same caption
    tree.addContainerProperty("caption", String.class, "");
    tree.setItemCaptionMode(AbstractSelect.ITEM_CAPTION_MODE_PROPERTY);
    tree.setItemCaptionPropertyId("caption");
    for (int i = 1; i <= 3; i++) {
        final Object id = addCaptionedItem("Division " + i, null);
        tree.expandItem(id);
        addCaptionedItem("Team A", id);
        addCaptionedItem("Team B", id);
        tree.setItemIcon(id, new ThemeResource("../runo/icons/16/folder.png"));
    }
    grid.addComponent(tree);
    return grid;
}