Source Code Cross Referenced for ConfigureMethodsPanel.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » ejb » ui » 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.ejb.ui 
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:        /*
042:         * ExportDataSourcesDialog.java
043:         *
044:         * Created on March 8, 2004, 12:09 PM
045:         */
046:
047:        package org.netbeans.modules.visualweb.ejb.ui;
048:
049:        import org.netbeans.modules.visualweb.ejb.datamodel.EjbGroup;
050:        import org.netbeans.modules.visualweb.ejb.datamodel.MethodInfo;
051:        import java.awt.Component;
052:        import java.util.Enumeration;
053:        import javax.swing.*;
054:        import javax.swing.event.TreeSelectionEvent;
055:        import javax.swing.event.TreeSelectionListener;
056:        import javax.swing.tree.DefaultMutableTreeNode;
057:        import javax.swing.tree.DefaultTreeCellRenderer;
058:        import javax.swing.tree.DefaultTreeModel;
059:        import javax.swing.tree.TreeNode;
060:        import javax.swing.tree.TreePath;
061:        import javax.swing.tree.TreeSelectionModel;
062:        import org.openide.util.NbBundle;
063:        import org.openide.util.Utilities;
064:
065:        /**
066:         * A panle to allow the user to configure the EJB business methods
067:         *
068:         * @author dongmei cao
069:         */
070:        public class ConfigureMethodsPanel extends JPanel {
071:
072:            private EjbGroup ejbGroup;
073:            private MethodDetailPanel methodDetailPanel;
074:
075:            public ConfigureMethodsPanel(EjbGroup ejbGrp) {
076:
077:                initComponents();
078:
079:                setName(NbBundle.getMessage(ConfigureMethodsPanel.class,
080:                        "CONFIGURE_METHODS"));
081:
082:                // Have the cell renderer to display nice icons
083:                methodTree.setCellRenderer(new DefaultTreeCellRenderer() {
084:                    public Component getTreeCellRendererComponent(JTree tree,
085:                            Object value, boolean sel, boolean expanded,
086:                            boolean leaf, int row, boolean hasFocus) {
087:
088:                        super .getTreeCellRendererComponent(tree, value, sel,
089:                                expanded, leaf, row, hasFocus);
090:
091:                        if (value instanceof  EjbGroupTreeNodes.MethodNode) {
092:                            // Method node
093:                            MethodInfo method = ((EjbGroupTreeNodes.MethodNode) value)
094:                                    .getMethod();
095:                            if (method.getReturnType().isCollection()
096:                                    && method.getReturnType()
097:                                            .getElemClassName() == null)
098:                                // Show the warning icon to indicate to the user that extra info needed
099:                                setIcon(new ImageIcon(
100:                                        Utilities
101:                                                .loadImage("org/netbeans/modules/visualweb/ejb/resources/warning.png")));
102:                            else
103:                                setIcon(new ImageIcon(
104:                                        Utilities
105:                                                .loadImage("org/netbeans/modules/visualweb/ejb/resources/methodPublic.gif")));
106:                        } else {
107:                            // Must be session ejb node
108:                            setIcon(new ImageIcon(
109:                                    Utilities
110:                                            .loadImage("org/netbeans/modules/visualweb/ejb/resources/session_bean.png")));
111:                        }
112:
113:                        return this ;
114:                    }
115:                });
116:
117:                this .ejbGroup = ejbGrp;
118:
119:                setEjbGroup(ejbGrp);
120:            }
121:
122:            public void setEjbGroup(EjbGroup ejbGrp) {
123:                this .ejbGroup = ejbGrp;
124:
125:                EjbGroupTreeNodes nodes = new EjbGroupTreeNodes(ejbGroup);
126:                DefaultTreeModel treeModel = new DefaultTreeModel(nodes
127:                        .getRoot());
128:                methodTree.setModel(treeModel);
129:                methodTree.getSelectionModel().setSelectionMode(
130:                        TreeSelectionModel.SINGLE_TREE_SELECTION);
131:
132:                // By default, expand all the nodes
133:                expandAll(true);
134:
135:                // Programatically select a node
136:                if (nodes.geFirstNodeToBeSelected() != null) {
137:                    methodTree.setSelectionPath(new TreePath(nodes
138:                            .geFirstNodeToBeSelected().getPath()));
139:                    methodDetailPanel = new MethodDetailPanel(ejbGroup, nodes
140:                            .geFirstNodeToBeSelected().getMethod());
141:                } else {
142:                    methodDetailPanel = new MethodDetailPanel(ejbGroup, null);
143:                }
144:
145:                methodPanel.add(methodDetailPanel);
146:
147:                methodTree
148:                        .addTreeSelectionListener(new TreeSelectionListener() {
149:                            public void valueChanged(TreeSelectionEvent e) {
150:                                DefaultMutableTreeNode node = (DefaultMutableTreeNode) methodTree
151:                                        .getLastSelectedPathComponent();
152:
153:                                if (node == null
154:                                        || e.getOldLeadSelectionPath() == null)
155:                                    return;
156:
157:                                // Set the element class and parameter name modification for the previous selection
158:                                DefaultMutableTreeNode prevNode = (DefaultMutableTreeNode) e
159:                                        .getOldLeadSelectionPath()
160:                                        .getLastPathComponent();
161:                                if (prevNode instanceof  EjbGroupTreeNodes.MethodNode) {
162:                                    MethodInfo prevMethod = ((EjbGroupTreeNodes.MethodNode) prevNode)
163:                                            .getMethod();
164:                                    if (prevMethod.getReturnType()
165:                                            .isCollection())
166:                                        methodDetailPanel
167:                                                .updateColElemClassName();
168:
169:                                    // Programmatically stop the CellEditor so that we do not lose the very last editting value
170:                                    methodDetailPanel.stopLastCellEditing();
171:                                }
172:
173:                                if (node instanceof  EjbGroupTreeNodes.MethodNode) {
174:                                    // A method is selected
175:                                    methodDetailPanel
176:                                            .setMethod(((EjbGroupTreeNodes.MethodNode) node)
177:                                                    .getMethod());
178:                                }
179:                            }
180:                        });
181:
182:            }
183:
184:            // If expand is true, expands all nodes in the tree.
185:            // Otherwise, collapses all nodes in the tree.
186:            public void expandAll(boolean expand) {
187:                TreeNode root = (TreeNode) methodTree.getModel().getRoot();
188:
189:                // Traverse tree from root
190:                expandAll(methodTree, new TreePath(root), expand);
191:            }
192:
193:            private void expandAll(JTree tree, TreePath parent, boolean expand) {
194:                // Traverse children
195:                TreeNode node = (TreeNode) parent.getLastPathComponent();
196:                if (node.getChildCount() >= 0) {
197:                    for (Enumeration e = node.children(); e.hasMoreElements();) {
198:                        TreeNode n = (TreeNode) e.nextElement();
199:                        TreePath path = parent.pathByAddingChild(n);
200:                        expandAll(tree, path, expand);
201:                    }
202:                }
203:
204:                // Expansion or collapse must be done bottom-up
205:                if (expand) {
206:                    tree.expandPath(parent);
207:                } else {
208:                    tree.collapsePath(parent);
209:                }
210:            }
211:
212:            public MethodDetailPanel getMethodDetailPanel() {
213:                return this .methodDetailPanel;
214:            }
215:
216:            /** This method is called from within the constructor to
217:             * initialize the form.
218:             * WARNING: Do NOT modify this code. The content of this method is
219:             * always regenerated by the Form Editor.
220:             */
221:            // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
222:            private void initComponents() {
223:                java.awt.GridBagConstraints gridBagConstraints;
224:
225:                selectionPanel = new javax.swing.JPanel();
226:                treeScrollPanel = new javax.swing.JScrollPane();
227:                methodTree = new javax.swing.JTree();
228:                methodsLabel = new javax.swing.JLabel();
229:                methodPanel = new javax.swing.JPanel();
230:
231:                setLayout(new java.awt.GridBagLayout());
232:
233:                selectionPanel.setBorder(javax.swing.BorderFactory
234:                        .createEmptyBorder(5, 10, 10, 10));
235:                selectionPanel.setVerifyInputWhenFocusTarget(false);
236:                selectionPanel.setLayout(new java.awt.BorderLayout());
237:
238:                methodTree.setRootVisible(false);
239:                methodTree.setVisibleRowCount(12);
240:                treeScrollPanel.setViewportView(methodTree);
241:                java.util.ResourceBundle bundle = java.util.ResourceBundle
242:                        .getBundle("org/netbeans/modules/visualweb/ejb/ui/Bundle"); // NOI18N
243:                methodTree.getAccessibleContext().setAccessibleName(
244:                        bundle.getString("EJB_METHODS")); // NOI18N
245:                methodTree.getAccessibleContext().setAccessibleDescription(
246:                        bundle.getString("EJB_METHODS")); // NOI18N
247:
248:                selectionPanel.add(treeScrollPanel,
249:                        java.awt.BorderLayout.CENTER);
250:                treeScrollPanel.getAccessibleContext().setAccessibleName(
251:                        bundle.getString("EJB_METHODS")); // NOI18N
252:                treeScrollPanel.getAccessibleContext()
253:                        .setAccessibleDescription(
254:                                bundle.getString("EJB_METHODS")); // NOI18N
255:
256:                methodsLabel.setLabelFor(methodTree);
257:                org.openide.awt.Mnemonics.setLocalizedText(methodsLabel,
258:                        org.openide.util.NbBundle.getMessage(
259:                                ConfigureMethodsPanel.class, "EJB_METHODS")); // NOI18N
260:                selectionPanel.add(methodsLabel, java.awt.BorderLayout.NORTH);
261:                methodsLabel.getAccessibleContext().setAccessibleName(
262:                        org.openide.util.NbBundle.getMessage(
263:                                ConfigureMethodsPanel.class, "EJB_METHODS")); // NOI18N
264:                methodsLabel.getAccessibleContext().setAccessibleDescription(
265:                        org.openide.util.NbBundle.getMessage(
266:                                ConfigureMethodsPanel.class, "EJB_METHODS")); // NOI18N
267:
268:                gridBagConstraints = new java.awt.GridBagConstraints();
269:                gridBagConstraints.gridx = 0;
270:                gridBagConstraints.gridy = 0;
271:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
272:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
273:                gridBagConstraints.weightx = 0.3;
274:                gridBagConstraints.weighty = 1.0;
275:                gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
276:                add(selectionPanel, gridBagConstraints);
277:                selectionPanel.getAccessibleContext().setAccessibleName(
278:                        bundle.getString("EJB_METHODS")); // NOI18N
279:                selectionPanel.getAccessibleContext().setAccessibleDescription(
280:                        bundle.getString("EJB_METHODS")); // NOI18N
281:
282:                methodPanel.setMinimumSize(new java.awt.Dimension(0, 0));
283:                methodPanel.setLayout(new java.awt.BorderLayout());
284:                gridBagConstraints = new java.awt.GridBagConstraints();
285:                gridBagConstraints.gridx = 2;
286:                gridBagConstraints.gridy = 0;
287:                gridBagConstraints.gridwidth = 2;
288:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
289:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
290:                gridBagConstraints.weightx = 0.7;
291:                gridBagConstraints.weighty = 1.0;
292:                gridBagConstraints.insets = new java.awt.Insets(12, 17, 0, 12);
293:                add(methodPanel, gridBagConstraints);
294:                methodPanel.getAccessibleContext().setAccessibleName(
295:                        bundle.getString("METHOD_DETAILS")); // NOI18N
296:                methodPanel.getAccessibleContext().setAccessibleDescription(
297:                        bundle.getString("METHOD_DETAILS")); // NOI18N
298:
299:                getAccessibleContext().setAccessibleName(
300:                        org.openide.util.NbBundle.getMessage(
301:                                ConfigureMethodsPanel.class,
302:                                "EXPORT_EJB_DATASOURCES")); // NOI18N
303:                getAccessibleContext().setAccessibleDescription(
304:                        org.openide.util.NbBundle.getMessage(
305:                                ConfigureMethodsPanel.class,
306:                                "EXPORT_EJB_DATASOURCES")); // NOI18N
307:            }// </editor-fold>//GEN-END:initComponents
308:
309:            // Variables declaration - do not modify//GEN-BEGIN:variables
310:            private javax.swing.JPanel methodPanel;
311:            private javax.swing.JTree methodTree;
312:            private javax.swing.JLabel methodsLabel;
313:            private javax.swing.JPanel selectionPanel;
314:            private javax.swing.JScrollPane treeScrollPanel;
315:            // End of variables declaration//GEN-END:variables
316:
317:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.