diff options
author | James Moger <james.moger@gitblit.com> | 2011-11-10 17:12:58 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2011-11-10 17:12:58 -0500 |
commit | c7e7e9f6d3cdc358234d1d1bfa5f3d0398226c6c (patch) | |
tree | e8e0459d973efeb8ce98f000531a9eb1c7a2192a | |
parent | 4eb1d83ac51f9b0a8813e7c1ed8e106e37c18562 (diff) | |
download | gitblit-c7e7e9f6d3cdc358234d1d1bfa5f3d0398226c6c.tar.gz gitblit-c7e7e9f6d3cdc358234d1d1bfa5f3d0398226c6c.zip |
Display more refs (still not all) per rss entry. Misc ui tweaks.
-rw-r--r-- | build.xml | 1 | ||||
-rw-r--r-- | docs/05_roadmap.mkd | 1 | ||||
-rw-r--r-- | src/com/gitblit/client/MessageRenderer.java | 142 | ||||
-rw-r--r-- | src/com/gitblit/client/SearchDialog.java | 3 | ||||
-rw-r--r-- | src/com/gitblit/client/SubscriptionsDialog.java | 2 |
5 files changed, 107 insertions, 42 deletions
@@ -456,6 +456,7 @@ <resource file="${basedir}/resources/bullet_feed.png" />
<resource file="${basedir}/resources/search-icon.png" />
<resource file="${basedir}/resources/commit_changes_16x16.png" />
+ <resource file="${basedir}/resources/commit_merge_16x16.png" />
<resource file="${basedir}/resources/blank.png" />
<resource file="${basedir}/src/com/gitblit/wicket/GitBlitWebApp.properties" />
diff --git a/docs/05_roadmap.mkd b/docs/05_roadmap.mkd index da84a6a3..237952b1 100644 --- a/docs/05_roadmap.mkd +++ b/docs/05_roadmap.mkd @@ -7,6 +7,7 @@ This list is volatile. * Eclipse: create plugin to enumerate repositories and delegate cloning to EGit
* Manager: support federation RPCs
+* Manager: redesign ref indicators in log, search, and activity views to support multiple local branches, remote branches, and tags
### TODO (medium priority)
diff --git a/src/com/gitblit/client/MessageRenderer.java b/src/com/gitblit/client/MessageRenderer.java index 9769c196..2fe3415a 100644 --- a/src/com/gitblit/client/MessageRenderer.java +++ b/src/com/gitblit/client/MessageRenderer.java @@ -21,6 +21,7 @@ import java.awt.FlowLayout; import java.awt.Font;
import java.io.Serializable;
+import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTable;
@@ -28,6 +29,8 @@ import javax.swing.border.Border; import javax.swing.border.LineBorder;
import javax.swing.table.TableCellRenderer;
+import org.eclipse.jgit.lib.Constants;
+
import com.gitblit.models.FeedEntryModel;
/**
@@ -41,33 +44,91 @@ public class MessageRenderer extends JPanel implements TableCellRenderer, Serial private static final long serialVersionUID = 1L;
- private static final String R_TAGS = "refs/tags/";
-
- private static final String R_HEADS = "refs/heads/";
-
- private static final String R_REMOTES = "refs/remotes/";
-
private final GitblitClient gitblit;
-
+
+ private final ImageIcon mergeIcon;
+
+ private final ImageIcon blankIcon;
+
private final JLabel messageLabel;
+ private final JLabel headLabel;
+
private final JLabel branchLabel;
+ private final JLabel remoteLabel;
+
+ private final JLabel tagLabel;
+
public MessageRenderer() {
this(null);
}
public MessageRenderer(GitblitClient gitblit) {
- super(new FlowLayout(FlowLayout.LEFT, 10, 1));
+ super(new FlowLayout(FlowLayout.LEFT, Utils.MARGIN, 1));
this.gitblit = gitblit;
+
+ mergeIcon = new ImageIcon(getClass().getResource("/commit_merge_16x16.png"));
+ blankIcon = new ImageIcon(getClass().getResource("/blank.png"));
messageLabel = new JLabel();
- branchLabel = new JLabel();
- branchLabel.setOpaque(true);
- Font font = branchLabel.getFont();
- branchLabel.setFont(font.deriveFont(font.getSize2D() - 1f));
+
+ headLabel = newRefLabel();
+ branchLabel = newRefLabel();
+ remoteLabel = newRefLabel();
+ tagLabel = newRefLabel();
+
add(messageLabel);
+ add(headLabel);
add(branchLabel);
+ add(remoteLabel);
+ add(tagLabel);
+ }
+
+ private JLabel newRefLabel() {
+ JLabel label = new JLabel();
+ label.setOpaque(true);
+ Font font = label.getFont();
+ label.setFont(font.deriveFont(font.getSize2D() - 1f));
+ return label;
+ }
+
+ private void resetRef(JLabel label) {
+ label.setText("");
+ label.setBackground(messageLabel.getBackground());
+ label.setBorder(null);
+ label.setVisible(false);
+ }
+
+ private void showRef(String ref, JLabel label) {
+ String name = ref;
+ Color bg = getBackground();
+ Border border = null;
+ if (name.startsWith(Constants.R_HEADS)) {
+ // local branch
+ bg = Color.decode("#CCFFCC");
+ name = name.substring(Constants.R_HEADS.length());
+ border = new LineBorder(Color.decode("#00CC33"), 1);
+ } else if (name.startsWith(Constants.R_REMOTES)) {
+ // remote branch
+ bg = Color.decode("#CAC2F5");
+ name = name.substring(Constants.R_REMOTES.length());
+ border = new LineBorder(Color.decode("#6C6CBF"), 1);
+ } else if (name.startsWith(Constants.R_TAGS)) {
+ // tag
+ bg = Color.decode("#FFFFAA");
+ name = name.substring(Constants.R_TAGS.length());
+ border = new LineBorder(Color.decode("#FFCC00"), 1);
+ } else if (name.equals(Constants.HEAD)) {
+ // HEAD
+ bg = Color.decode("#FFAAFF");
+ border = new LineBorder(Color.decode("#FF00EE"), 1);
+ } else {
+ }
+ label.setText(name);
+ label.setBackground(bg);
+ label.setBorder(border);
+ label.setVisible(true);
}
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
@@ -96,46 +157,49 @@ public class MessageRenderer extends JPanel implements TableCellRenderer, Serial }
// reset ref label
- branchLabel.setText("");
- branchLabel.setBackground(messageLabel.getBackground());
- branchLabel.setBorder(null);
+ resetRef(headLabel);
+ resetRef(branchLabel);
+ resetRef(remoteLabel);
+ resetRef(tagLabel);
+ int parentCount = 0;
if (entry.tags != null) {
for (String tag : entry.tags) {
+ if (tag.startsWith("ref:")) {
+ // strip ref:
+ tag = tag.substring("ref:".length());
+ } else {
+ // count parents
+ if (tag.startsWith("parent:")) {
+ parentCount++;
+ }
+ }
if (tag.equals(entry.branch)) {
+ // skip current branch label
continue;
}
- String name = tag;
- Color bg = getBackground();
- Border border = null;
- if (name.startsWith(R_HEADS)) {
+ if (tag.startsWith(Constants.R_HEADS)) {
// local branch
- bg = Color.decode("#CCFFCC");
- name = name.substring(R_HEADS.length());
- border = new LineBorder(Color.decode("#00CC33"), 1);
- } else if (name.startsWith(R_REMOTES)) {
- // origin branch
- bg = Color.decode("#CAC2F5");
- name = name.substring(R_REMOTES.length());
- border = new LineBorder(Color.decode("#6C6CBF"), 1);
- } else if (name.startsWith(R_TAGS)) {
+ showRef(tag, branchLabel);
+ } else if (tag.startsWith(Constants.R_REMOTES)) {
+ // remote branch
+ showRef(tag, remoteLabel);
+ } else if (tag.startsWith(Constants.R_TAGS)) {
// tag
- bg = Color.decode("#FFFFAA");
- name = name.substring(R_TAGS.length());
- border = new LineBorder(Color.decode("#FFCC00"), 1);
- } else if (name.equals("HEAD")) {
+ showRef(tag, tagLabel);
+ } else if (tag.equals(Constants.HEAD)) {
// HEAD
- bg = Color.decode("#FFAAFF");
- border = new LineBorder(Color.decode("#FF00EE"), 1);
- } else {
-
+ showRef(tag, headLabel);
}
- branchLabel.setText(" " + name + " ");
- branchLabel.setBackground(bg);
- branchLabel.setBorder(border);
}
}
+ if (parentCount > 1) {
+ // multiple parents, show merge icon
+ messageLabel.setIcon(mergeIcon);
+ } else {
+ messageLabel.setIcon(blankIcon);
+ }
return this;
}
}
\ No newline at end of file diff --git a/src/com/gitblit/client/SearchDialog.java b/src/com/gitblit/client/SearchDialog.java index 88864a91..628a2097 100644 --- a/src/com/gitblit/client/SearchDialog.java +++ b/src/com/gitblit/client/SearchDialog.java @@ -92,8 +92,7 @@ public class SearchDialog extends JFrame { this.gitblit = gitblit;
this.isSearch = isSearch;
setTitle(Translation.get(isSearch ? "gb.search" : "gb.log"));
- setIconImage(new ImageIcon(getClass().getResource(
- isSearch ? "/gitblt-favicon.png" : "/commit_changes_16x16.png")).getImage());
+ setIconImage(new ImageIcon(getClass().getResource("/gitblt-favicon.png")).getImage());
initialize();
setSize(900, 550);
}
diff --git a/src/com/gitblit/client/SubscriptionsDialog.java b/src/com/gitblit/client/SubscriptionsDialog.java index 20a64292..ed0b971f 100644 --- a/src/com/gitblit/client/SubscriptionsDialog.java +++ b/src/com/gitblit/client/SubscriptionsDialog.java @@ -57,7 +57,7 @@ public abstract class SubscriptionsDialog extends JDialog { public SubscriptionsDialog(List<FeedModel> registrations) {
super();
this.feeds = registrations;
- setTitle(Translation.get("gb.manage"));
+ setTitle(Translation.get("gb.subscribe"));
setIconImage(new ImageIcon(getClass().getResource("/gitblt-favicon.png")).getImage());
initialize();
setSize(600, 400);
|