commit | author | age
|
f13c4c
|
1 |
/*
|
JM |
2 |
* Copyright 2011 gitblit.com.
|
|
3 |
*
|
|
4 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5 |
* you may not use this file except in compliance with the License.
|
|
6 |
* You may obtain a copy of the License at
|
|
7 |
*
|
|
8 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9 |
*
|
|
10 |
* Unless required by applicable law or agreed to in writing, software
|
|
11 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13 |
* See the License for the specific language governing permissions and
|
|
14 |
* limitations under the License.
|
|
15 |
*/
|
232890
|
16 |
package com.gitblit.wicket.pages;
|
JM |
17 |
|
|
18 |
import java.util.List;
|
|
19 |
|
|
20 |
import org.apache.wicket.PageParameters;
|
|
21 |
import org.apache.wicket.markup.html.basic.Label;
|
|
22 |
import org.apache.wicket.markup.repeater.Item;
|
|
23 |
import org.apache.wicket.markup.repeater.data.DataView;
|
|
24 |
import org.apache.wicket.markup.repeater.data.ListDataProvider;
|
|
25 |
|
1f9dae
|
26 |
import com.gitblit.models.TicketModel;
|
87cc1e
|
27 |
import com.gitblit.utils.StringUtils;
|
793f76
|
28 |
import com.gitblit.utils.TicgitUtils;
|
698678
|
29 |
import com.gitblit.wicket.GitBlitWebSession;
|
232890
|
30 |
import com.gitblit.wicket.WicketUtils;
|
1f9dae
|
31 |
import com.gitblit.wicket.panels.LinkPanel;
|
232890
|
32 |
|
9802a7
|
33 |
public class TicketsPage extends RepositoryPage {
|
232890
|
34 |
|
9802a7
|
35 |
public TicketsPage(PageParameters params) {
|
cebf45
|
36 |
super(params);
|
232890
|
37 |
|
793f76
|
38 |
List<TicketModel> tickets = TicgitUtils.getTickets(getRepository());
|
232890
|
39 |
|
698678
|
40 |
// header
|
2a7306
|
41 |
add(new LinkPanel("header", "title", repositoryName, SummaryPage.class,
|
JM |
42 |
newRepositoryParameter()));
|
232890
|
43 |
|
9802a7
|
44 |
ListDataProvider<TicketModel> ticketsDp = new ListDataProvider<TicketModel>(tickets);
|
JM |
45 |
DataView<TicketModel> ticketsView = new DataView<TicketModel>("ticket", ticketsDp) {
|
232890
|
46 |
private static final long serialVersionUID = 1L;
|
2a7306
|
47 |
int counter;
|
232890
|
48 |
|
9802a7
|
49 |
public void populateItem(final Item<TicketModel> item) {
|
JM |
50 |
final TicketModel entry = item.getModelObject();
|
232890
|
51 |
Label stateLabel = new Label("ticketState", entry.state);
|
1e47ab
|
52 |
WicketUtils.setTicketCssClass(stateLabel, entry.state);
|
232890
|
53 |
item.add(stateLabel);
|
2a7306
|
54 |
item.add(WicketUtils.createDateLabel("ticketDate", entry.date, GitBlitWebSession
|
JM |
55 |
.get().getTimezone()));
|
|
56 |
item.add(new Label("ticketHandler", StringUtils.trimString(
|
|
57 |
entry.handler.toLowerCase(), 30)));
|
|
58 |
item.add(new LinkPanel("ticketTitle", "list subject", StringUtils.trimString(
|
|
59 |
entry.title, 80), TicketPage.class, newPathParameter(entry.name)));
|
232890
|
60 |
|
698678
|
61 |
WicketUtils.setAlternatingBackground(item, counter);
|
232890
|
62 |
counter++;
|
JM |
63 |
}
|
|
64 |
};
|
|
65 |
add(ticketsView);
|
|
66 |
}
|
671c19
|
67 |
|
a2709d
|
68 |
protected PageParameters newPathParameter(String path) {
|
JM |
69 |
return WicketUtils.newPathParameter(repositoryName, objectId, path);
|
|
70 |
}
|
155bf7
|
71 |
|
cebf45
|
72 |
@Override
|
JM |
73 |
protected String getPageName() {
|
9802a7
|
74 |
return getString("gb.tickets");
|
cebf45
|
75 |
}
|
232890
|
76 |
}
|