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 |
*/
|
698678
|
16 |
package com.gitblit.wicket.pages;
|
JM |
17 |
|
|
18 |
import org.apache.wicket.PageParameters;
|
ef5c58
|
19 |
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
|
698678
|
20 |
|
9c4725
|
21 |
import com.gitblit.utils.StringUtils;
|
ef5c58
|
22 |
import com.gitblit.wicket.WicketUtils;
|
698678
|
23 |
import com.gitblit.wicket.panels.LogPanel;
|
JM |
24 |
|
|
25 |
public class LogPage extends RepositoryPage {
|
|
26 |
|
|
27 |
public LogPage(PageParameters params) {
|
|
28 |
super(params);
|
|
29 |
|
8c9a20
|
30 |
addSyndicationDiscoveryLink();
|
85c2e6
|
31 |
|
7d35e2
|
32 |
int pageNumber = WicketUtils.getPage(params);
|
ef5c58
|
33 |
int prevPage = Math.max(0, pageNumber - 1);
|
JM |
34 |
int nextPage = pageNumber + 1;
|
9c4725
|
35 |
String refid = objectId;
|
JM |
36 |
if (StringUtils.isEmpty(refid)) {
|
|
37 |
refid = getRepositoryModel().HEAD;
|
|
38 |
}
|
|
39 |
LogPanel logPanel = new LogPanel("logPanel", repositoryName, refid, getRepository(), -1,
|
2a7306
|
40 |
pageNumber - 1);
|
f602a2
|
41 |
boolean hasMore = logPanel.hasMore();
|
JM |
42 |
add(logPanel);
|
ef5c58
|
43 |
|
2a7306
|
44 |
add(new BookmarkablePageLink<Void>("firstPageTop", LogPage.class,
|
JM |
45 |
WicketUtils.newObjectParameter(repositoryName, objectId))
|
|
46 |
.setEnabled(pageNumber > 1));
|
|
47 |
add(new BookmarkablePageLink<Void>("prevPageTop", LogPage.class,
|
|
48 |
WicketUtils.newLogPageParameter(repositoryName, objectId, prevPage))
|
|
49 |
.setEnabled(pageNumber > 1));
|
|
50 |
add(new BookmarkablePageLink<Void>("nextPageTop", LogPage.class,
|
|
51 |
WicketUtils.newLogPageParameter(repositoryName, objectId, nextPage))
|
|
52 |
.setEnabled(hasMore));
|
ef5c58
|
53 |
|
2a7306
|
54 |
add(new BookmarkablePageLink<Void>("firstPageBottom", LogPage.class,
|
JM |
55 |
WicketUtils.newObjectParameter(repositoryName, objectId))
|
|
56 |
.setEnabled(pageNumber > 1));
|
|
57 |
add(new BookmarkablePageLink<Void>("prevPageBottom", LogPage.class,
|
|
58 |
WicketUtils.newLogPageParameter(repositoryName, objectId, prevPage))
|
|
59 |
.setEnabled(pageNumber > 1));
|
|
60 |
add(new BookmarkablePageLink<Void>("nextPageBottom", LogPage.class,
|
|
61 |
WicketUtils.newLogPageParameter(repositoryName, objectId, nextPage))
|
|
62 |
.setEnabled(hasMore));
|
698678
|
63 |
}
|
ef5c58
|
64 |
|
698678
|
65 |
@Override
|
JM |
66 |
protected String getPageName() {
|
|
67 |
return getString("gb.log");
|
|
68 |
}
|
|
69 |
}
|