Beispiel #1
0
  public Object build(TableModel model, Collection studies, String title, String action)
      throws Exception {

    Table table = model.getTableInstance();
    table.setTitle(title);

    table.setAction(model.getContext().getContextPath() + action);
    table.setTableId("studies");
    table.setItems(studies);
    table.setOnInvokeAction("buildTable('studies')");
    table.setShowPagination(false);
    table.setSortable(true);
    table.setShowExports(false);
    table.setImagePath(model.getContext().getContextPath() + "/images/table/*.gif");
    model.addTable(table);

    Row row = model.getRowInstance();
    row.setInterceptor("edu.duke.cabig.c3pr.web.ajax.StudyRowInterceptor");
    model.addRow(row);

    Column columnTitle = model.getColumnInstance();
    columnTitle.setTitle("Short Title");
    columnTitle.setProperty("shortTitleText");
    model.addColumn(columnTitle);

    Column columnIdentifier = model.getColumnInstance();
    columnIdentifier.setProperty("primaryIdentifier");
    model.addColumn(columnIdentifier);

    Column columnPhase = model.getColumnInstance();
    columnPhase.setTitle("Phase");
    columnPhase.setProperty("phaseCode");
    model.addColumn(columnPhase);

    Column columnStatus = model.getColumnInstance();
    columnStatus.setTitle("Status");
    columnStatus.setProperty("coordinatingCenterStudyStatus.code");
    model.addColumn(columnStatus);

    Column columnCompanion = model.getColumnInstance();
    columnCompanion.setTitle("Companion Indicator");
    columnCompanion.setProperty("companionIndicatorDisplayValue");
    model.addColumn(columnCompanion);

    // Column columnSite = model.getColumnInstance();
    // columnSite.setTitle("Sites");
    // columnSite.setProperty("printStudySites");
    // model.addColumn(columnSite);

    return model.assemble();
  }
 public ModelLimitFactory(TableModel model) {
   this.model = model;
   this.tableId = model.getTableHandler().getTable().getTableId();
   this.prefixWithTableId = model.getTableHandler().prefixWithTableId();
   this.context = model.getContext();
   this.registry = model.getRegistry();
   this.isExported = getExported();
 }
  /** {@inheritDoc} */
  public String getHtmlDisplay(TableModel model, Column column) {
    ColumnBuilder columnBuilder = new ColumnBuilder(column);

    columnBuilder.tdStart();

    try {
      Object bean = model.getCurrentRowBean();
      String outageid = BeanUtils.getProperty(bean, "outageid");

      @SuppressWarnings("unchecked")
      Collection<String> selectedoutagesIds =
          (Collection<String>)
              model
                  .getContext()
                  .getSessionAttribute(SuppressOutageCheckBoxConstants.SELECTED_OUTAGES);
      if (selectedoutagesIds != null && selectedoutagesIds.contains(outageid)) {
        columnBuilder
            .getHtmlBuilder()
            .input("hidden")
            .name("chkbx_" + outageid)
            .value(SuppressOutageCheckBoxConstants.SELECTED)
            .xclose();
        columnBuilder
            .getHtmlBuilder()
            .input("checkbox")
            .name(BeanUtils.getProperty(bean, "outageid"));
        columnBuilder.getHtmlBuilder().onclick("setOutageState(this)");
        columnBuilder.getHtmlBuilder().checked();
        columnBuilder.getHtmlBuilder().xclose();
      } else {
        columnBuilder
            .getHtmlBuilder()
            .input("hidden")
            .name("chkbx_" + outageid)
            .value(SuppressOutageCheckBoxConstants.UNSELECTED)
            .xclose();
        columnBuilder
            .getHtmlBuilder()
            .input("checkbox")
            .name(BeanUtils.getProperty(bean, "outageid"));
        columnBuilder.getHtmlBuilder().onclick("setOutageState(this)");
        columnBuilder.getHtmlBuilder().xclose();
      }
    } catch (Throwable e) {
    }

    columnBuilder.tdEnd();
    return columnBuilder.toString();
  }