Example usage for com.vaadin.ui GridLayout addComponent

List of usage examples for com.vaadin.ui GridLayout addComponent

Introduction

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

Prototype

public void addComponent(Component component, int column, int row)
        throws OverlapsException, OutOfBoundsException 

Source Link

Document

Adds the component to the grid in cells column1,row1 (NortWest corner of the area.) End coordinates (SouthEast corner of the area) are the same as column1,row1.

Usage

From source file:com.wcs.wcslib.vaadin.widget.recaptcha.demo.DummyRegWithReCaptcha.java

License:Apache License

private Layout createForm() {
    RegistrationFields registrationFields = new RegistrationFields();
    fieldGroup.buildAndBindMemberFields(registrationFields);
    GridLayout layout = new GridLayout(2, 2);
    layout.setSpacing(true);//from w  ww . j av  a  2  s  . com
    layout.addComponent(registrationFields.getLogin(), 0, 0);
    layout.addComponent(registrationFields.getPassword(), 0, 1);
    layout.addComponent(registrationFields.getPasswordAgain(), 1, 1);
    registrationFields.login.focus();
    return layout;
}

From source file:de.escidoc.admintool.view.util.LayoutHelper.java

License:Open Source License

/**
 * Helper method. Puts a blank in front of a component. Useful for buttons.
 * //from  ww w  . j a  v  a  2 s. co m
 * @param comp
 *            The component to display.
 * @return The component in an grid layout. A blank in front and afterwards is inserted.
 */
public static synchronized GridLayout create(final Component comp) {
    final GridLayout hor = new GridLayout(3, 1);
    hor.setHeight(Constants.DEFAULT_HEIGHT);
    hor.addComponent(new Label(" "), 0, 0);
    hor.addComponent(comp, 1, 0);
    hor.setComponentAlignment(comp, Alignment.MIDDLE_RIGHT);
    hor.addComponent(new Label(" "), 2, 0);
    hor.setSpacing(false);
    return hor;
}

From source file:de.gedoplan.webclients.vaadin.views.CustomerForm.java

protected void buildLayout() {
    GridLayout gridLayout = new GridLayout(4, 4);
    gridLayout.setSpacing(true);/* w  w w.j a va2 s  .  com*/
    gridLayout.setMargin(true);
    gridLayout.setWidth(100, Unit.PERCENTAGE);
    gridLayout.addComponent(id, 0, 0);
    gridLayout.addComponent(name, 1, 0, 2, 0);
    gridLayout.addComponent(kontakt, 3, 0);
    gridLayout.addComponent(strasse, 0, 1);
    gridLayout.addComponent(plz, 1, 1);
    gridLayout.addComponent(stadt, 2, 1, 3, 1);
    gridLayout.addComponent(region, 0, 2);
    gridLayout.addComponent(land, 1, 2);
    gridLayout.addComponent(telefon, 2, 2);
    gridLayout.addComponent(fax, 3, 2);
    gridLayout.addComponent(speichern, 1, 3);
    gridLayout.addComponent(abbrechen, 2, 3);
    gridLayout.setComponentAlignment(speichern, Alignment.MIDDLE_CENTER);
    gridLayout.setComponentAlignment(abbrechen, Alignment.MIDDLE_CENTER);
    speichern.setWidth(200, Unit.PIXELS);
    abbrechen.setWidth(200, Unit.PIXELS);
    setSpacing(true);
    setWidth(100, Unit.PERCENTAGE);
    addComponent(gridLayout);
}

From source file:de.metas.ui.web.vaadin.window.editor.FieldEditorsContainer.java

License:Open Source License

