Example usage for com.vaadin.ui Panel setContent

List of usage examples for com.vaadin.ui Panel setContent

Introduction

In this page you can find the example usage for com.vaadin.ui Panel setContent.

Prototype

@Override
public void setContent(Component content) 

Source Link

Document

Sets the content of this container.

Usage

From source file:com.ocs.dynamo.ui.composite.dialog.BaseModalDialog.java

License:Apache License

private void constructLayout() {
    this.setModal(true);
    this.setResizable(false);

    Panel panel = new Panel();
    panel.setCaptionAsHtml(true);// w  w w.  j  a v  a2  s  .co m
    panel.setCaption(getTitle());

    this.setContent(panel);

    VerticalLayout main = new DefaultVerticalLayout();
    main.setStyleName("ocsDialog");
    panel.setContent(main);

    doBuild(main);

    DefaultHorizontalLayout buttonBar = new DefaultHorizontalLayout();
    main.addComponent(buttonBar);

    doBuildButtonBar(buttonBar);
}

From source file:com.ocs.dynamo.ui.composite.form.ModelBasedEditForm.java

License:Apache License

/**
 * Construct the layout (form and panel) for an attribute group
 * /* w  w  w.jav a 2s  .  c o m*/
 * @param parent
 *            the parent component
 * @param tabs
 *            whether to include the component in a tab sheet
 * @param tabSheet
 *            the parent tab sheet (only used if the "tabs" parameter is true)
 * @param caption
 *            caption of the panel or tab sheet
 * @param lowest
 *            indicates whether this is the lowest level
 * @return
 */
private Layout constructAttributeGroupLayout(Layout parent, boolean tabs, TabSheet tabSheet, String caption,
        boolean lowest) {
    Layout innerLayout = null;
    if (lowest) {
        innerLayout = new FormLayout();
        ((FormLayout) innerLayout).setMargin(true);
        if (!tabs) {
            ((FormLayout) innerLayout).setStyleName(DynamoConstants.CSS_CLASS_HALFSCREEN);
        }
    } else {
        innerLayout = new DefaultVerticalLayout(true, true);
    }

    if (tabs) {
        tabSheet.addTab(innerLayout, caption);
    } else {
        Panel panel = new Panel();
        panel.setStyleName("attributePanel");
        panel.setCaption(caption);
        panel.setContent(innerLayout);
        parent.addComponent(panel);
    }
    return innerLayout;
}

From source file:com.ocs.dynamo.ui.composite.layout.BaseSplitLayout.java

License:Apache License

/**
 * Builds the component//  ww w  .  j  a  v  a2 s .  c o m
 */
@Override
public void build() {
    mainLayout = new DefaultVerticalLayout(true, true);

    HorizontalSplitPanel splitter = null;
    VerticalLayout splitterLayout = null;

    detailLayout = new DefaultVerticalLayout();
    emptyDetailView();

    // optional header
    headerLayout = constructHeaderLayout();
    if (headerLayout != null) {
        mainLayout.addComponent(headerLayout);
    }

    // construct option quick search field
    quickSearchField = constructSearchField();

    // additional quick search field
    if (!isHorizontalMode()) {
        if (quickSearchField != null) {
            mainLayout.addComponent(quickSearchField);
        }
    }

    // table init
    getTableWrapper().getTable().setPageLength(getPageLength());
    getTableWrapper().getTable().setSortEnabled(isSortEnabled());
    constructTableDividers();

    // extra splitter (for horizontal mode)
    if (isHorizontalMode()) {
        splitter = new HorizontalSplitPanel();
        mainLayout.addComponent(splitter);

        splitterLayout = new DefaultVerticalLayout(false, true);
        if (quickSearchField != null) {
            splitterLayout.addComponent(quickSearchField);
        }

        splitterLayout.addComponent(getTableWrapper());
        splitter.setFirstComponent(splitterLayout);
    } else {
        mainLayout.addComponent(getTableWrapper());
    }

    if (isHorizontalMode()) {
        splitterLayout.addComponent(getButtonBar());
    } else {
        mainLayout.addComponent(getButtonBar());
    }

    // create a panel to hold the edit form
    Panel editPanel = new Panel();
    editPanel.setContent(detailLayout);

    if (isHorizontalMode()) {
        // create the layout that is the right part of the splitter
        VerticalLayout extra = new DefaultVerticalLayout(true, false);
        extra.addComponent(editPanel);
        splitter.setSecondComponent(extra);
    } else {
        mainLayout.addComponent(editPanel);
    }

    addButton = constructAddButton();
    if (addButton != null) {
        getButtonBar().addComponent(addButton);
    }

    removeButton = constructRemoveButton();
    if (removeButton != null) {
        registerButton(removeButton);
        getButtonBar().addComponent(removeButton);
    }

    // allow the user to define extra buttons
    postProcessButtonBar(getButtonBar());

    postProcessLayout(mainLayout);

    checkButtonState(null);
    setCompositionRoot(mainLayout);
}

