Example usage for com.vaadin.ui Alignment MIDDLE_CENTER

List of usage examples for com.vaadin.ui Alignment MIDDLE_CENTER

Introduction

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

Prototype

Alignment MIDDLE_CENTER

To view the source code for com.vaadin.ui Alignment MIDDLE_CENTER.

Click Source Link

Usage

From source file:dhbw.ka.mwi.businesshorizon2.ui.process.navigation.NavigationViewImpl.java

License:Open Source License

private void addOverviewButton() {
    Button overviewButton = new Button("Projektbersicht");
    overviewButton.addStyleName("default");
    overviewButton.addListener(new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override/*  w  w  w.  ja va2  s .c o  m*/
        public void buttonClick(ClickEvent event) {
            presenter.showProjectList();

        }
    });

    this.topbarinnerlayout.addComponent(overviewButton);
    this.topbarinnerlayout.setComponentAlignment(overviewButton, Alignment.MIDDLE_CENTER);
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.process.output.OutputViewImpl.java

License:Open Source License

/**
 * Erstelle das GUI zum Prozessschritt "Ausgabe"
 * /*from  www  . j a v a  2  s .c  o  m*/
 * @author Florian Stier
 */
private void generateUi() {

    progressIndicator = new ProgressIndicator();
    progressIndicator.setIndeterminate(true);
    progressIndicator.setEnabled(true);
    progressIndicator.setStyleName("bar");
    progressIndicator.setCaption("Berechne..");

    vl.addComponent(progressIndicator);
    vl.setComponentAlignment(progressIndicator, Alignment.MIDDLE_CENTER);
    this.setContent(vl);
    this.setStyleName("borderless light");
    this.setSizeFull();

}

From source file:dhbw.ka.mwi.businesshorizon2.ui.resultscreen.onescenario.OneScenarioResultViewImpl.java

License:Open Source License

/**
 * Erstelle das GUI zum Prozessschritt "Ausgabe"
 * /*  w  w w. j  a  va  2  s .  c  o  m*/
 * @author Florian Stier
 */
private void generateUi() {

    setSizeFull();
    planningLayout = new HorizontalLayout();
    planningLabel = new Label("Planungsprmissen:");
    scenarioLayout = new GridLayout(2, 5);
    renditeEKLabel = new Label("Renditeforderung EK:");
    renditeFKLabel = new Label("Renditeforderung FK:");
    gewerbeStLabel = new Label("Gewerbesteuer:");
    koerperStLabel = new Label("Krperschaftssteuer inkl. Solidarittszuschlag:");
    personalTaxRateLabel = new Label("Persnlicher Steuersatz");
    renditeEK = new Label();
    renditeFK = new Label();
    gewerbeSt = new Label();
    koerperSt = new Label();
    personalTaxRate = new Label();
    companyValueLayout = new HorizontalLayout();
    companyValueLabel = new Label("Unternehmenswert:");
    companyValue = new Label();
    gap = new Label();
    gap2 = new Label();
    gap3 = new Label();
    gap4 = new Label();
    expandingGap = new Label();
    expandingGap2 = new Label();
    expandingGap3 = new Label();
    capitalChartLayout = new VerticalLayout();
    cashflowChartLayout = new VerticalLayout();
    chartArea = new HorizontalLayout();

    gap.setWidth("20px");
    gap2.setWidth("20px");
    gap3.setHeight("20px");
    gap4.setHeight("20px");
    expandingGap.setSizeFull();

    planningLayout.setWidth(100, UNITS_PERCENTAGE);
    companyValueLayout.setHeight(100, UNITS_PIXELS);
    companyValueLayout.setWidth(100, UNITS_PERCENTAGE);
    scenarioLayout.setWidth(100, UNITS_PERCENTAGE);
    planningLabel.setWidth(SIZE_UNDEFINED, 0);
    companyValue.setWidth(SIZE_UNDEFINED, 0);
    companyValueLabel.setWidth(SIZE_UNDEFINED, 0);
    capitalChartLayout.setWidth(250, UNITS_PIXELS);
    capitalChartLayout.setHeight(250, UNITS_PIXELS);
    cashflowChartLayout.setWidth(350, UNITS_PIXELS);
    cashflowChartLayout.setHeight(250, UNITS_PIXELS);
    chartArea.setWidth(100, UNITS_PERCENTAGE);
    chartArea.setHeight(SIZE_UNDEFINED, 0);

    planningLabel.setStyleName("font12bold");
    renditeEKLabel.setStyleName("font12bold");
    renditeFKLabel.setStyleName("font12bold");
    gewerbeStLabel.setStyleName("font12bold");
    koerperStLabel.setStyleName("font12bold");
    personalTaxRateLabel.setStyleName("font12bold");
    renditeEK.setStyleName("font12bold");
    renditeFK.setStyleName("font12bold");
    gewerbeSt.setStyleName("font12bold");
    koerperSt.setStyleName("font12bold");
    personalTaxRate.setStyleName("font12bold");
    companyValueLabel.setStyleName("font14bold");
    companyValue.setStyleName("font14bold");

    scenarioLayout.setStyleName("resultScenarioLayout");
    companyValueLayout.setStyleName("companyValueLayout");

    planningLayout.addComponent(planningLabel);
    planningLayout.addComponent(gap2);
    planningLayout.addComponent(scenarioLayout);
    scenarioLayout.addComponent(renditeEKLabel, 0, 0);
    scenarioLayout.addComponent(renditeEK, 1, 0);
    scenarioLayout.addComponent(renditeFKLabel, 0, 1);
    scenarioLayout.addComponent(renditeFK, 1, 1);
    scenarioLayout.addComponent(gewerbeStLabel, 0, 2);
    scenarioLayout.addComponent(gewerbeSt, 1, 2);
    scenarioLayout.addComponent(koerperStLabel, 0, 3);
    scenarioLayout.addComponent(koerperSt, 1, 3);
    scenarioLayout.addComponent(personalTaxRateLabel, 0, 4);
    scenarioLayout.addComponent(personalTaxRate, 1, 4);
    companyValueLayout.addComponent(expandingGap2);
    companyValueLayout.addComponent(companyValueLabel);
    companyValueLayout.addComponent(gap);
    companyValueLayout.addComponent(companyValue);
    companyValueLayout.addComponent(expandingGap3);

    planningLayout.setComponentAlignment(planningLabel, Alignment.MIDDLE_LEFT);
    planningLayout.setExpandRatio(scenarioLayout, 1.0f);
    companyValueLayout.setComponentAlignment(companyValueLabel, Alignment.MIDDLE_CENTER);
    companyValueLayout.setComponentAlignment(companyValue, Alignment.MIDDLE_CENTER);
    companyValueLayout.setExpandRatio(expandingGap2, 1.0f);
    companyValueLayout.setExpandRatio(expandingGap3, 1.0f);
    //      scenarioLayout.setColumnExpandRatio(1, 1.0f);
    //      scenarioLayout.setComponentAlignment(renditeEK, Alignment.MIDDLE_RIGHT);
    //      scenarioLayout.setComponentAlignment(renditeFK, Alignment.MIDDLE_RIGHT);
    //      scenarioLayout.setComponentAlignment(gewerbeSt, Alignment.MIDDLE_RIGHT);
    scenarioLayout.setComponentAlignment(koerperSt, Alignment.BOTTOM_CENTER);

    chartArea.addComponent(capitalChartLayout);
    chartArea.addComponent(cashflowChartLayout);

    addComponent(planningLayout);
    addComponent(gap3);
    addComponent(companyValueLayout);
    addComponent(gap4);
    addComponent(chartArea);
    addComponent(expandingGap);

    setExpandRatio(expandingGap, 1.0f);
}

