Example usage for com.vaadin.ui VerticalLayout VerticalLayout

List of usage examples for com.vaadin.ui VerticalLayout VerticalLayout

Introduction

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

Prototype

public VerticalLayout() 

Source Link

Document

Constructs an empty VerticalLayout.

Usage

From source file:com.cms.component.CommonLayout.java

private void buildRootLayout() {
    root = new VerticalLayout();
    root.setImmediate(true);/*from  w  w w.jav  a2  s . c  om*/
    root.setWidth("100%");
    root.setHeight("100%");
    root.setMargin(true);
    root.setSpacing(true);
    // top-level component properties
    setWidth("100.0%");
    setHeight("100.0%");

    //Them cac thanh phan vao grid
    setCompositionRoot(root);
}

From source file:com.cms.component.CommonSearchForm.java

public void init() {
    root = new VerticalLayout();
    root.setImmediate(true);/*from   www  .j  a  va2s  .  c  o m*/
    root.setWidth("100%");
    root.setHeight("100%");
    root.setMargin(false);
    root.setSpacing(false);
    // top-level component properties
    setWidth("100.0%");
    setHeight("100.0%");
    root = buildMainLayout();
    setCompositionRoot(root);
}

From source file:com.cms.ui.CommonUI.java

public CommonUI(String leftCaption, String rightCaption) {
    //        Style
    //        Page.Styles styles = Page.getCurrent().getStyles();
    //        styles.add("*{font-family: tahoma; font-size: 13px;}");
    //        styles.add(".custom-feildset{border: 1px solid #ccc;}");
    //        styles.add(".v-caption-custom-feildset{position: relative}");
    //        styles.add(".v-caption-custom-feildset span{display: block; margin-top: -8px; position: absolute; z-index: 1000 !important; background: #fff;}");
    //        styles.add(".v-textfield-dashing{background: #99EE6B;}");

    mainLayout = new HorizontalSplitPanel();
    mainLayout.setSizeFull();//from   w  w w.j  a  v a  2s .c  o  m
    mainLayout.setStyleName("v-scrollable");
    setStyleName("v-scrollable");
    setWidth("100.0%");
    setHeight("100%");
    panelLeft = new Panel();
    panelRight = new Panel();
    panelLeft.setImmediate(true);
    mainLayout.setImmediate(true);
    panelRight.setImmediate(true);
    leftLayout = new VerticalLayout();
    rightLayout = new VerticalLayout();
    //         set margin
    leftLayout.setMargin(true);
    rightLayout.setMargin(true);
    //        set caption
    panelLeft.setCaption(leftCaption);
    panelRight.setCaption(rightCaption);

    panelLeft.setContent(leftLayout);
    panelRight.setContent(rightLayout);

    panelLeft.setSizeFull();
    panelRight.setSizeFull();

    leftLayout.setWidth("100%");
    leftLayout.setHeight("-1px");
    rightLayout.setWidth("100%");
    rightLayout.setHeight("-1px");
    //        panelLeft.setHeight("1200px");
    //        panelRight.setHeight("1200px");
    mainLayout.setFirstComponent(panelLeft);
    mainLayout.setSecondComponent(panelRight);
    setCompositionRoot(mainLayout);

}

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  a v a  2s .c o  m
    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.coatl.pruebas.cloudstorage.CloudStorageUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    this.layout = new VerticalLayout();
    layout.addComponent(new Label("Pruebas de DataStore"));

    setContent(layout);/* w w  w .j ava 2 s.co  m*/
    //this.listarCubeta();
}

