]> source.dussan.org Git - gitblit.git/commitdiff
Polish GitblitPanel. Exclude the manager from GO and WAR builds.
authorJames Moger <james.moger@gitblit.com>
Tue, 18 Oct 2011 02:22:40 +0000 (22:22 -0400)
committerJames Moger <james.moger@gitblit.com>
Tue, 18 Oct 2011 02:22:40 +0000 (22:22 -0400)
build.xml
src/com/gitblit/client/GitblitPanel.java
src/com/gitblit/client/HeaderPanel.java [new file with mode: 0644]

index 720bf90faedea8a5ea4e89890871e95b576217f8..5ed87d5a5e68049b6f7a3dc66e3f584ad1249b83 100644 (file)
--- a/build.xml
+++ b/build.xml
                <jar jarfile="${project.deploy.dir}/${project.jar}">\r
                        <fileset dir="${project.build.dir}">\r
                                <include name="**/*" />\r
+                               <exclude name="com/gitblit/client/**" />\r
                        </fileset>\r
                        <fileset dir="${project.resources.dir}">\r
                                <exclude name="thumbs.db" />\r
                                <exclude name="WEB-INF/web.xml" />\r
                                <exclude name="com/gitblit/tests/" />\r
                                <exclude name="com/gitblit/build/**" />\r
+                               <exclude name="com/gitblit/client/**" />\r
                                <exclude name="com/gitblit/GitBlitServer*.class" />\r
                                <exclude name="com/gitblit/Launcher*.class" />\r
                                <exclude name="com/gitblit/MakeCertificate*.class" />                           \r
index 3e2cb7af46de1ae2d8395f34053fdd05003d58da..5525e414b119d6b5c961951ef2a418abaf977317 100644 (file)
@@ -19,6 +19,7 @@ import java.awt.BorderLayout;
 import java.awt.Color;\r
 import java.awt.Component;\r
 import java.awt.Desktop;\r
+import java.awt.FlowLayout;\r
 import java.awt.Insets;\r
 import java.awt.event.ActionEvent;\r
 import java.awt.event.ActionListener;\r
@@ -215,15 +216,22 @@ public class GitblitPanel extends JPanel implements CloseTabListener {
                repositoryTablePanel.add(repositoryFilterPanel, BorderLayout.NORTH);\r
                repositoryTablePanel.add(new JScrollPane(repositoriesTable), BorderLayout.CENTER);\r
 \r
-               JPanel repositoryControls = new JPanel();\r
+               JPanel repositoryControls = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));\r
                repositoryControls.add(refreshRepositories);\r
                repositoryControls.add(browseRepository);\r
                repositoryControls.add(createRepository);\r
                repositoryControls.add(editRepository);\r
                repositoryControls.add(delRepository);\r
 \r
-               JPanel repositoriesPanel = new JPanel(new BorderLayout(margin, margin));\r
-               repositoriesPanel.add(newHeaderLabel(Translation.get("gb.repositories")),\r
+               JPanel repositoriesPanel = new JPanel(new BorderLayout(margin, margin)) {\r
+\r
+                       private static final long serialVersionUID = 1L;\r
+\r
+                       public Insets getInsets() {\r
+                               return insets;\r
+                       }\r
+               };\r
+               repositoriesPanel.add(new HeaderPanel(Translation.get("gb.repositories")),\r
                                BorderLayout.NORTH);\r
                repositoriesPanel.add(repositoryTablePanel, BorderLayout.CENTER);\r
                repositoriesPanel.add(repositoryControls, BorderLayout.SOUTH);\r
@@ -300,14 +308,21 @@ public class GitblitPanel extends JPanel implements CloseTabListener {
                userTablePanel.add(userFilterPanel, BorderLayout.NORTH);\r
                userTablePanel.add(new JScrollPane(usersTable), BorderLayout.CENTER);\r
 \r
-               JPanel userControls = new JPanel();\r
+               JPanel userControls = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));\r
                userControls.add(refreshUsers);\r
                userControls.add(createUser);\r
                userControls.add(editUser);\r
                userControls.add(delUser);\r
 \r
-               JPanel usersPanel = new JPanel(new BorderLayout(margin, margin));\r
-               usersPanel.add(newHeaderLabel(Translation.get("gb.users")), BorderLayout.NORTH);\r
+               JPanel usersPanel = new JPanel(new BorderLayout(margin, margin)) {\r
+\r
+                       private static final long serialVersionUID = 1L;\r
+\r
+                       public Insets getInsets() {\r
+                               return insets;\r
+                       }\r
+               };\r
+               usersPanel.add(new HeaderPanel(Translation.get("gb.users")), BorderLayout.NORTH);\r
                usersPanel.add(userTablePanel, BorderLayout.CENTER);\r
                usersPanel.add(userControls, BorderLayout.SOUTH);\r
 \r
@@ -320,15 +335,6 @@ public class GitblitPanel extends JPanel implements CloseTabListener {
                add(tabs, BorderLayout.CENTER);\r
        }\r
 \r
-       private JLabel newHeaderLabel(String text) {\r
-               JLabel label = new JLabel(text);\r
-               label.setOpaque(true);\r
-               label.setForeground(Color.white);\r
-               label.setBackground(Color.gray);\r
-               label.setFont(label.getFont().deriveFont(14f));\r
-               return label;\r
-       }\r
-\r
        private void setRepositoryRenderer(RepositoriesModel.Columns col, TableCellRenderer renderer) {\r
                String name = repositoriesTable.getColumnName(col.ordinal());\r
                repositoriesTable.getColumn(name).setCellRenderer(renderer);\r
diff --git a/src/com/gitblit/client/HeaderPanel.java b/src/com/gitblit/client/HeaderPanel.java
new file mode 100644 (file)
index 0000000..b3953b3
--- /dev/null
@@ -0,0 +1,57 @@
+/*\r
+ * Copyright 2011 gitblit.com.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *     http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package com.gitblit.client;\r
+\r
+import java.awt.Color;\r
+import java.awt.FlowLayout;\r
+import java.awt.GradientPaint;\r
+import java.awt.Graphics;\r
+import java.awt.Graphics2D;\r
+import java.awt.Paint;\r
+import java.awt.geom.Point2D;\r
+import java.awt.geom.Rectangle2D;\r
+\r
+import javax.swing.JLabel;\r
+import javax.swing.JPanel;\r
+\r
+public class HeaderPanel extends JPanel {\r
+\r
+       private static final long serialVersionUID = 1L;\r
+\r
+       private Color lightColor = new Color(0, 0, 0x60);\r
+\r
+       public HeaderPanel(String text) {\r
+               super(new FlowLayout(FlowLayout.LEFT), true);\r
+               setOpaque(true);\r
+               setBackground(new Color(0, 0, 0x20));\r
+\r
+               JLabel label = new JLabel(text);\r
+               label.setForeground(Color.white);\r
+               label.setFont(label.getFont().deriveFont(14f));\r
+               add(label);\r
+       }\r
+\r
+       @Override\r
+       public void paintComponent(Graphics oldG) {\r
+               Graphics2D g = (Graphics2D) oldG;\r
+               Point2D startPoint = new Point2D.Float(0, 0);\r
+               Point2D endPoint = new Point2D.Float(0, getHeight());\r
+               Paint gradientPaint = new GradientPaint(startPoint, lightColor, endPoint, getBackground(),\r
+                               false);\r
+               g.setPaint(gradientPaint);\r
+               g.fill(new Rectangle2D.Double(0, 0, getWidth(), getHeight()));\r
+       }\r
+}\r