From source file:dhbw.ka.mwi.businesshorizon2.ui.resultscreen.ResultScreenViewImpl.java

License:Open Source License

/**
 * Erstelle das GUI zum Prozessschritt "Ausgabe"
 * /*ww  w  .  j  ava  2 s  . c o  m*/
 * @author Florian Stier
 */
private void generateUi() {

    progressIndicator = new ProgressIndicator();
    progressIndicator.setIndeterminate(true);
    progressIndicator.setEnabled(true);
    progressIndicator.setStyleName("bar");
    progressIndicator.setCaption("Berechne..");

    addComponent(progressIndicator);
    setComponentAlignment(progressIndicator, Alignment.MIDDLE_CENTER);
    //      addComponent(vl);
    setStyleName("borderless light");
    setWidth(95, UNITS_PERCENTAGE);
    setHeight(100, UNITS_PERCENTAGE);
    setStyleName("projectDetailsLayout");

}

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

License:Open Source License

/**
 * Erstelle das GUI zum Prozessschritt "Szenarien"
 * /*from   w w w .  ja  v a2 s .c o  m*/
 * @author Julius Hacker, Tobias Lindner
 */
private void generateUi() {

    addScenarioLayout = new HorizontalLayout();

    addIcon = new Embedded(null,
            new ThemeResource("./images/icons/newIcons/1418766077_circle_add_plus_-128_green.png"));
    addIcon.setHeight(30, UNITS_PIXELS);

    addLabel = new Label("Szenario hinzufgen");
    addLabel.addStyleName("scenarios");
    addLabel.addStyleName("addScenario");

    addScenarioLayout.addComponent(addIcon);

    gap3 = new Label();
    gap3.setWidth(10, UNITS_PIXELS);

    addScenarioLayout.addComponent(gap3);
    addScenarioLayout.addComponent(addLabel);
    addScenarioLayout.setComponentAlignment(addLabel, Alignment.MIDDLE_CENTER);

    addScenarioLayout.addListener(new LayoutClickListener() {
        private static final long serialVersionUID = 1L;

        @Override
        public void layoutClick(LayoutClickEvent event) {
            presenter.addScenario();
        }
    });

    gap4 = new Label();
    gap4.setHeight(15, UNITS_PIXELS);

    this.vlScenarios = new VerticalLayout();
    this.vlScenarios.setSizeFull();
    this.setMargin(true);

    addComponent(addScenarioLayout);
    setComponentAlignment(addScenarioLayout, Alignment.MIDDLE_LEFT);
    addComponent(gap4);
    addComponent(this.vlScenarios);

    vlScenarios.addStyleName("scenarios");
}

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  ww w. j  a  va  2 s  .c o  m
 * 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:ec.com.vipsoft.ce.ui.FacturaView.java

