Example usage for com.vaadin.ui VerticalSplitPanel setFirstComponent

List of usage examples for com.vaadin.ui VerticalSplitPanel setFirstComponent

Introduction

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

Prototype

public void setFirstComponent(Component c) 

Source Link

Document

Sets the first component of this split panel.

Usage

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   ww  w .java2 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.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 w w  w.  j a  va2s .c  o m
    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.cavisson.gui.dashboard.components.controls.SplitPanels.java

License:Apache License

public SplitPanels() {
    setMargin(true);//from   ww w .  j ava  2 s  . c o m

    Label h1 = new Label("Split Panels");
    h1.addStyleName("h1");
    addComponent(h1);

    addComponent(new Label(
            "Outlines are just to show the areas of the SplitPanels. They are not part of the actual component style."));

    HorizontalLayout row = new HorizontalLayout();
    row.addStyleName("wrapping");
    row.setSpacing(true);
    row.setMargin(new MarginInfo(true, false, false, false));
    addComponent(row);

    HorizontalSplitPanel sp = new HorizontalSplitPanel();
    sp.setCaption("Default style");
    sp.setWidth("400px");
    sp.setHeight(null);
    sp.setFirstComponent(getContent());
    sp.setSecondComponent(getContent());
    row.addComponent(sp);

    VerticalSplitPanel sp2 = new VerticalSplitPanel();
    sp2.setCaption("Default style");
    sp2.setWidth("300px");
    sp2.setHeight("200px");
    sp2.setFirstComponent(getContent());
    sp2.setSecondComponent(getContent());
    row.addComponent(sp2);

    sp = new HorizontalSplitPanel();
    sp.setCaption("Large style");
    sp.setWidth("300px");
    sp.setHeight("200px");
    sp.addStyleName("large");
    sp.setFirstComponent(getContent());
    sp.setSecondComponent(getContent());
    row.addComponent(sp);

    sp2 = new VerticalSplitPanel();
    sp2.setCaption("Large style");
    sp2.setWidth("300px");
    sp2.setHeight("200px");
    sp2.addStyleName("large");
    sp2.setFirstComponent(getContent());
    sp2.setSecondComponent(getContent());
    row.addComponent(sp2);
}

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

@Override
protected void init(VaadinRequest vaadinRequest) {
    this.principal = new VerticalLayout();
    {//from w w w .  ja v a 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.mcparland.john.AdjustableLayout.java

License:Apache License

/**
 * Create the content panel./*  w  w w .  j  a  v a  2  s  . c  o  m*/
 * 
 * @return the content panel.
 */
private Component createContentPanel() {
    VerticalSplitPanel contentPanel = new VerticalSplitPanel();
    contentPanel.setFirstComponent(createEditorPanel());
    contentPanel.setSecondComponent(createTable());
    contentPanel.setSplitPosition(80, Unit.PERCENTAGE);
    return contentPanel;
}

From source file:com.mcparland.john.DragAndDropPanel.java

License:Apache License

/**
 * Create a DragAndDropPanel.//from   w ww  .jav  a 2s .c om
 * 
 */
public DragAndDropPanel() {
    super();
    final VerticalSplitPanel leftSplitPanel = new VerticalSplitPanel();
    leftSplitPanel.setSizeFull();
    leftSplitPanel.setFirstComponent(createLayout(new HorizontalLayout()));
    leftSplitPanel.setSecondComponent(new VerticalLayout());

    final VerticalSplitPanel rightSplitPanel = new VerticalSplitPanel();
    rightSplitPanel.setSizeFull();
    rightSplitPanel.setFirstComponent(createLayout(new GridLayout(3, 3)));
    rightSplitPanel.setSecondComponent(new InlineCssLayout());

    setFirstComponent(leftSplitPanel);
    setSecondComponent(rightSplitPanel);
    setSizeFull();
}

From source file:com.openhris.payroll.PayrollAdvancesLedgerUI.java

public PayrollAdvancesLedgerUI(int branchId) {
    this.branchId = branchId;

    setSpacing(false);// w w w .  j  a v a  2 s  .co  m
    setMargin(false);
    setWidth("100%");
    setHeight("100%");
    setImmediate(true);

    final VerticalSplitPanel vsplit = new VerticalSplitPanel();

    vsplit.setImmediate(true);
    vsplit.setMargin(false);
    vsplit.setSizeFull();
    vsplit.setLocked(true);

    vsplit.setSplitPosition(90, Sizeable.UNITS_PIXELS);

    GridLayout glayout = new GridLayout(2, 1);
    glayout.setWidth("60%");
    glayout.setMargin(true);
    glayout.setSpacing(true);

    employeeComboBox(getBranchId());
    glayout.addComponent(employee, 0, 0);

    Button button = new Button();
    button.setWidth("100%");
    button.setCaption("Generate Ledger");
    button.setEnabled(UserAccessControl.isPayroll());
    button.addListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            System.out.println("employeeId: " + employee.getValue());
        }
    });

    glayout.addComponent(button, 1, 0);
    glayout.setComponentAlignment(button, Alignment.BOTTOM_LEFT);

    vsplit.setFirstComponent(glayout);
    addComponent(vsplit);

    setExpandRatio(vsplit, 1.0f);
}

