示例#1
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;
         }
       }
   }
 }
示例#2
0
 /**
  * Return the log shown in the passed row.
  *
  * <p>This must be called inside the EDT.
  *
  * @param row The row of the table containing the log
  * @return The log in the passed row
  */
 public ILogEntry getVisibleLogEntry(int row) {
   if (closed) {
     return null;
   }
   try {
     ILogEntry ret;
     ret = allLogs.getLog(rows.get(row));
     return ret;
   } catch (LogCacheException e) {
     e.printStackTrace();
     return null;
   }
 }
示例#3
0
 /**
  * @return The time frame of the log in cache
  * @see com.cosylab.logging.client.cache.LogCache
  */
 public Calendar getTimeFrame() {
   return allLogs.getTimeFrame();
 }
示例#4
0
 /**
  * @return The amount of disk space used by the files of the cache
  * @throws IOException In case of error getting the size of at least one of the used cache files
  */
 public long usedDiskSpace() throws IOException {
   return allLogs.getFilesSize();
 }
示例#5
0
 /** @return The number of files used by the cache */
 public int numberOfUsedFiles() {
   return allLogs.getNumberOfCacheFiles();
 }