Example usage for com.vaadin.ui Window setContent

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

Introduction

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

Prototype

@Override
public void setContent(Component content) 

Source Link

Document

Sets the content of this container.

Usage

From source file:au.org.scoutmaster.views.ContactView.java

private void showMailForm(final TextField emailField) {
    final Window mailWindow = new Window("Send Email");
    mailWindow.setWidth("80%");
    mailWindow.setHeight("80%");
    final User sender = (User) getSession().getAttribute("user");
    mailWindow.setContent(new EmailForm(mailWindow, sender, getCurrent(), emailField.getValue()));
    mailWindow.setVisible(true);//from  www  .  j a va  2  s. c  o  m
    mailWindow.center();
    UI.getCurrent().addWindow(mailWindow);

}

From source file:com.bsb.common.vaadin.embed.component.ComponentWrapper.java

License:Apache License

/**
 * Wraps a {@link Layout} into a Vaadin application.
 *
 * @param layout the layout to wrap/*from   w  w  w  .j  a  va 2  s.co  m*/
 * @return an application displaying that layout
 */
public Application wrapLayout(Layout layout) {
    // TODO: add a header to switch the style, etc
    // TODO: add bookmark to set the style
    final Window mainWindow = new Window("Dev");

    if (server.getConfig().isDevelopmentHeader()) {
        final VerticalSplitPanel mainLayout = new VerticalSplitPanel();
        mainLayout.setSizeFull();
        mainLayout.setSplitPosition(SPLIT_POSITION, Sizeable.UNITS_PIXELS);
        mainLayout.setLocked(true);

        final DevApplicationHeader header = new DevApplicationHeader(server);
        header.setSpacing(true);
        mainLayout.setFirstComponent(header);

        mainLayout.setSecondComponent(layout);

        mainWindow.setContent(mainLayout);
    } else {
        mainWindow.setContent(layout);
    }

    return new DevApplication(server, mainWindow);
}

From source file:com.bsb.samples.vaadin.wizard.core.WizardSampleApplication.java

License:Apache License

@Override
public void init() {
    final VerticalLayout mainLayout = new VerticalLayout();
    mainLayout.setSizeFull();/* ww w . j ava  2s  .c o m*/
    mainLayout.setMargin(true);

    final Wizard wizard = new Wizard();
    wizard.addStep(new FirstStep(), "First");
    wizard.addStep(new FinalStep(), "Final");
    wizard.setWidth(800, Sizeable.UNITS_PIXELS);
    wizard.setHeight(600, Sizeable.UNITS_PIXELS);

    mainLayout.addComponent(wizard);
    mainLayout.setComponentAlignment(wizard, Alignment.MIDDLE_CENTER);

    final Window mainWindow = new Window("Wizard Sample");
    mainWindow.setContent(mainLayout);
    setMainWindow(mainWindow);

}

From source file:com.cavisson.gui.dashboard.components.calender.BeanItemContainerTestUI.java

License:Apache License

/**
 * Opens up a modal dialog window where an event can be modified
 * //from ww w.  ja v  a2 s . c  om
 * @param event
 *            The event to modify
 */
private void editEvent(final BasicEvent event) {
    Window modal = new Window("Add event");
    modal.setModal(true);
    modal.setResizable(false);
    modal.setDraggable(false);
    modal.setWidth("300px");
    final FieldGroup fieldGroup = new FieldGroup();

    FormLayout formLayout = new FormLayout();
    TextField captionField = new TextField("Caption");
    captionField.setImmediate(true);
    TextField descriptionField = new TextField("Description");
    descriptionField.setImmediate(true);
    DateField startField = new DateField("Start");
    startField.setResolution(Resolution.MINUTE);
    startField.setImmediate(true);
    DateField endField = new DateField("End");
    endField.setImmediate(true);
    endField.setResolution(Resolution.MINUTE);

    formLayout.addComponent(captionField);
    formLayout.addComponent(descriptionField);
    formLayout.addComponent(startField);
    formLayout.addComponent(endField);

    fieldGroup.bind(captionField, ContainerEventProvider.CAPTION_PROPERTY);
    fieldGroup.bind(descriptionField, ContainerEventProvider.DESCRIPTION_PROPERTY);
    fieldGroup.bind(startField, ContainerEventProvider.STARTDATE_PROPERTY);
    fieldGroup.bind(endField, ContainerEventProvider.ENDDATE_PROPERTY);

    fieldGroup.setItemDataSource(new BeanItem<BasicEvent>(event,
            Arrays.asList(ContainerEventProvider.CAPTION_PROPERTY, ContainerEventProvider.DESCRIPTION_PROPERTY,
                    ContainerEventProvider.STARTDATE_PROPERTY, ContainerEventProvider.ENDDATE_PROPERTY)));
    modal.setContent(formLayout);
    modal.addCloseListener(new Window.CloseListener() {
        @Override
        public void windowClose(CloseEvent e) {
            // Commit changes to bean
            try {
                fieldGroup.commit();
            } catch (CommitException e1) {
                e1.printStackTrace();
            }

            if (events.containsId(event)) {
                /*
                 * BeanItemContainer does not notify container listeners
                 * when the bean changes so we need to trigger a
                 * ItemSetChange event
                 */
                BasicEvent dummy = new BasicEvent();
                events.addBean(dummy);
                events.removeItem(dummy);

            } else {
                events.addBean(event);
            }
        }
    });
    getUI().addWindow(modal);
}

