From 0e44acbb2fec928a1606dc60f427a148fff405c9 Mon Sep 17 00:00:00 2001
From: Mohamed Ragab <moragab@gmail.com>
Date: Wed, 02 May 2012 11:15:01 -0400
Subject: [PATCH] Added a script to facilitate setting the proxy host and port and no proxy hosts, and then it concatenates all the java system properties for setting the java proxy configurations and puts the resulting string in an environment variable JAVA_PROXY_CONFIG, modified the scirpts gitblit,  gitblit-ubuntu, and gitblit-centos to source the java-proxy-config.sh script and then include the resulting java proxy configuration in the java command

---
 src/com/gitblit/client/Utils.java |   40 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/src/com/gitblit/client/Utils.java b/src/com/gitblit/client/Utils.java
index ae81e7f..538e6be 100644
--- a/src/com/gitblit/client/Utils.java
+++ b/src/com/gitblit/client/Utils.java
@@ -17,10 +17,13 @@
 
 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;
 
@@ -37,20 +40,36 @@
 
 public class Utils {
 
-	public static JTable newTable(TableModel model) {
+	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) {
 		JTable table = new JTable(model);
 		table.setCellSelectionEnabled(false);
 		table.setRowSelectionAllowed(true);
 		table.getTableHeader().setReorderingAllowed(false);
 		table.setGridColor(new Color(0xd9d9d9));
 		table.setBackground(Color.white);
-		table.setDefaultRenderer(Date.class, new DateCellRenderer(null, Color.orange.darker()));
+		table.setDefaultRenderer(Date.class,
+				new DateCellRenderer(datePattern, Color.orange.darker()));
 		return table;
+	}
+
+	public static void explainNotAllowed(Component c, RpcRequest request) {
+		String msg = MessageFormat.format("The Gitblit server does not allow the request \"{0}\".",
+				request.name());
+		JOptionPane.showMessageDialog(c, msg, "Not Allowed", JOptionPane.ERROR_MESSAGE);
 	}
 
 	public static void explainForbidden(Component c, RpcRequest request) {
 		String msg = MessageFormat.format(
-				"The request \"{0}\" has been forbidden by the Gitblit server.", request.name());
+				"The request \"{0}\" has been forbidden for the account by the Gitblit server.",
+				request.name());
 		JOptionPane.showMessageDialog(c, msg, "Forbidden", JOptionPane.ERROR_MESSAGE);
 	}
 
@@ -58,6 +77,12 @@
 		String msg = MessageFormat.format(
 				"This account is not authorized to execute the request \"{0}\".", request.name());
 		JOptionPane.showMessageDialog(c, msg, "Unauthorized", JOptionPane.ERROR_MESSAGE);
+	}
+
+	public static void explainUnknown(Component c, RpcRequest request) {
+		String msg = MessageFormat.format(
+				"The request \"{0}\" is not recognized by the Gitblit server.", request.name());
+		JOptionPane.showMessageDialog(c, msg, "Unknown Request", JOptionPane.ERROR_MESSAGE);
 	}
 
 	public static void showException(Component c, Throwable t) {
@@ -114,4 +139,13 @@
 		// 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);
+		}
+	}
+
 }

--
Gitblit v1.9.1