Source Code Cross Referenced for XmlEditorTreeDefinitionNode.java in  » Report » jmagallanes-1.0 » com » calipso » xmleditor » 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 » Report » jmagallanes 1.0 » com.calipso.xmleditor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.calipso.xmleditor;
002:
003:        import org.exolab.castor.xml.schema.AttributeDecl;
004:        import org.exolab.castor.xml.schema.SimpleTypesFactory;
005:
006:        import java.util.*;
007:
008:        /**
009:         *
010:         * User: soliveri
011:         * Date: 25-sep-2003
012:         * Time: 14:19:12
013:         *
014:         */
015:
016:        public class XmlEditorTreeDefinitionNode {
017:
018:            private Map subNodes;
019:            private String value;
020:            private boolean mustHaveChilds;
021:            private Vector itemsKeys;
022:            private HashMap items;
023:
024:            public XmlEditorTreeDefinitionNode(String value) {
025:                this .value = value;
026:            }
027:
028:            /**
029:             * Agrega un nodo a los hijos del nodo.
030:             * @param value
031:             * @return
032:             */
033:            public XmlEditorTreeDefinitionNode addNodeFrom(String value) {
034:                XmlEditorTreeDefinitionNode node = null;
035:                node = new XmlEditorTreeDefinitionNode(value);
036:                getSubnodes().put(value, node);
037:                return node;
038:            }
039:
040:            /**
041:             * Agrega los atributos al nodo.
042:             * @param enumeration
043:             * @throws XmlEditorException
044:             */
045:            public void addNodeAttributes(Enumeration enumeration)
046:                    throws XmlEditorException {
047:                while (enumeration.hasMoreElements()) {
048:                    AttributeDecl attributeDecl = (AttributeDecl) enumeration
049:                            .nextElement();
050:                    int type = attributeDecl.getSimpleType()
051:                            .getBuiltInBaseType().getTypeCode();
052:                    switch (type) {
053:                    case SimpleTypesFactory.STRING_TYPE:
054:                        getItems().put(
055:                                attributeDecl.getName(),
056:                                new XmlEditorTreeNodeItemDefinition(
057:                                        attributeDecl.getName().toUpperCase(),
058:                                        attributeDecl.isOptional(),
059:                                        XmlEditorDataType.STRING, attributeDecl
060:                                                .getName()));
061:                        break;
062:                    case SimpleTypesFactory.NMTOKEN_TYPE:
063:                        Enumeration facets = attributeDecl.getSimpleType()
064:                                .getLocalFacets();
065:                        getItems().put(
066:                                attributeDecl.getName(),
067:                                new XmlEditorTreeNodeItemDefinition(
068:                                        attributeDecl.getName().toUpperCase(),
069:                                        attributeDecl.isOptional(),
070:                                        XmlEditorDataType.TOKENS, facets));
071:                        break;
072:                    case SimpleTypesFactory.BOOLEAN_TYPE:
073:                        getItems().put(
074:                                attributeDecl.getName(),
075:                                new XmlEditorTreeNodeItemDefinition(
076:                                        attributeDecl.getName().toUpperCase(),
077:                                        attributeDecl.isOptional(),
078:                                        XmlEditorDataType.BOOLEAN,
079:                                        attributeDecl.getName()));
080:                        break;
081:                    case SimpleTypesFactory.INTEGER_TYPE:
082:                    case SimpleTypesFactory.INT_TYPE:
083:                    case SimpleTypesFactory.DECIMAL_TYPE: //Todo: Mejorar el tratamiento de este tipo en particular
084:                        getItems().put(
085:                                attributeDecl.getName(),
086:                                new XmlEditorTreeNodeItemDefinition(
087:                                        attributeDecl.getName().toUpperCase(),
088:                                        attributeDecl.isOptional(),
089:                                        XmlEditorDataType.INTEGER,
090:                                        attributeDecl.getName()));
091:                        break;
092:                    default:
093:                        throw new XmlEditorException(
094:                                "No existe el tipo de dato solicitado");
095:                    }
096:                    /*      if(attributeDecl.getSimpleType().getBuiltInBaseType().getTypeCode() == SimpleTypesFactory.STRING_TYPE) {
097:                     getItems().put(attributeDecl.getName(), new XmlEditorTreeNodeItemDefinition(attributeDecl.getName().toUpperCase(), attributeDecl.isOptional(), XmlEditorDataType.STRING, attributeDecl.getName()));
098:                     } else if (attributeDecl.getSimpleType().getBuiltInBaseType().getTypeCode() == SimpleTypesFactory.NMTOKEN_TYPE) {
099:                     Enumeration facets = attributeDecl.getSimpleType().getLocalFacets();
100:                     getItems().put(attributeDecl.getName(), new XmlEditorTreeNodeItemDefinition(attributeDecl.getName().toUpperCase(), attributeDecl.isOptional(), XmlEditorDataType.TOKENS, facets));
101:                     } else if (attributeDecl.getSimpleType().getBuiltInBaseType().getTypeCode() == SimpleTypesFactory.BOOLEAN_TYPE) {
102:                     getItems().put(attributeDecl.getName(), new XmlEditorTreeNodeItemDefinition(attributeDecl.getName().toUpperCase(), attributeDecl.isOptional(), XmlEditorDataType.BOOLEAN, attributeDecl.getName()));
103:                     }*/
104:                    getItemsKeys().add(attributeDecl.getName());
105:                }
106:            }
107:
108:            public String getValue() {
109:                return value;
110:            }
111:
112:            public void setMustHaveChilds(int childs) {
113:                if (childs >= 1) {
114:                    this .mustHaveChilds = true;
115:                } else {
116:                    this .mustHaveChilds = false;
117:                }
118:            }
119:
120:            public Map getSubnodes() {
121:                if (subNodes == null) {
122:                    subNodes = new HashMap();
123:                }
124:                return subNodes;
125:            }
126:
127:            public Vector getItemsKeys() {
128:                if (itemsKeys == null) {
129:                    itemsKeys = new Vector();
130:                }
131:                return itemsKeys;
132:            }
133:
134:            public HashMap getItems() {
135:                if (items == null) {
136:                    items = new HashMap();
137:                }
138:                return items;
139:            }
140:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.