From source file:com.coatl.pruebas.datastore.DataStoreUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    this.principal = new VerticalLayout();
    {//  ww  w  .j a  va  2s .  c o  m
        principal.addComponent(new Label("Pruebas de DataStore"));
        HorizontalLayout superior = new HorizontalLayout();
        principal.addComponent(superior);

        this.forma = new FormLayout();
        superior.addComponent(forma);
        {
            this.tabla = new TextField("Tabla");
            tabla.setValue("iq3_usuarios");
            forma.addComponents(tabla);

            this.nombre = new TextField("Nombre");
            forma.addComponents(nombre);
            this.ap1 = new TextField("Apellido Paterno");
            forma.addComponents(ap1);
            this.ap2 = new TextField("Apellido Materno");
            forma.addComponents(ap2);
            this.renglones = new Label("Renglones");
            forma.addComponents(renglones);

        }

        FormLayout botones = new FormLayout();
        /*
        botones.addComponent(new Label(" "));
        botones.addComponent(new Label("Acciones:"));
         */
        superior.addComponent(botones);

        Button recargar = new Button("Recargar");
        botones.addComponent(recargar);
        recargar.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                listarObjetos();
            }
        });

        Button guardar = new Button("Guardar");
        botones.addComponent(guardar);
        guardar.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                Map m = new HashMap();
                m.put("nombre", nombre.getValue());
                m.put("ap1", ap1.getValue());
                m.put("ap2", ap2.getValue());
                m.put("id", nombre.getValue());

                IU7.ds.guardar(tabla.getValue(), m);
                System.out.println("Objeto guardado");
                listarObjetos();
            }
        });

        Button borrar = new Button("Borrar");
        botones.addComponent(borrar);
        borrar.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                borrar();
            }
        });

        Button mil = new Button("Hacer 1,000");
        botones.addComponent(mil);
        mil.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                for (int i = 0; i < 1000; i++) {
                    Map m = new HashMap();
                    String id = "ID_" + i + "_" + Math.random();
                    m.put("id", id);
                    m.put("nombre", "Nombre_" + id + "_" + Math.random());
                    m.put("ap1", "Ap1_" + id + "_" + Math.random());
                    m.put("ap2", "Ap2_" + id + "_" + Math.random());
                    IU7.ds.guardar(tabla.getValue(), m);
                    System.out.println(" >" + id);
                }
            }
        });

    }

    VerticalSplitPanel vsl = new VerticalSplitPanel();
    setContent(vsl);
    vsl.setFirstComponent(principal);

    grid.setSizeFull();
    grid.setComponenteSuperior(new Label("primer panel"));
    //grid.setComponenteMedio(new Label("segundo panel"));
    //grid.setComponenteInferior(new Label("tercer panel"));
    grid.setNombreTabla(tabla.getValue());
    grid.setColumnas("id,nombre,ap1,ap2");
    grid.setColumnasVisibles("nombre,ap1,ap2");

    vsl.setSecondComponent(grid);
    //grid.setComponenteMedio(grid);
    this.listarObjetos();
}

From source file:com.coatl.pruebas.MyUI.java

@Override
protected void init(VaadinRequest vaadinRequest) {
    final VerticalLayout layout = new VerticalLayout();

    final TextField name = new TextField();
    name.setCaption("Escribe algo aqu:");

    Button button = new Button("Dime que escrib");

    button.addClickListener(new Button.ClickListener() {
        @Override/*from  w  w  w.  j a  va2 s.c om*/
        public void buttonClick(Button.ClickEvent event) {
            System.out.println("Click!");
            layout.addComponent(new Label("Usted escribi> " + name.getValue()));
        }
    });

    layout.addComponents(name, button);
    layout.setMargin(true);
    layout.setSpacing(true);

    setContent(layout);
}

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

ixDefinicionDeForma getForma(String forma, String tipo) {
    Stack<AbstractComponent> pila = new Stack();
    Map<String, AbstractComponent> componentes = new HashMap();
    AbstractComponent ultimo = null;//from w  w  w. j a v a2s  .  c  o  m

    String[] cmds = forma.split(" ");

    for (String cmd : cmds) {
        cmd = cmd.trim();
        if (!cmd.equals("")) {
            //System.out.println("CMD> [" + cmd + "]");
            if (cmd.equals("bConfBorrar")) {
                agregar(pila, getbConfBorrar());

            } else if (cmd.equals("bBorrar")) {
                agregar(pila, getbBorrar());

            } else if (cmd.equals("bGuardar")) {
                agregar(pila, getbGuardar());

            } else if (cmd.equals("bCrear")) {
                agregar(pila, getbCrear());
            } else if (cmd.startsWith("H")) {
                HorizontalLayout hl = new HorizontalLayout();
                if (cmd.contains("m")) {
                    hl.setMargin(true);
                }
                agregar(pila, hl);
            } else if (cmd.startsWith("V")) {
                VerticalLayout vl = new VerticalLayout();
                if (cmd.contains("m")) {
                    vl.setMargin(true);
                }
                agregar(pila, vl);
            } else if (cmd.startsWith("F")) {
                FormLayout fl = new FormLayout();
                if (cmd.contains("m")) {
                    fl.setMargin(true);
                }
                agregar(pila, fl);
            } else if (cmd.equals(".")) {
                ultimo = pila.pop();
                //System.out.println("Sacando de pila a " + ultimo);
            } else if (cmd.startsWith("'")) {
                String txt = cmd.substring(1);
                while (txt.contains("~")) {
                    txt = txt.replace("~", " ");
                }
                Label l = new Label(txt);

                agregar(pila, l);
            } else {
                //System.out.println("Buscando columna [" + cmd + "]");
                ixDefinicionDeColumna columna = columnas.get(cmd);
                String claseControl = columna.getClaseControl();
                if (claseControl == null) {
                    claseControl = "com.vaadin.ui.TextField";
                }

                AbstractComponent con = null;

                try {
                    con = (AbstractComponent) this.getClass().getClassLoader().loadClass(claseControl)
                            .newInstance();
                } catch (Exception ex) {
                    System.out.println("ERROR INSTANCIANDO> [" + claseControl + "], " + ex);
                }
                con.setCaption(this.getTituloColumna(cmd));
                if (con != null) {
                    agregar(pila, con);
                    componentes.put(cmd, con);
                }

                if (tipo != null) {
                    if (tipo.toLowerCase().equals("c")) {
                        if (columna.isSoloLecturaCrear() || columna.isSoloLectura()) {
                            con.setReadOnly(true);
                        }
                    }
                    if (tipo.toLowerCase().equals("e") || tipo.toLowerCase().equals("g")) {
                        if (columna.isSoloLecturaGuardar() || columna.isSoloLectura()) {
                            con.setReadOnly(true);
                        }
                    }
                    if (tipo.toLowerCase().equals("b")) {

                        con.setReadOnly(true);
                    }
                }

            }
        }
    }

    while (pila.size() > 0) {
        ultimo = pila.pop();
    }

    ixDefinicionDeForma res = new ixDefinicionDeForma();
    res.setComponente(ultimo);
    res.setComponentes(componentes);

    return res;
}

