From 841651baee2181c1543555d1eabcd0e4fee48827 Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Wed, 05 Oct 2011 22:22:43 -0400
Subject: [PATCH] New setting to disable RPC administration. Advancing the RPC client.

---
 src/com/gitblit/client/DateCellRenderer.java |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/com/gitblit/client/DateCellRenderer.java b/src/com/gitblit/client/DateCellRenderer.java
index 591926b..053cf52 100644
--- a/src/com/gitblit/client/DateCellRenderer.java
+++ b/src/com/gitblit/client/DateCellRenderer.java
@@ -15,29 +15,44 @@
  */
 package com.gitblit.client;
 
+import java.awt.Color;
 import java.awt.Component;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
 import javax.swing.JTable;
+import javax.swing.SwingConstants;
 import javax.swing.table.DefaultTableCellRenderer;
 
+import com.gitblit.utils.TimeUtils;
+
+/**
+ * Time ago cell renderer with real date tooltip.
+ * 
+ * @author James Moger
+ * 
+ */
 public class DateCellRenderer extends DefaultTableCellRenderer {
 
 	private static final long serialVersionUID = 1L;
 
 	private final String pattern;
 
-	public DateCellRenderer(String pattern) {
+	public DateCellRenderer(String pattern, Color foreground) {
 		this.pattern = (pattern == null ? "yyyy-MM-dd HH:mm" : pattern);
+		setForeground(foreground);
+		setHorizontalAlignment(SwingConstants.CENTER);
 	}
 
 	public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
 			boolean hasFocus, int row, int column) {
 		super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
 		if (value instanceof Date) {
+			Date date = (Date) value;
+			String timeAgo = TimeUtils.timeAgo(date);
 			String strDate = new SimpleDateFormat(pattern).format((Date) value);
-			this.setText(strDate);
+			this.setText(timeAgo);
+			this.setToolTipText(strDate);
 		}
 		return this;
 	}

--
Gitblit v1.9.1