Source Code Cross Referenced for XPersistentPojoModelEx.java in  » XML-UI » xui32 » com » xoetrope » data » pojo » 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 » xui32 » com.xoetrope.data.pojo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.xoetrope.data.pojo;
002:
003:        import java.lang.reflect.Method;
004:        import net.xoetrope.optional.data.pojo.XPojoContext;
005:        import net.xoetrope.optional.data.pojo.XPersistenceController;
006:        import net.xoetrope.xui.data.XModel;
007:
008:        public class XPersistentPojoModelEx extends XPojoModelEx {
009:            public static final int NUM_FIXED_ATTRIBUTES = 1;
010:            public static final int TX_REQUIRED_ATTRIBUTE = 0;
011:
012:            public XPersistentPojoModelEx(XModel pm, Method gtr, Method str,
013:                    String pn, XPersistentPojoDataSourceEx ds) {
014:                super (pm, gtr, str, pn, ds);
015:            }
016:
017:            public XPersistentPojoModelEx(XModel pm, Object p,
018:                    XPersistentPojoDataSourceEx ds) {
019:                super (pm, p, ds);
020:            }
021:
022:            public XPersistentPojoModelEx(XModel pm, Class pc, String pn,
023:                    XPersistentPojoDataSourceEx ds) {
024:                super (pm, pc, pn, ds);
025:            }
026:
027:            public int getNumAttributes() {
028:                return (NUM_FIXED_ATTRIBUTES + super .getNumAttributes());
029:            }
030:
031:            public String getAttribName(int i) {
032:                int na = super .getNumAttributes();
033:                if (i == na + TX_REQUIRED_ATTRIBUTE)
034:                    return "transaction required";
035:                else
036:                    return super .getAttribName(i);
037:            }
038:
039:            /**
040:             * Updates the value of the underlying property
041:             */
042:            public void obtainPropertyValue() {
043:                Object pc = dataSource.getPojoContext();
044:                if (pc instanceof  XPersistenceController) {
045:                    XPersistenceController controller = (XPersistenceController) dataSource
046:                            .getPojoContext();
047:                    controller.beginTransaction();
048:                }
049:                super .obtainPropertyValue();
050:            }
051:
052:            protected boolean requiresTransaction(String propertyName) {
053:                boolean txr = false;
054:                if (adapter != null)
055:                    txr = ((XPersistentPojoAdapterEx) adapter)
056:                            .requiresTransaction(propertyName);
057:                return txr;
058:            }
059:
060:            protected void setTransaction(String propertyName, boolean state) {
061:                if (adapter == null)
062:                    return;
063:                if (state)
064:                    ((XPersistentPojoAdapterEx) adapter)
065:                            .setTransaction(propertyName);
066:                else
067:                    ((XPersistentPojoAdapterEx) adapter)
068:                            .unsetTransaction(propertyName);
069:            }
070:
071:            public Object getAttribValue(int i) {
072:                int na = super .getNumAttributes();
073:                if (i == na + TX_REQUIRED_ATTRIBUTE) {
074:                    boolean txr = false;
075:                    if (parentModel instanceof  XPersistentPojoModelEx)
076:                        txr = ((XPersistentPojoModelEx) parentModel)
077:                                .requiresTransaction(propertyName);
078:                    return (txr ? "true" : "false");
079:                } else {
080:                    return super .getAttribValue(i);
081:                }
082:            }
083:
084:            /**
085:             * Returns the value of the attribute at the specified index.
086:             * The value is converted to a String object.
087:             * @param i the index of the attribute
088:             * @return String value of the attribute
089:             */
090:            public String getAttribValueAsString(int i) {
091:                return (String) getAttribValue(i);
092:            }
093:
094:            public void setAttribValue(int i, Object value) {
095:                int na = super .getNumAttributes();
096:                if (i == na + TX_REQUIRED_ATTRIBUTE) {
097:                    if (!(parentModel instanceof  XPersistentPojoModelEx))
098:                        return;
099:                    boolean txr = false;
100:                    if ("true".equals(value))
101:                        txr = true;
102:                    else if ("false".equals(value))
103:                        txr = false;
104:                    else
105:                        return;
106:                    XPersistentPojoModelEx pm = (XPersistentPojoModelEx) parentModel;
107:                    pm.setTransaction(propertyName, txr);
108:                    pm.setDirty(true);
109:                } else {
110:                    super .setAttribValue(i, value);
111:                }
112:            }
113:
114:            public boolean getAttribRuntime(int i) {
115:                int na = super .getNumAttributes();
116:                if (i == na + TX_REQUIRED_ATTRIBUTE)
117:                    return false;
118:                else
119:                    return super .getAttribRuntime(i);
120:            }
121:
122:            public int getAttribType(int i) {
123:                int na = super .getNumAttributes();
124:                if (i == na + TX_REQUIRED_ATTRIBUTE)
125:                    return ATTRIB_COMBO;
126:                else
127:                    return super .getAttribType(i);
128:            }
129:
130:            public String[] getAttribAvailableValues(int i) {
131:                int na = super .getNumAttributes();
132:                if (i == na + TX_REQUIRED_ATTRIBUTE)
133:                    return (new String[] { "true", "false" });
134:                else
135:                    return super .getAttribAvailableValues(i);
136:            }
137:
138:            public boolean isAttribEditable(int i) {
139:                int na = super .getNumAttributes();
140:                if (i == na + TX_REQUIRED_ATTRIBUTE)
141:                    return ((parentModel instanceof  XPersistentPojoModelEx) && (getAttribType(i) != ATTRIB_NEDITABLE));
142:                else
143:                    return super.isAttribEditable(i);
144:            }
145:
146:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.