Source Code Cross Referenced for CodeModel.java in  » Swing-Library » abeille-forms-designer » com » jeta » swingbuilder » store » 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 » Swing Library » abeille forms designer » com.jeta.swingbuilder.store 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (C) 2005 Jeff Tassin
003:         *
004:         * This library is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU Lesser General Public
006:         * License as published by the Free Software Foundation; either
007:         * version 2.1 of the License, or (at your option) any later version.
008:         *
009:         * This library is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:         * Lesser General Public License for more details.
013:         *
014:         * You should have received a copy of the GNU Lesser General Public
015:         * License along with this library; if not, write to the Free Software
016:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
017:         */
018:
019:        package com.jeta.swingbuilder.store;
020:
021:        import java.io.Externalizable;
022:        import java.io.IOException;
023:        import java.util.HashMap;
024:
025:        import com.jeta.forms.logger.FormsLogger;
026:        import com.jeta.forms.store.memento.FormMemento;
027:        import com.jeta.open.registry.JETARegistry;
028:        import com.jeta.swingbuilder.common.ComponentNames;
029:        import com.jeta.swingbuilder.interfaces.app.ObjectStore;
030:        import com.jeta.swingbuilder.interfaces.userprops.TSUserPropertiesUtils;
031:
032:        /**
033:         * Model for code generation options for a form.
034:         * 
035:         * @author Jeff Tassin
036:         */
037:        public class CodeModel implements  Externalizable {
038:            static final long serialVersionUID = 5327987415154522473L;
039:
040:            public static final String ID_CODEGEN_OPTIONS_CACHE = "code.options.cache";
041:            public static final String ID_MEMBER_PREFIX = "code.member.prefix";
042:            public static final String ID_INCLUDE_MAIN = "code.include.main";
043:            public static final String ID_INCLUDE_NONSTANDARD = "code.include.nonstandard.components";
044:
045:            private String m_form_id;
046:
047:            /**
048:             * verion of this class
049:             */
050:            public static final int VERSION = 1;
051:
052:            /**
053:             * attibutes local to a form
054:             */
055:            private String m_package;
056:            private String m_classname = "MyForm";
057:
058:            /**
059:             * global attibutes
060:             */
061:            private transient String m_member_prefix = "m_";
062:            private transient boolean m_include_main = true;
063:            private transient boolean m_include_nonstandard = true;
064:
065:            public CodeModel() {
066:                loadGlobals();
067:            }
068:
069:            private CodeModel(FormMemento fm) {
070:                m_form_id = fm.getId();
071:                loadGlobals();
072:            }
073:
074:            public static CodeModel createInstance(FormMemento fm) {
075:                try {
076:                    ObjectStore os = (ObjectStore) JETARegistry
077:                            .lookup(ComponentNames.APPLICATION_STATE_STORE);
078:                    HashMap cgen_options = (HashMap) os
079:                            .load(ID_CODEGEN_OPTIONS_CACHE);
080:
081:                    CodeModel model = null;
082:                    if (cgen_options != null) {
083:                        model = (CodeModel) cgen_options.get(fm.getId());
084:                    }
085:
086:                    if (model == null)
087:                        model = new CodeModel(fm);
088:                    model.loadGlobals();
089:                    return model;
090:                } catch (Exception e) {
091:                    FormsLogger.severe(e);
092:                    return new CodeModel(fm);
093:                }
094:            }
095:
096:            public static void save(CodeModel model) {
097:                TSUserPropertiesUtils.setString(ID_MEMBER_PREFIX, model
098:                        .getMemberPrefix());
099:                TSUserPropertiesUtils.setBoolean(ID_INCLUDE_MAIN, model
100:                        .isIncludeMain());
101:                TSUserPropertiesUtils.setBoolean(ID_INCLUDE_NONSTANDARD, model
102:                        .isIncludeNonStandard());
103:                try {
104:                    ObjectStore os = (ObjectStore) JETARegistry
105:                            .lookup(ComponentNames.APPLICATION_STATE_STORE);
106:                    HashMap cgen_options = (HashMap) os
107:                            .load(ID_CODEGEN_OPTIONS_CACHE);
108:                    if (cgen_options == null) {
109:                        cgen_options = new HashMap();
110:                    }
111:                    cgen_options.put(model.getFormId(), model);
112:                    os.store(ID_CODEGEN_OPTIONS_CACHE, cgen_options);
113:                } catch (Exception e) {
114:                    FormsLogger.severe(e);
115:                }
116:            }
117:
118:            public String getFormId() {
119:                return m_form_id;
120:            }
121:
122:            public String getPackage() {
123:                return m_package;
124:            }
125:
126:            public String getClassName() {
127:                return m_classname;
128:            }
129:
130:            public String getMemberPrefix() {
131:                return m_member_prefix;
132:            }
133:
134:            public boolean isIncludeMain() {
135:                return m_include_main;
136:            }
137:
138:            public boolean isIncludeNonStandard() {
139:                return m_include_nonstandard;
140:            }
141:
142:            private void loadGlobals() {
143:                m_member_prefix = TSUserPropertiesUtils.getString(
144:                        ID_MEMBER_PREFIX, "m_");
145:                m_include_main = TSUserPropertiesUtils.getBoolean(
146:                        ID_INCLUDE_MAIN, true);
147:                m_include_nonstandard = TSUserPropertiesUtils.getBoolean(
148:                        ID_INCLUDE_NONSTANDARD, true);
149:            }
150:
151:            public void setPackage(String pkg) {
152:                m_package = pkg;
153:            }
154:
155:            public void setClassName(String cname) {
156:                m_classname = cname;
157:            }
158:
159:            public void setMemberPrefix(String prefix) {
160:                m_member_prefix = prefix;
161:            }
162:
163:            public void setIncludeMain(boolean inc) {
164:                m_include_main = inc;
165:            }
166:
167:            public void setIncludeNonStandard(boolean inc) {
168:                m_include_nonstandard = inc;
169:            }
170:
171:            /**
172:             * Externalizable Implementation
173:             */
174:            public void readExternal(java.io.ObjectInput in)
175:                    throws ClassNotFoundException, IOException {
176:                int version = in.readInt();
177:                m_package = (String) in.readObject();
178:                m_classname = (String) in.readObject();
179:                m_form_id = (String) in.readObject();
180:            }
181:
182:            /**
183:             * Externalizable Implementation
184:             */
185:            public void writeExternal(java.io.ObjectOutput out)
186:                    throws IOException {
187:                out.writeInt(VERSION);
188:                out.writeObject(m_package);
189:                out.writeObject(m_classname);
190:                out.writeObject(m_form_id);
191:            }
192:
193:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.