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.ui.commons;
20  
21  import de.agilecoders.wicket.core.markup.html.bootstrap.components.PopoverBehavior;
22  import de.agilecoders.wicket.core.markup.html.bootstrap.components.PopoverConfig;
23  import de.agilecoders.wicket.core.markup.html.bootstrap.components.TooltipConfig;
24  import org.apache.wicket.Component;
25  import org.apache.wicket.markup.html.basic.Label;
26  import org.apache.wicket.model.Model;
27  
28  public final class Constants {
29  
30      public static final String SYNCOPE = "syncope";
31  
32      public static final String UNKNOWN = "UNKNOWN";
33  
34      public static final String ROLE_AUTHENTICATED = "AUTHENTICATED";
35  
36      public static final String MENU_COLLAPSE = "MENU_COLLAPSE";
37  
38      public static final String VEIL_INDICATOR_MARKUP_ID = "veil";
39  
40      public static final String MODELER_CONTEXT = "modelerContext";
41  
42      public static final String MODEL_ID_PARAM = "modelId";
43  
44      public static final String KEY_FIELD_NAME = "key";
45  
46      public static final String SCHEMA_FIELD_NAME = "schema";
47  
48      public static final String DESCRIPTION_FIELD_NAME = "description";
49  
50      public static final String USERNAME_FIELD_NAME = "username";
51  
52      public static final String NAME_FIELD_NAME = "name";
53  
54      public static final String DEFAULT_TOKEN_FIELD_NAME = "token";
55  
56      public static final String ON_CLICK = "click";
57  
58      public static final String ON_CHANGE = "change";
59  
60      public static final String ON_KEYUP = "keyup";
61  
62      public static final String ON_KEYDOWN = "keydown";
63  
64      public static final String ON_BLUR = "blur";
65  
66      public static final String PNG_EXT = ".png";
67  
68      public static final String FEEDBACK = "feedback";
69  
70      public static final String OPERATION_SUCCEEDED = "operation_succeeded";
71  
72      public static final String OPERATION_ERROR = "operation_error";
73  
74      public static final String CAPTCHA_ERROR = "captcha_error";
75  
76      public static final String SEARCH_ERROR = "search_error";
77  
78      public static final String UNEXPECTED_CONDITION_ERROR = "unexpected_condition_error";
79  
80      public static final String ERROR = "error";
81  
82      public static final String OUTER = "outer";
83  
84      public static final String ACTION = "action";
85  
86      public static final String CONFIRM_DELETE = "confirmDelete";
87  
88      public static final String BEFORE_LOGOUT_PAGE = "beforeLogoutPage";
89  
90      public static final String PARAM_PASSWORD_RESET_TOKEN = "pwdResetToken";
91  
92      public static final String PAGEPARAM_CREATE = "CREATE";
93  
94      public static final String PAGEPARAM_CURRENT_PAGE = "_current_page";
95  
96      public static final String PREF_ANY_DETAILS_VIEW = "any.%s.details.view";
97  
98      public static final String PREF_ANY_PLAIN_ATTRS_VIEW = "any.%s.plain.attrs.view";
99  
100     public static final String PREF_ANY_DER_ATTRS_VIEW = "any.%s.der.attrs.view";
101 
102     public static final String CREATED_ICON = "far fa-check-circle";
103 
104     public static final String SUSPENDED_ICON = "fas fa-ban";
105 
106     public static final String ACTIVE_ICON = "far fa-check-circle";
107 
108     public static final String UNDEFINED_ICON = "fas fa-question-circle";
109 
110     public static final String NOT_FOUND_ICON = "fas fa-minus-circle";
111 
112     public static final String WARNING_ICON = "fas fa-exclamation-circle";
113 
114     public static final int MAX_GROUP_LIST_SIZE = 30;
115 
116     public static final int MAX_ROLE_LIST_SIZE = 30;
117 
118     public static final String NOTIFICATION_TITLE_PARAM = "notificationTitle";
119 
120     public static final String NOTIFICATION_MSG_PARAM = "notificationMessage";
121 
122     public static final String NOTIFICATION_LEVEL_PARAM = "notificationLevel";
123 
124     public static final String ENDUSER_ANYLAYOUT = "enduser.anylayout";
125 
126     public static final String CONTENT_ID = "content";
127 
128     public static Component getJEXLPopover(final Component caller, final TooltipConfig.Placement placement) {
129         return getJEXLPopover(caller, placement, caller.getString("jexl_ex1"), caller.getString("jexl_ex2"));
130     }
131 
132     public static Component getJEXLPopover(
133             final Component caller,
134             final TooltipConfig.Placement placement,
135             final String... jexlExamples) {
136 
137         StringBuilder body = new StringBuilder(caller.getString("jexl_info")).
138                 append("<ul>");
139         for (String jexlExample : jexlExamples) {
140             body.append("<li>").append(jexlExample).append("</li>");
141         }
142         body.append("</ul>").
143                 append("<a href='https://commons.apache.org/proper/commons-jexl/reference/' target='_blank'>").
144                 append(caller.getString("jexl_syntax_url")).
145                 append("</a>");
146 
147         return new Label("jexlInfo", Model.of()).add(new PopoverBehavior(
148                 Model.<String>of(),
149                 Model.of(body.toString()),
150                 new PopoverConfig().withHtml(true).withPlacement(placement)) {
151 
152             private static final long serialVersionUID = -7867802555691605021L;
153 
154             @Override
155             protected String createRelAttribute() {
156                 return "jexlInfo";
157             }
158         });
159     }
160 
161     private Constants() {
162         // private constructor for static utility class
163     }
164 }