From source file:com.ocs.dynamo.ui.composite.layout.LazyTabLayout.java

License:Apache License

@Override
public void build() {
    Panel panel = new Panel();
    panel.setCaptionAsHtml(true);/* ww  w. ja  v a2  s .  c o m*/
    panel.setCaption(createTitle());

    VerticalLayout main = new DefaultVerticalLayout(true, true);
    panel.setContent(main);

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

    main.addComponent(tabs);
    setupLazySheet(tabs);
    setCompositionRoot(panel);
}

From source file:com.piccritic.website.license.LicenseView.java

License:Open Source License

public LicenseView() {
    addComponent(lc);/*from  w w w. ja v  a2  s.com*/
    Panel p = new Panel();
    addComponent(p);
    setExpandRatio(p, 1);
    lc.setNullSelectionItemId("Select a License for the short description");

    lc.addValueChangeListener(e -> {
        License license = lc.getValue();
        if (license != null) {
            description = new Label(license.getDescription());
            description.setContentMode(ContentMode.PREFORMATTED);
            p.setContent(description);
        }
    });
}

From source file:com.piccritic.website.post.CreatePost.java

/**
 * This window is responsible for creating a post form with an @see Upload
 * component a post will only be uploaded if a picture, a title and a
 * description.// w  w w .j  a  v  a 2 s  .c  om
 * 
 * @param handle user that is creating the post
 */
public CreatePost(String handle) {
    this.handle = handle;
    setSizeFull();
    setModal(true);
    Panel layout = new Panel();
    layout.setSizeFull();
    setContent(layout);
    layout.setContent(form);
    if (handle == null) {
        close();
    }

    image.setVisible(false);
    image.setSizeFull();
    image.setHeightUndefined();

    form.setMargin(true);
    form.addComponent(title);
    form.addComponent(image);
    form.addComponent(description);
    form.addComponent(tags);
    form.addComponent(license);
    form.getComponent(0);
    title.setSizeFull();
    description.setSizeFull();

    confirm.setEnabled(false);
    description.setRequired(true);

    title.setRequired(true);
    setupImagereceiver();
}

From source file:com.pms.component.ganttchart.DemoUI.java

License:Apache License