From source file:com.compomics.sigpep.webapp.MyVaadinApplication.java

License:Apache License

@Override
public void init() {
    iApplication = this;
    iSigPepSessionFactory = ApplicationLocator.getInstance().getApplication().getSigPepSessionFactory();

    //add theme/*from  w w w  .  j  a va2  s.c  o  m*/
    setTheme("sigpep");

    //add main window
    Window lMainwindow = new Window("Sigpep Application");
    setMainWindow(lMainwindow);
    lMainwindow.addStyleName("v-app-my");

    //add notification component
    iNotifique = new Notifique(Boolean.FALSE);
    CustomOverlay lCustomOverlay = new CustomOverlay(iNotifique, getMainWindow());
    getMainWindow().addComponent(lCustomOverlay);

    //add form help
    iFormHelp = new FormHelp();
    iFormHelp.setFollowFocus(Boolean.TRUE);
    this.getMainWindow().getContent().addComponent(iFormHelp);

    //add panels
    iCenterLeft = new Panel();
    iCenterLeft.addStyleName(Reindeer.PANEL_LIGHT);
    iCenterLeft.setHeight("400px");
    iCenterLeft.setWidth("100%");

    iCenterRight = new Panel();
    iCenterRight.addStyleName(Reindeer.PANEL_LIGHT);
    iCenterRight.setHeight("400px");
    iCenterRight.setWidth("75%");

    //add form tabs
    iFormTabSheet = new FormTabSheet(this);
    iCenterLeft.addComponent(iFormTabSheet);

    iBottomLayoutResults = new VerticalLayout();

    if (PropertiesConfigurationHolder.showTestDemoFolder()) {
        Button lButton = new Button("load test data");
        lButton.addListener(new Button.ClickListener() {
            public void buttonClick(Button.ClickEvent event) {
                new BackgroundThread().run();
            }
        });
        iBottomLayoutResults.addComponent(lButton);
    }

    // Add the selector component
    iSelectionComponent = new TransitionSelectionComponent(MyVaadinApplication.this);
    iCenterRight.addComponent(iSelectionComponent);

    iHeaderLayout = new HorizontalLayout();
    iHeaderLayout.setSizeFull();
    iHeaderLayout.setHeight("100px");
    iHeaderLayout.addStyleName("v-header");

    VerticalLayout lVerticalLayout = new VerticalLayout();

    GridLayout lGridLayout = new GridLayout(2, 1);
    lGridLayout.setSpacing(true);
    lGridLayout.setSizeFull();

    lGridLayout.addComponent(iCenterLeft, 0, 0);
    lGridLayout.setComponentAlignment(iCenterLeft, Alignment.TOP_LEFT);

    lGridLayout.addComponent(iCenterRight, 1, 0);
    lGridLayout.setComponentAlignment(iCenterRight, Alignment.TOP_CENTER);

    lVerticalLayout.addComponent(iHeaderLayout);
    lVerticalLayout.addComponent(lGridLayout);
    lVerticalLayout.addComponent(iBottomLayoutResults);

    lVerticalLayout.setComponentAlignment(iHeaderLayout, Alignment.MIDDLE_CENTER);
    lVerticalLayout.setComponentAlignment(lGridLayout, Alignment.MIDDLE_CENTER);
    lVerticalLayout.setComponentAlignment(iBottomLayoutResults, Alignment.MIDDLE_CENTER);

    lMainwindow.addComponent(lVerticalLayout);
    lMainwindow.addComponent(pusher);

    // Create a tracker for vaadin.com domain.
    String lDomainName = PropertiesConfigurationHolder.getInstance().getString("analytics.domain");
    String lPageId = PropertiesConfigurationHolder.getInstance().getString("analytics.page");

    GoogleAnalyticsTracker tracker = new GoogleAnalyticsTracker("UA-26252212-1", lDomainName);
    lMainwindow.addComponent(tracker);
    tracker.trackPageview(lPageId);

    /**
     * Sets an UncaughtExceptionHandler and executes the thread by the ExecutorsService
     */
    Thread.setDefaultUncaughtExceptionHandler(new MyUncaughtExceptionHandler());

    parseSessionId();
}

