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.pages;
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.BookmarkablePageLinkBuilder;
25  import org.apache.syncope.client.console.panels.AnyTypeClassesPanel;
26  import org.apache.syncope.client.console.panels.AnyTypesPanel;
27  import org.apache.syncope.client.console.panels.RelationshipTypesPanel;
28  import org.apache.syncope.client.console.panels.SchemasPanel;
29  import org.apache.syncope.client.console.rest.AnyTypeClassRestClient;
30  import org.apache.syncope.client.console.rest.AnyTypeRestClient;
31  import org.apache.syncope.client.console.rest.RelationshipTypeRestClient;
32  import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
33  import org.apache.wicket.extensions.markup.html.tabs.ITab;
34  import org.apache.wicket.markup.html.WebMarkupContainer;
35  import org.apache.wicket.markup.html.panel.Panel;
36  import org.apache.wicket.model.Model;
37  import org.apache.wicket.request.mapper.parameter.PageParameters;
38  import org.apache.wicket.spring.injection.annot.SpringBean;
39  
40  public class Types extends BasePage {
41  
42      private static final long serialVersionUID = 8091922398776299403L;
43  
44      protected enum Type {
45          SCHEMA,
46          ANYTYPECLASS,
47          ANYTYPE,
48          RELATIONSHIPTYPE;
49  
50      }
51  
52      @SpringBean
53      protected RelationshipTypeRestClient relationshipTypeRestClient;
54  
55      @SpringBean
56      protected AnyTypeRestClient anyTypeRestClient;
57  
58      @SpringBean
59      protected AnyTypeClassRestClient anyTypeClassRestClient;
60  
61      public Types(final PageParameters parameters) {
62          super(parameters);
63  
64          body.add(BookmarkablePageLinkBuilder.build("dashboard", "dashboardBr", Dashboard.class));
65  
66          WebMarkupContainer content = new WebMarkupContainer("content");
67          content.setOutputMarkupId(true);
68          content.add(new AjaxBootstrapTabbedPanel<>("tabbedPanel", buildTabList()));
69          body.add(content);
70      }
71  
72      private List<ITab> buildTabList() {
73          final List<ITab> tabs = new ArrayList<>();
74  
75          tabs.add(new AbstractTab(new Model<>("RelationshipTypes")) {
76  
77              private static final long serialVersionUID = -6815067322125799251L;
78  
79              @Override
80              public Panel getPanel(final String panelId) {
81                  return new RelationshipTypesPanel(panelId, relationshipTypeRestClient, getPageReference());
82              }
83          });
84  
85          tabs.add(new AbstractTab(new Model<>("AnyTypes")) {
86  
87              private static final long serialVersionUID = -6815067322125799251L;
88  
89              @Override
90              public Panel getPanel(final String panelId) {
91                  return new AnyTypesPanel(panelId, anyTypeRestClient, getPageReference());
92              }
93          });
94  
95          tabs.add(new AbstractTab(new Model<>("AnyTypeClasses")) {
96  
97              private static final long serialVersionUID = -6815067322125799251L;
98  
99              @Override
100             public Panel getPanel(final String panelId) {
101                 return new AnyTypeClassesPanel(panelId, anyTypeClassRestClient, getPageReference());
102             }
103         });
104 
105         tabs.add(new AbstractTab(new Model<>("Schemas")) {
106 
107             private static final long serialVersionUID = -6815067322125799251L;
108 
109             @Override
110             public Panel getPanel(final String panelId) {
111                 return new SchemasPanel(panelId, getPageReference());
112             }
113         });
114 
115         return tabs;
116     }
117 }