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.cerebro.provevaadin.ChatOnGame.java

public ChatOnGame(User user) {
    if (user.getUltimoLuogoPG() != null) {
        logger.info("Luogo: " + user.getUltimoLuogoPG());
    } else {//from   ww w . j  a va 2  s.  c  om
        logger.info("Nessun luogo selezionato");
    }
    Panel messagesPanel = new Panel();
    messagesPanel.setSizeFull();
    messagesPanel.setContent(messages);
    this.addComponent(messagesPanel);
    this.setExpandRatio(messagesPanel, 1.0f);

    HorizontalLayout sendBar = new HorizontalLayout();
    sendBar.setWidth("100%");
    final TextField input = new TextField();
    input.setWidth("100%");
    sendBar.addComponent(input);
    sendBar.setExpandRatio(input, 1.0f);

    Button send = new Button("Send");
    send.setClickShortcut(ShortcutAction.KeyCode.ENTER, null);
    send.addClickListener((Button.ClickEvent event) -> {
        logger.info("Invio del messaggio al server");
        BroadcasterOnGame.broadcast(input.getValue(), FROM);
        input.setValue("");
    });
    sendBar.addComponent(send);
    this.addComponent(sendBar);

    BroadcasterOnGame.register(this);
}

From source file:com.cms.utils.CommonUtils.java

public static Panel addOg2Panel(OptionGroup og, String caption, String height) {
    og.setWidth("100%");
    og.setHeight("-1px");
    og.setImmediate(true);/* w w w.  j  av  a 2 s  .com*/
    og.setMultiSelect(true);
    VerticalLayout layout = new VerticalLayout();
    layout.setWidth("100%");
    layout.setHeightUndefined();
    layout.setImmediate(true);
    layout.setMargin(true);
    layout.setSpacing(true);
    layout.addComponent(og);
    layout.setComponentAlignment(og, Alignment.MIDDLE_LEFT);
    Panel panel = new Panel();
    if (!DataUtil.isStringNullOrEmpty(caption)) {
        panel.setCaption(caption);
    }
    panel.setWidth("100%");
    panel.setImmediate(true);
    if (!DataUtil.isStringNullOrEmpty(height)) {
        panel.setHeight(height);
    } else {
        panel.setHeight("200px");
    }
    panel.addStyleName(Runo.PANEL_LIGHT);
    panel.setContent(layout);
    return panel;
}

From source file:com.esofthead.mycollab.module.project.view.task.GanttChartTaskContainer.java

License:Open Source License

private Panel createControls() {

    Panel panel = new Panel();
    panel.setWidth(100, Unit.PERCENTAGE);

    HorizontalLayout controls = new HorizontalLayout();
    controls.setSpacing(true);//from  ww  w.  java2 s .  co  m
    controls.setMargin(true);
    panel.setContent(controls);

    start = new DateField(AppContext.getMessage(TaskI18nEnum.FORM_START_DATE));
    start.setValue(gantt.getStartDate());
    start.setResolution(Resolution.DAY);
    start.setImmediate(true);
    start.addValueChangeListener(startDateValueChangeListener);

    end = new DateField(AppContext.getMessage(TaskI18nEnum.FORM_END_DATE));
    end.setValue(gantt.getEndDate());
    end.setResolution(Resolution.DAY);
    end.setImmediate(true);
    end.addValueChangeListener(endDateValueChangeListener);

    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);

    controls.addComponent(start);
    controls.addComponent(end);
    controls.addComponent(reso);
    panel.setStyleName(UIConstants.THEME_NO_BORDER);

    return panel;
}

From source file:com.esofthead.mycollab.module.project.view.task.GanttChartViewImpl.java

License:Open Source License

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

    MHorizontalLayout controls = new MHorizontalLayout().withMargin(true);
    panel.setContent(controls);

    DateFieldExt start = new DateFieldExt(AppContext.getMessage(TaskI18nEnum.FORM_START_DATE));
    start.setValue(gantt.getStartDate());
    start.setResolution(Resolution.DAY);
    start.setImmediate(true);//from  w  w  w .  j  a v a  2s. c  om
    start.addValueChangeListener(startDateValueChangeListener);

    DateField end = new DateFieldExt(AppContext.getMessage(TaskI18nEnum.FORM_END_DATE));
    end.setValue(gantt.getEndDate());
    end.setResolution(Resolution.DAY);
    end.setImmediate(true);
    end.addValueChangeListener(endDateValueChangeListener);

    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);

    controls.with(start, end, reso);
    panel.setStyleName(UIConstants.THEME_NO_BORDER);

    return panel;
}