public void construirGui() {
    HorizontalLayout l1 = new HorizontalLayout();
    l1.setSpacing(true);//from w  w  w . j a v a  2 s  .  c  o m
    tipoFactura = new ComboBox();
    tipoFactura.addItem("regular");
    tipoFactura.setItemCaption("regular", "REGULAR");
    tipoFactura.addItem("exportacion");
    tipoFactura.setItemCaption("exportacion", "EXPORTACION");
    tipoFactura.addItem("reembolso");
    tipoFactura.setItemCaption("reembolso", "REEMBOLSO");
    tipoFactura.setNullSelectionAllowed(false);
    tipoFactura.setValue("regular");

    tipoIdentificacion = new ComboBox();

    tipoIdentificacion.addItem("05");
    tipoIdentificacion.setItemCaption("05", "CEDULA");
    tipoIdentificacion.addItem("06");
    tipoIdentificacion.setItemCaption("06", "PASAPORTE");
    tipoIdentificacion.addItem("07");
    tipoIdentificacion.setItemCaption("07", "FINAL");
    tipoIdentificacion.addItem("08");
    tipoIdentificacion.setItemCaption("08", "ID EXTERIOR");
    tipoIdentificacion.addItem("04");
    tipoIdentificacion.setItemCaption("04", "RUC");
    tipoIdentificacion.setNullSelectionAllowed(false);
    tipoIdentificacion.setValue("04");

    l1.addComponent(tipoIdentificacion);
    rucBeneficiario = new CampoNumeroIdentificacion();
    l1.addComponent(rucBeneficiario);
    Label lrazonSocial = new Label("R. Social");
    l1.addComponent(lrazonSocial);
    razonSocialBeneficiario = new CampoRazonSocial();
    l1.addComponent(razonSocialBeneficiario);
    Label ldireccion = new Label("Dir.");
    l1.addComponent(ldireccion);
    direccion = new CampoDireccion();
    l1.addComponent(direccion);
    fechaEmision = new CampoFecha();
    l1.addComponent(fechaEmision);
    //////////////////////////////////////////
    HorizontalLayout l2 = new HorizontalLayout();
    l2.setSpacing(true);
    Label lordenCompra = new Label("OC");
    setMargin(true);
    l2.addComponent(lordenCompra);
    ordenCompra = new TextField();
    ordenCompra.setWidth("70px");
    l2.addComponent(ordenCompra);
    Label lvencimiento = new Label("Cond. Pago");
    l2.addComponent(lvencimiento);
    formaPago = new CampoCodigo();
    formaPago.setWidth("100px");
    l2.addComponent(formaPago);
    Label lguia = new Label("Gua Remisin");
    l2.addComponent(lguia);
    numeroGuiaRemision = new CampoNumeroComprobante();
    l2.addComponent(numeroGuiaRemision);
    Label lsucursalCliente = new Label("Sucursal cliente");
    l2.addComponent(lsucursalCliente);
    codigoEstablecimientoDestino = new CampoCodigo();
    codigoEstablecimientoDestino.setInputPrompt("001");
    codigoEstablecimientoDestino.setWidth("70px");
    l2.addComponent(codigoEstablecimientoDestino);

    ////////////////////////////////
    codigoIVA = new ComboBox();
    codigoIVA.addItem("0");
    codigoIVA.addItem("2");
    codigoIVA.setNullSelectionAllowed(false);
    codigoIVA.setValue("2");
    codigoIVA.setItemCaption("0", "0%");
    codigoIVA.setItemCaption("2", "12%");
    codigoIVA.setWidth("80px");
    HorizontalLayout l3 = new HorizontalLayout();
    l3.setSpacing(true);
    botonBuscarDetalle = new BotonBuscar();
    l3.addComponent(botonBuscarDetalle);
    codigoP = new TextField();
    codigoP.setWidth("80px");
    l3.addComponent(codigoP);
    bienSeleccionado = new TextField();
    bienSeleccionado.setWidth("150px");
    l3.addComponent(bienSeleccionado);
    l3.addComponent(new Label("IVA"));
    l3.addComponent(codigoIVA);
    Label lcantidad = new Label("Cant.");
    l3.addComponent(lcantidad);
    cantidad = new CampoCantidad();
    l3.addComponent(cantidad);
    Label lvalorU = new Label("V. Unitario");
    l3.addComponent(lvalorU);
    valorUnitario = new CampoDinero();
    l3.addComponent(valorUnitario);
    Label ldescuento = new Label("Dcto.");
    l3.addComponent(ldescuento);
    descuento = new CampoDinero();
    l3.addComponent(descuento);
    Label labelLote = new Label("lote");
    l3.addComponent(labelLote);
    lote = new TextField();
    lote.setInputPrompt("lote 323, expira 2016-05-22");
    lote.setWidth("165px");
    botonAnadirDetalle = new BotonAnadir();
    l3.addComponent(lote);
    l3.addComponent(botonAnadirDetalle);
    botonEliminarDetalle = new BotonRemoverDetalle();
    l3.addComponent(botonEliminarDetalle);
    botonRegistrar = new BotonRegistrar();
    botonCancelar = new BotonCancelar();
    //l3.addComponent(botonRegistrar);
    //l3.addComponent(botonCancelar);
    ////////////////////////////////////////
    HorizontalLayout l4 = new HorizontalLayout();
    l4.setSizeFull();

    tablaDetalles = new Grid();
    beanContainerDetalles = new BeanItemContainer<FacturaDetalleBinding>(FacturaDetalleBinding.class);
    tablaDetalles.setContainerDataSource(beanContainerDetalles);
    //   tablaDetalles.setEditorEnabled(true);

    //        tablaDetalles.setPageLength(5);
    //        tablaDetalles.setSelectable(true);
    //        tablaDetalles.setMultiSelect(false);
    tablaDetalles.setWidth("100%");
    tablaDetalles.setReadOnly(true);
    tablaDetalles.removeColumn("infoAdicional3");
    tablaDetalles.removeColumn("infoAdicional2");
    tablaDetalles.removeColumn("codigoAlterno");
    tablaDetalles.removeColumn("codigoIVA");
    tablaDetalles.removeColumn("ice");
    tablaDetalles.setColumnOrder("cantidad", "codigo", "descripcion", "infoAdicional1", "valorUnitario",
            "descuento", "iva12", "valorTotal");
    l4.addComponent(tablaDetalles);
    l4.setComponentAlignment(tablaDetalles, Alignment.MIDDLE_CENTER);
    ///////////////////////////////////////////////////////7
    HorizontalLayout l5 = new HorizontalLayout();

    l5.setSpacing(true);
    l5.addComponent(tipoFactura);
    Label lcountry = new Label("PAIS DETINO");
    l5.addComponent(lcountry);
    comboPaisDestino = construirComboPaises();
    l5.addComponent(comboPaisDestino);
    HorizontalLayout l6 = new HorizontalLayout();
    l6.setSpacing(true);
    subtotal = new Label("Subtotal $0.00");
    iva12 = new Label("IVA12%  $0.00");
    ice = new Label("ICE $0.00");
    total = new Label("TOTAL $0.00");
    l6.addComponent(subtotal);
    l6.addComponent(iva12);
    l6.addComponent(ice);
    l6.addComponent(total);
    l6.addComponent(botonRegistrar);
    l6.addComponent(botonCancelar);
    l5.addComponent(l6);
    //        l5.addComponent(botonRegistrar);
    //        l5.addComponent(botonCancelar);

    //        l5.setSizeFull();
    //        VerticalLayout v1=new VerticalLayout();
    //        Label linfo=new Label("Info");
    //        HorizontalLayout vl1=new HorizontalLayout();
    //        vl1.setSpacing(true);
    //        vl1.addComponent(linfo);
    //       
    //        v1.addComponent(vl1);

    //        VerticalLayout v2=new VerticalLayout();
    //        v2.setSizeFull();
    //    
    //        HorizontalLayout v2l1=new HorizontalLayout();
    //        v2l1.addComponent(botonRegistrar);
    //        v2l1.addComponent(botonCancelar);
    //        v2.addComponent(v2l1);
    //        v2.setComponentAlignment(v2l1, Alignment.TOP_RIGHT);
    //        l5.addComponent(v1);
    //        l5.addComponent(v2);

    //////////////////////////////////////////////
    setSpacing(true);
    addComponent(l1);
    addComponent(l2);
    addComponent(l3);
    addComponent(l4);
    addComponent(l5);
    setComponentAlignment(l1, Alignment.MIDDLE_CENTER);
    setComponentAlignment(l2, Alignment.MIDDLE_CENTER);
    setComponentAlignment(l3, Alignment.MIDDLE_CENTER);
    setComponentAlignment(l4, Alignment.MIDDLE_CENTER);
    //  setComponentAlignment(l5, Alignment.MIDDLE_CENTER);
}

From source file:edu.cornell.qatarmed.planrnaseq.BrowseAndAnnotate.java

