Source Code Cross Referenced for FormBeanModel.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » compiler » model » 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 » Library » Apache beehive 1.0.2 src » org.apache.beehive.netui.compiler.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         *
017:         * $Header:$
018:         */
019:        package org.apache.beehive.netui.compiler.model;
020:
021:        import java.util.ArrayList;
022:        import java.util.Collection;
023:        import java.util.List;
024:
025:        import org.apache.beehive.netui.compiler.JpfLanguageConstants;
026:        import org.w3c.dom.Element;
027:
028:        /**
029:         * Represents a form bean in a Struts application.
030:         */
031:        public class FormBeanModel extends StrutsElementSupport implements 
032:                JpfLanguageConstants {
033:            public static class Property {
034:                private String _name;
035:                private String _type;
036:                private boolean _required;
037:                private boolean _multiValue;
038:
039:                public Property(String name, String type, boolean required,
040:                        boolean multival) {
041:                    _name = name;
042:                    _type = type;
043:                    _required = required;
044:                    _multiValue = multival;
045:                }
046:
047:                public String getName() {
048:                    return _name;
049:                }
050:
051:                public void setName(String name) {
052:                    _name = name;
053:                }
054:
055:                public String getType() {
056:                    return _type;
057:                }
058:
059:                public void setType(String type) {
060:                    _type = type;
061:                }
062:
063:                public boolean isRequired() {
064:                    return _required;
065:                }
066:
067:                public void setRequired(boolean required) {
068:                    _required = required;
069:                }
070:
071:                public boolean isMultiValue() {
072:                    return _multiValue;
073:                }
074:
075:                public void setMultiValue(boolean multi) {
076:                    _multiValue = multi;
077:                }
078:            }
079:
080:            private static final String CUSTOM_ACTION_FORM_BEAN_CLASSNAME = PAGEFLOW_PACKAGE
081:                    + ".config.PageFlowActionFormBean";
082:
083:            private String _id = ""; // NOI18N
084:            private boolean _dynamic = false;
085:            private String _name = null; // required to be set
086:            private String _type = null; // required to be set
087:            private String _formBeanMessageResourcesKey = null;
088:
089:            /** This is a NetUI-specific property. */
090:            private String _actualType = null;
091:
092:            /** This is a NetUI-specific property. */
093:            private boolean _pageFlowScoped; // required to be set
094:
095:            private ArrayList _properties = new ArrayList();
096:
097:            public FormBeanModel(String name, String type, String actualType,
098:                    boolean pageFlowScoped, String formBeanMessageResorucesKey,
099:                    StrutsApp parent) {
100:                super (parent);
101:                _name = name;
102:                _type = type;
103:                _actualType = actualType;
104:                _pageFlowScoped = pageFlowScoped;
105:                _formBeanMessageResourcesKey = formBeanMessageResorucesKey;
106:            }
107:
108:            protected void writeToElement(XmlModelWriter xw, Element element) {
109:                element.setAttribute("name", _name);
110:
111:                setElementAttribute(element, "type", _type);
112:                setElementAttribute(element, "id", _id);
113:                setElementAttribute(element, "className", getClassName());
114:                setElementAttribute(element, "dynamic", _dynamic);
115:                setElementAttribute(element, "className",
116:                        CUSTOM_ACTION_FORM_BEAN_CLASSNAME);
117:
118:                if (_actualType != null
119:                        && !_actualType.equals(element.getAttribute("type"))) {
120:                    setCustomProperty(xw, element, "actualType", _actualType,
121:                            CUSTOM_ACTION_FORM_BEAN_CLASSNAME);
122:                }
123:            }
124:
125:            public String getId() {
126:                return _id;
127:            }
128:
129:            public void setId(String id) {
130:                _id = id;
131:            }
132:
133:            public void setClassName(String className) {
134:                if (className != null) {
135:                    if ("org.apache.struts.action.DynaActionForm"
136:                            .equals(className)) // NOI18N
137:                        _dynamic = true;
138:
139:                    setClassName(className);
140:                }
141:            }
142:
143:            public boolean isDynamic() {
144:                return _dynamic;
145:            }
146:
147:            public void setDynamic(boolean dynamic) {
148:                _dynamic = dynamic;
149:            }
150:
151:            public String getName() {
152:                return _name;
153:            }
154:
155:            public void setName(String name) {
156:                _name = name;
157:            }
158:
159:            public String getType() {
160:                return _type;
161:            }
162:
163:            public void setType(String type) {
164:                _type = type;
165:            }
166:
167:            public String getActualType() {
168:                return _actualType;
169:            }
170:
171:            public void setActualType(String actualType) {
172:                _actualType = actualType;
173:            }
174:
175:            public String getFormBeanMessageResourcesKey() {
176:                return _formBeanMessageResourcesKey;
177:            }
178:
179:            public void addProperty(String name, String type, boolean required,
180:                    boolean multival) {
181:                _properties.add(new Property(name, type, required, multival));
182:            }
183:
184:            /**
185:             * Sets the collection of properties for a form bean to a new collection.
186:             */
187:            public void updateProperties(Collection newProps) {
188:                _properties = new ArrayList();
189:
190:                if (newProps != null) {
191:                    _properties.addAll(newProps);
192:                }
193:            }
194:
195:            public Property[] getProperties() {
196:                return (Property[]) _properties.toArray(new Property[] {});
197:            }
198:
199:            public void deleteProperty(String name) {
200:                for (int i = 0; i < _properties.size(); ++i) {
201:                    Property prop = (Property) _properties.get(i);
202:
203:                    if (prop.getName().equals(name)) {
204:                        _properties.remove(i--);
205:                    }
206:                }
207:            }
208:
209:            public void deleteProperty(Property prop) {
210:                _properties.remove(prop);
211:            }
212:
213:            public Property findProperty(String name) {
214:                int index = findPropertyIndex(name);
215:                return index != -1 ? (Property) _properties.get(index) : null;
216:            }
217:
218:            protected int findPropertyIndex(String name) {
219:                for (int i = 0; i < _properties.size(); ++i) {
220:                    Property prop = (Property) _properties.get(i);
221:
222:                    if (prop.getName().equals(name)) {
223:                        return i;
224:                    }
225:                }
226:
227:                return -1;
228:            }
229:
230:            /**
231:             * Returns a clone (shallow copy) of the internal properties list.
232:             */
233:            protected final List getPropertyList() {
234:                return (List) _properties.clone();
235:            }
236:
237:            public boolean isPageFlowScoped() {
238:                return _pageFlowScoped;
239:            }
240:
241:            protected void addSetProperty(XmlModelWriter xw, Element element,
242:                    String propertyName, String propertyValue) {
243:                throw new UnsupportedOperationException("not implemented for "
244:                        + getClass().getName());
245:            }
246:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.