Source Code Cross Referenced for XTableTableBinding.java in  » XML-UI » XUI » net » xoetrope » optional » data » 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 » XUI » net.xoetrope.optional.data 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package net.xoetrope.optional.data;
002:
003:        import java.awt.Component;
004:
005:        import net.xoetrope.optional.data.sql.DatabaseTableModel;
006:        import net.xoetrope.xui.XModelHolder;
007:        import net.xoetrope.xui.XProjectManager;
008:        import net.xoetrope.xui.data.XDataBinding;
009:        import net.xoetrope.xui.data.XModel;
010:        import net.xoetrope.xui.data.XRowSelector;
011:
012:        /**
013:         * A binding that binds a table component to a database table. Normally this
014:         * object should be setup by the XOptionalBindingFactory
015:         * <p>Copyright Xoetrope(c) 2003-2004</p>
016:         * $Revision: 1.2 $
017:         */
018:        public class XTableTableBinding implements  XDataBinding {
019:            protected XModelHolder target;
020:            protected boolean useUnique;
021:            protected XModel outputNode;
022:            protected XModel sourceNode;
023:            protected String outputPath;
024:            protected String sourcePath;
025:
026:            public XTableTableBinding(Object comp, XModel xmodel) {
027:                target = (XModelHolder) comp;
028:                target.setModel(xmodel);
029:                sourceNode = xmodel;
030:            }
031:
032:            /**
033:             * Updates the table component with the value obtained from the data model.
034:             * This method does nothing as the table should dynamically pull its data from
035:             * the model. Any change in the model is effected by the setSore or
036:             * setSourcePath methods.
037:             */
038:            public void get() {
039:            }
040:
041:            /**
042:             * Updates the data model with the value retrieved from the table component.
043:             */
044:            public void set() {
045:                int selIdx = ((XRowSelector) target).getSelectedRow();
046:                if (selIdx >= 0) {
047:                    Object result = ((DatabaseTableModel) sourceNode)
048:                            .getFieldValue(selIdx, 0);
049:                    if (result != null)
050:                        outputNode.set(result);
051:                }
052:            }
053:
054:            /**
055:             * Get the UI component that participates in this binding
056:             * @return the component
057:             */
058:            public Component getComponent() {
059:                return (Component) target;
060:            }
061:
062:            /**
063:             * Get the model path for the source data
064:             */
065:            public String getSourcePath() {
066:                return sourcePath;
067:            }
068:
069:            /**
070:             * Get the model path for the output/state data
071:             */
072:            public String getOutputPath() {
073:                return outputPath;
074:            }
075:
076:            /**
077:             * Set the model path for the source data
078:             */
079:            public void setSourcePath(String newPath) {
080:                if (newPath != null) {
081:                    sourceNode = (XModel) XProjectManager.getModel().get(
082:                            newPath);
083:                    sourcePath = newPath;
084:                    target.setModel(sourceNode);
085:                }
086:            }
087:
088:            /**
089:             * Set the model path for the output/state data
090:             */
091:            public void setOutputPath(String newPath) {
092:                if (newPath != null) {
093:                    outputPath = XModel.prefixOutputPath(newPath);
094:                    outputNode = (XModel) XProjectManager.getModel().get(
095:                            outputPath);
096:                }
097:            }
098:
099:            /**
100:             * Update the model node used in the binding. Note that this method does not
101:             * modify the path values stored by this node.
102:             * @param newNode the new model for the data source
103:             */
104:            public void setSource(XModel newNode) {
105:                sourceNode = newNode;
106:                target.setModel(sourceNode);
107:            }
108:
109:            /**
110:             * Update the path values stored by this node. The output path is used to
111:             * store selection data and state.
112:             * @param newNode the new model for saving the output data
113:             */
114:            public void setOutput(XModel newModel) {
115:                outputNode = newModel;
116:            }
117:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.