From source file:com.cavisson.gui.dashboard.components.charts.Impl.ResizeInsideVaadinComponent.java

@Override
protected Component getChart() {

    VerticalSplitPanel verticalSplitPanel = new VerticalSplitPanel();
    HorizontalSplitPanel horizontalSplitPanel = new HorizontalSplitPanel();
    horizontalSplitPanel.setSecondComponent(verticalSplitPanel);
    verticalSplitPanel.setFirstComponent(createChart());

    VerticalLayout verticalLayout = new VerticalLayout();
    verticalLayout.setMargin(true);//from   www  .j  a  v  a  2  s .c om
    verticalLayout.setSpacing(true);
    verticalLayout.addComponent(
            new Label("Relatively sized components resize themselves automatically when in Vaadin component."));

    Button button = new Button("Open in a window");
    button.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            Window window = new Window("Chart windodw");
            window.setContent(createChart());
            window.setWidth("50%");
            window.setHeight("50%");

            getUI().addWindow(window);

        }
    });

    verticalLayout.addComponent(button);
    horizontalSplitPanel.setFirstComponent(verticalLayout);

    return horizontalSplitPanel;
}

From source file:com.coatl.vaadin.abc.ixABCDialogos.java

public void abrirCrear() {
    cerrarDialogos();//  w w  w .j  av  a  2s . c om
    defFormaCrear = getFormaCrear();

    Window subWindow = new Window("Crear");

    subWindow.setContent(defFormaCrear.getComponente());
    getIxUI().addWindow(subWindow);
    subWindow.center();

    this.defFormaCrear.setVentana(subWindow);
}

From source file:com.coatl.vaadin.abc.ixABCDialogos.java

public void abrirEditar() {
    cerrarDialogos();//from  w w  w. j  a  v a 2  s. co  m
    defFormaEditar = getFormaEditar();

    Window subWindow = new Window("Editar");

    subWindow.setContent(defFormaEditar.getComponente());
    getIxUI().addWindow(subWindow);
    subWindow.center();

    this.defFormaEditar.setVentana(subWindow);
}

From source file:com.coatl.vaadin.abc.ixABCDialogos.java

public void abrirBorrar() {
    if (defFormaEditar == null) {
        return;//from w w w  . ja  v a2s .  com
    }

    Map m = defFormaEditar.getMapa();
    cerrarDialogos();

    defFormaBorrar = getFormaBorrar();
    defFormaBorrar.vaciarMapa(m);

    Window subWindow = new Window("Borrar");
    subWindow.setContent(defFormaBorrar.getComponente());

    getIxUI().addWindow(subWindow);
    subWindow.center();

    this.defFormaBorrar.setVentana(subWindow);
}

From source file:com.concur.ui.WebApp.java

License:Apache License

private Window createWindow() {
    FormLayout fl = new FormLayout();

    //        final SessionGuard sg = new SessionGuard();
    //        sg.setKeepalive(true);
    //        fl.addComponent(sg);

    fl.setSizeFull();/*from  ww w  .  j  a v  a  2  s.  co  m*/
    fl.setMargin(true);
    fl.addComponent(new Label("<h2>ATS Tuple Store -- Demo App<h2/>", Label.CONTENT_XML));

    actionField = new NativeSelect("Action:");
    actionField.addItem("Authenticate");
    actionField.addItem("GetTuple");
    actionField.addItem("PutTuple");
    actionField.addItem("GetConfigurations");
    actionField.select("Authenticate");
    fl.addComponent(actionField);

    tokenField = new TextField("Authentication Token:");
    tokenField.setColumns(40);
    fl.addComponent(tokenField);

    tupleKeyField = new TextField("TupleKey:");
    tupleKeyField.setColumns(40);
    fl.addComponent(tupleKeyField);

    tupleDataArea = new TextArea("TupleData:");
    tupleDataArea.setColumns(40);
    tupleDataArea.setRows(5);
    fl.addComponent(tupleDataArea);

    Button b = new Button("Send Request");
    b.addListener(new Button.ClickListener() {
        public void buttonClick(ClickEvent event) {
            submit();
        }
    });

    fl.addComponent(b);

    final Window w = new Window("ATS Tuple Store -- DEMO");
    w.setContent(fl);
    return w;
}

From source file:com.dungnv.streetfood.ui.RichTextWinDowUI.java

public void addAction() {
    btnEdit.addClickListener(new Button.ClickListener() {
        @Override/*from  w ww.  ja  v a  2  s. c o m*/
        public void buttonClick(Button.ClickEvent event) {
            Window window = new Window();
            window.setSizeFull();
            window.setResizable(false);
            window.setClosable(false);
            window.setContent(layoutWindow);
            UI.getCurrent().addWindow(window);

        }
    });

    btnCloseWindow.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            UI.getCurrent().removeWindow(event.getButton().findAncestor(Window.class));
        }
    });
}