James Moger
2011-04-11 7d35e227475bb4a6ba185788cc663e38822c15f8
src/com/gitblit/wicket/panels/RefsPanel.java
@@ -13,28 +13,27 @@
import org.apache.wicket.markup.repeater.data.ListDataProvider;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import com.gitblit.utils.JGitUtils;
import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.pages.LogPage;
import com.gitblit.wicket.pages.TagPage;
public class RefsPanel extends Panel {
   private static final long serialVersionUID = 1L;
   public RefsPanel(String id, Repository r, RevCommit c) {
      this(id, c, JGitUtils.getAllRefs(r));
   }
   public RefsPanel(String id, RevCommit c, Map<ObjectId, List<String>> refs) {
   public RefsPanel(String id, final String repositoryName, RevCommit c, Map<ObjectId, List<String>> refs) {
      super(id);
      List<String> refNames = refs.get(c.getId());
      if (refNames == null) {
         refNames = new ArrayList<String>();
      }
      Collections.sort(refNames);
      refNames.remove(Constants.HEAD);
      ListDataProvider<String> refsDp = new ListDataProvider<String>(refNames);
      DataView<String> refsView = new DataView<String>("ref", refsDp) {
         private static final long serialVersionUID = 1L;
@@ -43,19 +42,23 @@
            Component c = null;
            if (entry.startsWith(Constants.R_HEADS)) {
               // local head
               c = new Label("refName", entry.substring(Constants.R_HEADS.length()));
               c = new LinkPanel("refName", null, entry.substring(Constants.R_HEADS.length()), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
//               c = new Label("refName", entry.substring(Constants.R_HEADS.length()));
               WicketUtils.setCssClass(c, "head");
            } else if (entry.startsWith(Constants.R_REMOTES)) {
               // remote head
               c = new Label("refName", entry.substring(Constants.R_REMOTES.length()));
               c = new LinkPanel("refName", null, entry.substring(Constants.R_REMOTES.length()), LogPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
//               c = new Label("refName", entry.substring(Constants.R_REMOTES.length()));
               WicketUtils.setCssClass(c, "ref");
            } else if (entry.startsWith(Constants.R_TAGS)) {
               // tag
               c = new Label("refName", entry.substring(Constants.R_TAGS.length()));
//               c = new BookmarkablePageLink<Void>("refName", TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
               c = new LinkPanel("refName", null, entry.substring(Constants.R_TAGS.length()), TagPage.class, WicketUtils.newObjectParameter(repositoryName, entry));
               //c = new Label("refName", entry.substring(Constants.R_TAGS.length()));
               WicketUtils.setCssClass(c, "tag");
            } else {
               // other
               c = new Label("refName", entry);
               c = new Label("refName", entry);
            }
            WicketUtils.setHtmlTitle(c, entry);
            item.add(c);