private void addChildEditor(final Label label, final Component editorComp,
        final PropertyLayoutInfo layoutInfo) {
    final GridLayout content = getContent();
    int labelColumn = contentNextColumn * 2;
    int labelRow = contentNextRow;

    if (layoutInfo.isNextColumn()) {
        labelColumn = content.getColumns();
        labelRow = 0;/*from  ww  w .  j av  a2  s  .  co  m*/
    }

    final int editorRowsSpan = layoutInfo.getRowsSpan();
    final int editorColumnFrom = labelColumn + 1;
    final int editorColumnTo = editorColumnFrom;
    final int editorRowFrom = labelRow;
    final int editorRowTo = editorRowFrom + (editorRowsSpan - 1);
    if (editorColumnTo >= content.getColumns()) {
        content.setColumns(editorColumnTo + 1);
    }
    if (editorRowTo >= content.getRows()) {
        content.setRows(editorRowTo + 1);
    }

    //
    //
    if (label != null) {
        content.addComponent(label, labelColumn, labelRow);
        content.setComponentAlignment(label, Alignment.MIDDLE_RIGHT);
    }
    content.addComponent(editorComp, editorColumnFrom, editorRowFrom, editorColumnTo, editorRowTo);
    content.setComponentAlignment(editorComp, Alignment.MIDDLE_LEFT);
    editorComp.setSizeFull();

    //
    //
    // contentNextColumn;
    contentNextRow = editorRowTo + 1;
}

From source file:dhbw.clippinggorilla.userinterface.windows.NewSourceWindow.java

private void refreshList(GridLayout grid, Crawler c) {
    VerticalLayout layoutList = new VerticalLayout();
    layoutList.setWidth("100%");
    layoutList.setSpacing(false);//from   ww w .  ja  v a 2  s  . c om
    layoutList.setMargin(false);
    Panel panelList = new Panel(layoutList);
    panelList.setHeight("325px");
    c.getIncludesByClass()
            .forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByClass(s, true),
                    Language.get(Word.INCLUDE_TAGS) + " " + Language.get(Word.BYCLASS), s, null)));
    c.getIncludesByTag().forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByTag(s, true),
            Language.get(Word.INCLUDE_TAGS) + " " + Language.get(Word.BYTAG), s, null)));
    c.getIncludesByID().forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByID(s, true),
            Language.get(Word.INCLUDE_TAGS) + " " + Language.get(Word.BYID), s, null)));
    c.getIncludesByAttribute()
            .forEach((k, v) -> layoutList.addComponent(getRow(layoutList, () -> c.removeByAttribute(k, v, true),
                    Language.get(Word.INCLUDE_TAGS) + " " + Language.get(Word.BYATTRIBUTEVALUE), k, v)));
    c.getExcludeByClass()
            .forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByClass(s, false),
                    Language.get(Word.EXCLUDE_TAGS) + " " + Language.get(Word.BYCLASS), s, null)));
    c.getExcludeByTag().forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByTag(s, false),
            Language.get(Word.EXCLUDE_TAGS) + " " + Language.get(Word.BYTAG), s, null)));
    c.getExcludeByID().forEach(s -> layoutList.addComponent(getRow(layoutList, () -> c.removeByID(s, false),
            Language.get(Word.EXCLUDE_TAGS) + " " + Language.get(Word.BYID), s, null)));
    c.getExcludeByAttribute().forEach(
            (k, v) -> layoutList.addComponent(getRow(layoutList, () -> c.removeByAttribute(k, v, false),
                    Language.get(Word.EXCLUDE_TAGS) + " " + Language.get(Word.BYATTRIBUTEVALUE), k, v)));
    grid.removeComponent(1, 0);
    grid.addComponent(panelList, 1, 0);
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.scenarioscreen.ScenarioScreenViewImpl.java

License:Open Source License

/**
 * Die Methode fuegt der View ein Szenario hinzu. Sie baut hierzu saemtliche
 * notwendigen GUI-Elemente und entsprechenden Listener hinzu.
 * /*from w ww .j a  v  a  2 s.  c om*/
 * Auf ein GridLayout umgestellt.
 * 
 * @author Julius Hacker, Tobias Lindner
 * @param rateReturnEquity Standardwert fuer die Renditeforderung Eigenkapital
 * @param rateReturnCapitalStock Standardwert fuer die Renditeforderung Fremdkapital
 * @param businessTax Standardwert fuer die Gewerbesteuer
 * @param corporateAndSolitaryTax Standardwert fuer die Koerperschaftssteuer mit Solidaritaetszuschlag.
 */

