James Moger
2012-09-10 fabe060d3a435f116128851f828e35c2af5fde67
commit | author | age
a7571b 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  */
16 package com.gitblit.wicket.pages;
17
18 import com.gitblit.GitBlit;
19 import com.gitblit.Keys;
20 import com.gitblit.wicket.panels.FederationProposalsPanel;
21 import com.gitblit.wicket.panels.FederationRegistrationsPanel;
22 import com.gitblit.wicket.panels.FederationTokensPanel;
23
24 public class FederationPage extends RootPage {
25
26     public FederationPage() {
27         super();
d376ab 28         setupPage("", "");
a7571b 29
JM 30         boolean showFederation = showAdmin && GitBlit.canFederate();
31         add(new FederationTokensPanel("federationTokensPanel", showFederation)
32                 .setVisible(showFederation));
33         FederationProposalsPanel proposalsPanel = new FederationProposalsPanel(
34                 "federationProposalsPanel");
35         if (showFederation) {
36             proposalsPanel.hideIfEmpty();
37         } else {
38             proposalsPanel.setVisible(false);
39         }
40
41         boolean showRegistrations = GitBlit.getBoolean(Keys.web.showFederationRegistrations, false);
42         FederationRegistrationsPanel registrationsPanel = new FederationRegistrationsPanel(
43                 "federationRegistrationsPanel");
44         if (showAdmin || showRegistrations) {
45             registrationsPanel.hideIfEmpty();
46         } else {
47             registrationsPanel.setVisible(false);
48         }
49         add(proposalsPanel);
50         add(registrationsPanel);
51     }
52 }