From source file:fi.jasoft.dragdroplayouts.demo.DemoUI.java

License:Apache License

@Override
protected void init(VaadinRequest request) {

    VerticalLayout content = new VerticalLayout();
    content.setSizeFull();/*from  w  w  w.j a  va 2  s .  co  m*/
    setContent(content);

    Label header = new Label("DragDropLayouts for Vaadin 8");
    header.setStyleName(ValoTheme.LABEL_H1);
    content.addComponent(header);

    HorizontalLayout hl = new HorizontalLayout();
    hl.setSizeFull();
    content.addComponent(hl);
    content.setExpandRatio(hl, 1);

    VerticalSplitPanel split = new VerticalSplitPanel();
    hl.addComponent(split);
    hl.setExpandRatio(split, 1);

    CssLayout placeHolder = new CssLayout(new Label("No view selected."));
    placeHolder.setSizeFull();
    split.setFirstComponent(placeHolder);

    Panel codePanel = new Panel(codeLabel);
    codePanel.setSizeFull();
    split.setSecondComponent(codePanel);

    navigator = new Navigator(this, placeHolder);

    navigator.addViewChangeListener(new ViewChangeListener() {

        @Override
        public boolean beforeViewChange(ViewChangeEvent event) {
            DemoView view = (DemoView) event.getNewView();
            selection.getSelectionModel().select(view);
            codeLabel.setValue(getFormattedSourceCode(view.getSource()));
            return true;
        }

        @Override
        public void afterViewChange(ViewChangeEvent event) {
            // TODO Auto-generated method stub

        }
    });

    try {
        addView(new DragdropAbsoluteLayoutDemo(navigator));
        addView(new DragdropVerticalLayoutDemo(navigator));
        addView(new DragdropHorizontalLayoutDemo(navigator));
        addView(new DragdropGridLayoutDemo(navigator));
        addView(new DragdropCssLayoutDemo(navigator));
        addView(new DragdropFormLayoutDemo(navigator));
        addView(new DragdropPanelDemo(navigator));

        addView(new DragdropLayoutDraggingDemo(navigator));
        addView(new DragdropHorizontalSplitPanelDemo(navigator));
        addView(new DragdropVerticalSplitPanelDemo(navigator));
        addView(new DragdropTabsheetDemo(navigator));
        addView(new DragdropAccordionDemo(navigator));

        addView(new DragdropDragFilterDemo(navigator));
        addView(new DragdropCaptionModeDemo(navigator));

        addView(new DragdropV7VerticalLayoutDemo(navigator));
        addView(new DragdropV7HorizontalLayoutDemo(navigator));

        // addView(new DragdropIframeDragging(navigator));

    } catch (Exception e) {
        e.printStackTrace();
        return;
    }

    hl.addComponent(selection = createViewSelection(), 0);

    String fragment = Page.getCurrent().getUriFragment();
    if (fragment == null || fragment.equals("")) {
        navigator.navigateTo(DragdropAbsoluteLayoutDemo.NAME);
    }
}