private Panel createControls() {
    Panel panel = new Panel();
    panel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    controls = new HorizontalLayout();
    controls.setSpacing(true);//from  w ww .j a  va  2 s  .c om
    controls.setMargin(true);
    panel.setContent(controls);

    start = createStartDateField();
    end = createEndDateField();

    Button createStep = new Button("Create New Step...", createStepClickListener);

    HorizontalLayout heightAndUnit = new HorizontalLayout(Util.createHeightEditor(gantt),
            Util.createHeightUnitEditor(gantt));

    HorizontalLayout widthAndUnit = new HorizontalLayout(Util.createWidthEditor(gantt),
            Util.createWidthUnitEditor(gantt));

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    localeSelect = new NativeSelect("Locale") {
        @Override
        public void attach() {
            super.attach();

            if (getValue() == null) {
                // use default locale
                setValue(gantt.getLocale());
                addValueChangeListener(localeValueChangeListener);
            }
        }
    };
    localeSelect.setNullSelectionAllowed(false);
    for (Locale l : Locale.getAvailableLocales()) {
        localeSelect.addItem(l);
        localeSelect.setItemCaption(l, l.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    localeSelect.setImmediate(true);

    String[] zones = new String[] { "GMT-0", "GMT-1", "GMT-2", "GMT-3", "GMT-4", "GMT-5", "GMT-6", "GMT-7",
            "GMT-8", "GMT-9", "GMT-10", "GMT-11", "GMT-12", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5",
            "GMT+6", "GMT+7", "GMT+8", "GMT+9", "GMT+10", "GMT+11", "GMT+12", "GMT+13", "GMT+14" };
    NativeSelect timezoneSelect = new NativeSelect("Timezone");
    timezoneSelect.setNullSelectionAllowed(false);
    timezoneSelect.addItem("Default");
    timezoneSelect.setItemCaption("Default", "Default (" + TimeZone.getDefault().getDisplayName() + ")");
    for (String timezoneId : zones) {
        TimeZone tz = TimeZone.getTimeZone(timezoneId);
        timezoneSelect.addItem(timezoneId);
        timezoneSelect.setItemCaption(timezoneId,
                tz.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    timezoneSelect.setValue("Default");
    timezoneSelect.setImmediate(true);
    timezoneSelect.addValueChangeListener(timezoneValueChangeListener);

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    controls.addComponent(localeSelect);
    controls.addComponent(timezoneSelect);
    controls.addComponent(heightAndUnit);
    controls.addComponent(widthAndUnit);
    controls.addComponent(createStep);
    controls.setComponentAlignment(createStep, Alignment.MIDDLE_LEFT);

    return panel;
}

From source file:com.pms.component.ganttchart.GanttChart.java

License:Apache License

private Panel createControls() {
    Panel panel = new Panel();
    panel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    controls = new HorizontalLayout();
    controls.setSpacing(true);/*  w  ww  .j av  a  2 s  . c  o  m*/
    controls.setMargin(true);
    panel.setContent(controls);

    start = createStartDateField();
    end = createEndDateField();

    Button createStep = new Button("Create New Step...", createStepClickListener);

    HorizontalLayout heightAndUnit = new HorizontalLayout(Util.createHeightEditor(gantt),
            Util.createHeightUnitEditor(gantt));

    HorizontalLayout widthAndUnit = new HorizontalLayout(Util.createWidthEditor(gantt),
            Util.createWidthUnitEditor(gantt));

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    localeSelect = new NativeSelect("Locale") {
        @Override
        public void attach() {
            super.attach();

            if (getValue() == null) {
                // use default locale
                setValue(gantt.getLocale());
                addValueChangeListener(localeValueChangeListener);
            }
        }
    };
    localeSelect.setNullSelectionAllowed(false);
    for (Locale l : Locale.getAvailableLocales()) {
        localeSelect.addItem(l);
        localeSelect.setItemCaption(l, l.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    localeSelect.setImmediate(true);

    String[] zones = new String[] { "GMT-0", "GMT-1", "GMT-2", "GMT-3", "GMT-4", "GMT-5", "GMT-6", "GMT-7",
            "GMT-8", "GMT-9", "GMT-10", "GMT-11", "GMT-12", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5",
            "GMT+6", "GMT+7", "GMT+8", "GMT+9", "GMT+10", "GMT+11", "GMT+12", "GMT+13", "GMT+14" };
    NativeSelect timezoneSelect = new NativeSelect("Timezone");
    timezoneSelect.setNullSelectionAllowed(false);
    timezoneSelect.addItem("Default");
    timezoneSelect.setItemCaption("Default", "Default (" + TimeZone.getDefault().getDisplayName() + ")");
    for (String timezoneId : zones) {
        TimeZone tz = TimeZone.getTimeZone(timezoneId);
        timezoneSelect.addItem(timezoneId);
        timezoneSelect.setItemCaption(timezoneId,
                tz.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    timezoneSelect.setValue("Default");
    timezoneSelect.setImmediate(true);
    timezoneSelect.addValueChangeListener(timezoneValueChangeListener);

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    //controls.addComponent(localeSelect);
    //controls.addComponent(timezoneSelect);
    controls.addComponent(heightAndUnit);
    controls.addComponent(widthAndUnit);
    //controls.addComponent(createStep);
    // controls.setComponentAlignment(createStep, Alignment.MIDDLE_LEFT);
    //controls.setComponentAlignment(widthAndUnit, Alignment.MIDDLE_LEFT);

    return panel;
}

From source file:com.pms.component.ganttchart.scheduletask.UserStoryGanntChart.java

License:Apache License

private Panel createControls() {
    Panel panel = new Panel();
    panel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    controls = new HorizontalLayout();
    controls.setSpacing(true);//from w w  w.  jav a  2  s  .c  o  m
    controls.setMargin(true);
    panel.setContent(controls);

    start = createStartDateField();
    end = createEndDateField();

    Button createStep = new Button("Create New Step...", createStepClickListener);

    HorizontalLayout heightAndUnit = new HorizontalLayout(Util.createHeightEditor(gantt),
            Util.createHeightUnitEditor(gantt));

    HorizontalLayout widthAndUnit = new HorizontalLayout(Util.createWidthEditor(gantt),
            Util.createWidthUnitEditor(gantt));

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    //reso.setValue(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    localeSelect = new NativeSelect("Locale") {
        @Override
        public void attach() {
            super.attach();

            if (getValue() == null) {
                // use default locale
                setValue(gantt.getLocale());
                addValueChangeListener(localeValueChangeListener);
            }
        }
    };
    localeSelect.setNullSelectionAllowed(false);
    for (Locale l : Locale.getAvailableLocales()) {
        localeSelect.addItem(l);
        localeSelect.setItemCaption(l, l.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    localeSelect.setImmediate(true);

    String[] zones = new String[] { "GMT-0", "GMT-1", "GMT-2", "GMT-3", "GMT-4", "GMT-5", "GMT-6", "GMT-7",
            "GMT-8", "GMT-9", "GMT-10", "GMT-11", "GMT-12", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5",
            "GMT+6", "GMT+7", "GMT+8", "GMT+9", "GMT+10", "GMT+11", "GMT+12", "GMT+13", "GMT+14" };
    NativeSelect timezoneSelect = new NativeSelect("Timezone");
    timezoneSelect.setNullSelectionAllowed(false);
    timezoneSelect.addItem("Default");
    timezoneSelect.setItemCaption("Default", "Default (" + TimeZone.getDefault().getDisplayName() + ")");
    for (String timezoneId : zones) {
        TimeZone tz = TimeZone.getTimeZone(timezoneId);
        timezoneSelect.addItem(timezoneId);
        timezoneSelect.setItemCaption(timezoneId,
                tz.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    timezoneSelect.setValue("Default");
    timezoneSelect.setImmediate(true);
    timezoneSelect.addValueChangeListener(timezoneValueChangeListener);

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    //controls.addComponent(localeSelect);
    //controls.addComponent(timezoneSelect);
    controls.addComponent(heightAndUnit);
    controls.addComponent(widthAndUnit);
    //controls.addComponent(createStep);
    // controls.setComponentAlignment(createStep, Alignment.MIDDLE_LEFT);
    //controls.setComponentAlignment(widthAndUnit, Alignment.MIDDLE_LEFT);

    return panel;
}

From source file:com.pms.component.member.taskganntchart.TaskGanttChart.java

License:Apache License

private Panel createControls() {
    Panel panel = new Panel();
    panel.setWidth(100, Sizeable.Unit.PERCENTAGE);

    controls = new HorizontalLayout();
    controls.setSpacing(true);/*from   w  w w . j  a  v  a 2 s  .  c  o m*/
    controls.setMargin(true);
    panel.setContent(controls);

    start = createStartDateField();
    end = createEndDateField();

    Button createStep = new Button("Create New Step...", createStepClickListener);

    HorizontalLayout heightAndUnit = new HorizontalLayout(Util.createHeightEditor(gantt),
            Util.createHeightUnitEditor(gantt));

    HorizontalLayout widthAndUnit = new HorizontalLayout(Util.createWidthEditor(gantt),
            Util.createWidthUnitEditor(gantt));

    reso = new NativeSelect("Resolution");
    reso.setNullSelectionAllowed(false);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Hour);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Day);
    reso.addItem(org.tltv.gantt.client.shared.Resolution.Week);
    reso.setValue(gantt.getResolution());
    reso.setImmediate(true);
    reso.addValueChangeListener(resolutionValueChangeListener);

    localeSelect = new NativeSelect("Locale") {
        @Override
        public void attach() {
            super.attach();

            if (getValue() == null) {
                // use default locale
                setValue(gantt.getLocale());
                addValueChangeListener(localeValueChangeListener);
            }
        }
    };
    localeSelect.setNullSelectionAllowed(false);
    for (Locale l : Locale.getAvailableLocales()) {
        localeSelect.addItem(l);
        localeSelect.setItemCaption(l, l.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    localeSelect.setImmediate(true);

    String[] zones = new String[] { "GMT-0", "GMT-1", "GMT-2", "GMT-3", "GMT-4", "GMT-5", "GMT-6", "GMT-7",
            "GMT-8", "GMT-9", "GMT-10", "GMT-11", "GMT-12", "GMT+1", "GMT+2", "GMT+3", "GMT+4", "GMT+5",
            "GMT+6", "GMT+7", "GMT+8", "GMT+9", "GMT+10", "GMT+11", "GMT+12", "GMT+13", "GMT+14" };
    NativeSelect timezoneSelect = new NativeSelect("Timezone");
    timezoneSelect.setNullSelectionAllowed(false);
    timezoneSelect.addItem("Default");
    timezoneSelect.setItemCaption("Default", "Default (" + TimeZone.getDefault().getDisplayName() + ")");
    for (String timezoneId : zones) {
        TimeZone tz = TimeZone.getTimeZone(timezoneId);
        timezoneSelect.addItem(timezoneId);
        timezoneSelect.setItemCaption(timezoneId,
                tz.getDisplayName(DashboardUI.getCurrent().getUI().getLocale()));
    }
    timezoneSelect.setValue("Default");
    timezoneSelect.setImmediate(true);
    timezoneSelect.addValueChangeListener(timezoneValueChangeListener);

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    //controls.addComponent(localeSelect);
    //controls.addComponent(timezoneSelect);
    //controls.addComponent(heightAndUnit);
    //controls.addComponent(widthAndUnit);
    //controls.addComponent(createStep);
    // controls.setComponentAlignment(createStep, Alignment.MIDDLE_LEFT);
    //controls.setComponentAlignment(widthAndUnit, Alignment.MIDDLE_LEFT);

    return panel;
}