protected void setTableAttributes(TableHandler tableHandler) {
   Table table = tableHandler.getTable();
   setAttribute("currentpage", table.getCurrentPage());
   setAttribute("rowcount", table.getRowCount());
   setAttribute("maxrowspage", table.getMaxRowsPerPage());
   setAttribute("headerposition", table.getHeaderPosition());
   setAttribute(
       "htmlstyleedit",
       StringUtils.defaultString(StringEscapeUtils.escapeHtml(table.getHtmlStyle())));
   setAttribute(
       "rowevenstyleedit",
       StringUtils.defaultString(StringEscapeUtils.escapeHtml(table.getRowEvenStyle())));
   setAttribute(
       "rowoddstyleedit",
       StringUtils.defaultString(StringEscapeUtils.escapeHtml(table.getRowOddStyle())));
   setAttribute(
       "rowhoverstyleedit",
       StringUtils.defaultString(StringEscapeUtils.escapeHtml(table.getRowHoverStyle())));
   setAttribute(
       "htmlclass", StringUtils.defaultString(StringEscapeUtils.escapeHtml(table.getHtmlClass())));
   setAttribute(
       "rowevenclass",
       StringUtils.defaultString(StringEscapeUtils.escapeHtml(table.getRowEventClass())));
   setAttribute(
       "rowoddclass",
       StringUtils.defaultString(StringEscapeUtils.escapeHtml(table.getRowOddClass())));
   setAttribute(
       "rowhoverclass",
       StringUtils.defaultString(StringEscapeUtils.escapeHtml(table.getRowHoverClass())));
   setAttribute("htmlstyleview", table.getHtmlStyle());
 }
  protected void renderTableHeader(TableHandler tableHandler) {
    // Table header.
    Table table = tableHandler.getTable();
    setTableAttributes(tableHandler);
    renderFragment("headerstart");

    // Header columns.
    for (int j = 0; j < table.getColumnCount(); j++) {
      TableColumn column = table.getColumn(j);
      setTableAttributes(tableHandler);
      setColumnAttributes(column, j);
      Integer selectedIdx = tableHandler.getSelectedColumnIndex();
      if (selectedIdx != null && selectedIdx.intValue() == j) renderFragment("headerselected");
      else renderFragment("headercolumn");
    }

    // Header end.
    setTableAttributes(tableHandler);
    renderFragment("headerend");
  }
Пример #3
0
  /**
   * This function is run when the robot is first started up and should be used for any
   * initialization code.
   */
  public void robotInit() {
    // Make robot objects
    driverstation = Driverstation.getInstance();
    drive = Drive.getInstance();
    shooter = Shooter.getInstance();
    //        lifterobject = LifterObject.getInstance();
    //        compressor = Compressor467.getInstance();
    Calibration.init();
    Autonomous.init();
    TableHandler.init();
    //        AxisCamera.getInstance();

  }
  public void service(
      HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse)
      throws FormatterException {
    tableHandler = (TableHandler) getParameter("tableHandler");
    Table table = tableHandler.getTable();

    if (table == null) {
      renderFragment("notable");
      return;
    }

    // Table start.
    setTableAttributes(tableHandler);
    renderFragment("tablestart");

    setTableAttributes(tableHandler);
    renderFragment("tablestarthead");

    setTableAttributes(tableHandler);
    renderFragment("tablestartcontents");

    setTableAttributes(tableHandler);
    renderFragment("tablestartcompleted");

    renderFragment("outputtableend");

    renderFragment("tableoutput");

    // Table header at top.
    if (table.getHeaderPosition().equals("top")) {
      renderTableHeader(tableHandler);
    }

    // Table empty
    if (table.getRowCount() == 0) {
      renderFragment("tableempty");
    }
    // Body start.
    else {
      setTableAttributes(tableHandler);
      renderFragment("bodystart");

      // Current page rows.
      int currentPage = table.getCurrentPage() - 1;
      int pageSize = table.getMaxRowsPerPage();
      int currentPageBegin = currentPage * pageSize;
      for (int i = currentPageBegin;
          i < currentPageBegin + pageSize && i < table.getRowCount();
          i++) {

        // Row start.
        setTableAttributes(tableHandler);
        setAttribute("rowindex", i);
        renderFragment("rowstart");

        // Row value at column.
        for (int j = 0; j < table.getColumnCount(); j++) {
          TableColumn column = table.getColumn(j);
          setTableAttributes(tableHandler);
          setColumnAttributes(column, j);
          setAttribute("rowindex", i);
          setAttribute("rowvalue", formatCellValue(table, i, j));
          setAttribute("columnhtmlvalue", formatHtmlCellValue(table, column, i, j));
          renderFragment("rowcolumn");
        }

        // Row end.
        setTableAttributes(tableHandler);
        setAttribute("rowindex", i);
        renderFragment("rowend");
      }
      // Body end.
      setTableAttributes(tableHandler);
      renderFragment("bodyend");

      // Table header at bottom.
      if (table.getHeaderPosition().equals("bottom")) {
        renderTableHeader(tableHandler);
      }
    }
    // Table end.
    setTableAttributes(tableHandler);
    renderFragment("tableend");
  }