diff options
author | James Moger <james.moger@gitblit.com> | 2011-04-05 22:26:37 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2011-04-05 22:26:37 -0400 |
commit | 232890f03476b8bb231d17883eb0faff93ec5049 (patch) | |
tree | cf558e7d72095a2735b52cea516c26175279de27 /src/com/gitblit/wicket/pages/BranchesPage.java | |
parent | ce33be67c4c8c783713ad51c187e8296ed71f233 (diff) | |
download | gitblit-232890f03476b8bb231d17883eb0faff93ec5049.tar.gz gitblit-232890f03476b8bb231d17883eb0faff93ec5049.zip |
Simplified links some more. Added TicGit browser.
Diffstat (limited to 'src/com/gitblit/wicket/pages/BranchesPage.java')
-rw-r--r-- | src/com/gitblit/wicket/pages/BranchesPage.java | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/src/com/gitblit/wicket/pages/BranchesPage.java b/src/com/gitblit/wicket/pages/BranchesPage.java new file mode 100644 index 00000000..1fc5f88b --- /dev/null +++ b/src/com/gitblit/wicket/pages/BranchesPage.java @@ -0,0 +1,71 @@ +package com.gitblit.wicket.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.wicket.PageParameters;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.markup.repeater.data.DataView;
+import org.apache.wicket.markup.repeater.data.ListDataProvider;
+import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.Repository;
+
+import com.gitblit.utils.JGitUtils;
+import com.gitblit.utils.Utils;
+import com.gitblit.wicket.LinkPanel;
+import com.gitblit.wicket.RepositoryPage;
+import com.gitblit.wicket.WicketUtils;
+import com.gitblit.wicket.models.RefModel;
+import com.gitblit.wicket.panels.BranchLinksPanel;
+
+
+public class BranchesPage extends RepositoryPage {
+
+ public BranchesPage(PageParameters params) {
+ super(params, "branches");
+
+ Repository r = getRepository();
+ List<RefModel> branches = new ArrayList<RefModel>();
+ branches.addAll(JGitUtils.getLocalBranches(r, -1));
+ branches.addAll(JGitUtils.getRemoteBranches(r, -1));
+ r.close();
+
+ // shortlog
+ add(new LinkPanel("summary", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));
+
+ ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);
+ DataView<RefModel> branchView = new DataView<RefModel>("branch", branchesDp) {
+ private static final long serialVersionUID = 1L;
+ int counter = 0;
+
+ public void populateItem(final Item<RefModel> item) {
+ final RefModel entry = item.getModelObject();
+ String date;
+ if (entry.getDate() != null) {
+ date = Utils.timeAgo(entry.getDate());
+ } else {
+ date = "";
+ }
+ Label branchDateLabel = new Label("branchDate", date);
+ item.add(branchDateLabel);
+ WicketUtils.setCssClass(branchDateLabel, Utils.timeAgoCss(entry.getDate()));
+
+ item.add(new LinkPanel("branchName", "list name", entry.getDisplayName(), ShortLogPage.class, newCommitParameter(entry.getName())));
+
+ boolean remote = entry.getName().startsWith(Constants.R_REMOTES);
+ item.add(new Label("branchType", remote ? "remote":"local"));
+
+ item.add(new BranchLinksPanel("branchLinks", repositoryName, entry));
+
+ String clazz = counter % 2 == 0 ? "dark" : "light";
+ WicketUtils.setCssClass(item, clazz);
+ counter++;
+ }
+ };
+ add(branchView);
+
+ // footer
+ addFooter();
+ }
+}
|