Source Code Cross Referenced for MetaBinding.java in  » IDE-Netbeans » form » org » netbeans » modules » form » 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 » IDE Netbeans » form » org.netbeans.modules.form 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.form;
043:
044:        import java.util.*;
045:
046:        public class MetaBinding {
047:            public static final int UPDATE_STRATEGY_READ_WRITE = 0;
048:            public static final int UPDATE_STRATEGY_READ = 1;
049:            public static final int UPDATE_STRATEGY_READ_ONCE = 2;
050:            public static final String TABLE_COLUMN_CLASS_PARAMETER = "javax.swing.binding.ParameterKeys.COLUMN_CLASS"; // NOI18N
051:            public static final String EDITABLE_PARAMETER = "javax.swing.binding.ParameterKeys.EDITABLE"; // NOI18N
052:            public static final String TEXT_CHANGE_STRATEGY = "javax.swing.binding.ParameterKeys.TEXT_CHANGE_STRATEGY"; // NOI18N
053:            public static final String TEXT_CHANGE_ON_TYPE = "javax.swing.binding.TextChangeStrategy.ON_TYPE"; // NOI18N
054:            public static final String TEXT_CHANGE_ON_ACTION_OR_FOCUS_LOST = "javax.swing.binding.TextChangeStrategy.ON_ACTION_OR_FOCUS_LOST"; // NOI18N;
055:            public static final String TEXT_CHANGE_ON_FOCUS_LOST = "javax.swing.binding.TextChangeStrategy.ON_FOCUS_LOST"; // NOI18N;
056:            public static final String DISPLAY_PARAMETER = "DISPLAY"; // NOI18N
057:            public static final String NAME_PARAMETER = "NAME"; // NOI18N
058:            public static final String IGNORE_ADJUSTING_PARAMETER = "IGNORE_ADJUSTING"; // NOI18N
059:            private RADComponent source;
060:            private RADComponent target;
061:            private String sourcePath;
062:            private String targetPath;
063:            private int updateStrategy = UPDATE_STRATEGY_READ_WRITE;
064:            private boolean nullValueSpecified;
065:            private boolean incompleteValueSpecified;
066:            private Map<String, String> parameters = new TreeMap<String, String>();
067:            private boolean bindImmediately;
068:
069:            private List<MetaBinding> subBindings;
070:
071:            public MetaBinding(RADComponent source, String sourcePath,
072:                    RADComponent target, String targetPath) {
073:                this .source = source;
074:                this .sourcePath = sourcePath;
075:                this .target = target;
076:                this .targetPath = targetPath;
077:            }
078:
079:            public RADComponent getSource() {
080:                return source;
081:            }
082:
083:            void setSource(RADComponent source) {
084:                this .source = source;
085:            }
086:
087:            public RADComponent getTarget() {
088:                return target;
089:            }
090:
091:            void setTarget(RADComponent target) {
092:                this .target = target;
093:                // backward compatibility hack
094:                Class clazz = target.getBeanClass();
095:                if (hasSubBindings()
096:                        && (javax.swing.JComboBox.class.isAssignableFrom(clazz) || javax.swing.JList.class
097:                                .isAssignableFrom(clazz))) {
098:                    assert (subBindings.size() == 1);
099:                    MetaBinding display = getSubBindings().iterator().next();
100:                    setParameter(DISPLAY_PARAMETER, display.getSourcePath());
101:                    clearSubBindings();
102:                }
103:            }
104:
105:            public String getSourcePath() {
106:                return sourcePath;
107:            }
108:
109:            public String getTargetPath() {
110:                return targetPath;
111:            }
112:
113:            public int getUpdateStrategy() {
114:                return updateStrategy;
115:            }
116:
117:            public void setUpdateStrategy(int updateStrategy) {
118:                this .updateStrategy = updateStrategy;
119:            }
120:
121:            public boolean isNullValueSpecified() {
122:                return nullValueSpecified;
123:            }
124:
125:            public void setNullValueSpecified(boolean nullValueSpecified) {
126:                this .nullValueSpecified = nullValueSpecified;
127:            }
128:
129:            public boolean isIncompletePathValueSpecified() {
130:                return incompleteValueSpecified;
131:            }
132:
133:            public void setIncompletePathValueSpecified(
134:                    boolean incompleteValueSpecified) {
135:                this .incompleteValueSpecified = incompleteValueSpecified;
136:            }
137:
138:            public boolean isConverterSpecified() {
139:                BindingProperty prop = getTarget().getBindingProperty(
140:                        getTargetPath());
141:                FormProperty converterProp = prop.getConverterProperty();
142:                return !converterProp.isDefaultValue();
143:            }
144:
145:            public boolean isValidatorSpecified() {
146:                BindingProperty prop = getTarget().getBindingProperty(
147:                        getTargetPath());
148:                FormProperty validatorProp = prop.getValidatorProperty();
149:                return !validatorProp.isDefaultValue();
150:            }
151:
152:            public boolean isNameSpecified() {
153:                BindingProperty prop = getTarget().getBindingProperty(
154:                        getTargetPath());
155:                FormProperty nameProp = prop.getNameProperty();
156:                return !nameProp.isDefaultValue();
157:            }
158:
159:            public boolean isBindImmediately() {
160:                return bindImmediately;
161:            }
162:
163:            public void setBindImmediately(boolean bindImmediately) {
164:                this .bindImmediately = bindImmediately;
165:            }
166:
167:            public void setParameter(String name, String value) {
168:                if (value == null) {
169:                    parameters.remove(name);
170:                } else {
171:                    name = changeObsoleteName(name);
172:                    if (name.equals(MetaBinding.TEXT_CHANGE_STRATEGY)) {
173:                        value = changeObsoleteValue(value);
174:                    }
175:                    parameters.put(name, value);
176:                }
177:            }
178:
179:            private static String changeObsoleteName(String name) {
180:                if (name.startsWith("javax.swing.binding.SwingBindingSupport")) { // NOI18N
181:                    if (name
182:                            .startsWith("javax.swing.binding.SwingBindingSupport.TableColumnClassParameter")) { // NOI18N
183:                        name = MetaBinding.TABLE_COLUMN_CLASS_PARAMETER;
184:                    } else if (name
185:                            .startsWith("javax.swing.binding.SwingBindingSupport.EditableParameter")) { // NOI18N
186:                        name = MetaBinding.EDITABLE_PARAMETER;
187:                    } else if (name
188:                            .startsWith("javax.swing.binding.SwingBindingSupport.TextChangeStrategyParameter")) { // NOI18N
189:                        name = MetaBinding.TEXT_CHANGE_STRATEGY;
190:                    }
191:                }
192:                return name;
193:            }
194:
195:            private static String changeObsoleteValue(String value) {
196:                if (value
197:                        .equals("javax.swing.binding.SwingBindingSupport.TextChangeStrategy.CHANGE_ON_TYPE")) { // NOI18N
198:                    value = MetaBinding.TEXT_CHANGE_ON_TYPE;
199:                } else if (value
200:                        .equals("javax.swing.binding.SwingBindingSupport.TextChangeStrategy.CHANGE_ON_ACTION_OR_FOCUS_LOST")) { // NOI18N
201:                    value = MetaBinding.TEXT_CHANGE_ON_ACTION_OR_FOCUS_LOST;
202:                } else if (value
203:                        .equals("javax.swing.binding.SwingBindingSupport.TextChangeStrategy.CHANGE_ON_FOCUS_LOST")) { // NOI18N
204:                    value = MetaBinding.TEXT_CHANGE_ON_FOCUS_LOST;
205:                }
206:                return value;
207:            }
208:
209:            public String getParameter(String name) {
210:                return parameters.get(name);
211:            }
212:
213:            Map<String, String> getParameters() {
214:                return parameters;
215:            }
216:
217:            public boolean hasSubBindings() {
218:                return subBindings != null && subBindings.size() > 0;
219:            }
220:
221:            public Collection<MetaBinding> getSubBindings() {
222:                return subBindings != null && subBindings.size() > 0 ? Collections
223:                        .unmodifiableCollection(subBindings)
224:                        : null;
225:            }
226:
227:            public MetaBinding addSubBinding(String sourcePath,
228:                    String targetPath) {
229:                if (subBindings == null) {
230:                    subBindings = new ArrayList<MetaBinding>();
231:                }
232:                MetaBinding binding = new MetaBinding(null, sourcePath, null,
233:                        targetPath);
234:                subBindings.add(binding);
235:                return binding;
236:            }
237:
238:            public void removeSubBinding(MetaBinding binding) {
239:                if (subBindings != null)
240:                    subBindings.remove(binding);
241:            }
242:
243:            public void clearSubBindings() {
244:                subBindings.clear();
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.