public PeptidesTableLayout(
      final int validPep,
      final int totalPep,
      final String desc,
      final Map<Integer, PeptideBean> pepProtList,
      final String accession,
      final String expName) {
    // for  peptides information (table) view
    MarginInfo m = new MarginInfo(false, false, true, false);
    this.setMargin(m);
    this.setSpacing(false);
    this.setWidth("100%");

    final HorizontalLayout headerLayout = new HorizontalLayout();
    headerLayout.setHeight("45px");
    headerLayout.setSpacing(true);
    show = new ShowLabel(true);
    headerLayout.addComponent(show);
    headerLayout.setComponentAlignment(show, Alignment.BOTTOM_LEFT);
    stat = true;

    final Label pepLabel =
        new Label(
            "<h4 style='font-family:verdana;color:black;'>Peptides ("
                + validPep
                + ") "
                + desc
                + "</h4>");
    // new Label("<h4 style='font-family:verdana;color:black;'>Peptides (" + validPep + "/" +
    // totalPep + ") " + desc + "</h4>");
    pepLabel.setContentMode(Label.CONTENT_XHTML);
    pepLabel.setHeight("45px");
    headerLayout.addComponent(pepLabel);
    headerLayout.setComponentAlignment(pepLabel, Alignment.TOP_RIGHT);

    this.addComponent(headerLayout);
    mainLayout = new VerticalLayout();
    mainLayout.setWidth("100%");
    this.addComponent(mainLayout);
    mainLayout.addComponent(pepTableLayout);
    mainLayout.setComponentAlignment(pepTableLayout, Alignment.MIDDLE_CENTER);

    Map<Integer, PeptideBean> vPepProtList = getValidatedList(pepProtList);

    vt = new PeptideTable(vPepProtList, null, false);
    pepTableLayout.addComponent(vt);
    if (trs != null) {
      PepSize = trs.getCurrentSize();
    }
    vt.setHeight(PepSize);

    HorizontalLayout lowerLayout = new HorizontalLayout();
    lowerLayout.setWidth("100%");
    lowerLayout.setHeight("25px");
    lowerLayout.setSpacing(false);
    //  Panel toolbar = new Panel(lowerLayout);
    // toolbar.setStyleName(Reindeer.PANEL_LIGHT);
    // toolbar.setHeight("35px");
    mainLayout.addComponent(lowerLayout);
    mainLayout.setComponentAlignment(lowerLayout, Alignment.TOP_CENTER);

    HorizontalLayout lowerLeftLayout = new HorizontalLayout();
    lowerLayout.addComponent(lowerLeftLayout);
    lowerLeftLayout.setSpacing(true);
    lowerLeftLayout.setMargin(new MarginInfo(false, false, false, false));
    lowerLayout.setComponentAlignment(lowerLeftLayout, Alignment.MIDDLE_LEFT);
    // lowerLayout.setExpandRatio(lowerLeftLayout, 0.4f);

    HorizontalLayout lowerRightLayout = new HorizontalLayout();
    // lowerRightLayout.setSpacing(true);
    lowerRightLayout.setWidth("450px");
    lowerLayout.addComponent(lowerRightLayout);
    lowerLayout.setComponentAlignment(lowerRightLayout, Alignment.BOTTOM_RIGHT);
    // lowerLayout.setExpandRatio(lowerRightLayout, 0.5f);

    final OptionGroup selectionType = new OptionGroup();
    selectionType.setMultiSelect(true);
    selectionType.addItem("\t\tShow Validated Peptides Only");
    selectionType.select("\t\tShow Validated Peptides Only");
    selectionType.setHeight("15px");
    lowerLeftLayout.addComponent(selectionType);
    lowerLeftLayout.setComponentAlignment(selectionType, Alignment.BOTTOM_LEFT);

    final TableResizeSet trs1 = new TableResizeSet(vt, PepSize); // resize tables
    lowerLeftLayout.addComponent(trs1);
    lowerLeftLayout.setComponentAlignment(trs1, Alignment.BOTTOM_LEFT);

    exportPepLayout.setWidth("300px");
    lowerRightLayout.addComponent(exportPepLayout);
    lowerRightLayout.setComponentAlignment(exportPepLayout, Alignment.BOTTOM_RIGHT);

    mainLayout.setSpacing(true);

    headerLayout.addListener(
        new com.vaadin.event.LayoutEvents.LayoutClickListener() {
          @Override
          public void layoutClick(LayoutEvents.LayoutClickEvent event) {

            if (stat) {
              stat = false;
              show.updateIcon(false);
              mainLayout.setVisible(false);
            } else {
              stat = true;
              show.updateIcon(true);
              mainLayout.setVisible(true);
            }
          }
        });
    selectionType.setImmediate(true);
    selectionType.addListener(
        new Property.ValueChangeListener() {
          @Override
          public void valueChange(Property.ValueChangeEvent event) {
            if (selectionType.isSelected("\t\tShow Validated Peptides Only")) {

              headerLayout.removeAllComponents();
              headerLayout.addComponent(show);
              headerLayout.setComponentAlignment(show, Alignment.BOTTOM_LEFT);

              // Label pepLabel = new Label("<h4 style='font-family:verdana;color:black;'>Peptides
              // (" + validPep + ") " + desc + "</h4>");
              pepLabel.setContentMode(Label.CONTENT_XHTML);
              pepLabel.setHeight("45px");
              headerLayout.addComponent(pepLabel);
              headerLayout.setComponentAlignment(pepLabel, Alignment.TOP_RIGHT);

              // Map<Integer, PeptideBean> vPepProtList = getValidatedList(pepProtList);

              pepTableLayout.removeAllComponents();
              // vt = new PeptideTable(vPepProtList, null);
              pepTableLayout.addComponent(vt);
              trs1.setTable(vt);
              vt.setHeight(pepTable.getHeight() + "");

            } else {
              headerLayout.removeAllComponents();
              headerLayout.addComponent(show);
              headerLayout.setComponentAlignment(show, Alignment.BOTTOM_LEFT);
              Label pepLabel =
                  new Label(
                      "<h4 style='font-family:verdana;color:black;'>Peptides ("
                          + validPep
                          + "/"
                          + totalPep
                          + ") "
                          + desc
                          + "</h4>");
              pepLabel.setContentMode(Label.CONTENT_XHTML);
              headerLayout.addComponent(pepLabel);
              headerLayout.setComponentAlignment(pepLabel, Alignment.TOP_RIGHT);

              pepTableLayout.removeAllComponents();
              pepTable = new PeptideTable(pepProtList, null, false);
              pepTableLayout.addComponent(pepTable);
              trs1.setTable(pepTable);
              pepTable.setHeight(vt.getHeight() + "");
            }
          }
        });
  }
