Source Code Cross Referenced for DataBinding.java in  » XML-UI » JAXX » jaxx » 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 » XML UI » JAXX » jaxx.compiler 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * Copyright 2006 Ethan Nicholas. All rights reserved.
03:         * Use is subject to license terms.
04:         */
05:        package jaxx.compiler;
06:
07:        import jaxx.*;
08:        import jaxx.types.*;
09:
10:        /** Represents a data binding in a JAXX file.  <code>DataBinding</code> uses {@link DataSource} to
11:         * track changes to a source expression and update the destination.
12:         */
13:        public class DataBinding {
14:            private String id;
15:
16:            /** The DatSource which tracks source expression changes. */
17:            private DataSource dataSource;
18:
19:            /** The data binding destination in the form <code>&lt;id&gt;.&lt;propertyName&gt;</code>. */
20:            private String dest;
21:
22:            /** A Java snippet which will cause the destination property to be updated with the current value of 
23:             * the binding.
24:             */
25:            private String assignment;
26:
27:            /** The current <code>JAXXCompiler</code>. */
28:            private JAXXCompiler compiler;
29:
30:            /** Creates a new data binding.
31:             *
32:             *@param source the Java source code for the data binding expression
33:             *@param dest the data binding destination in the form <code>&lt;id&gt;.&lt;propertyName&gt;</code>
34:             *@param assignment Java snippet which will cause the destination property to be updated with the current value of the binding
35:             *@param compiler the current <code>JAXXCompiler</code>
36:             */
37:            public DataBinding(String source, String dest, String assignment,
38:                    JAXXCompiler compiler) {
39:                this .id = dest;
40:                this .dataSource = new DataSource(id, source, compiler);
41:                this .dest = dest;
42:                this .assignment = assignment;
43:                this .compiler = compiler;
44:            }
45:
46:            public String getId() {
47:                return id;
48:            }
49:
50:            /** Compiles the data binding expression.  This method calls methods in <code>JAXXCompiler</code>
51:             * to add the Java code that performs the data binding setup.
52:             *
53:             *@param quickNoDependencies true to optimize bindings with no dependencies by simply running them at startup time
54:             *@return <code>true</code> if the expression has dependencies, <code>false</code> otherwise
55:             *@throws CompilerException if a compilation error occurs
56:             */
57:            public boolean compile(boolean quickNoDependencies)
58:                    throws CompilerException {
59:                // DataSource.compile handles all of the listener additions
60:                boolean result = dataSource
61:                        .compile("new jaxx.runtime.DataBindingListener("
62:                                + compiler.getRootObject().getJavaCode() + ", "
63:                                + TypeManager.getJavaCode(id) + ")");
64:
65:                if (!result && quickNoDependencies) {
66:                    if (!dest.endsWith(".layout")) // layout is specially handled early in the chain
67:                        compiler.initDataBindings.append(assignment
68:                                + JAXXCompiler.getLineSeparator());
69:                    return false; // no dependencies, just a static expression
70:                } else {
71:                    if (compiler.processDataBinding.length() > 0)
72:                        compiler.processDataBinding.append("else ");
73:                    compiler.processDataBinding.append("if ($dest.equals("
74:                            + TypeManager.getJavaCode(id) + ")) { "
75:                            + assignment + "}\n"
76:                            + JAXXCompiler.getLineSeparator());
77:                    return true;
78:                }
79:            }
80:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.