summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/wicket/panels/PageLinksPanel.java
blob: 02491bca5c05daca62da90a7bda9b88c7feefb25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.gitblit.wicket.panels;

import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.panel.Panel;

import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.pages.CommitPage;
import com.gitblit.wicket.pages.ShortLogPage;
import com.gitblit.wicket.pages.SummaryPage;
import com.gitblit.wicket.pages.TagsPage;
import com.gitblit.wicket.pages.TreePage;


public class PageLinksPanel extends Panel {

	private static final long serialVersionUID = 1L;

	public PageLinksPanel(String id, String repositoryName, String pageName) {
		super(id);
		// summary
		if (pageName.equals("summary")) {
			add(new Label("summary", pageName));
		} else {
			add(new LinkPanel("summary", null, "summary", SummaryPage.class, new PageParameters("p=" + repositoryName)));
		}

		// shortlog
		if (pageName.equals("shortlog")) {
			add(new Label("shortlog", pageName));
		} else {
			add(new LinkPanel("shortlog", null, "shortlog", ShortLogPage.class, new PageParameters("p=" + repositoryName)));
		}
		
		// tags
		if (pageName.equals("tags")) {
			add(new Label("tags", pageName));
		} else {
			add(new LinkPanel("tags", null, "tags", TagsPage.class, new PageParameters("p=" + repositoryName)));
		}

		// commit
		if (pageName.equals("commit")) {
			add(new Label("commit", pageName));
		} else {
			add(new LinkPanel("commit", null, "commit", CommitPage.class, new PageParameters("p=" + repositoryName + ",h=HEAD")));
		}
		// commitdiff
		if (pageName.equals("commitdiff")) {
			add(new Label("commitdiff", pageName));
		} else {
			add(new Label("commitdiff", "commitdiff"));
		}
		// tree
		if (pageName.equals("tree")) {
			add(new Label("tree", pageName));
		} else {
			add(new LinkPanel("tree", null, "tree", TreePage.class, new PageParameters("p=" + repositoryName + ",h=HEAD")));
		}		
	}
}