Source Code Cross Referenced for Tree.java in  » J2EE » webwork-2.2.6 » com » opensymphony » webwork » components » 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 » J2EE » webwork 2.2.6 » com.opensymphony.webwork.components 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2005 ePlus Corporation. All Rights Reserved.
003:         */
004:        package com.opensymphony.webwork.components;
005:
006:        import com.opensymphony.xwork.util.OgnlValueStack;
007:
008:        import javax.servlet.http.HttpServletRequest;
009:        import javax.servlet.http.HttpServletResponse;
010:        import java.io.Writer;
011:
012:        /**
013:         * <!-- START SNIPPET: javadoc -->
014:         *
015:         * Renders a tree widget with AJAX support.<p/>
016:         * 
017:         * The id attribute is normally specified, such that it could be looked up using
018:         * javascript if necessary.<p/>
019:         *
020:         * <!-- END SNIPPET: javadoc -->
021:         *
022:         * <p/> <b>Examples</b>
023:         *
024:         * <pre>
025:         * <!-- START SNIPPET: example -->
026:         * 
027:         * &lt-- statically --&gt;
028:         * &lt;ww:tree id="..." label="..."&gt;
029:         *    &lt;ww:treenode id="..." label="..." /&gt;
030:         *    &lt;ww:treenode id="..." label="..."&gt;
031:         *        &lt;ww:treenode id="..." label="..." /&gt;
032:         *        &lt;ww:treenode id="..." label="..." /&gt;
033:         *    &;lt;/ww:treenode&gt;
034:         *    &lt;ww:treenode id="..." label="..." /&gt;
035:         * &lt;/ww:tree&gt;
036:         * 
037:         * &lt;-- dynamically --&gt;
038:         * &lt;ww:tree 
039:         *          id="..."
040:         *          rootNode="..."
041:         *          nodeIdProperty="..."
042:         *          nodeTitleProperty="..."
043:         *          childCollectionProperty="..." /&gt;
044:         * 
045:         * <!-- END SNIPPET: example -->
046:         * </pre>
047:         *
048:         * Created : Oct 27, 2005 3:56:23 PM
049:         *
050:         * @author Jason Carreira <jcarreira@eplus.com>
051:         * @author tm_jee
052:         *
053:         * @ww.tag name="tree" tld-body-content="JSP" tld-tag-class="com.opensymphony.webwork.views.jsp.ui.TreeTag"
054:         * description="Render a tree widget."
055:         */
056:        public class Tree extends ClosingUIBean {
057:            private static final String TEMPLATE = "tree-close";
058:            private static final String OPEN_TEMPLATE = "tree";
059:            private String toggle = "fade";
060:            private String treeSelectedTopic;
061:            private String treeExpandedTopic;
062:            private String treeCollapsedTopic;
063:            protected String rootNodeAttr;
064:            protected String childCollectionProperty;
065:            protected String nodeTitleProperty;
066:            protected String nodeIdProperty;
067:            private String showRootGrid;
068:
069:            private String showGrid;
070:            private String blankIconSrc;
071:            private String gridIconSrcL;
072:            private String gridIconSrcV;
073:            private String gridIconSrcP;
074:            private String gridIconSrcC;
075:            private String gridIconSrcX;
076:            private String gridIconSrcY;
077:            private String expandIconSrcPlus;
078:            private String expandIconSrcMinus;
079:            private String iconWidth;
080:            private String iconHeight;
081:            private String toggleDuration;
082:            private String templateCssPath;
083:
084:            public Tree(OgnlValueStack stack, HttpServletRequest request,
085:                    HttpServletResponse response) {
086:                super (stack, request, response);
087:            }
088:
089:            public boolean start(Writer writer) {
090:                boolean result = super .start(writer);
091:
092:                if (this .label == null) {
093:                    if ((rootNodeAttr == null)
094:                            || (childCollectionProperty == null)
095:                            || (nodeTitleProperty == null)
096:                            || (nodeIdProperty == null)) {
097:                        fieldError(
098:                                "label",
099:                                "The TreeTag requires either a value for 'label' or ALL of 'rootNode', "
100:                                        + "'childCollectionProperty', 'nodeTitleProperty', and 'nodeIdProperty'",
101:                                null);
102:                    }
103:                }
104:                return result;
105:            }
106:
107:            protected void evaluateExtraParams() {
108:                super .evaluateExtraParams();
109:
110:                if (toggle != null) {
111:                    addParameter("toggle", findString(toggle));
112:                }
113:
114:                if (treeSelectedTopic != null) {
115:                    addParameter("treeSelectedTopic",
116:                            findString(treeSelectedTopic));
117:                }
118:
119:                if (treeExpandedTopic != null) {
120:                    addParameter("treeExpandedTopic",
121:                            findString(treeExpandedTopic));
122:                }
123:
124:                if (treeCollapsedTopic != null) {
125:                    addParameter("treeCollapsedTopic",
126:                            findString(treeCollapsedTopic));
127:                }
128:
129:                if (rootNodeAttr != null) {
130:                    addParameter("rootNode", findValue(rootNodeAttr));
131:                }
132:
133:                if (childCollectionProperty != null) {
134:                    addParameter("childCollectionProperty",
135:                            findString(childCollectionProperty));
136:                }
137:
138:                if (nodeTitleProperty != null) {
139:                    addParameter("nodeTitleProperty",
140:                            findString(nodeTitleProperty));
141:                }
142:
143:                if (nodeIdProperty != null) {
144:                    addParameter("nodeIdProperty", findString(nodeIdProperty));
145:                }
146:
147:                if (showRootGrid != null) {
148:                    addParameter("showRootGrid", findValue(showRootGrid,
149:                            Boolean.class));
150:                }
151:
152:                if (showGrid != null) {
153:                    addParameter("showGrid", findValue(showGrid, Boolean.class));
154:                }
155:
156:                if (blankIconSrc != null) {
157:                    addParameter("blankIconSrc", findString(blankIconSrc));
158:                }
159:
160:                if (gridIconSrcL != null) {
161:                    addParameter("gridIconSrcL", findString(gridIconSrcL));
162:                }
163:
164:                if (gridIconSrcV != null) {
165:                    addParameter("gridIconSrcV", findString(gridIconSrcV));
166:                }
167:
168:                if (gridIconSrcP != null) {
169:                    addParameter("gridIconSrcP", findString(gridIconSrcP));
170:                }
171:
172:                if (gridIconSrcC != null) {
173:                    addParameter("gridIconSrcC", findString(gridIconSrcC));
174:                }
175:
176:                if (gridIconSrcX != null) {
177:                    addParameter("gridIconSrcX", findString(gridIconSrcX));
178:                }
179:
180:                if (gridIconSrcY != null) {
181:                    addParameter("gridIconSrcY", findString(gridIconSrcY));
182:                }
183:
184:                if (expandIconSrcPlus != null) {
185:                    addParameter("expandIconSrcPlus",
186:                            findString(expandIconSrcPlus));
187:                }
188:
189:                if (expandIconSrcMinus != null) {
190:                    addParameter("expandIconSrcMinus",
191:                            findString(expandIconSrcMinus));
192:                }
193:
194:                if (iconWidth != null) {
195:                    addParameter("iconWidth", findValue(iconWidth,
196:                            Integer.class));
197:                }
198:                if (iconHeight != null) {
199:                    addParameter("iconHeight", findValue(iconHeight,
200:                            Integer.class));
201:                }
202:                if (toggleDuration != null) {
203:                    addParameter("toggleDuration", findValue(toggleDuration,
204:                            Integer.class));
205:                }
206:                if (templateCssPath != null) {
207:                    addParameter("templateCssPath", findString(templateCssPath));
208:                }
209:            }
210:
211:            public String getDefaultOpenTemplate() {
212:                return OPEN_TEMPLATE;
213:            }
214:
215:            protected String getDefaultTemplate() {
216:                return TEMPLATE;
217:            }
218:
219:            public String getToggle() {
220:                return toggle;
221:            }
222:
223:            /**
224:             * The toggle property.
225:             * @ww.tagattribute required="false"
226:             */
227:            public void setToggle(String toggle) {
228:                this .toggle = toggle;
229:            }
230:
231:            public String getTreeSelectedTopic() {
232:                return treeSelectedTopic;
233:            }
234:
235:            /**
236:             * The treeSelectedTopic property.
237:             * @ww.tagattribute required="false"
238:             */
239:            public void setTreeSelectedTopic(String treeSelectedTopic) {
240:                this .treeSelectedTopic = treeSelectedTopic;
241:            }
242:
243:            public String getTreeExpandedTopic() {
244:                return treeExpandedTopic;
245:            }
246:
247:            /**
248:             * The treeExpandedTopic property.
249:             * @ww.tagattribute required="false"
250:             */
251:            public void setTreeExpandedTopic(String treeExpandedTopic) {
252:                this .treeExpandedTopic = treeExpandedTopic;
253:            }
254:
255:            public String getTreeCollapsedTopic() {
256:                return treeCollapsedTopic;
257:            }
258:
259:            /**
260:             * The treeCollapsedTopic property.
261:             * @ww.tagattribute required="false"
262:             */
263:            public void setTreeCollapsedTopic(String treeCollapsedTopic) {
264:                this .treeCollapsedTopic = treeCollapsedTopic;
265:            }
266:
267:            public String getRootNode() {
268:                return rootNodeAttr;
269:            }
270:
271:            /**
272:             * The rootNode property.
273:             * @ww.tagattribute required="false"
274:             */
275:            public void setRootNode(String rootNode) {
276:                this .rootNodeAttr = rootNode;
277:            }
278:
279:            public String getChildCollectionProperty() {
280:                return childCollectionProperty;
281:            }
282:
283:            /**
284:             * The childCollectionProperty property.
285:             * @ww.tagattribute required="false"
286:             */
287:            public void setChildCollectionProperty(
288:                    String childCollectionProperty) {
289:                this .childCollectionProperty = childCollectionProperty;
290:            }
291:
292:            public String getNodeTitleProperty() {
293:                return nodeTitleProperty;
294:            }
295:
296:            /**
297:             * The nodeTitleProperty property.
298:             * @ww.tagattribute required="false"
299:             */
300:            public void setNodeTitleProperty(String nodeTitleProperty) {
301:                this .nodeTitleProperty = nodeTitleProperty;
302:            }
303:
304:            public String getNodeIdProperty() {
305:                return nodeIdProperty;
306:            }
307:
308:            /**
309:             * The nodeIdProperty property.
310:             * @ww.tagattribute required="false"
311:             */
312:            public void setNodeIdProperty(String nodeIdProperty) {
313:                this .nodeIdProperty = nodeIdProperty;
314:            }
315:
316:            /**
317:             * The showRootGrid property (default true).
318:             * @ww.tagattribute required="false"
319:             */
320:            public void setShowRootGrid(String showRootGrid) {
321:                this .showRootGrid = showRootGrid;
322:            }
323:
324:            public String getShowRootGrid() {
325:                return showRootGrid;
326:            }
327:
328:            public String getBlankIconSrc() {
329:                return blankIconSrc;
330:            }
331:
332:            /**
333:             * Blank icon image source.
334:             * @ww.tagattribute required="false"
335:             */
336:            public void setBlankIconSrc(String blankIconSrc) {
337:                this .blankIconSrc = blankIconSrc;
338:            }
339:
340:            public String getExpandIconSrcMinus() {
341:                return expandIconSrcMinus;
342:            }
343:
344:            /**
345:             * Expand icon (-) image source.
346:             * @ww.tagattribute required="false"
347:             */
348:            public void setExpandIconSrcMinus(String expandIconSrcMinus) {
349:                this .expandIconSrcMinus = expandIconSrcMinus;
350:            }
351:
352:            public String getExpandIconSrcPlus() {
353:                return expandIconSrcPlus;
354:            }
355:
356:            /**
357:             * Expand Icon (+) image source.
358:             * @ww.tagattribute required="false"
359:             */
360:            public void setExpandIconSrcPlus(String expandIconSrcPlus) {
361:                this .expandIconSrcPlus = expandIconSrcPlus;
362:            }
363:
364:            public String getGridIconSrcC() {
365:                return gridIconSrcC;
366:            }
367:
368:            /**
369:             * Image source for under child item child icons.
370:             * @ww.tagattribute required="false"
371:             */
372:            public void setGridIconSrcC(String gridIconSrcC) {
373:                this .gridIconSrcC = gridIconSrcC;
374:            }
375:
376:            public String getGridIconSrcL() {
377:                return gridIconSrcL;
378:            }
379:
380:            /**
381:             * Image source for last child grid.
382:             * @ww.tagattribute required="false"
383:             */
384:            public void setGridIconSrcL(String gridIconSrcL) {
385:                this .gridIconSrcL = gridIconSrcL;
386:            }
387:
388:            public String getGridIconSrcP() {
389:                return gridIconSrcP;
390:            }
391:
392:            /**
393:             * Image source for under parent item child icons.
394:             * @ww.tagattribute required="false"
395:             */
396:            public void setGridIconSrcP(String gridIconSrcP) {
397:                this .gridIconSrcP = gridIconSrcP;
398:            }
399:
400:            public String getGridIconSrcV() {
401:                return gridIconSrcV;
402:            }
403:
404:            /**
405:             * Image source for vertical line.
406:             * @ww.tagattribute required="false"
407:             */
408:            public void setGridIconSrcV(String gridIconSrcV) {
409:                this .gridIconSrcV = gridIconSrcV;
410:            }
411:
412:            public String getGridIconSrcX() {
413:                return gridIconSrcX;
414:            }
415:
416:            /**
417:             * Image source for grid for sole root item.
418:             * @ww.tagattribute required="false"
419:             */
420:            public void setGridIconSrcX(String gridIconSrcX) {
421:                this .gridIconSrcX = gridIconSrcX;
422:            }
423:
424:            public String getGridIconSrcY() {
425:                return gridIconSrcY;
426:            }
427:
428:            /**
429:             * Image source for grid for last root item.
430:             * @ww.tagattribute required="false"
431:             */
432:            public void setGridIconSrcY(String gridIconSrcY) {
433:                this .gridIconSrcY = gridIconSrcY;
434:            }
435:
436:            public String getIconHeight() {
437:                return iconHeight;
438:            }
439:
440:            /**
441:             * Icon height (default 18 pixels).
442:             * @ww.tagattribute required="false"
443:             */
444:            public void setIconHeight(String iconHeight) {
445:                this .iconHeight = iconHeight;
446:            }
447:
448:            public String getIconWidth() {
449:                return iconWidth;
450:            }
451:
452:            /**
453:             * Icon width (default 19 pixels).
454:             * @ww.tagattribute required="false"
455:             */
456:            public void setIconWidth(String iconWidth) {
457:                this .iconWidth = iconWidth;
458:            }
459:
460:            public String getTemplateCssPath() {
461:                return templateCssPath;
462:            }
463:
464:            /**
465:             * Template css path (default {contextPath}/struts/tree.css.
466:             * @ww.tagattribute required="false"
467:             */
468:            public void setTemplateCssPath(String templateCssPath) {
469:                this .templateCssPath = templateCssPath;
470:            }
471:
472:            public String getToggleDuration() {
473:                return toggleDuration;
474:            }
475:
476:            /**
477:             * Toggle duration (default 150 ms)
478:             * @ww.tagattribute required="false"
479:             */
480:            public void setToggleDuration(String toggleDuration) {
481:                this .toggleDuration = toggleDuration;
482:            }
483:
484:            public String getShowGrid() {
485:                return showGrid;
486:            }
487:
488:            /**
489:             * Show grid (default true).
490:             * @ww.tagattribute required="false"
491:             */
492:            public void setShowGrid(String showGrid) {
493:                this.showGrid = showGrid;
494:            }
495:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.