diff options
author | James Moger <james.moger@gitblit.com> | 2013-11-16 11:42:06 -0500 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-11-26 16:07:04 -0500 |
commit | 99d0d4fd66f3490b61c700065b7d16bc4e73f226 (patch) | |
tree | 0e5d8bd9e7b14905ab6ea71e8bf6253345415a70 /src/main/java/com/gitblit/wicket/pages/SummaryPage.java | |
parent | a7a0b8ea01dca14602fdb49047d987c36461e861 (diff) | |
download | gitblit-99d0d4fd66f3490b61c700065b7d16bc4e73f226.tar.gz gitblit-99d0d4fd66f3490b61c700065b7d16bc4e73f226.zip |
Eliminate nearly all direct GitBlit singleton references in Wicket
This is the first step towards modularization and injection. All
direct references to the GitBlit singleton within the Wicket pages
and panels have been replaced to proxy methods in the GitBlitWebApp
singleton. There are still two Wicket classes which rely on the
GitBlit singleton; those require manual instantiation (servlet 3).
Change-Id: I0cdbbcf87959d590c446c99abb09c07c87c737bc
Diffstat (limited to 'src/main/java/com/gitblit/wicket/pages/SummaryPage.java')
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/SummaryPage.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/SummaryPage.java b/src/main/java/com/gitblit/wicket/pages/SummaryPage.java index 5604be4e..9129302b 100644 --- a/src/main/java/com/gitblit/wicket/pages/SummaryPage.java +++ b/src/main/java/com/gitblit/wicket/pages/SummaryPage.java @@ -40,7 +40,6 @@ import org.wicketstuff.googlecharts.LineStyle; import org.wicketstuff.googlecharts.MarkerType;
import org.wicketstuff.googlecharts.ShapeMarker;
-import com.gitblit.GitBlit;
import com.gitblit.Keys;
import com.gitblit.models.Metric;
import com.gitblit.models.RepositoryModel;
@@ -67,11 +66,11 @@ public class SummaryPage extends RepositoryPage { public SummaryPage(PageParameters params) {
super(params);
- int numberCommits = GitBlit.getInteger(Keys.web.summaryCommitCount, 20);
+ int numberCommits = app().settings().getInteger(Keys.web.summaryCommitCount, 20);
if (numberCommits <= 0) {
numberCommits = 20;
}
- int numberRefs = GitBlit.getInteger(Keys.web.summaryRefsCount, 5);
+ int numberRefs = app().settings().getInteger(Keys.web.summaryRefsCount, 5);
Repository r = getRepository();
final RepositoryModel model = getRepositoryModel();
@@ -82,8 +81,8 @@ public class SummaryPage extends RepositoryPage { List<Metric> metrics = null;
Metric metricsTotal = null;
- if (!model.skipSummaryMetrics && GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
- metrics = GitBlit.self().getRepositoryDefaultMetrics(model, r);
+ if (!model.skipSummaryMetrics && app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {
+ metrics = app().repositories().getRepositoryDefaultMetrics(model, r);
metricsTotal = metrics.remove(0);
}
@@ -101,7 +100,7 @@ public class SummaryPage extends RepositoryPage { @Override
public void populateItem(final Item<String> item) {
String ownername = item.getModelObject();
- UserModel ownerModel = GitBlit.self().getUserModel(ownername);
+ UserModel ownerModel = app().users().getUserModel(ownername);
if (ownerModel != null) {
item.add(new LinkPanel("owner", null, ownerModel.getDisplayName(), UserPage.class,
WicketUtils.newUsernameParameter(ownerModel.username)).setRenderBodyOnly(true));
@@ -138,10 +137,10 @@ public class SummaryPage extends RepositoryPage { add(new TagsPanel("tagsPanel", repositoryName, r, numberRefs).hideIfEmpty());
add(new BranchesPanel("branchesPanel", getRepositoryModel(), r, numberRefs, false).hideIfEmpty());
- if (GitBlit.getBoolean(Keys.web.summaryShowReadme, false)) {
+ if (app().settings().getBoolean(Keys.web.summaryShowReadme, false)) {
// show a readme on the summary page
RevCommit head = JGitUtils.getCommit(r, null);
- MarkupProcessor processor = new MarkupProcessor(GitBlit.getSettings());
+ MarkupProcessor processor = new MarkupProcessor(app().settings());
MarkupDocument markupDoc = processor.getReadme(r, repositoryName, getBestCommitId(head));
if (markupDoc == null || markupDoc.markup == null) {
add(new Label("readme").setVisible(false));
@@ -169,7 +168,7 @@ public class SummaryPage extends RepositoryPage { private void insertActivityGraph(List<Metric> metrics) {
if ((metrics != null) && (metrics.size() > 0)
- && GitBlit.getBoolean(Keys.web.generateActivityGraph, true)) {
+ && app().settings().getBoolean(Keys.web.generateActivityGraph, true)) {
IChartData data = WicketUtils.getChartData(metrics);
ChartProvider provider = new ChartProvider(new Dimension(290, 100), ChartType.LINE,
|