View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.client.console.topology;
20  
21  import de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel;
22  import java.util.ArrayList;
23  import java.util.List;
24  import org.apache.syncope.client.console.annotations.IdMPage;
25  import org.apache.syncope.client.console.pages.BasePage;
26  import org.apache.syncope.client.console.pages.Connectors;
27  import org.apache.syncope.client.console.pages.Resources;
28  import org.apache.syncope.client.console.panels.ConnidLocations;
29  import org.apache.syncope.common.lib.types.IdMEntitlement;
30  import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
31  import org.apache.wicket.extensions.markup.html.tabs.ITab;
32  import org.apache.wicket.markup.html.WebMarkupContainer;
33  import org.apache.wicket.markup.html.panel.Panel;
34  import org.apache.wicket.model.Model;
35  
36  @IdMPage(label = "TabularTopology", icon = "fas fa-plug", listEntitlement = IdMEntitlement.RESOURCE_LIST, priority = 1)
37  public class TabularTopology extends BasePage {
38  
39      private static final long serialVersionUID = -4434385801124981824L;
40  
41      public TabularTopology() {
42          TopologyWebSocketBehavior websocket = new TopologyWebSocketBehavior();
43          body.add(websocket);
44  
45          WebMarkupContainer content = new WebMarkupContainer("content");
46          content.setOutputMarkupId(true);
47          content.add(new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList()));
48          body.add(content);
49      }
50  
51      protected List<ITab> buildTabList() {
52          List<ITab> tabs = new ArrayList<>();
53  
54          tabs.add(new AbstractTab(new Model<>("Resources")) {
55  
56              private static final long serialVersionUID = -6815067322125799251L;
57  
58              @Override
59              public Panel getPanel(final String panelId) {
60                  return new Resources(panelId, getPageReference());
61              }
62          });
63  
64          tabs.add(new AbstractTab(new Model<>("Connectors")) {
65  
66              private static final long serialVersionUID = -6815067322125799251L;
67  
68              @Override
69              public Panel getPanel(final String panelId) {
70                  return new Connectors(panelId, getPageReference());
71              }
72          });
73  
74          tabs.add(new AbstractTab(new Model<>("ConnectorServers")) {
75  
76              private static final long serialVersionUID = -6815067322125799251L;
77  
78              @Override
79              public Panel getPanel(final String panelId) {
80                  return new ConnidLocations.Builder(getPageReference()) {
81  
82                      private static final long serialVersionUID = -2555113973787214723L;
83  
84                  }.build(panelId);
85              }
86          });
87  
88          return tabs;
89      }
90  }