Source Code Cross Referenced for EjbDataSourcePropertiesPanel.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:         * DataSourcePropertiesPanel.java
043:         *
044:         * Created on March 10, 2004, 12:13 PM
045:         */
046:
047:        package org.netbeans.modules.visualweb.ejb.ui;
048:
049:        import org.netbeans.modules.visualweb.ejb.datamodel.EjbGroup;
050:        import org.openide.DialogDisplayer;
051:        import org.openide.NotifyDescriptor;
052:        import org.openide.util.NbBundle;
053:
054:        /** 
055:         *  
056:         */
057:        public class EjbDataSourcePropertiesPanel extends javax.swing.JPanel {
058:            private EjbGroup ejbGrp;
059:
060:            public EjbDataSourcePropertiesPanel() {
061:                initComponents();
062:            }
063:
064:            public void clear() {
065:                nameTextField.setText("");
066:                containerTypeTextField.setText("");
067:                serverHostTextField.setText("");
068:                iiopPortTextField.setText("");
069:            }
070:
071:            public void setDataSourceProperties(EjbGroup group) {
072:                this .ejbGrp = group;
073:
074:                nameTextField.setText(group.getName());
075:                containerTypeTextField.setText(group.getAppServerVendor());
076:                serverHostTextField.setText(group.getServerHost());
077:                iiopPortTextField
078:                        .setText(Integer.toString(group.getIIOPPort()));
079:            }
080:
081:            public boolean saveChange() {
082:                StringBuffer msg = new StringBuffer();
083:                if (!validateData(msg)) {
084:                    NotifyDescriptor d = new NotifyDescriptor.Message(msg
085:                            .toString(), NotifyDescriptor.ERROR_MESSAGE);
086:                    DialogDisplayer.getDefault().notify(d);
087:                    return false;
088:                } else {
089:                    ejbGrp.setName(getName());
090:                    ejbGrp.setServerHost(getServerHost());
091:                    ejbGrp.setIIOPPort(Integer.parseInt(getIIOPPort()));
092:
093:                    return true;
094:                }
095:            }
096:
097:            public String getName() {
098:                // Workaround for 113538 Export/Import EJB feature doesn't work on Linux
099:                if (nameTextField == null) {
100:                    return "";
101:                }
102:                return nameTextField.getText().trim();
103:            }
104:
105:            public String getServerHost() {
106:                return serverHostTextField.getText().trim();
107:            }
108:
109:            public String getIIOPPort() {
110:                return iiopPortTextField.getText();
111:            }
112:
113:            private boolean validateData(StringBuffer errorMsg) {
114:                // Make sure the user didn't change anything to be invalid
115:
116:                boolean valid = true;
117:
118:                if (getName() == null || getName().length() == 0) {
119:                    if (valid) {
120:                        nameTextField.requestFocus();
121:                        valid = false;
122:                    }
123:
124:                    errorMsg.append(NbBundle.getMessage(
125:                            EjbDataSourcePropertiesPanel.class,
126:                            "EMPTY_GROUP_NAME"));
127:                    errorMsg.append("\n");
128:                }
129:
130:                if (getServerHost() == null || getServerHost().length() == 0) {
131:                    if (valid) {
132:                        serverHostTextField.requestFocus();
133:                        valid = false;
134:                    }
135:
136:                    errorMsg.append(NbBundle.getMessage(
137:                            EjbDataSourcePropertiesPanel.class,
138:                            "EMPTY_SERVER_HOST"));
139:                    errorMsg.append("\n");
140:                } else if (getServerHost().indexOf(' ') != -1) {
141:                    // Can not contain spaces
142:                    if (valid) {
143:                        serverHostTextField.requestFocus();
144:                        serverHostTextField.selectAll();
145:                        valid = false;
146:                    }
147:
148:                    errorMsg.append(NbBundle.getMessage(
149:                            EjbDataSourcePropertiesPanel.class,
150:                            "SPACES_IN_SERVER_HOST", "\'" + getServerHost()
151:                                    + "\'"));
152:                    errorMsg.append("\n");
153:                }
154:
155:                if (getIIOPPort() == null || getIIOPPort().length() == 0) {
156:                    if (valid) {
157:                        iiopPortTextField.requestFocus();
158:                        valid = false;
159:                    }
160:
161:                    errorMsg.append(NbBundle.getMessage(
162:                            EjbDataSourcePropertiesPanel.class,
163:                            "EMPTY_IIOP_PORT"));
164:                    errorMsg.append("\n");
165:                } else {
166:                    // Make it is a number
167:                    try {
168:                        int portNum = Integer.parseInt(getIIOPPort());
169:                    } catch (NumberFormatException ex) {
170:                        if (valid) {
171:                            iiopPortTextField.requestFocus();
172:                            iiopPortTextField.selectAll();
173:                            valid = false;
174:                        }
175:
176:                        errorMsg.append(NbBundle.getMessage(
177:                                EjbDataSourcePropertiesPanel.class,
178:                                "IIOP_PORT_NOT_NUMBER"));
179:                        errorMsg.append("\n");
180:                    }
181:                }
182:
183:                return valid;
184:            }
185:
186:            /** This method is called from within the constructor to
187:             * initialize the form.
188:             * WARNING: Do NOT modify this code. The content of this method is
189:             * always regenerated by the Form Editor.
190:             */
191:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
192:            private void initComponents() {
193:                java.awt.GridBagConstraints gridBagConstraints;
194:
195:                nameLabel = new javax.swing.JLabel();
196:                nameTextField = new javax.swing.JTextField();
197:                iiopPortLabel = new javax.swing.JLabel();
198:                iiopPortTextField = new javax.swing.JTextField();
199:                containerTypeLabel = new javax.swing.JLabel();
200:                containerTypeTextField = new javax.swing.JTextField();
201:                serverHostLabel = new javax.swing.JLabel();
202:                serverHostTextField = new javax.swing.JTextField();
203:                fillPanel = new javax.swing.JPanel();
204:
205:                setLayout(new java.awt.GridBagLayout());
206:
207:                nameLabel.setDisplayedMnemonic(org.openide.util.NbBundle
208:                        .getMessage(EjbDataSourcePropertiesPanel.class,
209:                                "EJB_GROUP_NAME_MNEMONIC").charAt(0));
210:                nameLabel
211:                        .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
212:                nameLabel.setLabelFor(nameTextField);
213:                nameLabel.setText(java.util.ResourceBundle.getBundle(
214:                        "org/netbeans/modules/visualweb/ejb/ui/Bundle")
215:                        .getString("EJB_GROUP_NAME_LABEL"));
216:                nameLabel.setPreferredSize(null);
217:                gridBagConstraints = new java.awt.GridBagConstraints();
218:                gridBagConstraints.gridx = 0;
219:                gridBagConstraints.gridy = 0;
220:                gridBagConstraints.gridwidth = 3;
221:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
222:                add(nameLabel, gridBagConstraints);
223:                nameLabel.getAccessibleContext().setAccessibleDescription(
224:                        java.util.ResourceBundle.getBundle(
225:                                "org/netbeans/modules/visualweb/ejb/ui/Bundle")
226:                                .getString("EJB_GROUP_NAME_DESC"));
227:
228:                nameTextField.setMinimumSize(new java.awt.Dimension(250, 20));
229:                nameTextField.setPreferredSize(null);
230:                nameTextField
231:                        .addFocusListener(new java.awt.event.FocusAdapter() {
232:                            public void focusLost(java.awt.event.FocusEvent evt) {
233:                                nameTextFieldFocusLost(evt);
234:                            }
235:                        });
236:
237:                gridBagConstraints = new java.awt.GridBagConstraints();
238:                gridBagConstraints.gridx = 3;
239:                gridBagConstraints.gridy = 0;
240:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
241:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
242:                gridBagConstraints.weightx = 1.0;
243:                gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
244:                add(nameTextField, gridBagConstraints);
245:                nameTextField.getAccessibleContext().setAccessibleDescription(
246:                        java.util.ResourceBundle.getBundle(
247:                                "org/netbeans/modules/visualweb/ejb/ui/Bundle")
248:                                .getString("EJB_GROUP_NAME_DESC"));
249:
250:                iiopPortLabel.setDisplayedMnemonic(org.openide.util.NbBundle
251:                        .getMessage(EjbDataSourcePropertiesPanel.class,
252:                                "IIOP_PORT_MNEMONIC_R").charAt(0));
253:                iiopPortLabel
254:                        .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
255:                iiopPortLabel.setLabelFor(iiopPortTextField);
256:                iiopPortLabel.setText(java.util.ResourceBundle.getBundle(
257:                        "org/netbeans/modules/visualweb/ejb/ui/Bundle")
258:                        .getString("IIOP_PORT_LABEL"));
259:                iiopPortLabel.setPreferredSize(null);
260:                gridBagConstraints = new java.awt.GridBagConstraints();
261:                gridBagConstraints.gridx = 0;
262:                gridBagConstraints.gridy = 6;
263:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
264:                gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0);
265:                add(iiopPortLabel, gridBagConstraints);
266:                iiopPortLabel.getAccessibleContext().setAccessibleDescription(
267:                        java.util.ResourceBundle.getBundle(
268:                                "org/netbeans/modules/visualweb/ejb/ui/Bundle")
269:                                .getString("IIOP_PORT_DESC"));
270:
271:                iiopPortTextField.setPreferredSize(null);
272:                gridBagConstraints = new java.awt.GridBagConstraints();
273:                gridBagConstraints.gridx = 3;
274:                gridBagConstraints.gridy = 6;
275:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
276:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
277:                gridBagConstraints.weightx = 1.0;
278:                gridBagConstraints.insets = new java.awt.Insets(10, 5, 0, 0);
279:                add(iiopPortTextField, gridBagConstraints);
280:                iiopPortTextField
281:                        .getAccessibleContext()
282:                        .setAccessibleDescription(
283:                                java.util.ResourceBundle
284:                                        .getBundle(
285:                                                "org/netbeans/modules/visualweb/ejb/ui/Bundle")
286:                                        .getString("IIOP_PORT_DESC"));
287:
288:                containerTypeLabel
289:                        .setDisplayedMnemonic(org.openide.util.NbBundle
290:                                .getMessage(EjbDataSourcePropertiesPanel.class,
291:                                        "APP_SERVER_LABEL2_MNEMONIC").charAt(0));
292:                containerTypeLabel
293:                        .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
294:                containerTypeLabel.setLabelFor(containerTypeTextField);
295:                containerTypeLabel.setText(java.util.ResourceBundle.getBundle(
296:                        "org/netbeans/modules/visualweb/ejb/ui/Bundle")
297:                        .getString("APP_SERVER_LABEL2"));
298:                containerTypeLabel.setPreferredSize(null);
299:                gridBagConstraints = new java.awt.GridBagConstraints();
300:                gridBagConstraints.gridx = 0;
301:                gridBagConstraints.gridy = 2;
302:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
303:                gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
304:                add(containerTypeLabel, gridBagConstraints);
305:                containerTypeLabel
306:                        .getAccessibleContext()
307:                        .setAccessibleDescription(
308:                                java.util.ResourceBundle
309:                                        .getBundle(
310:                                                "org/netbeans/modules/visualweb/ejb/ui/Bundle")
311:                                        .getString("APP_SERVER_DESC"));
312:
313:                containerTypeTextField.setEditable(false);
314:                containerTypeTextField.setMinimumSize(new java.awt.Dimension(
315:                        250, 20));
316:                containerTypeTextField.setPreferredSize(null);
317:                gridBagConstraints = new java.awt.GridBagConstraints();
318:                gridBagConstraints.gridx = 3;
319:                gridBagConstraints.gridy = 2;
320:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
321:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
322:                gridBagConstraints.weightx = 1.0;
323:                gridBagConstraints.insets = new java.awt.Insets(12, 5, 0, 0);
324:                add(containerTypeTextField, gridBagConstraints);
325:                containerTypeTextField
326:                        .getAccessibleContext()
327:                        .setAccessibleDescription(
328:                                java.util.ResourceBundle
329:                                        .getBundle(
330:                                                "org/netbeans/modules/visualweb/ejb/ui/Bundle")
331:                                        .getString("APP_SERVER_DESC"));
332:
333:                serverHostLabel.setDisplayedMnemonic(org.openide.util.NbBundle
334:                        .getMessage(EjbDataSourcePropertiesPanel.class,
335:                                "SERVER_HOST_MNEMONIC").charAt(0));
336:                serverHostLabel
337:                        .setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
338:                serverHostLabel.setLabelFor(serverHostTextField);
339:                serverHostLabel.setText(java.util.ResourceBundle.getBundle(
340:                        "org/netbeans/modules/visualweb/ejb/ui/Bundle")
341:                        .getString("SERVER_HOST_LABEL"));
342:                gridBagConstraints = new java.awt.GridBagConstraints();
343:                gridBagConstraints.gridx = 0;
344:                gridBagConstraints.gridy = 4;
345:                gridBagConstraints.gridwidth = 2;
346:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
347:                gridBagConstraints.insets = new java.awt.Insets(12, 0, 0, 0);
348:                add(serverHostLabel, gridBagConstraints);
349:                serverHostLabel
350:                        .getAccessibleContext()
351:                        .setAccessibleDescription(
352:                                java.util.ResourceBundle
353:                                        .getBundle(
354:                                                "org/netbeans/modules/visualweb/ejb/ui/Bundle")
355:                                        .getString("SERVER_HOST_DESC"));
356:
357:                serverHostTextField.setPreferredSize(null);
358:                gridBagConstraints = new java.awt.GridBagConstraints();
359:                gridBagConstraints.gridx = 3;
360:                gridBagConstraints.gridy = 4;
361:                gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
362:                gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
363:                gridBagConstraints.weightx = 1.0;
364:                gridBagConstraints.insets = new java.awt.Insets(12, 5, 0, 0);
365:                add(serverHostTextField, gridBagConstraints);
366:                serverHostTextField
367:                        .getAccessibleContext()
368:                        .setAccessibleDescription(
369:                                java.util.ResourceBundle
370:                                        .getBundle(
371:                                                "org/netbeans/modules/visualweb/ejb/ui/Bundle")
372:                                        .getString("SERVER_HOST_DESC"));
373:
374:                fillPanel.setPreferredSize(null);
375:                gridBagConstraints = new java.awt.GridBagConstraints();
376:                gridBagConstraints.gridx = 0;
377:                gridBagConstraints.gridy = 7;
378:                gridBagConstraints.gridwidth = 4;
379:                gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
380:                gridBagConstraints.weightx = 1.0;
381:                gridBagConstraints.weighty = 1.0;
382:                add(fillPanel, gridBagConstraints);
383:
384:            }
385:
386:            // </editor-fold>//GEN-END:initComponents
387:
388:            private void nameTextFieldFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_nameTextFieldFocusLost
389:
390:            }//GEN-LAST:event_nameTextFieldFocusLost
391:
392:            // Variables declaration - do not modify//GEN-BEGIN:variables
393:            private javax.swing.JLabel containerTypeLabel;
394:            private javax.swing.JTextField containerTypeTextField;
395:            private javax.swing.JPanel fillPanel;
396:            private javax.swing.JLabel iiopPortLabel;
397:            private javax.swing.JTextField iiopPortTextField;
398:            private javax.swing.JLabel nameLabel;
399:            private javax.swing.JTextField nameTextField;
400:            private javax.swing.JLabel serverHostLabel;
401:            private javax.swing.JTextField serverHostTextField;
402:            // End of variables declaration//GEN-END:variables
403:
404:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.