Source Code Cross Referenced for ValueBindingPanel.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » faces » dt » std » 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 » visualweb.api.designer » org.netbeans.modules.visualweb.faces.dt.std 
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-2007 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:        package org.netbeans.modules.visualweb.faces.dt.std;
042:
043:        import org.netbeans.modules.visualweb.faces.dt.HtmlDesignInfoBase;
044:        import java.awt.GridBagConstraints;
045:        import java.awt.GridBagLayout;
046:        import java.awt.Insets;
047:        import javax.faces.component.UIData;
048:        import javax.faces.component.UISelectItems;
049:        import javax.faces.component.UISelectMany;
050:        import javax.faces.component.html.HtmlDataTable;
051:        import javax.swing.JLabel;
052:        import javax.swing.JPanel;
053:        import javax.swing.JTabbedPane;
054:        import javax.swing.JTextField;
055:        import org.netbeans.modules.visualweb.faces.dt.std.table.HtmlDataTableState;
056:        import org.netbeans.modules.visualweb.faces.dt.util.ComponentBundle;
057:        import com.sun.rave.designtime.DesignBean;
058:        import com.sun.rave.designtime.DesignProperty;
059:        import com.sun.rave.designtime.faces.FacesDesignProperty;
060:        import org.openide.explorer.propertysheet.editors.EnhancedCustomPropertyEditor;
061:
062:        public class ValueBindingPanel extends JPanel implements 
063:                EnhancedCustomPropertyEditor {
064:
065:            private static final ComponentBundle bundle = ComponentBundle
066:                    .getBundle(ValueBindingPanel.class);
067:
068:            protected DesignProperty liveProperty;
069:            protected boolean isValueProperty;
070:            protected FacesDesignProperty facesDesignProperty;
071:            protected JTabbedPane tabs = new JTabbedPane();
072:
073:            protected ObjectBindingPanel2 objectPanel = null; //new ObjectBindingPanel(this);
074:            protected DataModelBindingPanel dmPanel = null; //new DataModelBindingPanel(this);
075:            protected RowDataBindingPanel rowDataPanel = null; //new RowDataBindingPanel(this);
076:            protected ColumnDataBindingPanel columnDataPanel = null; //new ColumnDataBindingPanel(this);
077:
078:            protected JTextField valueTextField = new JTextField();
079:            protected GridBagLayout gridBagLayout1 = new GridBagLayout();
080:            protected JLabel valueLabel = new JLabel();
081:            protected ValueBindingPropertyEditor vbpe;
082:
083:            public ValueBindingPanel(ValueBindingPropertyEditor vbpe,
084:                    DesignProperty lp) {
085:                this .vbpe = vbpe;
086:                this .liveProperty = lp;
087:                // This type of code REALLY sucks, but I'm stuck with it for now :( TODO
088:                isValueProperty = "value".equals(liveProperty
089:                        .getPropertyDescriptor().getName());
090:                this .facesDesignProperty = lp instanceof  FacesDesignProperty ? (FacesDesignProperty) lp
091:                        : null;
092:                try {
093:                    jbInit();
094:                } catch (Exception e) {
095:                    e.printStackTrace();
096:                }
097:
098:                Object bean = lp.getDesignBean().getInstance();
099:
100:                // find the current value
101:                String currentBinding = lp.getValueSource();
102:                valueTextField.setText(currentBinding);
103:
104:                if (isValueProperty && bean instanceof  HtmlDataTable) {
105:                    dmPanel = new DataModelBindingPanel(this , null, lp);
106:                    tabs.add(dmPanel, bundle.getMessage("bindToDb")); //NOI18N
107:                } else if (isValueProperty && bean instanceof  UISelectItems) {
108:                    columnDataPanel = new ColumnDataBindingPanel(this , null, lp);
109:                    tabs.add(columnDataPanel, bundle
110:                            .getMessage("bindDiplayToDb")); //NOI18N
111:                } else if (!isValueProperty || !(bean instanceof  UISelectMany)) {
112:                    rowDataPanel = new RowDataBindingPanel(this , null, lp);
113:                    tabs.add(rowDataPanel, bundle.getMessage("bindToDb")); //NOI18N
114:                }
115:
116:                objectPanel = new ObjectBindingPanel2(this , lp);
117:                tabs.add(objectPanel, bundle.getMessage("bindToObj")); //NOI18N
118:                if (!isValueProperty) {
119:                    tabs.setSelectedComponent(objectPanel);
120:                }
121:
122:                initializing = false;
123:            }
124:
125:            public Object getPropertyValue() throws IllegalStateException {
126:                String vb = getValueBinding();
127:
128:                // special handling for UISelectItems
129:                DesignBean bean = liveProperty.getDesignBean();
130:                if (bean.getInstance() instanceof  UISelectItems
131:                        && isValueProperty) { //NOI18N
132:
133:                    // if we're blanking out the value binding for 'value'
134:                    // replug-in the default items (or nuke them if not)
135:                    //MBOHM for 6194849, no harm in calling this line here, and would be more risky to change
136:                    vb = HtmlDesignInfoBase.maybeSetupDefaultSelectItems(bean,
137:                            vb);
138:                    // check and see if we need a converter
139:                    //MBOHM 6194849 //HtmlDesignInfoBase.maybeSetupConverter(bean, selectItemsValueType);
140:                }
141:                // special handling for UIData bound to a rowset
142:                else if (bean.getInstance() instanceof  UIData
143:                        && "value".equals(liveProperty.getPropertyDescriptor()
144:                                .getName())) {
145:
146:                    vb = HtmlDataTableState
147:                            .maybeGenerateRowsetColumns(bean, vb);
148:                }
149:
150:                if (vb != null && vb.length() == 0) {
151:                    vb = null;
152:                }
153:                return vb;
154:            }
155:
156:            protected int selectItemsValueType = 0;
157:
158:            public void setSelectItemsValueType(int sqlType) {
159:                this .selectItemsValueType = sqlType;
160:            }
161:
162:            protected boolean initializing = true;
163:
164:            public void setValueBinding(String valueBinding) {
165:                if (initializing) {
166:                    return;
167:                }
168:                valueTextField.setText(valueBinding);
169:            }
170:
171:            public String getValueBinding() {
172:                return valueTextField.getText();
173:            }
174:
175:            private void jbInit() throws Exception {
176:                this .setLayout(gridBagLayout1);
177:                valueLabel.setText(bundle.getMessage("currValSetting")); //NOI18N
178:                this .add(valueLabel, new GridBagConstraints(0, 0, 1, 1, 1.0,
179:                        0.0, GridBagConstraints.CENTER,
180:                        GridBagConstraints.HORIZONTAL, new Insets(8, 8, 2, 8),
181:                        0, 0));
182:                this .add(valueTextField, new GridBagConstraints(0, 1, 1, 1,
183:                        1.0, 0.0, GridBagConstraints.WEST,
184:                        GridBagConstraints.HORIZONTAL, new Insets(0, 8, 4, 8),
185:                        0, 0));
186:                this .add(tabs, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0,
187:                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
188:                        new Insets(0, 8, 8, 8), 0, 0));
189:                //        valueTextField.getDocument().addUndoableEditListener(new UndoableEditListener() {
190:                //            public void undoableEditHappened(UndoableEditEvent e) {
191:                //                if (initializing)
192:                //                    return;
193:                //                firePropertyChange(null, null, null);
194:                //                if (vbpe != null) {
195:                //                    vbpe.setAsText(valueTextField.getText());
196:                //                }
197:                //            }
198:                //        });
199:            }
200:        }
w__w_w.j___a___v__a__2s.___com__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.