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
|
package com.gitblit.wicket.pages;
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 com.gitblit.utils.JGitUtils;
import com.gitblit.utils.StringUtils;
import com.gitblit.wicket.GitBlitWebSession;
import com.gitblit.wicket.LinkPanel;
import com.gitblit.wicket.RepositoryPage;
import com.gitblit.wicket.WicketUtils;
import com.gitblit.wicket.models.TicGitTicket;
public class TicGitPage extends RepositoryPage {
public TicGitPage(PageParameters params) {
super(params);
List<TicGitTicket> tickets = JGitUtils.getTicGitTickets(getRepository());
// header
add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));
ListDataProvider<TicGitTicket> ticketsDp = new ListDataProvider<TicGitTicket>(tickets);
DataView<TicGitTicket> ticketsView = new DataView<TicGitTicket>("ticket", ticketsDp) {
private static final long serialVersionUID = 1L;
int counter = 0;
public void populateItem(final Item<TicGitTicket> item) {
final TicGitTicket entry = item.getModelObject();
Label stateLabel = new Label("ticketState", entry.state);
WicketUtils.setTicketCssClass(stateLabel, entry.state);
item.add(stateLabel);
item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession.get().getTimezone()));
item.add(new Label("ticketHandler", StringUtils.trimString(entry.handler.toLowerCase(), 30)));
item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(entry.title, 80), TicGitTicketPage.class, newPathParameter(entry.name)));
WicketUtils.setAlternatingBackground(item, counter);
counter++;
}
};
add(ticketsView);
}
@Override
protected String getPageName() {
return getString("gb.ticgit");
}
}
|