Source Code Cross Referenced for XContainer.java in  » XML » activexml » org » xdev » base » xssl » 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 » XML » activexml » org.xdev.base.xssl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Created on Jul 14, 2003
003:         *
004:         * To change the template for this generated file go to
005:         * Window>Preferences>Java>Code Generation>Code and Comments
006:         */
007:        package org.xdev.base.xssl;
008:
009:        import java.util.ArrayList;
010:        import java.util.HashMap;
011:        import java.util.Iterator;
012:
013:        import org.xdev.base.util.ServerUtilities;
014:        import org.xdev.base.util.Tools;
015:        import org.xdev.base.xssl.text.TextAppend;
016:
017:        /**
018:         * @author AYegorov
019:         *
020:         * To change the template for this generated type comment go to
021:         * Window>Preferences>Java>Code Generation>Code and Comments
022:         */
023:        public final class XContainer extends TextAppend {
024:            public static final String TRANSACTION_CONTAINER_TAG_NAME = "container";
025:
026:            private String openTag = "";
027:            private String closeTag = "";
028:
029:            private HashMap attributes = new HashMap();
030:
031:            /**
032:             * @param id
033:             */
034:            public XContainer(String id) {
035:                super (id);
036:                // TODO Auto-generated constructor stub
037:            }
038:
039:            /**
040:             * @param id
041:             * @param properties
042:             */
043:            public XContainer(String id, HashMap properties) {
044:                super (id, properties);
045:                this .attributes = (HashMap) properties.clone();
046:            }
047:
048:            private String buildOpenTag(String id, HashMap attributes) {
049:                StringBuffer buffer = new StringBuffer();
050:                buffer.append("<").append(id);
051:                if (attributes != null && attributes.size() > 0) {
052:                    Iterator iter = attributes.keySet().iterator();
053:                    String name = null;
054:                    Object value = null;
055:                    while (iter.hasNext()) {
056:                        name = (String) iter.next();
057:                        if (name != null && !name.startsWith("@")
058:                                && !name.endsWith("@") && !name.startsWith("$")) {
059:                            value = attributes.get(name);
060:                            if (value != null && !"".equals(value)) {
061:                                value = this .resolveKeyword(value);
062:
063:                                value = (value != null ? value.toString() : "");
064:
065:                                try {
066:                                    buffer.append(" ").append(name).append("=")
067:                                            .append("\"").append(
068:                                                    ServerUtilities
069:                                                            .escapeXml(value))
070:                                            .append("\"");
071:                                } catch (Exception ex) {
072:                                    this .log(ex);
073:                                }
074:                                value = null;
075:                            }
076:                        }
077:                        name = null;
078:                    }
079:                }
080:
081:                return buffer.append(">").toString();
082:            }
083:
084:            private String buildCloseTag(String id) {
085:                StringBuffer buffer = new StringBuffer();
086:
087:                return buffer.append("</").append(id).append(">").toString();
088:            }
089:
090:            /* (non-Javadoc)
091:             * @see org.xdev.base.templates.TemplateElementIterator#invoke(org.xdev.base.templates.TemplateComponent)
092:             */
093:            /*protected void invoke(XSSLAction component) throws Exception {
094:            	if (component instanceof XSSLReturn) {
095:            		Object value = ((XSSLReturn)component).getValue();
096:            		
097:            		if (value != null) {
098:            			this.buffer.append(value);
099:            		}
100:            	}
101:            }
102:
103:            protected void set() throws Exception{
104:            	this.buffer = new StringBuffer();
105:            }*/
106:
107:            protected void invoke() throws Exception {
108:                super .invoke();
109:            }
110:
111:            /*public Object getValue(){
112:            	return this.buffer.toString();
113:            }*/
114:
115:            /* (non-Javadoc)
116:             * @see org.xdev.base.transaction.AbstractTransaction#setTagName()
117:             */
118:            protected String setTagName() {
119:                return XContainer.TRANSACTION_CONTAINER_TAG_NAME;
120:            }
121:
122:            public void setOpenTag(String tag) {
123:                this .openTag = tag;
124:            }
125:
126:            public void setCloseTag(String tag) {
127:                this .closeTag = tag;
128:            }
129:
130:            public Object getObjectValue() {
131:
132:                java.util.List children = this .getRoot().getTemporaryBind(
133:                        this .getName());
134:
135:                if (children != null && children.size() > 0) {
136:
137:                    int size = children.size();
138:
139:                    XSSLComponent child = null;
140:
141:                    ArrayList returns = new ArrayList();
142:
143:                    for (int i = 0; i < size; i++) {
144:
145:                        child = (XSSLComponent) children.get(i);
146:
147:                        if (child instanceof  XSSLAction) {
148:
149:                            try {
150:                                ((XSSLAction) child).execute((XSSLAction) this 
151:                                        .getParentComponent());
152:
153:                                if (child instanceof  XSSLReturn) {
154:                                    returns.add(((XSSLReturn) child)
155:                                            .getObjectValue());
156:                                }
157:                            } catch (Exception ex) {
158:                                this .logError(ex);
159:                            }
160:                        }
161:                    }
162:
163:                    return returns.size() == 1 ? returns.get(0) : returns;
164:
165:                } else {
166:                    StringBuffer buffer = new StringBuffer();
167:
168:                    buffer.append(this.buildOpenTag(this.getId(),
169:                            this.attributes));
170:
171:                    buffer.append(super.getObjectValue());
172:
173:                    buffer.append(this.buildCloseTag(this.getId()));
174:
175:                    return buffer.toString();
176:                }
177:            }
178:
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.