Exemplo n.º 1
0
  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() + "");
            }
          }
        });
  }
Exemplo n.º 2
0
  @Override
  Component getMap() {

    OpenStreetMapLayer osm = new OpenStreetMapLayer();
    osm.setDisplayName("OSM Streets Base");

    GoogleStreetMapLayer gsm = new GoogleStreetMapLayer();
    gsm.setDisplayName("Google Streets Base");

    GoogleHybridMapLayer ghm = new GoogleHybridMapLayer();
    ghm.setDisplayName("Google Hybrid Base");

    map.addLayer(osm);
    map.addLayer(gsm);
    map.addLayer(ghm);

    map.setCenter(-104.9, 38);
    map.setZoom(6);
    map.setSizeFull();

    Label l1 =
        new Label(
            "The map's base layer state should be synchronized between this OptionGroup and the OL LayerSwitcher.");
    l1.setSizeUndefined();

    final Layer[] layers = {osm, gsm, ghm};
    final List<Layer> layerlist = Arrays.asList(layers);
    final OptionGroup baseLayers = new OptionGroup("Base Layers", layerlist);
    baseLayers.select(osm.getDisplayName());
    baseLayers.setNullSelectionAllowed(false);
    baseLayers.setImmediate(true);
    baseLayers.addValueChangeListener(
        new ValueChangeListener() {
          public void valueChange(ValueChangeEvent event) {
            Layer newlayer = (Layer) event.getProperty().getValue();
            if (!newlayer.equals(map.getBaseLayer())) {
              map.setBaseLayer(newlayer);
            }
          }
        });

    map.addBaseLayerChangeListener(
        new BaseLayerChangeListener() {

          public void baseLayerChanged(BaseLayerChangeEvent event) {
            Layer newBaseLayer = map.getBaseLayer();
            if (!newBaseLayer.equals(baseLayers.getValue())) {
              baseLayers.select(newBaseLayer);
            }
          }
        });

    VerticalLayout vl = new VerticalLayout();
    vl.setSizeFull();
    vl.addComponent(l1);
    vl.addComponent(baseLayers);
    vl.addComponent(map);
    vl.setExpandRatio(map, 1f);

    return vl;
  }
  @Override
  public void init() {
    buttonCancel = new Button("Batalkan");
    buttonCancel.addClickListener(this);

    buttonShow = new Button("Tampilkan Laporan");
    buttonShow.addClickListener(this);

    buttonPrint = new Button("Cetak");
    buttonPrint.addClickListener(this);
    buttonPrint.setIcon(new ThemeResource("icons/image/icon-print.png"));

    opener = new BrowserWindowOpener(ReportPrint.class);
    opener.setFeatures("height=200,width=400,resizable");
    // A button to open the printer-friendly page.
    opener.extend(buttonPrint);

    DateTime now = DateTime.now();
    Date beginYear =
        now.withDayOfYear(now.dayOfYear().getMinimumValue())
            .withHourOfDay(now.hourOfDay().getMinimumValue())
            .toDate();
    Date endYear =
        now.withDayOfYear(now.dayOfYear().getMaximumValue())
            .withHourOfDay(now.hourOfDay().getMaximumValue())
            .toDate();

    selectStartDate = new DateField("Dari Tanggal");
    selectStartDate.setImmediate(true);
    selectStartDate.setWidth(function.FORM_WIDTH);
    selectStartDate.setValue(beginYear);

    selectEndDate = new DateField("Hingga Tanggal");
    selectEndDate.setImmediate(true);
    selectEndDate.setWidth(function.FORM_WIDTH);
    selectEndDate.setValue(endYear);
    selectAcceptance = new OptionGroup("Persetujuan");
    Item itemType1 = selectAcceptance.addItem("diterima");
    Item itemType2 = selectAcceptance.addItem("belumditerima");
    selectAcceptance.setImmediate(true);
    selectAcceptance.setValue("diterima");

    selectAcceptance.setItemCaption("diterima", "Barang Kadaluarsa Disetujui");

    selectAcceptance.setItemCaption("belumditerima", "Barang Kadaluarsa Belum Disetujui");
    selectContent = new ComboBox("Pilih Tampilan");
    selectContent.setImmediate(true);
    selectContent.addItem(ReportContent.CHART);
    selectContent.addItem(ReportContent.TABLE);
    selectContent.addItem(ReportContent.TABLE_CHART);
    selectContent.setItemCaption(ReportContent.CHART, "Tampilkan Chart");
    selectContent.setItemCaption(ReportContent.TABLE, "Tampilkan Tabel");
    selectContent.setItemCaption(ReportContent.TABLE_CHART, "Tampilkan Tabel dan Chart");
    selectContent.setItemCaption(4, "Minggu Ke-4");
    selectContent.setValue(ReportContent.TABLE);

    selectAcceptance.addValueChangeListener(this);
    selectStartDate.addValueChangeListener(this);
    selectEndDate.addValueChangeListener(this);
    selectContent.addValueChangeListener(this);
    updateWindowOpener();

    construct();
  }