@Override
public void addScenario(String rateReturnEquity, String rateReturnCapitalStock, String corporateAndSolitaryTax,
        String businessTax, String personalTaxRate, boolean isIncludeInCalculation, final int number) {
    HashMap<String, AbstractComponent> scenarioComponents = new HashMap<String, AbstractComponent>();

    Property.ValueChangeListener changeListener = new Property.ValueChangeListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            presenter.updateScenario(number);
            logger.debug("TextChange ausgeloest");
            logger.debug("ChangeListener " + System.identityHashCode(this));
            presenter.isValid();
        }
    };

    final GridLayout gl = new GridLayout(3, 7);
    gl.addStyleName("gridLayoutScenarios");
    gl.setSizeFull();
    gl.setColumnExpandRatio(0, 2);
    gl.setColumnExpandRatio(1, 1);
    gl.setColumnExpandRatio(2, 1);

    final Label scenarioName = new Label("<strong>Szenario " + number + "</strong>");
    scenarioName.setContentMode(Label.CONTENT_XHTML);
    scenarioComponents.put("label", scenarioName);

    logger.debug("SzenarioName: " + scenarioName);
    gl.addComponent(scenarioName, 0, 0);

    //EK Rendite
    final Label textEigenkapital = new Label("Renditeforderung Eigenkapital: ");
    textEigenkapital.setSizeFull();

    final TextField tfEigenkapital = new TextField();

    if (!"0.0".equals(rateReturnEquity)) {
        tfEigenkapital.setValue(rateReturnEquity);
    }

    tfEigenkapital.setImmediate(true);
    tfEigenkapital.addStyleName("scenario");
    tfEigenkapital.addListener(changeListener);

    gl.addComponent(textEigenkapital, 0, 1);
    gl.addComponent(tfEigenkapital, 1, 1);

    scenarioComponents.put("rateReturnEquity", tfEigenkapital);

    // Fremdkapital      
    final Label textFremdkapitel = new Label("Renditeforderung FK: ");

    final TextField tfFremdkapital = new TextField();

    if (!"0.0".equals(rateReturnCapitalStock)) {
        tfFremdkapital.setValue(rateReturnCapitalStock);
    }

    tfFremdkapital.setImmediate(true);
    tfFremdkapital.addStyleName("scenario");
    tfFremdkapital.addListener(changeListener);

    gl.addComponent(textFremdkapitel, 0, 2);
    gl.addComponent(tfFremdkapital, 1, 2);

    scenarioComponents.put("rateReturnCapitalStock", tfFremdkapital);

    //Gewerbesteuer
    final Label textGewerbesteuer = new Label("Gewerbesteuer:");
    final TextField tfGewerbesteuer = new TextField();

    if (!"0.0".equals(businessTax)) {
        tfGewerbesteuer.setValue(businessTax);
    }

    tfGewerbesteuer.setImmediate(true);
    tfGewerbesteuer.addStyleName("scenario");
    tfGewerbesteuer.addListener(changeListener);

    gl.addComponent(textGewerbesteuer, 0, 3);
    gl.addComponent(tfGewerbesteuer, 1, 3);

    scenarioComponents.put("businessTax", tfGewerbesteuer);

    //Krperschaftssteuer
    final Label textKoerperschaftssteuer = new Label("Krperschaftssteuer mit Solidarittszuschlag: ");

    final TextField tfKoerperschaftssteuer = new TextField();

    if (!"0.0".equals(corporateAndSolitaryTax)) {
        tfKoerperschaftssteuer.setValue(corporateAndSolitaryTax);
    }

    tfKoerperschaftssteuer.setImmediate(true);
    tfKoerperschaftssteuer.addStyleName("scenario");
    tfKoerperschaftssteuer.addListener(changeListener);

    gl.addComponent(textKoerperschaftssteuer, 0, 4);
    gl.addComponent(tfKoerperschaftssteuer, 1, 4);

    scenarioComponents.put("corporateAndSolitaryTax", tfKoerperschaftssteuer);

    // Persnlicher Steuersatz
    final Label textPersonalTaxRate = new Label("pers\u00F6nlicher Steuersatz: ");
    final TextField tfPersonalTaxRate = new TextField();
    if (!"0.0".equals(personalTaxRate)) {
        tfPersonalTaxRate.setValue(personalTaxRate);
    }
    tfPersonalTaxRate.setImmediate(true);
    tfPersonalTaxRate.addStyleName("scenario");
    tfPersonalTaxRate.addListener(changeListener);

    gl.addComponent(textPersonalTaxRate, 0, 5);
    gl.addComponent(tfPersonalTaxRate, 1, 5);

    scenarioComponents.put("personalTaxRate", tfPersonalTaxRate);

    deleteIcon = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418766003_editor_trash_delete_recycle_bin_-128.png"));
    deleteIcon.setHeight(60, UNITS_PIXELS);
    deleteIcon.addStyleName("deleteScenario");

    deleteIcon.addListener(new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void click(ClickEvent event) {
            presenter.removeScenario(number);
        }

    });

    gl.addComponent(deleteIcon, 2, 0, 2, 6);
    gl.setComponentAlignment(deleteIcon, Alignment.MIDDLE_CENTER);

    final Label gap = new Label();
    gap.setHeight(20, UNITS_PIXELS);

    gl.addComponent(gap, 0, 6);

    scenarioComponents.put("scenario", gl);

    this.scenarios.add(scenarioComponents);
    this.vlScenarios.addComponent(gl);

    //Button bei 3 Scenarios deaktivieren
    if (number == 3) {
        deactivateAddScenario();
    }
}

