Source Code Cross Referenced for TreeNodeBase.java in  » IDE-Netbeans » visualweb.api.designer » com » sun » rave » web » ui » component » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » visualweb.api.designer » com.sun.rave.web.ui.component 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:         * <h3>HTML Elements and Layout</h3>
051:         * 
052:         *     <p> The <code>TreeNode</code> component is designed to be used as a child
053:         * 	of a <code>Tree</code> or another <code>TreeNode</code> component.
054:         * 	This allows <code>TreeNode</code>s to form a tree structure.  When the
055:         * 	tree structure is rendered, the <code>TreeNode</code> component
056:         * 	represents a "node" in the tree.  The <code>TreeNode</code> component
057:         * 	is responsible for rendering:</p>
058:         * 
059:         *     <ul><li>A row of the tree lines that connect to other tree nodes.</li>
060:         * 	<li>An expand / collapse <code>IconHyperlink</code> if there is atleast
061:         * 	    1 child <code>TreeNode</code> (this will show or hide its child
062:         * 	    <code>TreeNode</code>(s)).</li>
063:         * 	<li>An optional <code>ImageHyperlink</code> that pertains to the
064:         * 	    content of the tree node.</li>
065:         * 	<li>Text or a <code>Hyperlink</code> for the content of the
066:         * 	    <code>TreeNode</code>.</li></ul>
067:         * 
068:         *     <p>	Portions of the <code>TreeNode</code> may be overriden using facets.
069:         * 	The following facets are supported:</p>
070:         * 
071:         *     <ul><li><div style="float:left; width: 100px;"><code>image</code></div>
072:         * 	    <div style="float:left; width: 50px;"><code>--</code></div>
073:         * 	    Replaces the <code>ImageHyperlink</code> which pertains to the
074:         * 	    content of the <code>TreeNode</code>.  When used properties that
075:         * 	    pertain to the <code>ImageHyperlink</code> will not have any
076:         * 	    effect.</li>
077:         * 	<li><div style="float:left; width: 100px;"><code>content</code></div>
078:         * 	    <div style="float:left; width: 50px;"><code>--</code></div>
079:         * 	    Replaces the static text/<code>Hyperlink</code> area.  When used
080:         * 	    properties that pertain to this area will not have any
081:         * 	    effect.</li></ul>
082:         * 
083:         * 
084:         *     <h3>Client Side Javascript Functions</h3>
085:         * 
086:         *     <p> None (although the <code>Tree</code> component does contain JavaScript functions).</p>
087:         * 
088:         * 
089:         *     <h3>Example:</h3>
090:         * 
091:         *     <p> For an example, please see the documentation for the <code>Tree</code> Tag.</p>
092:         * <p>Auto-generated component class.
093:         * Do <strong>NOT</strong> modify; all changes
094:         * <strong>will</strong> be lost!</p>
095:         */
096:
097:        public abstract class TreeNodeBase extends
098:                com.sun.rave.web.ui.component.TemplateComponentBase {
099:
100:            /**
101:             * <p>Construct a new <code>TreeNodeBase</code>.</p>
102:             */
103:            public TreeNodeBase() {
104:                super ();
105:                setRendererType("com.sun.rave.web.ui.TreeNode");
106:            }
107:
108:            /**
109:             * <p>Return the identifier of the component family to which this
110:             * component belongs.  This identifier, in conjunction with the value
111:             * of the <code>rendererType</code> property, may be used to select
112:             * the appropriate {@link Renderer} for this component instance.</p>
113:             */
114:            public String getFamily() {
115:                return "com.sun.rave.web.ui.TreeNode";
116:            }
117:
118:            // action
119:            private javax.faces.el.MethodBinding action = null;
120:
121:            /**
122:             * <p>	Specifies the <code>action</code> for the <code>Hyperlink</code> and
123:             * 	for the <code>HyperlinkImage</code> of this component.  The<code>Hyperlink</code> may alternately be defined via the
124:             * 	"<code>content</code>" facet, and the image via the
125:             * 	"<code>image</code>" facet.  See <code>Hyperlink</code> documentation
126:             * 	for more information on how to use <code>action</code>.</p><p>	This property will not apply to the facets when a facet is used.</p>
127:             */
128:            public javax.faces.el.MethodBinding getAction() {
129:                if (this .action != null) {
130:                    return this .action;
131:                }
132:                ValueBinding _vb = getValueBinding("action");
133:                if (_vb != null) {
134:                    return (javax.faces.el.MethodBinding) _vb
135:                            .getValue(getFacesContext());
136:                }
137:                return null;
138:            }
139:
140:            /**
141:             * <p>	Specifies the <code>action</code> for the <code>Hyperlink</code> and
142:             * 	for the <code>HyperlinkImage</code> of this component.  The<code>Hyperlink</code> may alternately be defined via the
143:             * 	"<code>content</code>" facet, and the image via the
144:             * 	"<code>image</code>" facet.  See <code>Hyperlink</code> documentation
145:             * 	for more information on how to use <code>action</code>.</p><p>	This property will not apply to the facets when a facet is used.</p>
146:             * @see #getAction()
147:             */
148:            public void setAction(javax.faces.el.MethodBinding action) {
149:                this .action = action;
150:            }
151:
152:            // actionListener
153:            private javax.faces.el.MethodBinding actionListener = null;
154:
155:            /**
156:             * <p>Method binding to a method that is invoked when this tree node is toggled
157:             *        open or close</p>
158:             */
159:            public javax.faces.el.MethodBinding getActionListener() {
160:                if (this .actionListener != null) {
161:                    return this .actionListener;
162:                }
163:                ValueBinding _vb = getValueBinding("actionListener");
164:                if (_vb != null) {
165:                    return (javax.faces.el.MethodBinding) _vb
166:                            .getValue(getFacesContext());
167:                }
168:                return null;
169:            }
170:
171:            /**
172:             * <p>Method binding to a method that is invoked when this tree node is toggled
173:             *        open or close</p>
174:             * @see #getActionListener()
175:             */
176:            public void setActionListener(
177:                    javax.faces.el.MethodBinding actionListener) {
178:                this .actionListener = actionListener;
179:            }
180:
181:            // expanded
182:            private boolean expanded = false;
183:            private boolean expanded_set = false;
184:
185:            /**
186:             * <p>	Specifies if this <code>TreeNode</code> will be expanded or collapsed,
187:             * 	in other words if its child <code>TreeNode</code>s should be
188:             * 	displayed.</p>
189:             */
190:            public boolean isExpanded() {
191:                if (this .expanded_set) {
192:                    return this .expanded;
193:                }
194:                ValueBinding _vb = getValueBinding("expanded");
195:                if (_vb != null) {
196:                    Object _result = _vb.getValue(getFacesContext());
197:                    if (_result == null) {
198:                        return false;
199:                    } else {
200:                        return ((Boolean) _result).booleanValue();
201:                    }
202:                }
203:                return false;
204:            }
205:
206:            /**
207:             * <p>	Specifies if this <code>TreeNode</code> will be expanded or collapsed,
208:             * 	in other words if its child <code>TreeNode</code>s should be
209:             * 	displayed.</p>
210:             * @see #isExpanded()
211:             */
212:            public void setExpanded(boolean expanded) {
213:                this .expanded = expanded;
214:                this .expanded_set = true;
215:            }
216:
217:            // imageURL
218:            private String imageURL = null;
219:
220:            /**
221:             * <p>	Specifies <code>imageURL</code> for the <code>ImageHyperlink</code>
222:             * 	of this component.  The image may alternately be defined
223:             * 	via the "<code>image</code>" facet.  The "<code>image</code>" facet may
224:             * 	be an <code>IconHyperlink</code> component to utilize<code>Theme</code> images.</p>  This property will not apply to the
225:             * 	facet when the facet used.
226:             */
227:            public String getImageURL() {
228:                if (this .imageURL != null) {
229:                    return this .imageURL;
230:                }
231:                ValueBinding _vb = getValueBinding("imageURL");
232:                if (_vb != null) {
233:                    return (String) _vb.getValue(getFacesContext());
234:                }
235:                return null;
236:            }
237:
238:            /**
239:             * <p>	Specifies <code>imageURL</code> for the <code>ImageHyperlink</code>
240:             * 	of this component.  The image may alternately be defined
241:             * 	via the "<code>image</code>" facet.  The "<code>image</code>" facet may
242:             * 	be an <code>IconHyperlink</code> component to utilize<code>Theme</code> images.</p>  This property will not apply to the
243:             * 	facet when the facet used.
244:             * @see #getImageURL()
245:             */
246:            public void setImageURL(String imageURL) {
247:                this .imageURL = imageURL;
248:            }
249:
250:            // style
251:            private String style = null;
252:
253:            /**
254:             * <p>CSS style(s) to be applied when this component is rendered.</p>
255:             */
256:            public String getStyle() {
257:                if (this .style != null) {
258:                    return this .style;
259:                }
260:                ValueBinding _vb = getValueBinding("style");
261:                if (_vb != null) {
262:                    return (String) _vb.getValue(getFacesContext());
263:                }
264:                return null;
265:            }
266:
267:            /**
268:             * <p>CSS style(s) to be applied when this component is rendered.</p>
269:             * @see #getStyle()
270:             */
271:            public void setStyle(String style) {
272:                this .style = style;
273:            }
274:
275:            // styleClass
276:            private String styleClass = null;
277:
278:            /**
279:             * <p>CSS style class(es) to be applied when this component is rendered.</p>
280:             */
281:            public String getStyleClass() {
282:                if (this .styleClass != null) {
283:                    return this .styleClass;
284:                }
285:                ValueBinding _vb = getValueBinding("styleClass");
286:                if (_vb != null) {
287:                    return (String) _vb.getValue(getFacesContext());
288:                }
289:                return null;
290:            }
291:
292:            /**
293:             * <p>CSS style class(es) to be applied when this component is rendered.</p>
294:             * @see #getStyleClass()
295:             */
296:            public void setStyleClass(String styleClass) {
297:                this .styleClass = styleClass;
298:            }
299:
300:            // target
301:            private String target = null;
302:
303:            /**
304:             * <p> Specifies the target for the <code>Hyperlink</code> and the<code>ImageHyperlink</code> of this component.  The<code>Hyperlink</code> may alternately be defined via the
305:             * 	"<code>content</code>" facet  of this tree node, and the image via the
306:             * 	"<code>image</code>" facet.</p><p>	This property will not apply to the facet when a facet is used.</p>
307:             */
308:            public String getTarget() {
309:                if (this .target != null) {
310:                    return this .target;
311:                }
312:                ValueBinding _vb = getValueBinding("target");
313:                if (_vb != null) {
314:                    return (String) _vb.getValue(getFacesContext());
315:                }
316:                return null;
317:            }
318:
319:            /**
320:             * <p> Specifies the target for the <code>Hyperlink</code> and the<code>ImageHyperlink</code> of this component.  The<code>Hyperlink</code> may alternately be defined via the
321:             * 	"<code>content</code>" facet  of this tree node, and the image via the
322:             * 	"<code>image</code>" facet.</p><p>	This property will not apply to the facet when a facet is used.</p>
323:             * @see #getTarget()
324:             */
325:            public void setTarget(String target) {
326:                this .target = target;
327:            }
328:
329:            // text
330:            private String text = null;
331:
332:            /**
333:             * <p>	Specifies the <code>text</code> for this component.  If a<code>url</code> or <code>action</code> is also specified, these
334:             * 	properties will be used to create a <code>Hyperlink</code> as the
335:             * 	content of this component.  If neither the<code>action</code> or <code>url</code> properties are specified, this
336:             * 	property will be used to display static text as the content for this
337:             * 	component.</p><p>	Alternately, the "<code>content</code>" facet may be used to specify
338:             * 	the content for this component.  If this facet is used, this
339:             * 	property has no effect.</p>
340:             */
341:            public String getText() {
342:                if (this .text != null) {
343:                    return this .text;
344:                }
345:                ValueBinding _vb = getValueBinding("text");
346:                if (_vb != null) {
347:                    return (String) _vb.getValue(getFacesContext());
348:                }
349:                return null;
350:            }
351:
352:            /**
353:             * <p>	Specifies the <code>text</code> for this component.  If a<code>url</code> or <code>action</code> is also specified, these
354:             * 	properties will be used to create a <code>Hyperlink</code> as the
355:             * 	content of this component.  If neither the<code>action</code> or <code>url</code> properties are specified, this
356:             * 	property will be used to display static text as the content for this
357:             * 	component.</p><p>	Alternately, the "<code>content</code>" facet may be used to specify
358:             * 	the content for this component.  If this facet is used, this
359:             * 	property has no effect.</p>
360:             * @see #getText()
361:             */
362:            public void setText(String text) {
363:                this .text = text;
364:            }
365:
366:            // toolTip
367:            private String toolTip = null;
368:
369:            /**
370:             * <p>Display the text as a tooltip for this component</p>
371:             */
372:            public String getToolTip() {
373:                if (this .toolTip != null) {
374:                    return this .toolTip;
375:                }
376:                ValueBinding _vb = getValueBinding("toolTip");
377:                if (_vb != null) {
378:                    return (String) _vb.getValue(getFacesContext());
379:                }
380:                return null;
381:            }
382:
383:            /**
384:             * <p>Display the text as a tooltip for this component</p>
385:             * @see #getToolTip()
386:             */
387:            public void setToolTip(String toolTip) {
388:                this .toolTip = toolTip;
389:            }
390:
391:            // url
392:            private String url = null;
393:
394:            /**
395:             * <p>	Specifies the <code>url</code> for the <code>Hyperlink</code> and the<code>ImageHyperlink</code> for this component.  The<code>Hyperlink</code> may alternately be defined via the
396:             * 	"<code>content</code>" facet, and the image via the
397:             * 	"<code>image</code>" facet.</p><p>	This property will not apply to the facet when a facet is used.</p>
398:             */
399:            public String getUrl() {
400:                if (this .url != null) {
401:                    return this .url;
402:                }
403:                ValueBinding _vb = getValueBinding("url");
404:                if (_vb != null) {
405:                    return (String) _vb.getValue(getFacesContext());
406:                }
407:                return null;
408:            }
409:
410:            /**
411:             * <p>	Specifies the <code>url</code> for the <code>Hyperlink</code> and the<code>ImageHyperlink</code> for this component.  The<code>Hyperlink</code> may alternately be defined via the
412:             * 	"<code>content</code>" facet, and the image via the
413:             * 	"<code>image</code>" facet.</p><p>	This property will not apply to the facet when a facet is used.</p>
414:             * @see #getUrl()
415:             */
416:            public void setUrl(String url) {
417:                this .url = url;
418:            }
419:
420:            // visible
421:            private boolean visible = false;
422:            private boolean visible_set = false;
423:
424:            /**
425:             * <p>Use the visible attribute to indicate whether the component should be
426:             *     viewable by the user in the rendered HTML page. If set to false, the
427:             *     HTML code for the component is present in the page, but the component
428:             *     is hidden with style attributes. By default, visible is set to true, so
429:             *     HTML for the component HTML is included and visible to the user. If the
430:             *     component is not visible, it can still be processed on subsequent form
431:             *     submissions because the HTML is present.</p>
432:             */
433:            public boolean isVisible() {
434:                if (this .visible_set) {
435:                    return this .visible;
436:                }
437:                ValueBinding _vb = getValueBinding("visible");
438:                if (_vb != null) {
439:                    Object _result = _vb.getValue(getFacesContext());
440:                    if (_result == null) {
441:                        return false;
442:                    } else {
443:                        return ((Boolean) _result).booleanValue();
444:                    }
445:                }
446:                return true;
447:            }
448:
449:            /**
450:             * <p>Use the visible attribute to indicate whether the component should be
451:             *     viewable by the user in the rendered HTML page. If set to false, the
452:             *     HTML code for the component is present in the page, but the component
453:             *     is hidden with style attributes. By default, visible is set to true, so
454:             *     HTML for the component HTML is included and visible to the user. If the
455:             *     component is not visible, it can still be processed on subsequent form
456:             *     submissions because the HTML is present.</p>
457:             * @see #isVisible()
458:             */
459:            public void setVisible(boolean visible) {
460:                this .visible = visible;
461:                this .visible_set = true;
462:            }
463:
464:            /**
465:             * <p>Restore the state of this component.</p>
466:             */
467:            public void restoreState(FacesContext _context, Object _state) {
468:                Object _values[] = (Object[]) _state;
469:                super .restoreState(_context, _values[0]);
470:                this .action = (javax.faces.el.MethodBinding) restoreAttachedState(
471:                        _context, _values[1]);
472:                this .actionListener = (javax.faces.el.MethodBinding) restoreAttachedState(
473:                        _context, _values[2]);
474:                this .expanded = ((Boolean) _values[3]).booleanValue();
475:                this .expanded_set = ((Boolean) _values[4]).booleanValue();
476:                this .imageURL = (String) _values[5];
477:                this .style = (String) _values[6];
478:                this .styleClass = (String) _values[7];
479:                this .target = (String) _values[8];
480:                this .text = (String) _values[9];
481:                this .toolTip = (String) _values[10];
482:                this .url = (String) _values[11];
483:                this .visible = ((Boolean) _values[12]).booleanValue();
484:                this .visible_set = ((Boolean) _values[13]).booleanValue();
485:            }
486:
487:            /**
488:             * <p>Save the state of this component.</p>
489:             */
490:            public Object saveState(FacesContext _context) {
491:                Object _values[] = new Object[14];
492:                _values[0] = super .saveState(_context);
493:                _values[1] = saveAttachedState(_context, action);
494:                _values[2] = saveAttachedState(_context, actionListener);
495:                _values[3] = this .expanded ? Boolean.TRUE : Boolean.FALSE;
496:                _values[4] = this .expanded_set ? Boolean.TRUE : Boolean.FALSE;
497:                _values[5] = this .imageURL;
498:                _values[6] = this .style;
499:                _values[7] = this .styleClass;
500:                _values[8] = this .target;
501:                _values[9] = this .text;
502:                _values[10] = this .toolTip;
503:                _values[11] = this .url;
504:                _values[12] = this .visible ? Boolean.TRUE : Boolean.FALSE;
505:                _values[13] = this.visible_set ? Boolean.TRUE : Boolean.FALSE;
506:                return _values;
507:            }
508:
509:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.