001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package com.sun.rave.web.ui.component;
042:
043: import java.io.IOException;
044: import javax.faces.component.UIComponent;
045: import javax.faces.context.FacesContext;
046: import javax.faces.el.MethodBinding;
047: import javax.faces.el.ValueBinding;
048:
049: /**
050: * <code></code>Use
051: * the <code>ui:alarm</code>
052: * tag to display a theme-specific image in the rendered HTML page.
053: * The <code>severity</code>attribute is used to specify the alarm severity which in turn is used to determine the theme-specific alarm icon to render.
054: * The <code>url</code> attribute and (and other attributes related to an image) may be used to override the them-sepcific alarm icon.<br>
055: * <h3>HTML Elements and Layout</h3>
056: * The rendered HTML page displays an XHTML compliant <code><img></code>
057: * element with any applicable attributes.
058: * <h3>Theme Identifiers</h3>
059: * Alarm icons.
060: * <h3>Client Side Javascript Functions</h3>
061: * None.
062: * <br>
063: * <h3>Examples</h3>
064: * <h4>Example 1: Create an alarm with critical severity.</h4>
065: * <code><ui:alarm id="alarm1" severity="critical" />
066: * <br>
067: * <br>
068: * <h4>Example 2: Create a alarm with major severity, but override the alarm image.</h4>
069: * <code><ui:alarm id="alarm2" severity="major"
070: * url="../images/major.gif" height="10" width="10"
071: * alt="Processor Alarm: Major" />
072: * </code><br>
073: * <p>Auto-generated component class.
074: * Do <strong>NOT</strong> modify; all changes
075: * <strong>will</strong> be lost!</p>
076: */
077:
078: public abstract class AlarmBase extends
079: com.sun.rave.web.ui.component.ImageComponent {
080:
081: /**
082: * <p>Construct a new <code>AlarmBase</code>.</p>
083: */
084: public AlarmBase() {
085: super ();
086: setRendererType("com.sun.rave.web.ui.Alarm");
087: }
088:
089: /**
090: * <p>Return the identifier of the component family to which this
091: * component belongs. This identifier, in conjunction with the value
092: * of the <code>rendererType</code> property, may be used to select
093: * the appropriate {@link Renderer} for this component instance.</p>
094: */
095: public String getFamily() {
096: return "com.sun.rave.web.ui.Alarm";
097: }
098:
099: // alt
100: private String alt = null;
101:
102: /**
103: * <p>Alternative text description used by screen reader tools</p>
104: */
105: public String getAlt() {
106: if (this .alt != null) {
107: return this .alt;
108: }
109: ValueBinding _vb = getValueBinding("alt");
110: if (_vb != null) {
111: return (String) _vb.getValue(getFacesContext());
112: }
113: return null;
114: }
115:
116: /**
117: * <p>Alternative text description used by screen reader tools</p>
118: * @see #getAlt()
119: */
120: public void setAlt(String alt) {
121: this .alt = alt;
122: }
123:
124: // onClick
125: private String onClick = null;
126:
127: /**
128: * <p>Scripting code executed when a mouse click
129: * occurs over this component.</p>
130: */
131: public String getOnClick() {
132: if (this .onClick != null) {
133: return this .onClick;
134: }
135: ValueBinding _vb = getValueBinding("onClick");
136: if (_vb != null) {
137: return (String) _vb.getValue(getFacesContext());
138: }
139: return null;
140: }
141:
142: /**
143: * <p>Scripting code executed when a mouse click
144: * occurs over this component.</p>
145: * @see #getOnClick()
146: */
147: public void setOnClick(String onClick) {
148: this .onClick = onClick;
149: }
150:
151: // onDblClick
152: private String onDblClick = null;
153:
154: /**
155: * <p>Scripting code executed when a mouse double click
156: * occurs over this component.</p>
157: */
158: public String getOnDblClick() {
159: if (this .onDblClick != null) {
160: return this .onDblClick;
161: }
162: ValueBinding _vb = getValueBinding("onDblClick");
163: if (_vb != null) {
164: return (String) _vb.getValue(getFacesContext());
165: }
166: return null;
167: }
168:
169: /**
170: * <p>Scripting code executed when a mouse double click
171: * occurs over this component.</p>
172: * @see #getOnDblClick()
173: */
174: public void setOnDblClick(String onDblClick) {
175: this .onDblClick = onDblClick;
176: }
177:
178: // onKeyDown
179: private String onKeyDown = null;
180:
181: /**
182: * <p>Scripting code executed when the user presses down on a key while the
183: * component has focus.</p>
184: */
185: public String getOnKeyDown() {
186: if (this .onKeyDown != null) {
187: return this .onKeyDown;
188: }
189: ValueBinding _vb = getValueBinding("onKeyDown");
190: if (_vb != null) {
191: return (String) _vb.getValue(getFacesContext());
192: }
193: return null;
194: }
195:
196: /**
197: * <p>Scripting code executed when the user presses down on a key while the
198: * component has focus.</p>
199: * @see #getOnKeyDown()
200: */
201: public void setOnKeyDown(String onKeyDown) {
202: this .onKeyDown = onKeyDown;
203: }
204:
205: // onKeyPress
206: private String onKeyPress = null;
207:
208: /**
209: * <p>Scripting code executed when the user presses and releases a key while
210: * the component has focus.</p>
211: */
212: public String getOnKeyPress() {
213: if (this .onKeyPress != null) {
214: return this .onKeyPress;
215: }
216: ValueBinding _vb = getValueBinding("onKeyPress");
217: if (_vb != null) {
218: return (String) _vb.getValue(getFacesContext());
219: }
220: return null;
221: }
222:
223: /**
224: * <p>Scripting code executed when the user presses and releases a key while
225: * the component has focus.</p>
226: * @see #getOnKeyPress()
227: */
228: public void setOnKeyPress(String onKeyPress) {
229: this .onKeyPress = onKeyPress;
230: }
231:
232: // onKeyUp
233: private String onKeyUp = null;
234:
235: /**
236: * <p>Scripting code executed when the user releases a key while the
237: * component has focus.</p>
238: */
239: public String getOnKeyUp() {
240: if (this .onKeyUp != null) {
241: return this .onKeyUp;
242: }
243: ValueBinding _vb = getValueBinding("onKeyUp");
244: if (_vb != null) {
245: return (String) _vb.getValue(getFacesContext());
246: }
247: return null;
248: }
249:
250: /**
251: * <p>Scripting code executed when the user releases a key while the
252: * component has focus.</p>
253: * @see #getOnKeyUp()
254: */
255: public void setOnKeyUp(String onKeyUp) {
256: this .onKeyUp = onKeyUp;
257: }
258:
259: // onMouseDown
260: private String onMouseDown = null;
261:
262: /**
263: * <p>Scripting code executed when the user presses a mouse button while the
264: * mouse pointer is on the component.</p>
265: */
266: public String getOnMouseDown() {
267: if (this .onMouseDown != null) {
268: return this .onMouseDown;
269: }
270: ValueBinding _vb = getValueBinding("onMouseDown");
271: if (_vb != null) {
272: return (String) _vb.getValue(getFacesContext());
273: }
274: return null;
275: }
276:
277: /**
278: * <p>Scripting code executed when the user presses a mouse button while the
279: * mouse pointer is on the component.</p>
280: * @see #getOnMouseDown()
281: */
282: public void setOnMouseDown(String onMouseDown) {
283: this .onMouseDown = onMouseDown;
284: }
285:
286: // onMouseMove
287: private String onMouseMove = null;
288:
289: /**
290: * <p>Scripting code executed when the user moves the mouse pointer while
291: * over the component.</p>
292: */
293: public String getOnMouseMove() {
294: if (this .onMouseMove != null) {
295: return this .onMouseMove;
296: }
297: ValueBinding _vb = getValueBinding("onMouseMove");
298: if (_vb != null) {
299: return (String) _vb.getValue(getFacesContext());
300: }
301: return null;
302: }
303:
304: /**
305: * <p>Scripting code executed when the user moves the mouse pointer while
306: * over the component.</p>
307: * @see #getOnMouseMove()
308: */
309: public void setOnMouseMove(String onMouseMove) {
310: this .onMouseMove = onMouseMove;
311: }
312:
313: // onMouseOut
314: private String onMouseOut = null;
315:
316: /**
317: * <p>Scripting code executed when a mouse out movement
318: * occurs over this component.</p>
319: */
320: public String getOnMouseOut() {
321: if (this .onMouseOut != null) {
322: return this .onMouseOut;
323: }
324: ValueBinding _vb = getValueBinding("onMouseOut");
325: if (_vb != null) {
326: return (String) _vb.getValue(getFacesContext());
327: }
328: return null;
329: }
330:
331: /**
332: * <p>Scripting code executed when a mouse out movement
333: * occurs over this component.</p>
334: * @see #getOnMouseOut()
335: */
336: public void setOnMouseOut(String onMouseOut) {
337: this .onMouseOut = onMouseOut;
338: }
339:
340: // onMouseOver
341: private String onMouseOver = null;
342:
343: /**
344: * <p>Scripting code executed when the user moves the mouse pointer into
345: * the boundary of this component.</p>
346: */
347: public String getOnMouseOver() {
348: if (this .onMouseOver != null) {
349: return this .onMouseOver;
350: }
351: ValueBinding _vb = getValueBinding("onMouseOver");
352: if (_vb != null) {
353: return (String) _vb.getValue(getFacesContext());
354: }
355: return null;
356: }
357:
358: /**
359: * <p>Scripting code executed when the user moves the mouse pointer into
360: * the boundary of this component.</p>
361: * @see #getOnMouseOver()
362: */
363: public void setOnMouseOver(String onMouseOver) {
364: this .onMouseOver = onMouseOver;
365: }
366:
367: // onMouseUp
368: private String onMouseUp = null;
369:
370: /**
371: * <p>Scripting code executed when the user releases a mouse button while
372: * the mouse pointer is on the component.</p>
373: */
374: public String getOnMouseUp() {
375: if (this .onMouseUp != null) {
376: return this .onMouseUp;
377: }
378: ValueBinding _vb = getValueBinding("onMouseUp");
379: if (_vb != null) {
380: return (String) _vb.getValue(getFacesContext());
381: }
382: return null;
383: }
384:
385: /**
386: * <p>Scripting code executed when the user releases a mouse button while
387: * the mouse pointer is on the component.</p>
388: * @see #getOnMouseUp()
389: */
390: public void setOnMouseUp(String onMouseUp) {
391: this .onMouseUp = onMouseUp;
392: }
393:
394: // severity
395: private String severity = null;
396:
397: /**
398: * <p>Specifies the severity of the alarm.
399: * Valid values are: critical, major, minor, down, ok.
400: * Note, a severity of ok renders no alarm icon. This is the default value.</p>
401: */
402: public String getSeverity() {
403: if (this .severity != null) {
404: return this .severity;
405: }
406: ValueBinding _vb = getValueBinding("severity");
407: if (_vb != null) {
408: return (String) _vb.getValue(getFacesContext());
409: }
410: return null;
411: }
412:
413: /**
414: * <p>Specifies the severity of the alarm.
415: * Valid values are: critical, major, minor, down, ok.
416: * Note, a severity of ok renders no alarm icon. This is the default value.</p>
417: * @see #getSeverity()
418: */
419: public void setSeverity(String severity) {
420: this .severity = severity;
421: }
422:
423: // style
424: private String style = null;
425:
426: /**
427: * <p>CSS style(s) to be applied when this component is rendered.</p>
428: */
429: public String getStyle() {
430: if (this .style != null) {
431: return this .style;
432: }
433: ValueBinding _vb = getValueBinding("style");
434: if (_vb != null) {
435: return (String) _vb.getValue(getFacesContext());
436: }
437: return null;
438: }
439:
440: /**
441: * <p>CSS style(s) to be applied when this component is rendered.</p>
442: * @see #getStyle()
443: */
444: public void setStyle(String style) {
445: this .style = style;
446: }
447:
448: // styleClass
449: private String styleClass = null;
450:
451: /**
452: * <p>CSS style class(es) to be applied when this component is rendered.</p>
453: */
454: public String getStyleClass() {
455: if (this .styleClass != null) {
456: return this .styleClass;
457: }
458: ValueBinding _vb = getValueBinding("styleClass");
459: if (_vb != null) {
460: return (String) _vb.getValue(getFacesContext());
461: }
462: return null;
463: }
464:
465: /**
466: * <p>CSS style class(es) to be applied when this component is rendered.</p>
467: * @see #getStyleClass()
468: */
469: public void setStyleClass(String styleClass) {
470: this .styleClass = styleClass;
471: }
472:
473: // toolTip
474: private String toolTip = null;
475:
476: /**
477: * <p>Display the text as a tooltip for this component</p>
478: */
479: public String getToolTip() {
480: if (this .toolTip != null) {
481: return this .toolTip;
482: }
483: ValueBinding _vb = getValueBinding("toolTip");
484: if (_vb != null) {
485: return (String) _vb.getValue(getFacesContext());
486: }
487: return null;
488: }
489:
490: /**
491: * <p>Display the text as a tooltip for this component</p>
492: * @see #getToolTip()
493: */
494: public void setToolTip(String toolTip) {
495: this .toolTip = toolTip;
496: }
497:
498: // visible
499: private boolean visible = false;
500: private boolean visible_set = false;
501:
502: /**
503: * <p>Use the visible attribute to indicate whether the component should be
504: * viewable by the user in the rendered HTML page. If set to false, the
505: * HTML code for the component is present in the page, but the component
506: * is hidden with style attributes. By default, visible is set to true, so
507: * HTML for the component HTML is included and visible to the user. If the
508: * component is not visible, it can still be processed on subsequent form
509: * submissions because the HTML is present.</p>
510: */
511: public boolean isVisible() {
512: if (this .visible_set) {
513: return this .visible;
514: }
515: ValueBinding _vb = getValueBinding("visible");
516: if (_vb != null) {
517: Object _result = _vb.getValue(getFacesContext());
518: if (_result == null) {
519: return false;
520: } else {
521: return ((Boolean) _result).booleanValue();
522: }
523: }
524: return true;
525: }
526:
527: /**
528: * <p>Use the visible attribute to indicate whether the component should be
529: * viewable by the user in the rendered HTML page. If set to false, the
530: * HTML code for the component is present in the page, but the component
531: * is hidden with style attributes. By default, visible is set to true, so
532: * HTML for the component HTML is included and visible to the user. If the
533: * component is not visible, it can still be processed on subsequent form
534: * submissions because the HTML is present.</p>
535: * @see #isVisible()
536: */
537: public void setVisible(boolean visible) {
538: this .visible = visible;
539: this .visible_set = true;
540: }
541:
542: /**
543: * <p>Restore the state of this component.</p>
544: */
545: public void restoreState(FacesContext _context, Object _state) {
546: Object _values[] = (Object[]) _state;
547: super .restoreState(_context, _values[0]);
548: this .alt = (String) _values[1];
549: this .onClick = (String) _values[2];
550: this .onDblClick = (String) _values[3];
551: this .onKeyDown = (String) _values[4];
552: this .onKeyPress = (String) _values[5];
553: this .onKeyUp = (String) _values[6];
554: this .onMouseDown = (String) _values[7];
555: this .onMouseMove = (String) _values[8];
556: this .onMouseOut = (String) _values[9];
557: this .onMouseOver = (String) _values[10];
558: this .onMouseUp = (String) _values[11];
559: this .severity = (String) _values[12];
560: this .style = (String) _values[13];
561: this .styleClass = (String) _values[14];
562: this .toolTip = (String) _values[15];
563: this .visible = ((Boolean) _values[16]).booleanValue();
564: this .visible_set = ((Boolean) _values[17]).booleanValue();
565: }
566:
567: /**
568: * <p>Save the state of this component.</p>
569: */
570: public Object saveState(FacesContext _context) {
571: Object _values[] = new Object[18];
572: _values[0] = super .saveState(_context);
573: _values[1] = this .alt;
574: _values[2] = this .onClick;
575: _values[3] = this .onDblClick;
576: _values[4] = this .onKeyDown;
577: _values[5] = this .onKeyPress;
578: _values[6] = this .onKeyUp;
579: _values[7] = this .onMouseDown;
580: _values[8] = this .onMouseMove;
581: _values[9] = this .onMouseOut;
582: _values[10] = this .onMouseOver;
583: _values[11] = this .onMouseUp;
584: _values[12] = this .severity;
585: _values[13] = this .style;
586: _values[14] = this .styleClass;
587: _values[15] = this .toolTip;
588: _values[16] = this .visible ? Boolean.TRUE : Boolean.FALSE;
589: _values[17] = this.visible_set ? Boolean.TRUE : Boolean.FALSE;
590: return _values;
591: }
592:
593: }
|