예제 #1
0
  /**
   * Returns default class for column. Creation date: (12/1/2001 14:18:53)
   *
   * @return java.lang.Class
   * @param column int
   */
  public final Class<?> getColumnClass(int column) {
    if (column == 0) {
      return Boolean.class;
    } else {
      int col = column - 1;

      if (col >= 0 && col < LogField.values().length) {
        return LogField.values()[col].getType();
      }
      return String.class;
    }
  }
예제 #2
0
  /**
   * Returns name of the column based LogEntryXML fields. If the specified index does not return a
   * valid column, blank string is returned. Creation date: (11/11/2001 13:50:16)
   *
   * @return java.lang.String
   * @param columnIndex int
   */
  public final String getColumnName(int columnIndex) {

    if (columnIndex == 0) {
      return "";
    }

    columnIndex = columnIndex - 1;

    return (columnIndex >= 0 && columnIndex < LogField.values().length)
        ? LogField.values()[columnIndex].getName()
        : "";
  }
예제 #3
0
 /**
  * Returns an item according to the row and the column of its position.
  *
  * @return java.lang.Object
  * @param row int
  * @param column int
  */
 @Override
 public Object getValueAt(int row, int column) {
   switch (column) {
     case 1:
       { // TIMESTAMP
         try {
           return new Date(allLogs.getLogTimestamp(rows.get(row)));
         } catch (Exception e) {
           // This can happen because deletion of logs is done asynchronously
           return null;
         }
       }
     case 2:
       { // ENTRYTYPE
         try {
           return allLogs.getLogType(rows.get(row));
         } catch (Exception e) {
           // This can happen because deletion of logs is done asynchronously
           return null;
         }
       }
     default:
       {
         ILogEntry log = getVisibleLogEntry(row);
         if (log == null) {
           return null;
         }
         if (column == 0) {
           return Boolean.valueOf(log.hasDatas());
         } else {
           Object val = log.getField(LogField.values()[column - 1]);
           if (val == null || val.toString() == null || val.toString().isEmpty()) {
             return emptyString;
           }
           // Format the string as HTML
           String ret = val.toString().replaceAll("<", "&lt;");
           ret = ret.replaceAll(">", "&gt;");
           ret = ret.replaceAll("\n", "<BR>");
           return htmlStartTAG + ret + htmlCloseTAG;
         }
       }
   }
 }
예제 #4
0
 /** Return number of columns in table */
 @Override
 public final int getColumnCount() {
   return LogField.values().length + 1;
 }