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 |
*/
|
f602a2
|
16 |
package com.gitblit.wicket.pages;
|
JM |
17 |
|
|
18 |
import org.apache.wicket.PageParameters;
|
|
19 |
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
|
20 |
|
|
21 |
import com.gitblit.wicket.WicketUtils;
|
|
22 |
import com.gitblit.wicket.panels.HistoryPanel;
|
|
23 |
|
|
24 |
public class HistoryPage extends RepositoryPage {
|
|
25 |
|
|
26 |
public HistoryPage(PageParameters params) {
|
|
27 |
super(params);
|
|
28 |
|
|
29 |
String path = WicketUtils.getPath(params);
|
|
30 |
int pageNumber = WicketUtils.getPage(params);
|
|
31 |
int prevPage = Math.max(0, pageNumber - 1);
|
|
32 |
int nextPage = pageNumber + 1;
|
|
33 |
|
2a7306
|
34 |
HistoryPanel history = new HistoryPanel("historyPanel", repositoryName, objectId, path,
|
JM |
35 |
getRepository(), -1, pageNumber - 1);
|
f602a2
|
36 |
boolean hasMore = history.hasMore();
|
JM |
37 |
add(history);
|
|
38 |
|
2a7306
|
39 |
add(new BookmarkablePageLink<Void>("firstPageTop", HistoryPage.class,
|
JM |
40 |
WicketUtils.newPathParameter(repositoryName, objectId, path))
|
|
41 |
.setEnabled(pageNumber > 1));
|
|
42 |
add(new BookmarkablePageLink<Void>("prevPageTop", HistoryPage.class,
|
|
43 |
WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, prevPage))
|
|
44 |
.setEnabled(pageNumber > 1));
|
|
45 |
add(new BookmarkablePageLink<Void>("nextPageTop", HistoryPage.class,
|
|
46 |
WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, nextPage))
|
|
47 |
.setEnabled(hasMore));
|
f602a2
|
48 |
|
2a7306
|
49 |
add(new BookmarkablePageLink<Void>("firstPageBottom", HistoryPage.class,
|
JM |
50 |
WicketUtils.newPathParameter(repositoryName, objectId, path))
|
|
51 |
.setEnabled(pageNumber > 1));
|
|
52 |
add(new BookmarkablePageLink<Void>("prevPageBottom", HistoryPage.class,
|
|
53 |
WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, prevPage))
|
|
54 |
.setEnabled(pageNumber > 1));
|
|
55 |
add(new BookmarkablePageLink<Void>("nextPageBottom", HistoryPage.class,
|
|
56 |
WicketUtils.newHistoryPageParameter(repositoryName, objectId, path, nextPage))
|
|
57 |
.setEnabled(hasMore));
|
f602a2
|
58 |
|
JM |
59 |
}
|
|
60 |
|
|
61 |
@Override
|
|
62 |
protected String getPageName() {
|
|
63 |
return getString("gb.history");
|
|
64 |
}
|
|
65 |
}
|