private void initSearch() {

    searchField.setInputPrompt("Search Project");
    /*/*from w  w w . ja  v  a  2  s  .co m*/
     //Attempted to do autosuggestion but it require Indexcontainer for attached to vaadin table. Currently vaadin table is 
     // attached to SqlContainer. It's possble to store fetch table data and use it for creating Indexcontainer and then attach it to vaadin table 
            
     searchField.setTextChangeEventMode(AbstractTextField.TextChangeEventMode.LAZY);
            
     searchField.addTextChangeListener(new FieldEvents.TextChangeListener() {
     public void textChange(final FieldEvents.TextChangeEvent event) {
              
     rnaseqContainer.removeAllContainerFilters();
     //   rnaseqContainer.addContainerFilter(new AnnotateRNAseqSQL.ContactFilter(event
     //         .getText()));
     }
     });
     */
    searchButton.setClickShortcut(KeyCode.ENTER);
    searchButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            if (event.getButton() == searchButton) {
                Component cc = findById(leftLayout, "GuidedSearch");
                if (cc != null) {
                    leftLayout.removeComponent(cc);
                }

                String search_value = searchField.getValue();
                rnaseqContainer = createMySQLContainer("study_filter", search_value);
                rnaseqContainer.removeAllContainerFilters();

                bioprojectSummaryTable.setContainerDataSource(rnaseqContainer);
                //   bioprojectSummaryTable.setVisibleColumns(new String[] { studyName });
                bioprojectSummaryTable.setSelectable(true);
                bioprojectSummaryTable.setImmediate(true);
                bioprojectSummaryTable.setColumnReorderingAllowed(true);
                bioprojectSummaryTable.setSortEnabled(true);
                bioprojectSummaryTable.setVisibleColumns(new Object[] { "Study", "title", "Numsample", "Numexp",
                        "Numrun", "Avgspots", "avgbases", "name" });
            }
        }
    });

    slowSearchButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            if (event.getButton() == slowSearchButton) {
                Component cc = findById(leftLayout, "GuidedSearch");
                if (cc != null) {
                    leftLayout.removeComponent(cc);
                }
                String search_value = searchField.getValue();
                rnaseqContainer = createMySQLContainer("study_filter_slow", search_value);
                rnaseqContainer.removeAllContainerFilters();

                bioprojectSummaryTable.setContainerDataSource(rnaseqContainer);
                //   bioprojectSummaryTable.setVisibleColumns(new String[] { studyName });
                bioprojectSummaryTable.setSelectable(true);
                bioprojectSummaryTable.setImmediate(true);
                bioprojectSummaryTable.setColumnReorderingAllowed(true);
                bioprojectSummaryTable.setSortEnabled(true);
                bioprojectSummaryTable.setVisibleColumns(new Object[] { "Study", "title", "Numsample", "Numexp",
                        "Numrun", "Avgspots", "avgbases", "name" });
            }
        }
    });

    guidedSearchButton.addClickListener(new Button.ClickListener() {
        public void buttonClick(Button.ClickEvent event) {
            if (event.getButton() == guidedSearchButton) {
                VerticalLayout guidedSearchLayout = new VerticalLayout();
                guidedSearchLayout.setId("GuidedSearch");
                //<editor-fold defaultstate="collapsed" desc="Guided search layout">
                HorizontalLayout diseaseLayout = new HorizontalLayout();
                CheckBox checkboxDiseaseYes = new CheckBox("Yes");
                CheckBox checkboxDiseaseNo = new CheckBox("No");

                Label diseaseTitle = new Label("<b>Disease: </b>", ContentMode.HTML);
                diseaseLayout.addComponent(diseaseTitle);
                diseaseLayout.addComponent(checkboxDiseaseNo);
                diseaseLayout.addComponent(checkboxDiseaseYes);

                //<editor-fold defaultstate="collapsed" desc="Study types panel (guided search)">
                Panel studyTypesPanel = new Panel("Sample Types");
                HorizontalLayout studyTypesLayout = new HorizontalLayout();

                HorizontalLayout caseControlLayout = new HorizontalLayout();
                CheckBox checkboxCaseControlYes = new CheckBox("Yes");
                CheckBox checkboxCaseControlNo = new CheckBox("No");

                Label caseControlTitle = new Label("<b>Case-Control: </b>", ContentMode.HTML);
                caseControlLayout.addComponent(caseControlTitle);
                caseControlLayout.addComponent(checkboxCaseControlYes);
                caseControlLayout.addComponent(checkboxCaseControlNo);
                HorizontalLayout timeSeriesLayout = new HorizontalLayout();
                CheckBox checkboxTimeSeriesYes = new CheckBox("Yes");
                CheckBox checkboxTimeSeriesNo = new CheckBox("No");

                Label timeSeriesTitle = new Label("<b>Time Series: </b>", ContentMode.HTML);
                timeSeriesLayout.addComponent(timeSeriesTitle);
                timeSeriesLayout.addComponent(checkboxTimeSeriesYes);
                timeSeriesLayout.addComponent(checkboxTimeSeriesNo);
                HorizontalLayout treatementLayout = new HorizontalLayout();
                CheckBox checkboxTreatmentYes = new CheckBox("Yes");
                CheckBox checkboxTreatmentNo = new CheckBox("No");
                //  checkboxTreatmentYes.setValue(true);
                Label treatmentTitle = new Label("<b>Treatment: </b>", ContentMode.HTML);
                treatementLayout.addComponent(treatmentTitle);
                treatementLayout.addComponent(checkboxTreatmentYes);
                treatementLayout.addComponent(checkboxTreatmentNo);

                studyTypesLayout.addComponent(caseControlLayout);
                Label emptyLabel = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
                        ContentMode.HTML);
                studyTypesLayout.addComponent(emptyLabel);
                studyTypesLayout.addComponent(timeSeriesLayout);
                Label emptyLabel_2 = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
                        ContentMode.HTML);
                studyTypesLayout.addComponent(emptyLabel_2);
                studyTypesLayout.addComponent(treatementLayout);
                studyTypesLayout.setSizeFull();
                studyTypesPanel.setContent(studyTypesLayout);
                studyTypesPanel.setWidth(Sizeable.SIZE_UNDEFINED, Unit.PERCENTAGE);
                studyTypesPanel.addStyleName("panelborder");

                //</editor-fold>`
                //<editor-fold defaultstate="collapsed" desc="Disease Category Panel (guided search)">
                Panel diseaseCategoryPanel = new Panel("Disease Category");
                HorizontalLayout diseaseCategoriesLayout = new HorizontalLayout();
                //Complex Disease
                ListSelect complexDisease = new ListSelect("Complex Disease");
                complexDisease.setMultiSelect(true);

                for (String disease : complexDiseaseArray) {
                    complexDisease.addItem(disease);
                }
                diseaseCategoriesLayout.addComponent(complexDisease);
                Label emptyLabel2 = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
                        ContentMode.HTML);
                diseaseCategoriesLayout.addComponent(emptyLabel2);
                // Rare disease
                ListSelect rareDisease = new ListSelect("Rare Diseases");
                rareDisease.setMultiSelect(true);

                for (String disease : rareDiseaseArray) {
                    rareDisease.addItem(disease);
                }
                diseaseCategoriesLayout.addComponent(rareDisease);
                Label emptyLabel3 = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
                        ContentMode.HTML);
                diseaseCategoriesLayout.addComponent(emptyLabel3);
                // Other diseases
                ListSelect otherDisease = new ListSelect("Other Diseases");
                otherDisease.setMultiSelect(true);
                for (String disease : otherDiseaseArray) {
                    otherDisease.addItem(disease);
                }
                diseaseCategoriesLayout.addComponent(otherDisease);
                //   Label emptyLabel4 = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", ContentMode.HTML);
                //  diseaseCategoriesLayout.addComponent(emptyLabel4);

                diseaseCategoryPanel.setContent(diseaseCategoriesLayout);
                diseaseCategoryPanel.setWidth(Sizeable.SIZE_UNDEFINED, Unit.PERCENTAGE);
                diseaseCategoryPanel.addStyleName("panelborder");

                //</editor-fold>
                //<editor-fold defaultstate="collapsed" desc="Platform (guided search)">
                ListSelect platformsListSelect = new ListSelect("Sequencing Platform");
                platformsListSelect.setMultiSelect(true);
                for (String platform : platforms) {
                    platformsListSelect.addItem(platform);
                }

                HorizontalLayout platformLayout = new HorizontalLayout();
                platformsListSelect.setHeight(platformsListSelect.size() + 2, Unit.EM);
                platformLayout.addComponent(platformsListSelect);
                //</editor-fold>

                //<editor-fold defaultstate="collapsed" desc="Sample types panel (guided search)">
                Panel sampleTypesPanel = new Panel("Sample Types");
                HorizontalLayout sampleTypesLayout = new HorizontalLayout();
                CheckBox checkboxSampleTypeCellLine = new CheckBox("Cell Line");
                CheckBox checkboxSampleTypeTissue = new CheckBox("Tissue");
                CheckBox checkboxSampleTypePrimaryCells = new CheckBox("Primary Cells");
                CheckBox checkboxSampleTypeWholeBlood = new CheckBox("Whole Blood");
                CheckBox checkboxSampleTypePlasma = new CheckBox("Plasma");

                HorizontalLayout CellLineLayout = new HorizontalLayout();
                CellLineLayout.addComponent(checkboxSampleTypeCellLine);

                HorizontalLayout PrimaryCellsLayout = new HorizontalLayout();
                PrimaryCellsLayout.addComponent(checkboxSampleTypePrimaryCells);

                HorizontalLayout TissueLayout = new HorizontalLayout();
                TissueLayout.addComponent(checkboxSampleTypeTissue);

                HorizontalLayout WholeBloodLayout = new HorizontalLayout();
                WholeBloodLayout.addComponent(checkboxSampleTypeWholeBlood);

                HorizontalLayout PlasmaLayout = new HorizontalLayout();
                PlasmaLayout.addComponent(checkboxSampleTypePlasma);

                sampleTypesLayout.addComponent(CellLineLayout);
                Label emptyLabel8 = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
                        ContentMode.HTML);
                sampleTypesLayout.addComponent(emptyLabel8);
                sampleTypesLayout.addComponent(PrimaryCellsLayout);
                Label emptyLabel5 = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
                        ContentMode.HTML);
                sampleTypesLayout.addComponent(emptyLabel5);
                sampleTypesLayout.addComponent(TissueLayout);
                Label emptyLabel6 = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
                        ContentMode.HTML);
                sampleTypesLayout.addComponent(emptyLabel6);
                sampleTypesLayout.addComponent(WholeBloodLayout);
                Label emptyLabel7 = new Label("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
                        ContentMode.HTML);
                sampleTypesLayout.addComponent(emptyLabel7);
                sampleTypesLayout.addComponent(PlasmaLayout);

                sampleTypesPanel.setContent(sampleTypesLayout);
                sampleTypesPanel.setWidth(Sizeable.SIZE_UNDEFINED, Unit.PERCENTAGE);
                sampleTypesPanel.addStyleName("panelborder");

                //</editor-fold>
                //<editor-fold defaultstate="collapsed" desc="Replicate Type">
                HorizontalLayout replicatTypesLayout = new HorizontalLayout();
                String replicateType_from_sra = "";
                String replicateType_confidence = "";
                Label suggestedreplicatTypeLabel = new Label("<b><i>Suggestion: </i></b>"
                        + replicateType_from_sra + " <b> <i> Confidence: <i></b>  " + replicateType_confidence,
                        ContentMode.HTML);
                String[] replicatTypes = new String[] { "Biological -- different individuals",
                        "Biological -- same individual but severe treatment to RNA",
                        "Semi Biological/Technical -- mild treatment",
                        "Technical -- machine parameter or buffer (very mild)" };
                List<String> replicatTypesList = Arrays.asList(replicatTypes);
                ComboBox replicatTypesListComboBox = new ComboBox("Replicates Type ", replicatTypesList);
                replicatTypesLayout.addComponent(replicatTypesListComboBox);
                replicatTypesLayout.addComponent(suggestedreplicatTypeLabel);

                //</editor-fold>
                checkboxCaseControlYes.addValueChangeListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        if (checkboxCaseControlYes.getValue()) {
                            checkboxCaseControlNo.setValue(!checkboxCaseControlYes.getValue());
                        }

                    }
                });
                checkboxCaseControlNo.addValueChangeListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        if (checkboxCaseControlNo.getValue()) {
                            checkboxCaseControlYes.setValue(!checkboxCaseControlNo.getValue());
                        }
                    }
                });

                checkboxTimeSeriesYes.addValueChangeListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        if (checkboxTimeSeriesYes.getValue()) {
                            checkboxTimeSeriesNo.setValue(!checkboxTimeSeriesYes.getValue());
                        }

                    }
                });
                checkboxTimeSeriesNo.addValueChangeListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        if (checkboxTimeSeriesNo.getValue()) {
                            checkboxTimeSeriesYes.setValue(!checkboxTimeSeriesNo.getValue());
                        }
                    }
                });

                checkboxTreatmentYes.addValueChangeListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        if (checkboxTreatmentYes.getValue()) {
                            checkboxTreatmentNo.setValue(!checkboxTreatmentYes.getValue());
                        }

                    }
                });
                checkboxTreatmentNo.addValueChangeListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        if (checkboxTreatmentNo.getValue()) {
                            checkboxTreatmentYes.setValue(!checkboxTreatmentNo.getValue());
                        }
                    }
                });

                checkboxDiseaseYes.addValueChangeListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        if (checkboxDiseaseYes.getValue()) {
                            checkboxDiseaseNo.setValue(!checkboxDiseaseYes.getValue());
                            diseaseCategoryPanel.setVisible(true);
                        }

                    }
                });
                checkboxDiseaseNo.addValueChangeListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        if (checkboxDiseaseNo.getValue()) {
                            checkboxDiseaseYes.setValue(!checkboxDiseaseNo.getValue());
                            diseaseCategoryPanel.setVisible(false);
                        }
                    }
                });

                //<editor-fold defaultstate="collapsed" desc="CheckBox Annotation Ongoing or Completed ">
                CheckBox checkboxAnnotaionCompleted = new CheckBox("Annotaion Completed");
                CheckBox checkboxAnnotaionOngoing = new CheckBox("Annotaion Ongoing");
                // checkboxAnnotaionOngoing.setValue(true);
                checkboxAnnotaionCompleted.addValueChangeListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        if (checkboxAnnotaionCompleted.getValue()) {
                            checkboxAnnotaionOngoing.setValue(!checkboxAnnotaionCompleted.getValue());
                        }
                    }
                });
                checkboxAnnotaionOngoing.addValueChangeListener(new Property.ValueChangeListener() {
                    @Override
                    public void valueChange(ValueChangeEvent event) {
                        if (checkboxAnnotaionOngoing.getValue()) {
                            checkboxAnnotaionCompleted.setValue(!checkboxAnnotaionOngoing.getValue());
                        }
                    }
                });
                //</editor-fold>

                HorizontalLayout annotationStatusLayout = new HorizontalLayout();
                annotationStatusLayout.addComponent(checkboxAnnotaionOngoing);
                annotationStatusLayout.addComponent(checkboxAnnotaionCompleted);

                Button guidedSearchSubmitButton = new Button("Search Meeting ALL Criteria");
                guidedSearchSubmitButton.addClickListener(new Button.ClickListener() {
                    public void buttonClick(Button.ClickEvent event) {
                        if (event.getButton() == guidedSearchSubmitButton) {
                            String query_part3 = "";
                            if (checkboxDiseaseYes.getValue() && !checkboxDiseaseNo.getValue()) {
                                query_part3 = query_part3 + " AND ( isDisease = 1) ";
                            } else if (!checkboxDiseaseYes.getValue() && checkboxDiseaseNo.getValue()) {
                                query_part3 = query_part3 + " AND (isDisease =  null  or isDisease = 0 ) ";
                            }
                            String selected_disease_category = "";
                            String main_disease = "";
                            for (Iterator i = complexDisease.getItemIds().iterator(); i.hasNext();) {
                                Object iid = (Object) i.next();
                                String temp = iid.toString();
                                if (!temp.startsWith("--")) {
                                    main_disease = temp;
                                }
                                if (complexDisease.isSelected(iid)) {
                                    // System.out.println("Selected" + temp);

                                    if (iid.toString().startsWith("--")) { // sub disease is selected
                                        if (selected_disease_category.isEmpty()) {
                                            selected_disease_category = "complex_disease|" + main_disease + "|"
                                                    + temp;
                                        } else {
                                            selected_disease_category = selected_disease_category + ";"
                                                    + "complex_disease|" + main_disease + "|" + temp;
                                        }

                                    } else { //main disease is selected
                                        //     selected_disease_main = main_disease;
                                        if (selected_disease_category.isEmpty()) {
                                            selected_disease_category = "complex_disease|" + main_disease + "|"
                                                    + "Any";
                                        } else {
                                            selected_disease_category = selected_disease_category + ";"
                                                    + "complex_disease|" + main_disease + "|" + "Any";
                                        }

                                    }
                                }
                            }
                            main_disease = "";
                            for (Iterator i = rareDisease.getItemIds().iterator(); i.hasNext();) {
                                Object iid = (Object) i.next();
                                String temp = iid.toString();
                                if (!temp.startsWith("--")) {
                                    main_disease = temp;
                                }
                                if (rareDisease.isSelected(iid)) {
                                    //  System.out.println("Selected" + temp);

                                    if (iid.toString().startsWith("--")) { // sub disease is selected
                                        if (selected_disease_category.isEmpty()) {
                                            selected_disease_category = "rare_disease|" + main_disease + "|"
                                                    + temp;
                                        } else {
                                            selected_disease_category = selected_disease_category + ";"
                                                    + "rare_disease|" + main_disease + "|" + temp;
                                        }

                                    } else {
                                        if (selected_disease_category.isEmpty()) {
                                            selected_disease_category = "rare_disease|" + main_disease + "|"
                                                    + "Any";
                                        } else {
                                            selected_disease_category = selected_disease_category + ";"
                                                    + "rare_disease|" + main_disease + "|" + "Any";
                                        }

                                    }
                                }
                            }
                            main_disease = "";
                            for (Iterator i = otherDisease.getItemIds().iterator(); i.hasNext();) {
                                Object iid = (Object) i.next();
                                String temp = iid.toString();
                                if (!temp.startsWith("--")) {
                                    main_disease = temp;
                                }
                                if (otherDisease.isSelected(iid)) {
                                    //  System.out.println("Selected" + temp);

                                    if (iid.toString().startsWith("--")) { // sub disease is selected
                                        if (selected_disease_category.isEmpty()) {
                                            selected_disease_category = "other_disease|" + main_disease + "|"
                                                    + temp;
                                        } else {
                                            selected_disease_category = selected_disease_category + ";"
                                                    + "other_disease|" + main_disease + "|" + temp;
                                        }

                                    } else {
                                        if (selected_disease_category.isEmpty()) {
                                            selected_disease_category = "other_disease|" + main_disease + "|"
                                                    + "Any";
                                        } else {
                                            selected_disease_category = selected_disease_category + ";"
                                                    + "other_disease|" + main_disease + "|" + "Any";
                                        }

                                    }
                                }
                            }

                            if (checkboxCaseControlYes.getValue() && !checkboxCaseControlNo.getValue()) {
                                query_part3 = query_part3 + " AND ( isCaseControl = 1) ";
                            } else if (!checkboxCaseControlYes.getValue() && checkboxCaseControlNo.getValue()) {
                                query_part3 = query_part3
                                        + " AND (isCaseControl =  null  or isCaseControl = 0 ) ";
                            }

                            if (checkboxTimeSeriesYes.getValue() && !checkboxTimeSeriesNo.getValue()) {
                                query_part3 = query_part3 + " AND ( isTimeSeries = 1) ";
                            } else if (!checkboxTimeSeriesYes.getValue() && checkboxTimeSeriesNo.getValue()) {
                                query_part3 = query_part3
                                        + " AND (isTimeSeries =  null  or isTimeSeries = 0 ) ";
                            }

                            if (checkboxTreatmentYes.getValue() && !checkboxTreatmentNo.getValue()) {
                                query_part3 = query_part3 + " AND ( isTreatment = 1) ";
                            } else if (!checkboxTreatmentYes.getValue() && checkboxTreatmentNo.getValue()) {
                                query_part3 = query_part3 + " AND (isTreatment =  null  or isTreatment = 0 ) ";
                            }

                            if (checkboxSampleTypeTissue.getValue()) {
                                query_part3 = query_part3 + " AND ( isTissue = 1) ";
                            } else {
                                //  query_part3 = query_part3  + " AND (isTissue =  null  or isTissue = 0 ) " ; 
                            }

                            if (checkboxSampleTypeCellLine.getValue()) {
                                query_part3 = query_part3 + " AND ( isCellLine = 1) ";
                            } else {
                                //  query_part3 = query_part3  + " AND (isCellLine =  null  or isCellLine = 0 ) " ; 
                            }

                            if (checkboxSampleTypePrimaryCells.getValue()) {
                                query_part3 = query_part3 + " AND ( isPrimaryCells = 1) ";
                            } else {
                                //   query_part3 = query_part3  + " AND (isPrimaryCells =  null  or isPrimaryCells = 0 ) " ; 
                            }

                            if (checkboxSampleTypeWholeBlood.getValue()) {
                                query_part3 = query_part3 + " AND ( isWholeBlood = 1) ";
                            } else {
                                //     query_part3 = query_part3  + " AND (isWholeBlood =  null  or isWholeBlood = 0 ) " ; 
                            }

                            if (checkboxSampleTypePlasma.getValue()) {
                                query_part3 = query_part3 + " AND ( isPlasma = 1) ";
                            } else {
                                //  query_part3 = query_part3  + " AND (isPlasma =  null  or isPlasma = 0 ) " ; 
                            }

                            String selected_sequencing_platforms = "";
                            for (Iterator i = platformsListSelect.getItemIds().iterator(); i.hasNext();) {
                                Object iid = (Object) i.next();
                                String temp = iid.toString();

                                if (platformsListSelect.isSelected(iid)) {
                                    if (selected_sequencing_platforms.isEmpty()) {
                                        selected_sequencing_platforms = temp;
                                    } else {
                                        selected_sequencing_platforms = selected_sequencing_platforms + ";"
                                                + temp;
                                    }

                                }
                            }

                            String replicate_type = "";
                            if (!(replicatTypesListComboBox.getValue() == null)) {
                                replicate_type = replicatTypesListComboBox.getValue().toString();
                            }
                            String annotation_status = "";
                            if (checkboxAnnotaionCompleted.getValue() && !checkboxAnnotaionOngoing.getValue()) {
                                annotation_status = "completed";
                            } else if (!checkboxAnnotaionCompleted.getValue()
                                    && checkboxAnnotaionOngoing.getValue()) {
                                annotation_status = "completed";
                            }
                            try {
                                String query_part1 = "SELECT * FROM study_summary ";

                                String query_part2 = " SELECT studyid FROM manual_annotation ";

                                if (replicate_type.length() > 1) {
                                    query_part3 = query_part3 + " AND ( replicate_type = '" + replicate_type
                                            + "' ) ";
                                }
                                if (annotation_status.length() > 1) {
                                    query_part3 = query_part3 + " AND ( annotation_status = '"
                                            + annotation_status + "' ) ";
                                }
                                if (selected_disease_category.length() > 1) {
                                    query_part3 = query_part3 + " AND disease_category like  " + "'%"
                                            + selected_disease_category + "%'";
                                }

                                if (selected_sequencing_platforms.length() > 1) {
                                    query_part3 = query_part3 + " AND sequencing_platform like  " + "'%"
                                            + selected_sequencing_platforms + "%'";
                                }

                                query_part3 = query_part3.trim();
                                if (query_part3.startsWith("AND")) {
                                    query_part3 = query_part3.substring(3);
                                }

                                String search_query = query_part1 + " where Study in (" + query_part2
                                        + " WHERE " + query_part3 + ")";

                                rnaseqContainer = createMySQLContainer("search_manual_annotation",
                                        search_query);
                                rnaseqContainer.removeAllContainerFilters();

                                bioprojectSummaryTable.setContainerDataSource(rnaseqContainer);
                                //   bioprojectSummaryTable.setVisibleColumns(new String[] { studyName });
                                bioprojectSummaryTable.setSelectable(true);
                                bioprojectSummaryTable.setImmediate(true);
                                bioprojectSummaryTable.setColumnReorderingAllowed(true);
                                bioprojectSummaryTable.setSortEnabled(true);
                                bioprojectSummaryTable.setVisibleColumns(new Object[] { "Study", "title",
                                        "Numsample", "Numexp", "Numrun", "Avgspots", "avgbases", "name" });

                            } catch (Exception e) {
                            }

                        }
                    }
                });

                Button guidedSearchANYSubmitButton = new Button("Search Meeting ANY Criteria");
                guidedSearchANYSubmitButton.addClickListener(new Button.ClickListener() {
                    public void buttonClick(Button.ClickEvent event) {
                        if (event.getButton() == guidedSearchANYSubmitButton) {
                            String query_part3 = "";
                            if (checkboxDiseaseYes.getValue() && !checkboxDiseaseNo.getValue()) {
                                query_part3 = query_part3 + " OR ( isDisease = 1) ";
                            } else if (!checkboxDiseaseYes.getValue() && checkboxDiseaseNo.getValue()) {
                                query_part3 = query_part3 + " OR (isDisease =  null  or isDisease = 0 ) ";
                            }
                            String selected_disease_category = "";
                            String main_disease = "";
                            for (Iterator i = complexDisease.getItemIds().iterator(); i.hasNext();) {
                                Object iid = (Object) i.next();
                                String temp = iid.toString();
                                if (!temp.startsWith("--")) {
                                    main_disease = temp;
                                }
                                if (complexDisease.isSelected(iid)) {
                                    //System.out.println("Selected" + temp);

                                    if (iid.toString().startsWith("--")) { // sub disease is selected
                                        if (selected_disease_category.isEmpty()) {
                                            selected_disease_category = "complex_disease|" + main_disease + "|"
                                                    + temp;
                                        } else {
                                            selected_disease_category = selected_disease_category + ";"
                                                    + "complex_disease|" + main_disease + "|" + temp;
                                        }

                                    } else { //main disease is selected
                                        //     selected_disease_main = main_disease;
                                        if (selected_disease_category.isEmpty()) {
                                            selected_disease_category = "complex_disease|" + main_disease + "|"
                                                    + "Any";
                                        } else {
                                            selected_disease_category = selected_disease_category + ";"
                                                    + "complex_disease|" + main_disease + "|" + "Any";
                                        }

                                    }
                                }
                            }
                            main_disease = "";
                            for (Iterator i = rareDisease.getItemIds().iterator(); i.hasNext();) {
                                Object iid = (Object) i.next();
                                String temp = iid.toString();
                                if (!temp.startsWith("--")) {
                                    main_disease = temp;
                                }
                                if (rareDisease.isSelected(iid)) {
                                    //  System.out.println("Selected" + temp);

                                    if (iid.toString().startsWith("--")) { // sub disease is selected
                                        if (selected_disease_category.isEmpty()) {
                                            selected_disease_category = "rare_disease|" + main_disease + "|"
                                                    + temp;
                                        } else {
                                            selected_disease_category = selected_disease_category + ";"
                                                    + "rare_disease|" + main_disease + "|" + temp;
                                        }

                                    } else {
                                        if (selected_disease_category.isEmpty()) {
                                            selected_disease_category = "rare_disease|" + main_disease + "|"
                                                    + "Any";
                                        } else {
                                            selected_disease_category = selected_disease_category + ";"
                                                    + "rare_disease|" + main_disease + "|" + "Any";
                                        }

                                    }
                                }
                            }
                            main_disease = "";
                            for (Iterator i = otherDisease.getItemIds().iterator(); i.hasNext();) {
                                Object iid = (Object) i.next();
                                String temp = iid.toString();
                                if (!temp.startsWith("--")) {
                                    main_disease = temp;
                                }
                                if (otherDisease.isSelected(iid)) {
                                    // System.out.println("Selected" + temp);

                                    if (iid.toString().startsWith("--")) { // sub disease is selected
                                        if (selected_disease_category.isEmpty()) {
                                            selected_disease_category = "other_disease|" + main_disease + "|"
                                                    + temp;
                                        } else {
                                            selected_disease_category = selected_disease_category + ";"
                                                    + "other_disease|" + main_disease + "|" + temp;
                                        }

                                    } else {
                                        if (selected_disease_category.isEmpty()) {
                                            selected_disease_category = "other_disease|" + main_disease + "|"
                                                    + "Any";
                                        } else {
                                            selected_disease_category = selected_disease_category + ";"
                                                    + "other_disease|" + main_disease + "|" + "Any";
                                        }

                                    }
                                }
                            }

                            if (checkboxCaseControlYes.getValue() && !checkboxCaseControlNo.getValue()) {
                                query_part3 = query_part3 + " OR ( isCaseControl = 1) ";
                            } else if (!checkboxCaseControlYes.getValue() && checkboxCaseControlNo.getValue()) {
                                query_part3 = query_part3
                                        + " OR (isCaseControl =  null  or isCaseControl = 0 ) ";
                            }

                            if (checkboxTimeSeriesYes.getValue() && !checkboxTimeSeriesNo.getValue()) {
                                query_part3 = query_part3 + " OR ( isTimeSeries = 1) ";
                            } else if (!checkboxTimeSeriesYes.getValue() && checkboxTimeSeriesNo.getValue()) {
                                query_part3 = query_part3 + " OR (isTimeSeries =  null  or isTimeSeries = 0 ) ";
                            }

                            if (checkboxTreatmentYes.getValue() && !checkboxTreatmentNo.getValue()) {
                                query_part3 = query_part3 + " OR ( isTreatment = 1) ";
                            } else if (!checkboxTreatmentYes.getValue() && checkboxTreatmentNo.getValue()) {
                                query_part3 = query_part3 + " OR (isTreatment =  null  or isTreatment = 0 ) ";
                            }

                            if (checkboxSampleTypeTissue.getValue()) {
                                query_part3 = query_part3 + " OR ( isTissue = 1) ";
                            } else {
                                //  query_part3 = query_part3  + " AND (isTissue =  null  or isTissue = 0 ) " ; 
                            }

                            if (checkboxSampleTypeCellLine.getValue()) {
                                query_part3 = query_part3 + " OR ( isCellLine = 1) ";
                            } else {
                                //  query_part3 = query_part3  + " AND (isCellLine =  null  or isCellLine = 0 ) " ; 
                            }

                            if (checkboxSampleTypePrimaryCells.getValue()) {
                                query_part3 = query_part3 + " OR ( isPrimaryCells = 1) ";
                            } else {
                                //   query_part3 = query_part3  + " AND (isPrimaryCells =  null  or isPrimaryCells = 0 ) " ; 
                            }

                            if (checkboxSampleTypeWholeBlood.getValue()) {
                                query_part3 = query_part3 + " OR ( isWholeBlood = 1) ";
                            } else {
                                //     query_part3 = query_part3  + " AND (isWholeBlood =  null  or isWholeBlood = 0 ) " ; 
                            }

                            if (checkboxSampleTypePlasma.getValue()) {
                                query_part3 = query_part3 + " OR ( isPlasma = 1) ";
                            } else {
                                //  query_part3 = query_part3  + " AND (isPlasma =  null  or isPlasma = 0 ) " ; 
                            }

                            String selected_sequencing_platforms = "";
                            for (Iterator i = platformsListSelect.getItemIds().iterator(); i.hasNext();) {
                                Object iid = (Object) i.next();
                                String temp = iid.toString();

                                if (platformsListSelect.isSelected(iid)) {
                                    if (selected_sequencing_platforms.isEmpty()) {
                                        selected_sequencing_platforms = temp;
                                    } else {
                                        selected_sequencing_platforms = selected_sequencing_platforms + ";"
                                                + temp;
                                    }

                                }
                            }

                            String replicate_type = "";
                            if (!(replicatTypesListComboBox.getValue() == null)) {
                                replicate_type = replicatTypesListComboBox.getValue().toString();
                            }
                            String annotation_status = "";
                            if (checkboxAnnotaionCompleted.getValue() && !checkboxAnnotaionOngoing.getValue()) {
                                annotation_status = "completed";
                            } else if (!checkboxAnnotaionCompleted.getValue()
                                    && checkboxAnnotaionOngoing.getValue()) {
                                annotation_status = "completed";
                            }
                            try {
                                String query_part1 = "SELECT * FROM study_summary ";

                                String query_part2 = " SELECT studyid FROM manual_annotation ";

                                if (replicate_type.length() > 1) {
                                    query_part3 = query_part3 + " OR ( replicate_type = '" + replicate_type
                                            + "' ) ";
                                }
                                if (annotation_status.length() > 1) {
                                    query_part3 = query_part3 + " OR ( annotation_status = '"
                                            + annotation_status + "' ) ";
                                }
                                if (selected_disease_category.length() > 1) {
                                    query_part3 = query_part3 + " OR disease_category like  " + "'%"
                                            + selected_disease_category + "%'";
                                }

                                if (selected_sequencing_platforms.length() > 1) {
                                    query_part3 = query_part3 + " AND sequencing_platform like  " + "'%"
                                            + selected_sequencing_platforms + "%'";
                                }

                                query_part3 = query_part3.trim();
                                if (query_part3.startsWith("OR")) {
                                    query_part3 = query_part3.substring(2);
                                }

                                String search_query = query_part1 + " where Study in (" + query_part2
                                        + " WHERE " + query_part3 + ")";

                                rnaseqContainer = createMySQLContainer("search_manual_annotation",
                                        search_query);
                                rnaseqContainer.removeAllContainerFilters();

                                bioprojectSummaryTable.setContainerDataSource(rnaseqContainer);
                                //   bioprojectSummaryTable.setVisibleColumns(new String[] { studyName });
                                bioprojectSummaryTable.setSelectable(true);
                                bioprojectSummaryTable.setImmediate(true);
                                bioprojectSummaryTable.setColumnReorderingAllowed(true);
                                bioprojectSummaryTable.setSortEnabled(true);
                                bioprojectSummaryTable.setVisibleColumns(new Object[] { "Study", "title",
                                        "Numsample", "Numexp", "Numrun", "Avgspots", "avgbases", "name" });

                            } catch (Exception e) {
                            }

                        }
                    }
                });

                HorizontalLayout guidedSearchButtonLayout = new HorizontalLayout();
                guidedSearchButtonLayout.addComponent(guidedSearchSubmitButton);
                guidedSearchButtonLayout.addComponent(guidedSearchANYSubmitButton);

                guidedSearchLayout.addComponent(diseaseLayout);
                //  guidedSearchLayout.addComponent(caseControlLayout);
                //  guidedSearchLayout.addComponent(timeSeriesLayout);
                guidedSearchLayout.addComponent(studyTypesPanel);
                guidedSearchLayout.addComponent(diseaseCategoryPanel);
                guidedSearchLayout.addComponent(platformLayout);
                guidedSearchLayout.addComponent(sampleTypesPanel);
                guidedSearchLayout.addComponent(replicatTypesLayout);
                guidedSearchLayout.addComponent(annotationStatusLayout);
                guidedSearchLayout.addComponent(guidedSearchButtonLayout);
                guidedSearchLayout.setComponentAlignment(guidedSearchButtonLayout, Alignment.MIDDLE_CENTER);
                int leftTopLayoutIndex = leftLayout.getComponentIndex(leftTopLayout);
                leftLayout.addComponent(guidedSearchLayout, leftTopLayoutIndex + 1);

                //</editor-fold>
            }
        }
    });

}

