summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/client/Utils.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2011-11-01 17:21:09 -0400
committerJames Moger <james.moger@gitblit.com>2011-11-01 17:21:09 -0400
commit38688b1f17bb2d43a144e92b086768e3e2523d2a (patch)
tree24d25d9f613c61ba2f5b9fe80d7d25fc8d4787ba /src/com/gitblit/client/Utils.java
parent17820f3a1153250a325fed23dfc2da59ce6ba777 (diff)
downloadgitblit-38688b1f17bb2d43a144e92b086768e3e2523d2a.tar.gz
gitblit-38688b1f17bb2d43a144e92b086768e3e2523d2a.zip
Refactored monolithic GitblitPanel into pieces. Revised feed generation.
Diffstat (limited to 'src/com/gitblit/client/Utils.java')
-rw-r--r--src/com/gitblit/client/Utils.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/com/gitblit/client/Utils.java b/src/com/gitblit/client/Utils.java
index 1f44c32d..538e6be7 100644
--- a/src/com/gitblit/client/Utils.java
+++ b/src/com/gitblit/client/Utils.java
@@ -17,10 +17,13 @@ package com.gitblit.client;
import java.awt.Color;
import java.awt.Component;
+import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.Font;
+import java.awt.Insets;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.net.URI;
import java.text.MessageFormat;
import java.util.Date;
@@ -36,9 +39,13 @@ import javax.swing.table.TableModel;
import com.gitblit.Constants.RpcRequest;
public class Utils {
-
+
+ public final static int MARGIN = 5;
+
+ public final static Insets INSETS = new Insets(MARGIN, MARGIN, MARGIN, MARGIN);
+
public final static String TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm";
-
+
public final static String DATE_FORMAT = "yyyy-MM-dd";
public static JTable newTable(TableModel model, String datePattern) {
@@ -48,7 +55,8 @@ public class Utils {
table.getTableHeader().setReorderingAllowed(false);
table.setGridColor(new Color(0xd9d9d9));
table.setBackground(Color.white);
- table.setDefaultRenderer(Date.class, new DateCellRenderer(datePattern, Color.orange.darker()));
+ table.setDefaultRenderer(Date.class,
+ new DateCellRenderer(datePattern, Color.orange.darker()));
return table;
}
@@ -131,4 +139,13 @@ public class Utils {
// Set the width
col.setPreferredWidth(width);
}
+
+ public static void browse(String url) {
+ try {
+ Desktop.getDesktop().browse(new URI(url));
+ } catch (Exception x) {
+ showException(null, x);
+ }
+ }
+
}