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.chartjs;
20  
21  import com.fasterxml.jackson.annotation.JsonRawValue;
22  import java.io.Serializable;
23  
24  /**
25   * Provides some basic options, that are available for all kinds of charts.
26   */
27  public abstract class ChartOptions implements Serializable {
28  
29      private static final long serialVersionUID = 2401861279216541412L;
30  
31      public static class Axis implements Serializable {
32  
33          private static final long serialVersionUID = 1L;
34  
35          private Boolean display;
36  
37          public Boolean getDisplay() {
38              return display;
39          }
40  
41          public void setDisplay(final Boolean display) {
42              this.display = display;
43          }
44      }
45  
46      public static class Scales implements Serializable {
47  
48          private static final long serialVersionUID = 1L;
49  
50          private Axis x;
51  
52          private Axis y;
53  
54          public Axis getX() {
55              return x;
56          }
57  
58          public void setX(final Axis x) {
59              this.x = x;
60          }
61  
62          public Axis getY() {
63              return y;
64          }
65  
66          public void setY(final Axis y) {
67              this.y = y;
68          }
69      }
70  
71      /** The animation. */
72      private Boolean animation;
73  
74      /** The animation steps. */
75      private Integer animationSteps;
76  
77      /** The animation easing. */
78      private String animationEasing;
79  
80      /** The on animation complete. */
81      private String onAnimationComplete;
82  
83      @JsonRawValue
84      private String customTooltips;
85  
86      private Boolean responsive;
87  
88      private Boolean maintainAspectRatio;
89  
90      private Boolean showTooltips;
91  
92      private String[] tooltipEvents = new String[] { "mousemove", "touchstart", "touchmove" };
93  
94      private String tooltipFillColor;
95  
96      private String tooltipFontFamily;
97  
98      private Integer tooltipFontSize;
99  
100     private String tooltipFontStyle;
101 
102     private String tooltipFontColor;
103 
104     private String tooltipTitleFontFamily;
105 
106     private Integer tooltipTitleFontSize;
107 
108     private String tooltipTitleFontStyle;
109 
110     private String tooltipTitleFontColor;
111 
112     private Integer tooltipYPadding;
113 
114     private Integer tooltipXPadding;
115 
116     private Integer tooltipCaretSize;
117 
118     private Integer tooltipCornerRadius;
119 
120     private Integer tooltipXOffset;
121 
122     private String tooltipTemplate;
123 
124     private String multiTooltipTemplate;
125 
126     private Scales scales;
127 
128     @JsonRawValue
129     private String onAnimationProgress;
130 
131     public String getCustomTooltips() {
132         return customTooltips;
133     }
134 
135     public void setCustomTooltips(final String customTooltips) {
136         this.customTooltips = customTooltips;
137     }
138 
139     /**
140      * Gets the animation.
141      *
142      * @return the animation
143      */
144     public Boolean getAnimation() {
145         return animation;
146     }
147 
148     /**
149      * Sets the animation.
150      *
151      * @param animation decides whether to animate the chart (default is true)
152      */
153     public void setAnimation(final Boolean animation) {
154         this.animation = animation;
155     }
156 
157     /**
158      * Gets the animation steps.
159      *
160      * @return the animation steps
161      */
162     public Integer getAnimationSteps() {
163         return animationSteps;
164     }
165 
166     /**
167      * Sets the animation steps.
168      *
169      * @param animationSteps the number of animation steps (default is 60)
170      */
171     public void setAnimationSteps(final Integer animationSteps) {
172         this.animationSteps = animationSteps;
173     }
174 
175     /**
176      * Gets the animation easing.
177      *
178      * @return the animation easing
179      */
180     public String getAnimationEasing() {
181         return animationEasing;
182     }
183 
184     /**
185      * Sets the animation easing.
186      *
187      * @param animationEasing the animation easing effect (default is "easeOutQuart")
188      */
189     public void setAnimationEasing(final String animationEasing) {
190         this.animationEasing = animationEasing;
191     }
192 
193     /**
194      * Gets the javascript function that fires on animation complete.
195      *
196      * @return the onAnimationComplete javascript function
197      */
198     public String getOnAnimationComplete() {
199         return onAnimationComplete;
200     }
201 
202     /**
203      * Sets the onAnimationComplete javascript function.
204      *
205      * @param onAnimationComplete a function, that fires when the animation is complete
206      */
207     public void setOnAnimationComplete(final String onAnimationComplete) {
208         this.onAnimationComplete = onAnimationComplete;
209     }
210 
211     public Boolean getResponsive() {
212         return responsive;
213     }
214 
215     public void setResponsive(final Boolean responsive) {
216         this.responsive = responsive;
217     }
218 
219     public Boolean getMaintainAspectRatio() {
220         return maintainAspectRatio;
221     }
222 
223     public void setMaintainAspectRatio(final Boolean maintainAspectRatio) {
224         this.maintainAspectRatio = maintainAspectRatio;
225     }
226 
227     public Boolean getShowTooltips() {
228         return showTooltips;
229     }
230 
231     public void setShowTooltips(final Boolean showTooltips) {
232         this.showTooltips = showTooltips;
233     }
234 
235     public String[] getTooltipEvents() {
236         return tooltipEvents;
237     }
238 
239     public void setTooltipEvents(final String[] tooltipEvents) {
240         this.tooltipEvents = tooltipEvents;
241     }
242 
243     public String getTooltipFillColor() {
244         return tooltipFillColor;
245     }
246 
247     public void setTooltipFillColor(final String tooltipFillColor) {
248         this.tooltipFillColor = tooltipFillColor;
249     }
250 
251     public String getTooltipFontFamily() {
252         return tooltipFontFamily;
253     }
254 
255     public void setTooltipFontFamily(final String tooltipFontFamily) {
256         this.tooltipFontFamily = tooltipFontFamily;
257     }
258 
259     public Integer getTooltipFontSize() {
260         return tooltipFontSize;
261     }
262 
263     public void setTooltipFontSize(final Integer tooltipFontSize) {
264         this.tooltipFontSize = tooltipFontSize;
265     }
266 
267     public String getTooltipFontStyle() {
268         return tooltipFontStyle;
269     }
270 
271     public void setTooltipFontStyle(final String tooltipFontStyle) {
272         this.tooltipFontStyle = tooltipFontStyle;
273     }
274 
275     public String getTooltipFontColor() {
276         return tooltipFontColor;
277     }
278 
279     public void setTooltipFontColor(final String tooltipFontColor) {
280         this.tooltipFontColor = tooltipFontColor;
281     }
282 
283     public String getTooltipTitleFontFamily() {
284         return tooltipTitleFontFamily;
285     }
286 
287     public void setTooltipTitleFontFamily(final String tooltipTitleFontFamily) {
288         this.tooltipTitleFontFamily = tooltipTitleFontFamily;
289     }
290 
291     public Integer getTooltipTitleFontSize() {
292         return tooltipTitleFontSize;
293     }
294 
295     public void setTooltipTitleFontSize(final Integer tooltipTitleFontSize) {
296         this.tooltipTitleFontSize = tooltipTitleFontSize;
297     }
298 
299     public String getTooltipTitleFontStyle() {
300         return tooltipTitleFontStyle;
301     }
302 
303     public void setTooltipTitleFontStyle(final String tooltipTitleFontStyle) {
304         this.tooltipTitleFontStyle = tooltipTitleFontStyle;
305     }
306 
307     public String getTooltipTitleFontColor() {
308         return tooltipTitleFontColor;
309     }
310 
311     public void setTooltipTitleFontColor(final String tooltipTitleFontColor) {
312         this.tooltipTitleFontColor = tooltipTitleFontColor;
313     }
314 
315     public Integer getTooltipYPadding() {
316         return tooltipYPadding;
317     }
318 
319     public void setTooltipYPadding(final Integer tooltipYPadding) {
320         this.tooltipYPadding = tooltipYPadding;
321     }
322 
323     public Integer getTooltipXPadding() {
324         return tooltipXPadding;
325     }
326 
327     public void setTooltipXPadding(final Integer tooltipXPadding) {
328         this.tooltipXPadding = tooltipXPadding;
329     }
330 
331     public Integer getTooltipCaretSize() {
332         return tooltipCaretSize;
333     }
334 
335     public void setTooltipCaretSize(final Integer tooltipCaretSize) {
336         this.tooltipCaretSize = tooltipCaretSize;
337     }
338 
339     public Integer getTooltipCornerRadius() {
340         return tooltipCornerRadius;
341     }
342 
343     public void setTooltipCornerRadius(final Integer tooltipCornerRadius) {
344         this.tooltipCornerRadius = tooltipCornerRadius;
345     }
346 
347     public Integer getTooltipXOffset() {
348         return tooltipXOffset;
349     }
350 
351     public void setTooltipXOffset(final Integer tooltipXOffset) {
352         this.tooltipXOffset = tooltipXOffset;
353     }
354 
355     public String getTooltipTemplate() {
356         return tooltipTemplate;
357     }
358 
359     public void setTooltipTemplate(final String tooltipTemplate) {
360         this.tooltipTemplate = tooltipTemplate;
361     }
362 
363     public String getMultiTooltipTemplate() {
364         return multiTooltipTemplate;
365     }
366 
367     public void setMultiTooltipTemplate(final String multiTooltipTemplate) {
368         this.multiTooltipTemplate = multiTooltipTemplate;
369     }
370 
371     public String getOnAnimationProgress() {
372         return onAnimationProgress;
373     }
374 
375     public void setOnAnimationProgress(final String onAnimationProgress) {
376         this.onAnimationProgress = onAnimationProgress;
377     }
378 
379     /**
380      * Tests whether this chart is responsive or not.
381      *
382      * @return true if its responsive, false otherwise.
383      */
384     public boolean isResponsive() {
385         return responsive;
386     }
387 
388     /**
389      * Sets the responsive option for this chart.
390      *
391      * @param responsive the responsive option value.
392      */
393     public void setResponsive(final boolean responsive) {
394         this.responsive = responsive;
395     }
396 
397     public Scales getScales() {
398         return scales;
399     }
400 
401     public void setScales(final Scales scales) {
402         this.scales = scales;
403     }
404 }