From source file:com.etest.connection.ErrorDBNotification.java

public static void showLoggedErrorOnWindow(String str) {
    Window sub = new Window("Logged ERROR");
    sub.setWidth("500px");
    sub.setHeight("300px");
    if (sub.getParent() == null) {
        UI.getCurrent().addWindow(sub);/*from w w w.j a v a  2 s .c  o m*/
    }
    sub.setModal(true);

    Panel panel = new Panel();
    panel.setSizeFull();

    panel.setContent(new Label(str));
    sub.setContent(panel);
}

From source file:com.etest.valo.CommonParts.java

License:Apache License

Panel loadingIndicators() {
    Panel p = new Panel("Loading Indicator");
    final VerticalLayout content = new VerticalLayout();
    p.setContent(content);
    content.setSpacing(true);// ww w .  j av a  2s .com
    content.setMargin(true);
    content.addComponent(new Label("You can test the loading indicator by pressing the buttons."));

    CssLayout group = new CssLayout();
    group.setCaption("Show the loading indicator for");
    group.addStyleName("v-component-group");
    content.addComponent(group);
    Button loading = new Button("0.8");
    loading.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(800);
            } catch (InterruptedException e) {
            }
        }
    });
    group.addComponent(loading);

    Button delay = new Button("3");
    delay.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(3000);
            } catch (InterruptedException e) {
            }
        }
    });
    group.addComponent(delay);

    Button wait = new Button("15");
    wait.addClickListener(new ClickListener() {
        @Override
        public void buttonClick(final ClickEvent event) {
            try {
                Thread.sleep(15000);
            } catch (InterruptedException e) {
            }
        }
    });
    wait.addStyleName("last");
    group.addComponent(wait);
    Label label = new Label("   seconds", ContentMode.HTML);
    label.setSizeUndefined();
    group.addComponent(label);

    Label spinnerDesc = new Label(
            "The theme also provides a mixin that you can use to include a spinner anywhere in your application. The button below reveals a Label with a custom style name, for which the spinner mixin is added.");
    spinnerDesc.addStyleName("small");
    spinnerDesc.setCaption("Spinner");
    content.addComponent(spinnerDesc);

    if (!MainUI.isTestMode()) {
        final Label spinner = new Label();
        spinner.addStyleName("spinner");

        Button showSpinnerButton = new Button("Show spinner", new ClickListener() {
            @Override
            public void buttonClick(final ClickEvent event) {
                content.replaceComponent(event.getComponent(), spinner);
            }
        });
        content.addComponent(showSpinnerButton);
    }

    return p;
}

From source file:com.etest.view.systemadministration.CurriculumMainUI.java

Panel dataGridPanel() {
    Panel panel = new Panel("List of All Curriculum");
    panel.setWidth("1000px");

    populateDataTable();/*  w  w w.j a  v  a  2  s.com*/
    panel.setContent(table);

    return panel;
}

From source file:com.etest.view.systemadministration.FacultyMainUI.java

Panel getDataTablePanel() {
    Panel panel = new Panel("Faculty");
    panel.setWidth("900px");

    populateDataTable();//from   w  w w .j  ava 2 s .co m
    panel.setContent(table);

    return panel;
}

From source file:com.etest.view.systemadministration.SemestralTeamUI.java

Panel dataTablePanel() {
    Panel panel = new Panel();
    panel.setWidth("100%");

    panel.setContent(table);
    return panel;
}

From source file:com.etest.view.systemadministration.syllabus.SyllabusMainUI.java

Panel dataGridPanel() {
    Panel panel = new Panel("List of All Syllabus");
    panel.setWidth("1000px");
    //        panel.setHeight("500px");

    populateDataTable();//from ww  w .  j a va  2 s .c om
    panel.setContent(table);

    return panel;
}