1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package org.primefaces.extensions.component.legend;
23
24 import java.util.Map;
25
26 import javax.faces.application.ResourceDependency;
27 import javax.faces.component.UIComponentBase;
28
29 import org.primefaces.component.api.Widget;
30
31
32
33
34
35
36
37 @ResourceDependency(library = "primefaces", name = "components.css")
38 @ResourceDependency(library = "primefaces", name = "jquery/jquery.js")
39 @ResourceDependency(library = "primefaces", name = "jquery/jquery-plugins.js")
40 @ResourceDependency(library = "primefaces", name = "core.js")
41 @ResourceDependency(library = "primefaces-extensions", name = "legend/legend.css")
42 @ResourceDependency(library = "primefaces-extensions", name = "legend/legend.js")
43 public class Legend extends UIComponentBase implements Widget {
44
45 public static final String COMPONENT_TYPE = "org.primefaces.extensions.component.Legend";
46 public static final String COMPONENT_FAMILY = "org.primefaces.extensions.component";
47 public static final String STYLE_CLASS_VERTICAL = "ui-legend-vertical ";
48 public static final String STYLE_CLASS_HORIZONTAL = "ui-legend-horizontal ";
49 public static final String SCALE_STYLE = "ui-legend-scale";
50 public static final String LABELS_STYLE = "ui-legend-labels";
51 public static final String TITLE_STYLE = "ui-legend-title";
52 public static final String FOOTER_STYLE = "ui-legend-footer";
53
54 private static final String DEFAULT_RENDERER = "org.primefaces.extensions.component.LegendRenderer";
55
56 @SuppressWarnings("java:S115")
57 protected enum PropertyKeys {
58
59
60 widgetVar,
61 style,
62 styleClass,
63 title,
64 footer,
65 values,
66 layout
67
68 }
69
70
71
72
73 public Legend() {
74 setRendererType(DEFAULT_RENDERER);
75 }
76
77
78
79
80 @Override
81 public String getFamily() {
82 return COMPONENT_FAMILY;
83 }
84
85 public String getLayout() {
86 return (String) getStateHelper().eval(PropertyKeys.layout, "vertical");
87 }
88
89 public void setLayout(final String layout) {
90 getStateHelper().put(PropertyKeys.layout, layout);
91 }
92
93 public String getTitle() {
94 return (String) getStateHelper().eval(PropertyKeys.title, null);
95 }
96
97 public void setTitle(final String title) {
98 getStateHelper().put(PropertyKeys.title, title);
99 }
100
101 public String getFooter() {
102 return (String) getStateHelper().eval(PropertyKeys.footer, null);
103 }
104
105 public void setFooter(final String footer) {
106 getStateHelper().put(PropertyKeys.footer, footer);
107 }
108
109 public String getStyle() {
110 return (String) getStateHelper().eval(PropertyKeys.style, null);
111 }
112
113 public void setStyle(final String _style) {
114 getStateHelper().put(PropertyKeys.style, _style);
115 }
116
117 public String getStyleClass() {
118 return (String) getStateHelper().eval(PropertyKeys.styleClass, null);
119 }
120
121 public void setStyleClass(final String _styleClass) {
122 getStateHelper().put(PropertyKeys.styleClass, _styleClass);
123 }
124
125 public Map<String, String> getValues() {
126 return (Map<String, String>) getStateHelper().eval(PropertyKeys.values, null);
127 }
128
129 public void setValues(final Map<String, String> map) {
130 getStateHelper().put(PropertyKeys.values, map);
131 }
132
133 }