From source file:fr.amapj.view.views.saisiecontrat.PopupSaisieJoker.java

License:Open Source License

@Override
protected void createContent(VerticalLayout contentLayout) {
    String msg = getTitre(abo.dateJokers.size());

    titre = new Label(msg, ContentMode.HTML);
    contentLayout.addComponent(titre);//  w  ww.ja v  a  2  s . c om

    GridLayout gl = new GridLayout(3, contratDTO.jokerNbMax);
    gl.setMargin(true);
    gl.setSpacing(true);

    SimpleDateFormat df = FormatUtils.getFullDate();

    for (int i = 0; i < contratDTO.jokerNbMax; i++) {
        ContratLigDTO dateJoker = (i < abo.dateJokers.size()) ? abo.dateJokers.get(i) : null;
        boolean isModifiable = isModifiable(dateJoker);
        //
        Label l1 = new Label("Joker " + (i + 1));
        l1.setWidth("80px");
        gl.addComponent(l1, 0, i);

        //
        if (isModifiable && readOnly == false) {
            ComboBox box = createComboBox(dateJoker, df);
            box.setWidth("220px");
            gl.addComponent(box, 1, i);
            combos.add(box);
        } else {
            String caption = dateJoker == null ? "Non utilis" : df.format(dateJoker.date);
            gl.addComponent(new Label(caption), 1, i);
            if (dateJoker != null) {
                nonModifiableJokers.add(dateJoker);
            }
        }

        String l3msg = isModifiable ? "" : " (Non modifiable)";
        Label l3 = new Label(l3msg);
        gl.addComponent(l3, 2, i);

    }
    contentLayout.addComponent(gl);

}

From source file:gov.va.ehtac.appsonfhir.ui.FHIRChart.java