From source file:hu.fnf.devel.wishbox.ui.MainPage.java

License:Open Source License

@Override
protected void init(VaadinRequest vaadinRequest) {
    PropertysetItem item = new PropertysetItem();
    item.addItemProperty("name", new ObjectProperty<String>("Zaphod"));
    item.addItemProperty("age", new ObjectProperty<Integer>(42));

    // Have some layout
    FormLayout form = new FormLayout();
    HorizontalLayout footer = new HorizontalLayout();
    footer.addComponent(new Button("cica"));
    footer.addComponent(new Button("kutya"));

    // Now create a binder that can also create the fields
    // using the default field factory
    FieldGroup binder = new FieldGroup(item);

    form.addComponent(binder.buildAndBind("Name", "name"));
    form.addComponent(binder.buildAndBind("Age", "age"));

    HorizontalSplitPanel sample = new HorizontalSplitPanel();
    sample.setSizeFull();/*  w  ww. j a v  a2  s . co  m*/

    VerticalSplitPanel verticalSplitPanel = new VerticalSplitPanel();
    verticalSplitPanel.setFirstComponent(form);
    verticalSplitPanel.setSecondComponent(new Label("masodik"));

    sample.setSecondComponent(verticalSplitPanel);

    Table grid = new Table();

    grid.setSizeFull();
    for (Object i : getItemContiner().getItemIds()) {
        System.out.println("item ids: " + i.toString());
    }
    grid.setContainerDataSource(getItemContiner());
    grid.setSelectable(true);
    grid.addValueChangeListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent valueChangeEvent) {
            final String valueString = String.valueOf(valueChangeEvent.getProperty().getValue());
            Notification.show("Value changed:", valueString, Notification.Type.TRAY_NOTIFICATION);
        }
    });
    sample.setFirstComponent(grid);

    setContent(sample);

    //            Main window is the primary browser window
    final Window main = new Window("Hello window");
    addWindow(main);
    // "Hello world" text is added to window as a Label component
    UserService userService = UserServiceFactory.getUserService();
    User user = userService.getCurrentUser();

    if (user != null) {
        String email = user.getEmail();
    } else {
        // no user logged in
    }
    assert user != null;

    main.setContent(new Label(user.getUserId()));
}

From source file:net.sourceforge.javydreamercsw.validation.manager.web.ValidationManagerUI.java

License:Apache License

@Override
public void updateScreen() {
    //Set up a menu header on top and the content below
    VerticalSplitPanel vs = new VerticalSplitPanel();
    vs.setSplitPosition(25, Unit.PERCENTAGE);
    //Set up top menu panel
    vs.setFirstComponent(getMenu());
    if (getUser() == null) {
        if (tabSheet != null) {
            tabSheet.removeAllComponents();
        }//from  w  w  w .  j a va 2s  .  c om
        showLoginDialog();
    } else {
        //Process any notifications
        //Check for assigned test
        getUser().update();
        //Process notifications
        Lookup.getDefault().lookupAll(NotificationProvider.class).forEach(p -> {
            p.processNotification();
        });
        createTree();
    }
    //Add the content
    vs.setSecondComponent(getContentComponent());
    if (getUser() != null) {
        showTab(Lookup.getDefault().lookup(DashboardProvider.class).getComponentCaption());
    } else {
        if (DataBaseManager.isDemo()) {
            showTab(Lookup.getDefault().lookup(DemoProvider.class).getComponentCaption());
        }
    }
    setContent(vs);
}