+ protected StringBuffer prefix(String username, Long timestamp,
+ String level, String category, String thread) {
+ StringBuffer buf = new StringBuffer("");
+ buf.append(dateFormat.format(new Date(timestamp))).append(" ");
+ // buf.append(level).append(" ");
+ return buf;
+ }
+
+ /** Normalize string to the given size */
+ protected String norm(String str, Integer size) {
+ int length = str.length();
+ if (length == size)
+ return str;
+ else if (length > size)
+ return str.substring(0, size);
+ else {
+ char[] arr = new char[size - length];
+ Arrays.fill(arr, ' ');
+ return str + new String(arr);
+ }
+ }
+
+ // protected String suffix(String username, Long timestamp, String level,
+ // String category, String thread) {
+ // return "";
+ // }
+
+ /** Scroll to the last line */
+ protected synchronized void scrollToLastLine() {
+ // we try to show last line with two methods
+ // viewer.reveal(lines.peekLast());
+
+ Table table = viewer.getTable();
+ TableItem ti = table.getItem(table.getItemCount() - 1);
+ table.showItem(ti);
+ }
+