From source file:edu.cornell.qatarmed.planrnaseq.SimpleLoginView.java

public SimpleLoginView() {
    setSizeFull();/*from w ww.  ja  v a2 s .c o m*/

    // Create the user input field
    user = new TextField("User:");
    user.setWidth("300px");
    user.setRequired(true);
    user.setInputPrompt("Your username (eg. joe@email.com)");
    user.addValidator(new EmailValidator("Username must be an email address"));
    user.setInvalidAllowed(false);

    // Create the password input field
    password = new PasswordField("Password:");
    password.setWidth("300px");
    password.addValidator(new PasswordValidator());
    password.setRequired(true);
    password.setValue("");
    password.setNullRepresentation("");

    // Create login button
    loginButton = new Button("Login", this);

    // Add both to a panel
    VerticalLayout fields = new VerticalLayout(user, password, loginButton);
    fields.setCaption("Please login to access the application. (test@test.com/passw0rd)");
    fields.setSpacing(true);
    fields.setMargin(new MarginInfo(true, true, true, false));
    fields.setSizeUndefined();

    // The view root layout
    VerticalLayout viewLayout = new VerticalLayout(fields);
    viewLayout.setSizeFull();
    viewLayout.setComponentAlignment(fields, Alignment.MIDDLE_CENTER);
    viewLayout.setStyleName(Reindeer.LAYOUT_BLUE);
    setCompositionRoot(viewLayout);
}