From source file:com.constellio.app.ui.pages.base.MainLayoutImpl.java

public MainLayoutImpl(AppLayerFactory appLayerFactory) {
    this.presenter = new MainLayoutPresenter(this);

    mainMenuContentFooterLayout = new HorizontalLayout();
    mainMenuContentFooterLayout.setSizeFull();
    mainMenuContentFooterLayout.addStyleName("main-menu-content-footer");

    contentViewWrapper = new Panel();

    Navigator navigator = new Navigator(UI.getCurrent(), contentViewWrapper);
    NavigatorConfigurationService navigatorConfigurationService = appLayerFactory
            .getNavigatorConfigurationService();
    navigatorConfigurationService.configure(navigator);
    UI.getCurrent().setNavigator(navigator);

    contentFooterWrapperLayout = new CssLayout();
    contentFooterWrapperLayout.setId("content-footer-wrapper");

    contentFooterLayout = new VerticalLayout();
    contentFooterLayout.addStyleName("content-footer");

    header = buildHeader();//from  w ww .  j  av a2 s .  c  om
    header.setSizeUndefined();

    mainMenu = buildMainMenu();

    userDocumentsWindow = new UserDocumentsWindow();
    dragAndDropWrapper = new DragAndDropWrapper(mainMenuContentFooterLayout);
    dragAndDropWrapper.setSizeFull();
    dragAndDropWrapper.setDropHandler(userDocumentsWindow);
    navigator.addViewChangeListener(new ViewChangeListener() {
        @Override
        public boolean beforeViewChange(ViewChangeEvent event) {
            return true;
        }

        @Override
        public void afterViewChange(ViewChangeEvent event) {
            View newView = event.getNewView();
            if (newView instanceof NoDragAndDrop) {
                dragAndDropWrapper.setDropHandler(null);
            } else if (newView instanceof DropHandler) {
                dragAndDropWrapper.setDropHandler((DropHandler) newView);
            } else {
                List<DropHandler> viewDropHandlers = ComponentTreeUtils.getChildren((Component) newView,
                        DropHandler.class);
                if (viewDropHandlers.size() > 1) {
                    dragAndDropWrapper.setDropHandler(null);
                } else if (viewDropHandlers.size() == 1) {
                    dragAndDropWrapper.setDropHandler(viewDropHandlers.get(0));
                } else if (dragAndDropWrapper.getDropHandler() != userDocumentsWindow) {
                    dragAndDropWrapper.setDropHandler(userDocumentsWindow);
                }
            }
            //            SerializationUtils.clone(event.getOldView());
            //            SerializationUtils.clone(newView);
        }
    });

    addComponent(header);
    addComponent(dragAndDropWrapper);
    setExpandRatio(dragAndDropWrapper, 1);

    mainMenuContentFooterLayout.addComponent(mainMenu);
    mainMenuContentFooterLayout.addComponent(contentFooterWrapperLayout);
    mainMenuContentFooterLayout.setExpandRatio(contentFooterWrapperLayout, 1);

    contentFooterWrapperLayout.addComponent(contentFooterLayout);

    contentFooterLayout.addComponent(contentViewWrapper);

    Component message = buildMessage();
    if (message != null) {
        message.addStyleName("message");
        contentFooterLayout.addComponent(message);
    }

    contentFooterLayout.setExpandRatio(contentViewWrapper, 1);

    Component footer = buildFooter();
    if (footer != null) {
        contentFooterLayout.addComponent(footer);
    }

    Component license = buildLicense();
    if (license != null) {
        license.addStyleName("license");
    }

    PagesComponentsExtensionParams params = new PagesComponentsExtensionParams(header, mainMenu,
            contentFooterLayout, this, contentViewWrapper, contentFooterWrapperLayout, presenter.getUser());
    appLayerFactory.getExtensions().getSystemWideExtensions().decorateView(params);
    String collection = ConstellioUI.getCurrentSessionContext().getCurrentCollection();
    if (collection != null) {
        appLayerFactory.getExtensions().forCollection(collection).decorateView(params);
    }

    buildInitJavascript();
}