1 package org.rcfaces.core.component;
2
3 import org.rcfaces.core.internal.component.Properties;
4 import org.rcfaces.core.internal.converter.CalendarModeConverter;
5 import org.rcfaces.core.internal.converter.CalendarLayoutConverter;
6 import java.lang.String;
7 import org.apache.commons.logging.LogFactory;
8 import org.rcfaces.core.component.capability.ICalendarModeCapability;
9 import org.rcfaces.core.component.capability.ICalendarLayoutCapability;
10 import org.rcfaces.core.component.capability.IBorderCapability;
11 import org.rcfaces.core.component.capability.IMultipleSelectCapability;
12 import org.rcfaces.core.component.AbstractCalendarComponent;
13 import javax.el.ValueExpression;
14 import java.util.HashSet;
15 import org.apache.commons.logging.Log;
16 import java.util.Set;
17 import java.util.Arrays;
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69 public class CalendarComponent extends AbstractCalendarComponent implements
70 IBorderCapability,
71 ICalendarLayoutCapability,
72 IMultipleSelectCapability,
73 ICalendarModeCapability {
74
75 private static final Log LOG = LogFactory.getLog(CalendarComponent.class);
76
77 public static final String COMPONENT_TYPE="org.rcfaces.core.calendar";
78
79 protected static final Set CAMELIA_ATTRIBUTES=new HashSet(AbstractCalendarComponent.CAMELIA_ATTRIBUTES);
80 static {
81 CAMELIA_ATTRIBUTES.addAll(Arrays.asList(new String[] {"multipleSelect","border","autoSelection","mode","calendarLayout"}));
82 }
83
84 public CalendarComponent() {
85 setRendererType(COMPONENT_TYPE);
86 }
87
88 public CalendarComponent(String componentId) {
89 this();
90 setId(componentId);
91 }
92
93 public void setMode(String calendarMode) {
94
95
96 setMode(((Integer)CalendarModeConverter.SINGLETON.getAsObject(null, this, calendarMode)).intValue());
97
98 }
99
100 public void setCalendarLayout(String layout) {
101
102
103 setCalendarLayout(((Integer)CalendarLayoutConverter.SINGLETON.getAsObject(null, this, layout)).intValue());
104
105 }
106
107 public boolean isBorder() {
108 return isBorder(null);
109 }
110
111
112
113
114 public boolean isBorder(javax.faces.context.FacesContext facesContext) {
115 return engine.getBoolProperty(Properties.BORDER, true, facesContext);
116 }
117
118
119
120
121
122 public final boolean isBorderSetted() {
123 return engine.isPropertySetted(Properties.BORDER);
124 }
125
126 public void setBorder(boolean border) {
127 engine.setProperty(Properties.BORDER, border);
128 }
129
130 public int getCalendarLayout() {
131 return getCalendarLayout(null);
132 }
133
134
135
136
137 public int getCalendarLayout(javax.faces.context.FacesContext facesContext) {
138 return engine.getIntProperty(Properties.CALENDAR_LAYOUT,ICalendarLayoutCapability.DEFAULT_LAYOUT, facesContext);
139 }
140
141
142
143
144
145 public final boolean isCalendarLayoutSetted() {
146 return engine.isPropertySetted(Properties.CALENDAR_LAYOUT);
147 }
148
149 public void setCalendarLayout(int calendarLayout) {
150 engine.setProperty(Properties.CALENDAR_LAYOUT, calendarLayout);
151 }
152
153 public boolean isMultipleSelect() {
154 return isMultipleSelect(null);
155 }
156
157
158
159
160 public boolean isMultipleSelect(javax.faces.context.FacesContext facesContext) {
161 return engine.getBoolProperty(Properties.MULTIPLE_SELECT, false, facesContext);
162 }
163
164
165
166
167
168 public final boolean isMultipleSelectSetted() {
169 return engine.isPropertySetted(Properties.MULTIPLE_SELECT);
170 }
171
172 public void setMultipleSelect(boolean multipleSelect) {
173 engine.setProperty(Properties.MULTIPLE_SELECT, multipleSelect);
174 }
175
176 public int getMode() {
177 return getMode(null);
178 }
179
180
181
182
183 public int getMode(javax.faces.context.FacesContext facesContext) {
184 return engine.getIntProperty(Properties.MODE,0, facesContext);
185 }
186
187
188
189
190
191 public final boolean isModeSetted() {
192 return engine.isPropertySetted(Properties.MODE);
193 }
194
195 public void setMode(int mode) {
196 engine.setProperty(Properties.MODE, mode);
197 }
198
199 public boolean isAutoSelection() {
200 return isAutoSelection(null);
201 }
202
203 public boolean isAutoSelection(javax.faces.context.FacesContext facesContext) {
204 return engine.getBoolProperty(Properties.AUTO_SELECTION, false, facesContext);
205 }
206
207 public void setAutoSelection(boolean autoSelection) {
208 engine.setProperty(Properties.AUTO_SELECTION, autoSelection);
209 }
210
211
212
213
214
215 public boolean isAutoSelectionSetted() {
216 return engine.isPropertySetted(Properties.AUTO_SELECTION);
217 }
218
219 protected Set getCameliaFields() {
220 return CAMELIA_ATTRIBUTES;
221 }
222 }