KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > icesoft > faces > component > outputconnectionstatus > OutputConnectionStatus


1 /*
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * "The contents of this file are subject to the Mozilla Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
11  * License for the specific language governing rights and limitations under
12  * the License.
13  *
14  * The Original Code is ICEfaces 1.5 open source software code, released
15  * November 5, 2006. The Initial Developer of the Original Code is ICEsoft
16  * Technologies Canada, Corp. Portions created by ICEsoft are Copyright (C)
17  * 2004-2006 ICEsoft Technologies Canada, Corp. All Rights Reserved.
18  *
19  * Contributor(s): _____________________.
20  *
21  * Alternatively, the contents of this file may be used under the terms of
22  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"
23  * License), in which case the provisions of the LGPL License are
24  * applicable instead of those above. If you wish to allow use of your
25  * version of this file only under the terms of the LGPL License and not to
26  * allow others to use your version of this file under the MPL, indicate
27  * your decision by deleting the provisions above and replace them with
28  * the notice and other provisions required by the LGPL License. If you do
29  * not delete the provisions above, a recipient may use your version of
30  * this file under either the MPL or the LGPL License."
31  *
32  */

33
34 package com.icesoft.faces.component.outputconnectionstatus;
35
36 import com.icesoft.faces.component.CSS_DEFAULT;
37 import com.icesoft.faces.component.ext.taglib.Util;
38
39 import javax.faces.component.html.HtmlPanelGroup;
40 import javax.faces.context.FacesContext;
41 import javax.faces.el.ValueBinding;
42
43 /**
44  * OutputConnectionStatus is a JSF component class representing an ICEfaces
45  * output connection status state indicator.
46  * <p/>
47  * This component extends the JSF HtmlPanelGroup component.
48  * <p/>
49  * By default the OutputConnectionStatus is rendered by the
50  * "com.icesoft.faces.OutputConnectionStatusRenderer" renderer type.
51  */

52
53 public class OutputConnectionStatus extends HtmlPanelGroup {
54     public static final String JavaDoc COMPONENT_TYPE =
55             "com.icesoft.faces.OutputConnectionStatus";
56     public static final String JavaDoc RENDERER_TYPE =
57             "com.icesoft.faces.OutputConnectionStatusRenderer";
58     public static final String JavaDoc COMPONENT_FAMILY = "javax.faces.Panel";
59     private static final String JavaDoc DEFAULT_LABEL = "";
60     private java.lang.String JavaDoc style;
61     private java.lang.String JavaDoc styleClass;
62     private java.lang.String JavaDoc inactiveLabel;
63     private java.lang.String JavaDoc activeLabel;
64     private java.lang.String JavaDoc cautionLabel;
65     private java.lang.String JavaDoc disconnectedLabel;
66     private java.lang.String JavaDoc renderedOnUserRole;
67
68     /**
69      * <p>Return the value of the <code>COMPONENT_FAMILY</code> of this
70      * component.</p>
71      */

72     public String JavaDoc getFamily() {
73         return COMPONENT_FAMILY;
74     }
75
76     /**
77      * <p>Return the value of the <code>RENDERER_TYPE</code> of this
78      * component.</p>
79      */

80     public String JavaDoc getRendererType() {
81         return RENDERER_TYPE;
82     }
83
84     /**
85      * <p>Return the value of the <code>COMPONENT_TYPE</code> of this
86      * component.</p>
87      */

88     public String JavaDoc getComponentType() {
89         return COMPONENT_TYPE;
90     }
91
92     /**
93      * <p>Return the value of the <code>activeClass</code> property.</p>
94      */

95     public String JavaDoc getActiveClass() {
96         return Util.getQualifiedStyleClass(this,
97                 CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_ACTIVE_CLASS);
98     }
99
100     /**
101      * <p>Set the value of the <code>activeLabel</code> property.</p>
102      */

103     public void setActiveLabel(java.lang.String JavaDoc activeLabel) {
104         this.activeLabel = activeLabel;
105     }
106
107     /**
108      * <p>Return the value of the <code>activeLabel</code> property.</p>
109      */

110     public String JavaDoc getActiveLabel() {
111         if (activeLabel != null) {
112             return activeLabel;
113         }
114         ValueBinding vb = getValueBinding("activeLabel");
115         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) :
116                DEFAULT_LABEL;
117     }
118
119     /**
120      * <p>Return the value of the <code>cautionClass</code> property.</p>
121      */

122     public String JavaDoc getCautionClass() {
123         return Util.getQualifiedStyleClass(this,
124                 CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_CAUTION_CLASS);
125     }
126
127     /**
128      * <p>Set the value of the <code>cautionLabel</code> property.</p>
129      */

130     public void setCautionLabel(java.lang.String JavaDoc cautionLabel) {
131         this.cautionLabel = cautionLabel;
132     }
133
134     /**
135      * <p>Return the value of the <code>cautionLabel</code> property.</p>
136      */

137     public String JavaDoc getCautionLabel() {
138         if (cautionLabel != null) {
139             return cautionLabel;
140         }
141         ValueBinding vb = getValueBinding("cautionLabel");
142         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) :
143                DEFAULT_LABEL;
144     }
145
146     /**
147      * <p>Return the value of the <code>disconnectedClass</code> property.</p>
148      */