public FHIRChart() {
    session = ((HealthElementsTouchKitUI) UI.getCurrent()).getSessionAttributes();
    setCaption("TriCare Portal");
    //final VerticalComponentGroup vert = new VerticalComponentGroup();
    GridLayout layout = new GridLayout(3, 2);
    layout.setMargin(true);//from   w w  w  .  j a v a  2  s.  com
    layout.setWidth("80%");
    layout.setHeight("100%");

    Panel problemListPanel = getProblemList();
    Panel medicationPanel = getMedications();
    Panel encountersPanel = getEncounters();
    Panel allergiesPanel = getAllergies();
    Panel testsPanel = getTests();
    Panel carePanel = getCarePlan();

    layout.addComponent(problemListPanel, 0, 0);
    layout.setComponentAlignment(problemListPanel, Alignment.TOP_LEFT);
    layout.addComponent(medicationPanel, 1, 0);
    layout.setComponentAlignment(medicationPanel, Alignment.TOP_LEFT);
    layout.addComponent(encountersPanel, 2, 0);
    layout.setComponentAlignment(encountersPanel, Alignment.TOP_LEFT);
    layout.addComponent(allergiesPanel, 0, 1);
    layout.setComponentAlignment(allergiesPanel, Alignment.TOP_LEFT);
    layout.addComponent(testsPanel, 1, 1);
    layout.setComponentAlignment(testsPanel, Alignment.TOP_LEFT);
    layout.addComponent(carePanel, 2, 1);
    layout.setComponentAlignment(carePanel, Alignment.TOP_LEFT);

    //vert.addComponent(layout);

    setContent(new CssLayout(layout));

}

From source file:gov.va.ehtac.myappsonfhir.ui.FitnessWellness.java

private GridLayout getChartLayout() {
    getChartData(-6);// ww  w. ja  va 2s . c  o m
    Button b1 = new Button("See More");
    Button b2 = new Button("See More");
    Button b3 = new Button("See More");
    Button b4 = new Button("See More");

    b1.setImmediate(true);
    b2.setImmediate(true);
    b3.setImmediate(true);
    b4.setImmediate(true);

    b1.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            dRequest = "raw";
            refresh();
        }
    });

    b2.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            dRequest = "raw";
            refresh();
        }
    });

    b3.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            dRequest = "raw";
            refresh();
        }
    });

    b4.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            dRequest = "raw";
            refresh();
        }
    });

    GridLayout grid = new GridLayout(2, 2);
    grid.setMargin(true);
    grid.setWidth("100%");

    Panel p1 = new Panel("Heart Rate Activity");
    p1.setHeight("100px");
    VerticalComponentGroup v = new VerticalComponentGroup();
    //v.addComponent(hChart.getChart());
    v.addComponent(hChart.getChart());
    v.addComponent(b1);
    grid.addComponent(v, 0, 0);

    Panel p2 = new Panel("Distance - Miles");
    p2.setHeight("100px");
    VerticalComponentGroup v2 = new VerticalComponentGroup();
    //v2.addComponent(dChart.getChart());
    v2.addComponent(dChart.getChart(results));
    v2.addComponent(b2);
    grid.addComponent(v2, 1, 0);

    Panel p3 = new Panel("Calories Burned");
    p3.setHeight("100px");
    VerticalComponentGroup v3 = new VerticalComponentGroup();
    //v3.addComponent(cChart.getChart());
    v3.addComponent(cChart.getChart(results));
    v3.addComponent(b3);
    grid.addComponent(v3, 0, 1);

    Panel p4 = new Panel("Steps Taken");
    p4.setHeight("100px");
    VerticalComponentGroup v4 = new VerticalComponentGroup();
    //v4.addComponent(sChart.getChart());
    v4.addComponent(sChart.getChart(results));
    v4.addComponent(b4);
    grid.addComponent(v4, 1, 1);
    return grid;
}

From source file:io.subutai.plugin.accumulo.ui.wizard.VerificationStep.java