Beispiel #2
0
  public FractionsLayout(
      final String accession,
      final double mw,
      Map<Integer, ProteinBean> proteinFractionAvgList,
      List<StandardProteinBean> standardProtPlotList,
      final String expName) {
    this.setSpacing(false);
    this.setWidth("100%");
    this.setMargin(new MarginInfo(false, false, false, true));

    final HorizontalLayout headerLayout = new HorizontalLayout();
    headerLayout.setHeight("45px");
    headerLayout.setSpacing(true);

    final HorizontalLayout clickableheaderLayout = new HorizontalLayout();
    clickableheaderLayout.setHeight("45px");
    clickableheaderLayout.setSpacing(true);
    headerLayout.addComponent(clickableheaderLayout);
    headerLayout.setComponentAlignment(clickableheaderLayout, Alignment.BOTTOM_LEFT);

    show = new ShowLabel(true);
    clickableheaderLayout.addComponent(show);
    clickableheaderLayout.setComponentAlignment(show, Alignment.BOTTOM_LEFT);

    stat = true;

    Label fractionLabel =
        new Label(
            "<h4 style='font-family:verdana;color:black;'>Fractions (Protein: "
                + accession
                + "  MW: "
                + mw
                + " kDa)</h4>");
    fractionLabel.setContentMode(Label.CONTENT_XHTML);
    fractionLabel.setHeight("45px");
    clickableheaderLayout.addComponent(fractionLabel);
    clickableheaderLayout.setComponentAlignment(fractionLabel, Alignment.TOP_RIGHT);

    //        Label infoLable = new Label("<center style='background-color:#E6E6FA;'><p
    // style='background-color:#E6E6FA;font-family:verdana;color:black;font-weight:bold;'>Bar charts
    // showing the distribution of the protein in the fractions cut from the gel.<br/>Three charts
    // show number of peptides, number of spectra and average precursor intensity.<br/>The fraction
    // number represents the gel pieces cut from top to bottom.<br/>Protein standards (dark blue
    // bars) indicate the molecular weight range of each fraction. Darker blue bars mark the area
    // where the protein's theoretical mass suggests the protein should occur. </p></center>");
    //        infoLable.setContentMode(Label.CONTENT_XHTML);
    //        infoLable.setWidth("300px");
    //        infoLable.setStyleName(Reindeer.LAYOUT_BLUE);
    //
    //        Help help = new Help();
    //        HorizontalLayout infoIco = help.getInfoNote(infoLable);
    //        infoIco.setMargin(new MarginInfo(false, false, false, true));
    //        headerLayout.addComponent(infoIco);
    //        headerLayout.setComponentAlignment(infoIco, Alignment.MIDDLE_LEFT);

    this.addComponent(headerLayout);

    mainLayout = new VerticalLayout();
    this.addComponent(mainLayout);

    FractionPlotLayout plotsLayout =
        new FractionPlotLayout(proteinFractionAvgList, mw, standardProtPlotList);
    mainLayout.addComponent(plotsLayout);
    mainLayout.setComponentAlignment(plotsLayout, Alignment.MIDDLE_CENTER);

    HorizontalLayout lowerLayout = new HorizontalLayout();
    lowerLayout.setWidth("100%");
    lowerLayout.setHeight("25px");
    lowerLayout.setMargin((new MarginInfo(false, true, false, true)));
    lowerLayout.setSpacing(false);

    //        Panel toolbar = new Panel(lowerLayout);
    //        toolbar.setStyleName(Reindeer.PANEL_LIGHT);
    ////       toolbar.setHeight("35px");
    //        toolbar.setWidth("100%");
    mainLayout.addComponent(lowerLayout);
    mainLayout.setComponentAlignment(lowerLayout, Alignment.TOP_CENTER);

    exportFracLayout.setWidth("300px");
    lowerLayout.addComponent(exportFracLayout);
    lowerLayout.setComponentAlignment(exportFracLayout, Alignment.MIDDLE_RIGHT);
    lowerLayout.setExpandRatio(exportFracLayout, 0.1f);
    final Table fractTable = getFractionTable(proteinFractionAvgList);
    fractTable.setVisible(false);
    this.addComponent(fractTable);
    expBtnFracTable =
        new PopupView(
            "Export Fractions from Selected Dataset for ( " + accession + " )",
            new CustomExportBtnLayout(
                null,
                "fractions",
                0,
                expName,
                accession,
                accession,
                null,
                null,
                0,
                null,
                fractTable,
                null));
    expBtnFracTable.setDescription(
        "Export Fractions from ( " + expName + " ) Dataset for ( " + accession + " )");
    // expBtnFracTable = new Help().getExpIcon(new CustomExportBtnLayout(null, "fractions", 0,
    // expName, accession, accession, null, null, 0, null, fractTable, null), "Export CSF-PR /
    // "+expName+" / Fractions", "Export CSF-PR / "+expName+" / Fractions");
    exportFracLayout.addComponent(expBtnFracTable);
    exportFracLayout.setMargin(new MarginInfo(false, true, false, false));
    exportFracLayout.setComponentAlignment(expBtnFracTable, Alignment.BOTTOM_RIGHT);

    clickableheaderLayout.addListener(
        new com.vaadin.event.LayoutEvents.LayoutClickListener() {
          @Override
          public void layoutClick(LayoutEvents.LayoutClickEvent event) {

            if (stat) {
              stat = false;
              show.updateIcon(false);
              mainLayout.setVisible(false);
            } else {
              stat = true;
              show.updateIcon(true);
              mainLayout.setVisible(true);
            }
          }
        });
  }