Source Code Cross Referenced for ElementTreeImpl.java in  » Ajax » ItsNat » org » itsnat » impl » core » domutil » 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 » Ajax » ItsNat » org.itsnat.impl.core.domutil 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:          ItsNat Java Web Application Framework
003:          Copyright (C) 2007 Innowhere Software Services S.L., Spanish Company
004:          Author: Jose Maria Arranz Santamaria
005:
006:          This program is free software: you can redistribute it and/or modify
007:          it under the terms of the GNU Affero General Public License as published by
008:          the Free Software Foundation, either version 3 of the License, or
009:          (at your option) any later version. See the GNU Affero General Public 
010:          License for more details. See the copy of the GNU Affero General Public License
011:          included in this program. If not, see <http://www.gnu.org/licenses/>.
012:         */
013:
014:        package org.itsnat.impl.core.domutil;
015:
016:        import org.itsnat.core.ItsNatDocument;
017:        import org.itsnat.core.ItsNatException;
018:        import org.itsnat.core.domutil.ElementTreeNodeRenderer;
019:        import org.itsnat.core.domutil.ElementTree;
020:        import org.itsnat.core.domutil.ElementTreeNode;
021:        import org.itsnat.core.domutil.ElementTreeNodeStructure;
022:        import org.itsnat.impl.core.ItsNatDocumentImpl;
023:        import org.w3c.dom.Element;
024:        import org.w3c.dom.Node;
025:
026:        /**
027:         *
028:         * @author jmarranz
029:         */
030:        public class ElementTreeImpl implements  ElementTree {
031:            protected ElementTreeNodeListImpl rootContainerList; // Sirve para crear y borrar el único posible nodo: el root
032:            protected boolean usePatternMarkupToRender;
033:
034:            /**
035:             * Creates a new instance of ElementTreeImpl
036:             */
037:            public ElementTreeImpl(ItsNatDocumentImpl itsNatDoc,
038:                    boolean treeTable, Element parentElement,
039:                    boolean removePattern, ElementTreeNodeStructure structure,
040:                    ElementTreeNodeRenderer renderer) {
041:                this .rootContainerList = itsNatDoc
042:                        .createElementTreeNodeListInternal(treeTable,
043:                                parentElement, removePattern, structure,
044:                                renderer);
045:
046:                if (!removePattern && (rootContainerList.getLength() > 1)) // Si es 1 es el nodo patrón que pasa a ser el root pero no debería haber nada más
047:                    throw new ItsNatException(
048:                            "A tree only can have a root node");
049:
050:                this .usePatternMarkupToRender = itsNatDoc
051:                        .isUsePatternMarkupToRender();
052:            }
053:
054:            public boolean isUsePatternMarkupToRender() {
055:                return usePatternMarkupToRender;
056:            }
057:
058:            public void setUsePatternMarkupToRender(
059:                    boolean usePatternMarkupToRender) {
060:                this .usePatternMarkupToRender = usePatternMarkupToRender;
061:            }
062:
063:            public Element getTreeContainerElement() {
064:                return rootContainerList.getTreeContainerElement();
065:            }
066:
067:            public ItsNatDocument getItsNatDocument() {
068:                return rootContainerList.getItsNatDocument();
069:            }
070:
071:            public Element getParentElement() {
072:                return rootContainerList.getParentElement();
073:            }
074:
075:            public boolean hasTreeNodeRoot() {
076:                return !rootContainerList.isEmpty();
077:            }
078:
079:            public ElementTreeNode getRootNode() {
080:                if (hasTreeNodeRoot())
081:                    return rootContainerList.getFirstTreeNode();
082:                else
083:                    return null;
084:            }
085:
086:            public ElementTreeNode addRootNode() {
087:                if (hasTreeNodeRoot())
088:                    throw new ItsNatException("Already has a root node");
089:
090:                return rootContainerList.addTreeNode();
091:            }
092:
093:            public ElementTreeNode addRootNode(Object value) {
094:                if (hasTreeNodeRoot())
095:                    throw new ItsNatException("Already has a root node");
096:
097:                return rootContainerList.addTreeNode(value);
098:            }
099:
100:            public void removeRootNode() {
101:                if (!hasTreeNodeRoot()) // Ya está quitado     
102:                    return;
103:
104:                rootContainerList.removeAllTreeNodes();
105:            }
106:
107:            public Element getRootPatternElement() {
108:                return rootContainerList.getChildPatternElement();
109:            }
110:
111:            public ElementTreeNode getElementTreeNodeFromNode(Node node) {
112:                return getElementTreeNodeFromNode(node,
113:                        getTreeContainerElement());
114:            }
115:
116:            public ElementTreeNode getElementTreeNodeFromNode(Node node,
117:                    Element treeContainerElem) {
118:                ElementTreeNodeImpl rootNode = (ElementTreeNodeImpl) getRootNode();
119:                if (rootNode == null)
120:                    return null;
121:
122:                return rootNode.getElementTreeNodeFromNode(node,
123:                        treeContainerElem);
124:            }
125:
126:            public ElementTreeNode getElementTreeNodeFromPath(int[] path) {
127:                // No se usa, para un posible uso recuperar.
128:                ElementTreeNodeImpl rootNode = (ElementTreeNodeImpl) getRootNode();
129:                if (rootNode == null)
130:                    return null;
131:
132:                return rootNode.getElementTreeNodeFromPath(path);
133:            }
134:
135:            public ElementTreeNode getElementTreeNodeFromPath(int[] path,
136:                    int fromIndex) {
137:                // No se usa, para un posible uso recuperar.       
138:                ElementTreeNodeImpl rootNode = (ElementTreeNodeImpl) getRootNode();
139:                if (rootNode == null)
140:                    return null;
141:
142:                return rootNode.getElementTreeNodeFromPath(path, fromIndex);
143:            }
144:
145:            public ElementTreeNode getElementTreeNodeFromRow(int row) {
146:                ElementTreeNodeImpl rootNode = (ElementTreeNodeImpl) getRootNode();
147:                if (rootNode == null)
148:                    return null; // No tiene root (el root es row = 0)
149:
150:                if (row == 0)
151:                    return rootNode;
152:
153:                return rootNode.getElementTreeNodeFromRow(row);
154:            }
155:
156:            public ElementTreeNodeRenderer getElementTreeNodeRenderer() {
157:                return rootContainerList.getElementTreeNodeRenderer();
158:            }
159:
160:            public void setElementTreeNodeRenderer(
161:                    ElementTreeNodeRenderer renderer) {
162:                rootContainerList.setElementTreeNodeRenderer(renderer);
163:            }
164:
165:            public ElementTreeNodeStructure getElementTreeNodeStructure() {
166:                return rootContainerList.getElementTreeNodeStructure();
167:            }
168:
169:            public void setElementTreeNodeStructure(
170:                    ElementTreeNodeStructure structure) {
171:                rootContainerList.setElementTreeNodeStructure(structure);
172:            }
173:
174:            public boolean containsUserValueName(String name) {
175:                return rootContainerList.containsUserValueName(name);
176:            }
177:
178:            public Object removeUserValue(String name) {
179:                return rootContainerList.removeUserValue(name);
180:            }
181:
182:            public Object getUserValue(String name) {
183:                return rootContainerList.getUserValue(name);
184:            }
185:
186:            public Object setUserValue(String name, Object value) {
187:                return rootContainerList.setUserValue(name, value);
188:            }
189:
190:            public String[] getUserValueNames() {
191:                return rootContainerList.getUserValueNames();
192:            }
193:
194:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.