Example usage for com.vaadin.ui Window getContent

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

Introduction

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

Prototype

@Override
    public Component getContent() 

Source Link

Usage

From source file:org.openeos.services.ui.vaadin.internal.UIApplicationImpl.java

License:Apache License

@Override
public <U> UIDialog showGenericFormDialog(BForm<U> form, U bean) {
    Map<String, Object> extraObjects = new HashMap<String, Object>();
    extraObjects.put(UIVaadinFormToolkit.EXTRA_OBJECT_APPLICATION, this);
    VaadinBindingFormInstance formInstance = vaadinToolkit.buildForm(form, commonBindingToolkit, extraObjects,
            false);/*from   www  .  j a  v  a  2  s  . c om*/

    Window window = new Window(form.getName());
    window.setModal(true);
    window.addComponent((ComponentContainer) formInstance.getImplementation());
    formInstance.setValue(bean);

    HorizontalLayout footer = new HorizontalLayout();
    footer.setWidth(100, HorizontalLayout.UNITS_PERCENTAGE);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    Button buttonOk = new Button("Ok");
    buttons.addComponent(buttonOk);
    Button buttonCancel = new Button("Cancel");
    buttons.addComponent(buttonCancel);

    footer.addComponent(buttons);
    footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT);
    window.addComponent(footer);
    ((VerticalLayout) window.getContent()).setComponentAlignment(footer, Alignment.BOTTOM_CENTER);
    window.getContent().setSizeFull();
    vaadinApplication.getMainWindow().addWindow(window);

    return new UIDialogImpl(window, buttonOk, buttonCancel, formInstance);

}

From source file:org.openeos.services.ui.vaadin.internal.UIApplicationImpl.java

License:Apache License

private <T> UIDialog showFormDialog(Class<T> modelClass, UIBean model, BindingFormCapability capability) {
    AbstractFormBindingForm<T> form = formRegistryService.getDefaultForm(modelClass,
            AbstractFormBindingForm.class, capability);
    Map<String, Object> extraObjects = new HashMap<String, Object>();
    extraObjects.put(UIVaadinFormToolkit.EXTRA_OBJECT_APPLICATION, this);
    VaadinBindingFormInstance formInstance = vaadinToolkit.buildForm(form.getAbstractBForm(),
            uiBeanBindingToolkit, extraObjects, false);

    Window window = new Window(form.getAbstractBForm().getName());
    window.setModal(true);// ww w.j ava2s.  com
    window.addComponent((ComponentContainer) formInstance.getImplementation());
    formInstance.setValue(model);

    HorizontalLayout footer = new HorizontalLayout();
    footer.setWidth(100, HorizontalLayout.UNITS_PERCENTAGE);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    Button buttonOk = new Button("Ok");
    buttons.addComponent(buttonOk);
    Button buttonCancel = new Button("Cancel");
    buttons.addComponent(buttonCancel);

    footer.addComponent(buttons);
    footer.setComponentAlignment(buttons, Alignment.MIDDLE_RIGHT);
    window.addComponent(footer);
    ((VerticalLayout) window.getContent()).setComponentAlignment(footer, Alignment.BOTTOM_CENTER);
    window.getContent().setSizeFull();
    vaadinApplication.getMainWindow().addWindow(window);

    return new UIDialogImpl(window, buttonOk, buttonCancel, formInstance);
}

From source file:org.opennms.features.jmxconfiggenerator.webui.JmxConfigGeneratorApplication.java

License:Open Source License

/**
 * Creates the main window and adds the header, main and button panels to
 * it./*ww  w.  j  a v  a  2s. co m*/
 */
private void initMainWindow() {
    Window window = new Window("JmxConfigGenerator GUI Tool");
    VerticalLayout layout = new VerticalLayout();
    layout.addComponent(headerPanel);
    layout.addComponent(contentPanel);
    // content Panel should use most of the space :)
    layout.setExpandRatio(contentPanel, 1);
    window.setContent(layout);
    window.getContent().setSizeFull();
    window.setSizeFull();
    addWindow(window);
}

From source file:org.processbase.ui.servlet.MainWindow.java

License:Open Source License

void openLogoutWindow() {
    Window logout = new Window(((PbApplication) getApplication()).getPbMessages().getString("btnLogout"));
    logout.setModal(true);/*from ww  w  .j  ava 2s .  c o m*/
    //        logout.setStyleName(Reindeer.WINDOW_BLACK);
    logout.setWidth("260px");
    logout.setResizable(false);
    logout.setClosable(false);
    logout.setDraggable(false);
    logout.setCloseShortcut(KeyCode.ESCAPE, null);

    Label helpText = new Label("Are you sure you want to log out?", Label.CONTENT_XHTML);
    logout.addComponent(helpText);

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.setSpacing(true);
    Button yes = new Button(((PbApplication) getApplication()).getPbMessages().getString("btnLogout"),
            new Button.ClickListener() {

                public void buttonClick(ClickEvent event) {
                    WebApplicationContext applicationContext = (WebApplicationContext) getApplication()
                            .getContext();
                    getApplication().close();
                    applicationContext.getHttpSession().invalidate();
                }
            });
    yes.setStyleName(Reindeer.BUTTON_DEFAULT);
    yes.focus();
    buttons.addComponent(yes);
    Button no = new Button(((PbApplication) getApplication()).getPbMessages().getString("btnCancel"),
            new Button.ClickListener() {

                public void buttonClick(ClickEvent event) {
                    removeWindow(event.getButton().getWindow());
                }
            });
    buttons.addComponent(no);

    logout.addComponent(buttons);
    ((VerticalLayout) logout.getContent()).setComponentAlignment(buttons, Alignment.MIDDLE_CENTER);
    ((VerticalLayout) logout.getContent()).setSpacing(true);

    addWindow(logout);
}

From source file:ru.codeinside.gses.webui.components.ContentWindowChanger.java

License:Mozilla Public License

public ContentWindowChanger(Window window) {
    this.window = window;
    current = window.getContent();
}

From source file:ru.codeinside.gses.webui.utils.Components.java

License:Mozilla Public License

public static Window createWindow(Window mainwindow, String caption) {
    Window subwindow = new Window(caption);
    subwindow.setSizeUndefined();//w  ww  . j av a 2 s.c  o  m
    subwindow.getContent().setSizeUndefined();
    subwindow.setScrollable(false);
    subwindow.setResizable(false);
    subwindow.setPositionX(50);
    subwindow.setPositionY(50);
    mainwindow.addWindow(subwindow);
    return subwindow;
}