public VerificationStep(final Accumulo accumulo, final Hadoop hadoop, final ExecutorService executorService,
        final Tracker tracker, EnvironmentManager environmentManager, final Wizard wizard) {

    setSizeFull();//from  w w w  . jav a  2  s.  com

    GridLayout grid = new GridLayout(1, 5);
    grid.setSpacing(true);
    grid.setMargin(true);
    grid.setSizeFull();

    Label confirmationLbl = new Label("<strong>Please verify the installation settings "
            + "(you may change them by clicking on Back button)</strong><br/>");
    confirmationLbl.setContentMode(ContentMode.HTML);

    ConfigView cfgView = new ConfigView("Installation configuration");
    cfgView.addStringCfg("Cluster Name", wizard.getConfig().getClusterName());
    cfgView.addStringCfg("Instance name", wizard.getConfig().getInstanceName());
    cfgView.addStringCfg("Password", wizard.getConfig().getPassword());
    cfgView.addStringCfg("Hadoop cluster", wizard.getConfig().getHadoopClusterName());
    cfgView.addStringCfg("Zookeeper cluster", wizard.getConfig().getZookeeperClusterName());

    if (wizard.getConfig().getSetupType() == SetupType.OVER_HADOOP_N_ZK) {
        try {
            Environment hadoopEnvironment = environmentManager.loadEnvironment(
                    hadoop.getCluster(wizard.getConfig().getHadoopClusterName()).getEnvironmentId());
            EnvironmentContainerHost master = hadoopEnvironment
                    .getContainerHostById(wizard.getConfig().getMasterNode());
            EnvironmentContainerHost gc = hadoopEnvironment
                    .getContainerHostById(wizard.getConfig().getGcNode());
            EnvironmentContainerHost monitor = hadoopEnvironment
                    .getContainerHostById(wizard.getConfig().getMonitor());
            Set<EnvironmentContainerHost> tracers = hadoopEnvironment
                    .getContainerHostsByIds(wizard.getConfig().getTracers());
            Set<EnvironmentContainerHost> slaves = hadoopEnvironment
                    .getContainerHostsByIds(wizard.getConfig().getSlaves());

            cfgView.addStringCfg("Master node", master.getHostname());
            cfgView.addStringCfg("GC node", gc.getHostname());
            cfgView.addStringCfg("Monitor node", monitor.getHostname());
            for (EnvironmentContainerHost containerHost : tracers) {
                cfgView.addStringCfg("Tracers", containerHost.getHostname());
            }
            for (EnvironmentContainerHost containerHost : slaves) {
                cfgView.addStringCfg("Slaves", containerHost.getHostname());
            }
        } catch (EnvironmentNotFoundException | ContainerHostNotFoundException e) {
            LOGGER.error("Error applying operations on environment/container", e);
        }
    } else {
        cfgView.addStringCfg("Number of Hadoop slaves",
                wizard.getHadoopClusterConfig().getCountOfSlaveNodes() + "");
        cfgView.addStringCfg("Hadoop replication factor",
                wizard.getHadoopClusterConfig().getReplicationFactor() + "");
        cfgView.addStringCfg("Hadoop domain name", wizard.getHadoopClusterConfig().getDomainName() + "");
        cfgView.addStringCfg("Number of tracers", wizard.getConfig().getNumberOfTracers() + "");
        cfgView.addStringCfg("Number of slaves", wizard.getConfig().getNumberOfSlaves() + "");
    }

    Button install = new Button("Install");
    install.setId("installBtn");
    install.addStyleName("default");
    install.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            UUID trackID;
            if (wizard.getConfig().getSetupType() == SetupType.OVER_HADOOP_N_ZK) {
                trackID = accumulo.installCluster(wizard.getConfig());
            } else {
                trackID = accumulo.installCluster(wizard.getConfig());
            }
            ProgressWindow window = new ProgressWindow(executorService, tracker, trackID,
                    AccumuloClusterConfig.PRODUCT_KEY);
            window.getWindow().addCloseListener(new Window.CloseListener() {
                @Override
                public void windowClose(Window.CloseEvent closeEvent) {
                    wizard.init();
                }
            });
            getUI().addWindow(window.getWindow());
        }
    });

    Button back = new Button("Back");
    back.setId("verBack");
    back.addStyleName("default");
    back.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            wizard.back();
        }
    });

    HorizontalLayout buttons = new HorizontalLayout();
    buttons.addComponent(back);
    buttons.addComponent(install);

    grid.addComponent(confirmationLbl, 0, 0);

    grid.addComponent(cfgView.getCfgTable(), 0, 1, 0, 3);

    grid.addComponent(buttons, 0, 4);

    setContent(grid);
}