commit | author | age
|
232890
|
1 |
package com.gitblit.wicket.pages;
|
JM |
2 |
|
|
3 |
import java.util.List;
|
|
4 |
|
|
5 |
import org.apache.wicket.PageParameters;
|
|
6 |
import org.apache.wicket.markup.html.basic.Label;
|
|
7 |
import org.apache.wicket.markup.repeater.Item;
|
|
8 |
import org.apache.wicket.markup.repeater.data.DataView;
|
|
9 |
import org.apache.wicket.markup.repeater.data.ListDataProvider;
|
|
10 |
|
|
11 |
import com.gitblit.utils.JGitUtils;
|
87cc1e
|
12 |
import com.gitblit.utils.StringUtils;
|
698678
|
13 |
import com.gitblit.wicket.GitBlitWebSession;
|
232890
|
14 |
import com.gitblit.wicket.LinkPanel;
|
JM |
15 |
import com.gitblit.wicket.RepositoryPage;
|
|
16 |
import com.gitblit.wicket.WicketUtils;
|
9802a7
|
17 |
import com.gitblit.wicket.models.TicketModel;
|
232890
|
18 |
|
9802a7
|
19 |
public class TicketsPage extends RepositoryPage {
|
232890
|
20 |
|
9802a7
|
21 |
public TicketsPage(PageParameters params) {
|
cebf45
|
22 |
super(params);
|
232890
|
23 |
|
9802a7
|
24 |
List<TicketModel> tickets = JGitUtils.getTickets(getRepository());
|
232890
|
25 |
|
698678
|
26 |
// header
|
JM |
27 |
add(new LinkPanel("header", "title", repositoryName, SummaryPage.class, newRepositoryParameter()));
|
232890
|
28 |
|
9802a7
|
29 |
ListDataProvider<TicketModel> ticketsDp = new ListDataProvider<TicketModel>(tickets);
|
JM |
30 |
DataView<TicketModel> ticketsView = new DataView<TicketModel>("ticket", ticketsDp) {
|
232890
|
31 |
private static final long serialVersionUID = 1L;
|
JM |
32 |
int counter = 0;
|
|
33 |
|
9802a7
|
34 |
public void populateItem(final Item<TicketModel> item) {
|
JM |
35 |
final TicketModel entry = item.getModelObject();
|
232890
|
36 |
Label stateLabel = new Label("ticketState", entry.state);
|
1e47ab
|
37 |
WicketUtils.setTicketCssClass(stateLabel, entry.state);
|
232890
|
38 |
item.add(stateLabel);
|
698678
|
39 |
item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession.get().getTimezone()));
|
87cc1e
|
40 |
item.add(new Label("ticketHandler", StringUtils.trimString(entry.handler.toLowerCase(), 30)));
|
9802a7
|
41 |
item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(entry.title, 80), TicketPage.class, newPathParameter(entry.name)));
|
232890
|
42 |
|
698678
|
43 |
WicketUtils.setAlternatingBackground(item, counter);
|
232890
|
44 |
counter++;
|
JM |
45 |
}
|
|
46 |
};
|
|
47 |
add(ticketsView);
|
|
48 |
}
|
155bf7
|
49 |
|
cebf45
|
50 |
@Override
|
JM |
51 |
protected String getPageName() {
|
9802a7
|
52 |
return getString("gb.tickets");
|
cebf45
|
53 |
}
|
232890
|
54 |
}
|