149     public String JavaDoc getDisconnectedClass() {
150         return Util.getQualifiedStyleClass(this,
151                 CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_DISCONNECT_CLASS);
152     }
153
154     /**
155      * <p>Set the value of the <code>disconnectedLabel</code> property.</p>
156      */

157     public void setDisconnectedLabel(java.lang.String JavaDoc disconnectedLabel) {
158         this.disconnectedLabel = disconnectedLabel;
159     }
160
161     /**
162      * <p>Return the value of the <code>disconnectedLabel</code> property.</p>
163      */

164     public String JavaDoc getDisconnectedLabel() {
165         if (disconnectedLabel != null) {
166             return disconnectedLabel;
167         }
168         ValueBinding vb = getValueBinding("disconnectedLabel");
169         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) :
170                DEFAULT_LABEL;
171     }
172
173     /**
174      * <p>Return the value of the <code>inactiveClass</code> property.</p>
175      */

176     public String JavaDoc getInactiveClass() {
177         return Util.getQualifiedStyleClass(this,
178                 CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_INACTIVE_CLASS);
179     }
180
181     /**
182      * <p>Set the value of the <code>inactiveLabel</code> property.</p>
183      */

184     public void setInactiveLabel(java.lang.String JavaDoc inactiveLabel) {
185         this.inactiveLabel = inactiveLabel;
186     }
187
188     /**
189      * <p>Return the value of the <code>inactiveLabel</code> property.</p>
190      */

191     public String JavaDoc getInactiveLabel() {
192         if (inactiveLabel != null) {
193             return inactiveLabel;
194         }
195         ValueBinding vb = getValueBinding("inactiveLabel");
196         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) :
197                DEFAULT_LABEL;
198     }
199
200     /**
201      * <p>Set the value of the <code>style</code> property.</p>
202      */

203     public void setStyle(java.lang.String JavaDoc style) {
204         this.style = style;
205     }
206
207     /**
208      * <p>Return the value of the <code>style</code> property.</p>
209      */

210     public String JavaDoc getStyle() {
211         if (style != null) {
212             return style;
213         }
214         ValueBinding vb = getValueBinding("style");
215         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) : null;
216     }
217
218     /**
219      * <p>Set the value of the <code>styleClass</code> property.</p>
220      */

221     public void setStyleClass(java.lang.String JavaDoc styleClass) {
222         this.styleClass = styleClass;
223     }
224
225     /**
226      * <p>Return the value of the <code>styleClass</code> property.</p>
227      */

228     public String JavaDoc getStyleClass() {
229         return Util.getQualifiedStyleClass(this,
230                         styleClass,
231                         CSS_DEFAULT.OUTPUT_CONNECTION_STATUS_DEFAULT_STYLE_CLASS,
232                         "styleClass");
233     }
234
235
236     /**
237      * <p>Set the value of the <code>renderedOnUserRole</code> property.</p>
238      */

239     public void setRenderedOnUserRole(String JavaDoc renderedOnUserRole) {
240         this.renderedOnUserRole = renderedOnUserRole;
241     }
242
243     /**
244      * <p>Return the value of the <code>renderedOnUserRole</code> property.</p>
245      */

246     public String JavaDoc getRenderedOnUserRole() {
247         if (renderedOnUserRole != null) {
248             return renderedOnUserRole;
249         }
250         ValueBinding vb = getValueBinding("renderedOnUserRole");
251         return vb != null ? (String JavaDoc) vb.getValue(getFacesContext()) : null;
252     }
253
254     /**
255      * <p>Return the value of the <code>rendered</code> property.</p>
256      */

257     public boolean isRendered() {
258         if (!Util.isRenderedOnUserRole(this)) {
259             return false;
260         }
261         return super.isRendered();
262     }
263
264     /**
265      * <p>Gets the state of the instance as a <code>Serializable</code>
266      * Object.</p>
267      */

268     public Object JavaDoc saveState(FacesContext context) {
269         Object JavaDoc values[] = new Object JavaDoc[11];
270         values[0] = super.saveState(context);
271         values[1] = style;
272         values[2] = styleClass;
273         values[3] = inactiveLabel;
274         values[4] = activeLabel;
275         values[5] = cautionLabel;
276         values[6] = disconnectedLabel;
277         values[7] = renderedOnUserRole;
278         return ((Object JavaDoc) (values));
279     }
280
281     /**
282      * <p>Perform any processing required to restore the state from the entries
283      * in the state Object.</p>
284      */

285     public void restoreState(FacesContext context, Object JavaDoc state) {
286         Object JavaDoc values[] = (Object JavaDoc[]) state;
287         super.restoreState(context, values[0]);
288         style = (String JavaDoc) values[1];
289         styleClass = (String JavaDoc) values[2];
290         inactiveLabel = (String JavaDoc) values[3];
291         activeLabel = (String JavaDoc) values[4];
292         cautionLabel = (String JavaDoc) values[5];
293         disconnectedLabel = (String JavaDoc) values[6];
294         renderedOnUserRole = (String JavaDoc) values[7];
295     }
296 }
297
Popular Tags