Source Code Cross Referenced for AttributeSpec.java in  » Ajax » Laszlo-4.0.10 » org » openlaszlo » compiler » 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 » Laszlo 4.0.10 » org.openlaszlo.compiler 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* -*- mode: Java; c-basic-offset: 2; -*- */
002:
003:        /**
004:         * LZX Attributes
005:         */package org.openlaszlo.compiler;
006:
007:        import org.openlaszlo.xml.internal.Schema.Type;
008:        import org.openlaszlo.xml.internal.XMLUtils;
009:        import org.jdom.Element;
010:
011:        /** Contains information about an attribute of a laszlo viewsystem class.
012:         */
013:        class AttributeSpec {
014:            /** The source Element from which this attribute was parsed */
015:            Element source = null;
016:            /** The attribute name */
017:            String name;
018:            /** The default value */
019:            String defaultValue = null;
020:            /** The setter function */
021:            String setter;
022:            /** The type of the attribute value*/
023:            Type type;
024:            /** Is this attribute required to instantiate an instance of this class? */
025:            boolean required = false;
026:            /** When does the initial value for this attribute get evaluated? */
027:            String when = NodeModel.WHEN_IMMEDIATELY;
028:
029:            /** If this is a method, the arglist */
030:            String arglist = null;
031:
032:            /** Can this attribute be overridden without a warning? value is null, 'true' or 'false' */
033:            String override = null;
034:
035:            /** Is this attribute equivalent to element content of a given type? */
036:            int contentType = NO_CONTENT;
037:
038:            /** Element content types: */
039:            static final int NO_CONTENT = 0;
040:            static final int TEXT_CONTENT = 1;
041:            static final int HTML_CONTENT = 2;
042:
043:            private String typeToLZX() {
044:                switch (contentType) {
045:                case TEXT_CONTENT:
046:                    return "text";
047:                case HTML_CONTENT:
048:                    return "html";
049:                default:
050:                    return type.toString();
051:                }
052:            }
053:
054:            public String toLZX(String indent, ClassModel super class) {
055:                AttributeSpec super Spec = super class.getAttribute(name);
056:                if (ViewSchema.METHOD_TYPE.equals(type)) {
057:                    return indent
058:                            + "  <method name='"
059:                            + name
060:                            + "'"
061:                            + (("".equals(arglist)) ? ""
062:                                    : (" args='" + arglist + "'")) + " />";
063:                }
064:
065:                if (super Spec == null) {
066:                    if (ViewSchema.EVENT_HANDLER_TYPE.equals(type)) {
067:                        return indent + "<event name='" + name + "' />";
068:                    }
069:                    return indent
070:                            + "<attribute name='"
071:                            + name
072:                            + "'"
073:                            + ((defaultValue != null) ? (" value='"
074:                                    + defaultValue + "'") : "")
075:                            + ((type != null) ? (" type='" + typeToLZX() + "'")
076:                                    : "")
077:                            + ((when != NodeModel.WHEN_IMMEDIATELY) ? (" when='"
078:                                    + when + "'")
079:                                    : "")
080:                            + (required ? (" required='true'") : "") + " />";
081:                } else if (!ViewSchema.EVENT_HANDLER_TYPE.equals(type)) {
082:                    String attrs = "";
083:                    if (defaultValue != null
084:                            && (!defaultValue.equals(super Spec.defaultValue))) {
085:                        attrs += " value='" + defaultValue + "'";
086:                    }
087:                    if (type != null
088:                            && (!type.equals(super class.getAttributeType(name)))) {
089:                        attrs += " type='" + typeToLZX() + "'";
090:                    }
091:                    if (when != null && (!when.equals(super Spec.when))) {
092:                        attrs += " when='" + when + "'";
093:                    }
094:                    if (required != super Spec.required) {
095:                        attrs += " required='" + required + "'";
096:                    }
097:                    if (attrs.length() > 0) {
098:                        return indent + "<attribute name='" + name + "'"
099:                                + attrs + " />";
100:                    }
101:                }
102:                return null;
103:            }
104:
105:            public String toString() {
106:                if (ViewSchema.METHOD_TYPE.equals(type)) {
107:                    return "[AttributeSpec: method name='"
108:                            + name
109:                            + "'"
110:                            + (("".equals(arglist)) ? ""
111:                                    : (" args='" + arglist + "'"))
112:                            + " override="
113:                            + (override == null ? "null"
114:                                    : ("'" + override + "'")) + "]";
115:                }
116:                if (ViewSchema.EVENT_HANDLER_TYPE.equals(type)) {
117:                    return "[AttributeSpec: event name='" + name + "' ]";
118:                }
119:                return "[AttributeSpec: attribute name='"
120:                        + name
121:                        + "'"
122:                        + ((defaultValue != null) ? (" value='" + defaultValue + "'")
123:                                : "")
124:                        + ((type != null) ? (" type='" + typeToLZX() + "'")
125:                                : "")
126:                        + ((when != NodeModel.WHEN_IMMEDIATELY) ? (" when='"
127:                                + when + "'") : "")
128:                        + (required ? (" required='true'") : "") + " ";
129:            }
130:
131:            AttributeSpec(String name, Type type, String defaultValue,
132:                    String setter, Element source) {
133:                this .source = source;
134:                this .name = name;
135:                this .type = type;
136:                this .defaultValue = defaultValue;
137:                this .setter = setter;
138:                this .when = XMLUtils.getAttributeValue(source, "when",
139:                        NodeModel.WHEN_IMMEDIATELY);
140:            }
141:
142:            AttributeSpec(String name, Type type, String defaultValue,
143:                    String setter, boolean required, Element source) {
144:                this .source = source;
145:                this .name = name;
146:                this .type = type;
147:                this .defaultValue = defaultValue;
148:                this .setter = setter;
149:                this .required = required;
150:                this .when = XMLUtils.getAttributeValue(source, "when",
151:                        NodeModel.WHEN_IMMEDIATELY);
152:            }
153:
154:            AttributeSpec(String name, Type type, String defaultValue,
155:                    String setter) {
156:                this .name = name;
157:                this .type = type;
158:                this .defaultValue = defaultValue;
159:                this .setter = setter;
160:            }
161:
162:            AttributeSpec(String name, Type type, String defaultValue,
163:                    String setter, boolean required) {
164:                this .name = name;
165:                this .type = type;
166:                this .defaultValue = defaultValue;
167:                this .setter = setter;
168:                this .required = required;
169:            }
170:        }
171:
172:        /**
173:         * @copyright Copyright 2001-2007 Laszlo Systems, Inc.  All Rights
174:         * Reserved.  Use is subject to license terms.
175:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.