From source file:edu.kit.dama.ui.admin.administration.user.UserDataForm.java

License:Apache License

public UserDataForm(UserDataAdministrationTab userDataAdministrationTab) {
    this.userDataAdministrationTab = userDataAdministrationTab;

    LOGGER.debug("Building " + DEBUG_ID_PREFIX + " ...");

    setId(DEBUG_ID_PREFIX.substring(0, DEBUG_ID_PREFIX.length() - 1));
    setColumns(5);/*from  w w w .ja v  a2  s.  c om*/
    setRows(4);
    setSizeFull();
    setSpacing(true);
    // Add components to
    addComponent(getUserIdField(), 0, 0);
    addComponent(getFirstNameField(), 0, 1);
    addComponent(getValidFromField(), 0, 2);
    addComponent(getEmailField(), 0, 3);
    addComponent(getDistinguishedNameField(), 2, 0);
    addComponent(getLastNameField(), 2, 1);
    addComponent(getValidUntilField(), 2, 2);
    addComponent(getMaximumRoleBox(), 2, 3);
    addComponent(getCommitChangesButton(), 4, 0);
    addComponent(getShowMembershipsButton(), 4, 1);
    addComponent(getRegisterUserButton(), 4, 2, 4, 3);
    setColumnExpandRatio(0, 0.39f);
    setColumnExpandRatio(1, 0.01f);
    setColumnExpandRatio(2, 0.39f);
    setColumnExpandRatio(3, 0.01f);
    setColumnExpandRatio(4, 0.2f);
    setComponentAlignment(getCommitChangesButton(), Alignment.MIDDLE_RIGHT);
    setComponentAlignment(getShowMembershipsButton(), Alignment.MIDDLE_RIGHT);
    setComponentAlignment(getRegisterUserButton(), Alignment.MIDDLE_CENTER);
}