Source Code Cross Referenced for DeviceAnywhereCustomizerPanel.java in  » IDE-Netbeans » debugger » org » netbeans » modules » deployment » deviceanywhere » 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 » debugger » org.netbeans.modules.deployment.deviceanywhere 
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:        /*
043:         * DeviceAnywhereCustomizerPanel.java
044:         *
045:         * Created on April 27, 2007, 4:34 PM
046:         */
047:
048:        package org.netbeans.modules.deployment.deviceanywhere;
049:
050:        import java.awt.Dialog;
051:        import java.awt.event.ActionEvent;
052:        import java.awt.event.ActionListener;
053:        import java.awt.event.ItemEvent;
054:        import java.awt.event.ItemListener;
055:        import java.awt.event.MouseEvent;
056:        import java.util.ArrayList;
057:        import java.util.List;
058:        import java.util.StringTokenizer;
059:        import javax.swing.JButton;
060:        import javax.swing.event.ChangeEvent;
061:        import javax.swing.event.ChangeListener;
062:        import javax.swing.event.DocumentEvent;
063:        import javax.swing.event.DocumentListener;
064:        import org.netbeans.modules.deployment.deviceanywhere.service.ApplicationAPIDeviceWrapper;
065:        import org.openide.DialogDescriptor;
066:        import org.openide.DialogDisplayer;
067:        import org.openide.NotifyDescriptor;
068:        import org.openide.awt.MouseUtils;
069:        import org.openide.util.NbBundle;
070:
071:        /**
072:         *
073:         * @author  suchys
074:         */
075:        public class DeviceAnywhereCustomizerPanel extends javax.swing.JPanel {
076:
077:            private List<ApplicationAPIDeviceWrapper> devices;
078:            private DeviceAnywhereDeploymentPlugin.PropertyEvaluator evaluator;
079:
080:            //private 
081:            /**
082:             * Creates new form DeviceAnywhereCustomizerPanel
083:             */
084:            DeviceAnywhereCustomizerPanel(
085:                    DeviceAnywhereDeploymentPlugin.PropertyEvaluator evaluator) {
086:                initComponents();
087:                //invisible components, only value holders
088:                allDevices.setVisible(false);
089:                selectedDevice.setVisible(false);
090:                selectedDeviceCareer.setVisible(false);
091:                add(allDevices);
092:                add(selectedDevice);
093:                add(selectedDeviceCareer);
094:                retriveButton.addActionListener(new DeviceListener());
095:                this .evaluator = evaluator;
096:            }
097:
098:            @Override
099:            public void addNotify() {
100:                String input = allDevices.getText();
101:                if (input.length() != 0) {
102:                    devicesComboBox.removeAllItems();
103:                    devices = new ArrayList<ApplicationAPIDeviceWrapper>();
104:                    //todo Is this good property parsing? Don't we have a better way to do it?
105:                    //todo, need to remove asserts for dev builds
106:                    try {
107:                        StringTokenizer st = new StringTokenizer(input, ";"); //NOI18N
108:                        while (st.hasMoreElements()) {
109:                            String token = st.nextToken();
110:                            StringTokenizer item = new StringTokenizer(token,
111:                                    ","); //NOI18N
112:                            String s = item.nextToken();
113:                            //assert s != null : "Missing token for DeviceID"; //NOI18N
114:                            int deviceId = Integer.parseInt(s.substring(s
115:                                    .indexOf("=") + 1)); //NOI18N
116:                            s = item.nextToken();
117:                            //assert s != null : "Missing token for DeviceName"; //NOI18N
118:                            String deviceName = s.substring(s.indexOf("=") + 1); //NOI18N
119:                            s = item.nextToken();
120:                            //assert s != null : "Missing token for DeviceCareer"; //NOI18N
121:                            String deviceCareer = s
122:                                    .substring(s.indexOf("=") + 1); //NOI18N
123:                            ApplicationAPIDeviceWrapper wrapper = new ApplicationAPIDeviceWrapper();
124:                            wrapper.setId(deviceId);
125:                            wrapper.setName(deviceName);
126:                            wrapper.setCarrier(deviceCareer);
127:                            devices.add(wrapper);
128:                            devicesComboBox.addItem(deviceName);
129:                        }
130:                    } catch (Exception e) {
131:                    }
132:                }
133:                if (devices == null || devices.size() == 0) {
134:                    selectedDevice.setText("-1");
135:                    devicesComboBox.addItem(NbBundle
136:                            .getMessage(DeviceAnywhereCustomizerPanel.class,
137:                                    "MSG_NoDevice")); //NOI18N
138:                } else {
139:                    String deviceId = selectedDevice.getText();
140:                    for (ApplicationAPIDeviceWrapper elem : devices) {
141:                        if (deviceId.equals(String.valueOf(elem.getId()))) {
142:                            devicesComboBox.setSelectedItem(elem.getName());
143:                            break;
144:                        }
145:                    }
146:                    if (devicesComboBox.getSelectedIndex() == -1) {
147:                        devicesComboBox.setSelectedIndex(0);
148:                    }
149:                }
150:                retriveButton
151:                        .setEnabled(true/*jTextFieldUser.getText().trim().length() != 0*/);
152:                //jTextFieldUser.getDocument().addDocumentListener(dl);
153:                devicesComboBox.addItemListener(il);
154:
155:                super .addNotify();
156:            }
157:
158:            @Override
159:            public void removeNotify() {
160:                super .removeNotify();
161:                //jTextFieldUser.getDocument().removeDocumentListener(dl);
162:                devicesComboBox.removeItemListener(il);
163:            }
164:
165:            /** This method is called from within the constructor to
166:             * initialize the form.
167:             * WARNING: Do NOT modify this code. The content of this method is
168:             * always regenerated by the Form Editor.
169:             */
170:            // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
171:            private void initComponents() {
172:
173:                allDevices = new javax.swing.JTextField();
174:                selectedDevice = new javax.swing.JTextField();
175:                selectedDeviceCareer = new javax.swing.JTextField();
176:                inputPasswordPanel = new javax.swing.JPanel();
177:                jLabel1 = new javax.swing.JLabel();
178:                passwordField = new javax.swing.JPasswordField();
179:                devicesComboBox = new javax.swing.JComboBox();
180:                jLabel5 = new javax.swing.JLabel();
181:                retriveButton = new javax.swing.JButton();
182:
183:                allDevices
184:                        .setName(DeviceAnywhereDeploymentPlugin.PROP_AVAILABLE_DEVICES);
185:
186:                selectedDevice
187:                        .setName(DeviceAnywhereDeploymentPlugin.PROP_DEVICE);
188:
189:                selectedDeviceCareer
190:                        .setName(DeviceAnywhereDeploymentPlugin.PROP_CAREER);
191:
192:                jLabel1.setLabelFor(passwordField);
193:                org.openide.awt.Mnemonics.setLocalizedText(jLabel1,
194:                        org.openide.util.NbBundle.getMessage(
195:                                DeviceAnywhereCustomizerPanel.class,
196:                                "MSG_InsertPass")); // NOI18N
197:
198:                org.jdesktop.layout.GroupLayout inputPasswordPanelLayout = new org.jdesktop.layout.GroupLayout(
199:                        inputPasswordPanel);
200:                inputPasswordPanel.setLayout(inputPasswordPanelLayout);
201:                inputPasswordPanelLayout
202:                        .setHorizontalGroup(inputPasswordPanelLayout
203:                                .createParallelGroup(
204:                                        org.jdesktop.layout.GroupLayout.LEADING)
205:                                .add(
206:                                        inputPasswordPanelLayout
207:                                                .createSequentialGroup()
208:                                                .addContainerGap()
209:                                                .add(jLabel1)
210:                                                .addPreferredGap(
211:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
212:                                                .add(
213:                                                        passwordField,
214:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
215:                                                        274, Short.MAX_VALUE)
216:                                                .addContainerGap()));
217:                inputPasswordPanelLayout
218:                        .setVerticalGroup(inputPasswordPanelLayout
219:                                .createParallelGroup(
220:                                        org.jdesktop.layout.GroupLayout.LEADING)
221:                                .add(
222:                                        inputPasswordPanelLayout
223:                                                .createSequentialGroup()
224:                                                .addContainerGap()
225:                                                .add(
226:                                                        inputPasswordPanelLayout
227:                                                                .createParallelGroup(
228:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
229:                                                                .add(jLabel1)
230:                                                                .add(
231:                                                                        passwordField,
232:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
233:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
234:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
235:                                                .addContainerGap(
236:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
237:                                                        Short.MAX_VALUE)));
238:
239:                jLabel1.getAccessibleContext().setAccessibleName(
240:                        org.openide.util.NbBundle.getMessage(
241:                                DeviceAnywhereCustomizerPanel.class,
242:                                "ACSN_InsertPass")); // NOI18N
243:                jLabel1.getAccessibleContext().setAccessibleDescription(
244:                        org.openide.util.NbBundle.getMessage(
245:                                DeviceAnywhereCustomizerPanel.class,
246:                                "ACSD_InsertPass")); // NOI18N
247:
248:                jLabel5.setLabelFor(devicesComboBox);
249:                org.openide.awt.Mnemonics.setLocalizedText(jLabel5,
250:                        org.openide.util.NbBundle.getMessage(
251:                                DeviceAnywhereCustomizerPanel.class,
252:                                "LBL_Device")); // NOI18N
253:
254:                org.openide.awt.Mnemonics.setLocalizedText(retriveButton,
255:                        org.openide.util.NbBundle.getMessage(
256:                                DeviceAnywhereCustomizerPanel.class,
257:                                "LBL_RetriveDevices")); // NOI18N
258:                retriveButton.setActionCommand(org.openide.util.NbBundle
259:                        .getMessage(DeviceAnywhereCustomizerPanel.class,
260:                                "LBL_RetriveDevices")); // NOI18N
261:
262:                org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
263:                        this );
264:                this .setLayout(layout);
265:                layout
266:                        .setHorizontalGroup(layout
267:                                .createParallelGroup(
268:                                        org.jdesktop.layout.GroupLayout.LEADING)
269:                                .add(
270:                                        org.jdesktop.layout.GroupLayout.TRAILING,
271:                                        layout
272:                                                .createSequentialGroup()
273:                                                .add(jLabel5)
274:                                                .addPreferredGap(
275:                                                        org.jdesktop.layout.LayoutStyle.UNRELATED)
276:                                                .add(devicesComboBox, 0, 316,
277:                                                        Short.MAX_VALUE)
278:                                                .addPreferredGap(
279:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
280:                                                .add(retriveButton)
281:                                                .add(0, 0, 0)));
282:                layout
283:                        .setVerticalGroup(layout
284:                                .createParallelGroup(
285:                                        org.jdesktop.layout.GroupLayout.LEADING)
286:                                .add(
287:                                        layout
288:                                                .createSequentialGroup()
289:                                                .add(
290:                                                        layout
291:                                                                .createParallelGroup(
292:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
293:                                                                .add(
294:                                                                        retriveButton)
295:                                                                .add(jLabel5)
296:                                                                .add(
297:                                                                        devicesComboBox,
298:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
299:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
300:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
301:                                                .addContainerGap(173,
302:                                                        Short.MAX_VALUE)));
303:
304:                jLabel5.getAccessibleContext().setAccessibleName(
305:                        org.openide.util.NbBundle.getMessage(
306:                                DeviceAnywhereCustomizerPanel.class,
307:                                "ACSN_Device")); // NOI18N
308:                jLabel5.getAccessibleContext().setAccessibleDescription(
309:                        org.openide.util.NbBundle.getMessage(
310:                                DeviceAnywhereCustomizerPanel.class,
311:                                "ACSD_Device")); // NOI18N
312:                retriveButton.getAccessibleContext().setAccessibleName(
313:                        org.openide.util.NbBundle.getMessage(
314:                                DeviceAnywhereCustomizerPanel.class,
315:                                "ACSN_RetriveDevices")); // NOI18N
316:                retriveButton.getAccessibleContext().setAccessibleDescription(
317:                        org.openide.util.NbBundle.getMessage(
318:                                DeviceAnywhereCustomizerPanel.class,
319:                                "ACSD_RetriveDevices")); // NOI18N
320:            }// </editor-fold>//GEN-END:initComponents
321:
322:            // Variables declaration - do not modify//GEN-BEGIN:variables
323:            private javax.swing.JTextField allDevices;
324:            private javax.swing.JComboBox devicesComboBox;
325:            private javax.swing.JPanel inputPasswordPanel;
326:            private javax.swing.JLabel jLabel1;
327:            private javax.swing.JLabel jLabel5;
328:            private javax.swing.JPasswordField passwordField;
329:            private javax.swing.JButton retriveButton;
330:            private javax.swing.JTextField selectedDevice;
331:            private javax.swing.JTextField selectedDeviceCareer;
332:
333:            // End of variables declaration//GEN-END:variables
334:
335:            private class DeviceListener implements  ActionListener /*, DocumentListener */{
336:
337:                protected final JButton okButton;
338:
339:                DeviceListener() {
340:                    this .okButton = new JButton(NbBundle
341:                            .getMessage(DeviceAnywhereCustomizerPanel.class,
342:                                    "LBL_ChooseOK")); //NOI18N
343:                    this .okButton.getAccessibleContext().setAccessibleName(
344:                            NbBundle.getMessage(
345:                                    DeviceAnywhereCustomizerPanel.class,
346:                                    "ACSN_ChooseOK")); //NOI18N
347:                    this .okButton
348:                            .getAccessibleContext()
349:                            .setAccessibleDescription(
350:                                    NbBundle
351:                                            .getMessage(
352:                                                    DeviceAnywhereCustomizerPanel.class,
353:                                                    "ACSD_ChooseOK")); //NOI18N
354:                }
355:
356:                // Implementation of ActionListener ------------------------------------
357:
358:                /** Handles button events
359:                 */
360:                public void actionPerformed(ActionEvent e) {
361:
362:                    String user = evaluator.evaluateGlobalProperty(
363:                            DeviceAnywhereDeploymentPlugin.PROP_USERID,
364:                            evaluator.evaluateProperty("deployment.instance")); //NOI18N
365:
366:                    if (user.trim().length() == 0) {
367:                        NotifyDescriptor.InputLine input = new NotifyDescriptor.InputLine(
368:                                NbBundle.getMessage(
369:                                        DeviceAnywhereCustomizerPanel.class,
370:                                        "MSG_InsertUsername"), //NOI18N
371:                                NbBundle.getMessage(
372:                                        DeviceAnywhereCustomizerPanel.class,
373:                                        "TITLE_InsertUsername")); //NOI18N
374:                        DialogDisplayer.getDefault().notify(input);
375:                        if (input.getValue() == NotifyDescriptor.OK_OPTION) {
376:                            user = input.getInputText();
377:                        } else {
378:                            return;
379:                        }
380:                    }
381:
382:                    String password = evaluator.evaluateGlobalProperty(
383:                            DeviceAnywhereDeploymentPlugin.PROP_PASSWORD,
384:                            evaluator.evaluateProperty("deployment.instance")); //NOI18N
385:
386:                    if (password.trim().length() == 0) {
387:                        DialogDescriptor input = new DialogDescriptor(
388:                                inputPasswordPanel, //NOI18N
389:                                NbBundle.getMessage(
390:                                        DeviceAnywhereCustomizerPanel.class,
391:                                        "TITLE_InsertPass")); //NOI18N
392:                        DialogDisplayer.getDefault().createDialog(input)
393:                                .setVisible(true);
394:                        if (input.getValue() == NotifyDescriptor.OK_OPTION) {
395:                            password = new String(passwordField.getPassword());
396:                        } else {
397:                            return;
398:                        }
399:                    }
400:
401:                    final DeviceChooser panel = new DeviceChooser(user,
402:                            password, null);
403:                    Object[] options = new Object[] { okButton,
404:                            DialogDescriptor.CANCEL_OPTION };
405:
406:                    //            panel.setSelectedMainClass(mainClassTextField.getText());
407:                    panel.addChangeListener(new ChangeListener() {
408:                        public void stateChanged(ChangeEvent e) {
409:                            if (e.getSource() instanceof  MouseEvent
410:                                    && MouseUtils.isDoubleClick(((MouseEvent) e
411:                                            .getSource()))) {
412:                                // click button and finish the dialog with selected class
413:                                okButton.doClick();
414:                            } else {
415:                                okButton
416:                                        .setEnabled(panel.getSelectedDevice() != null);
417:                            }
418:                        }
419:                    });
420:                    okButton.setEnabled(false);
421:                    DialogDescriptor desc = new DialogDescriptor(
422:                            panel,
423:                            NbBundle.getMessage(
424:                                    DeviceAnywhereCustomizerPanel.class,
425:                                    "TITLE_ChooseDevice"), //NOI18N
426:                            true, options, options[0],
427:                            DialogDescriptor.BOTTOM_ALIGN, null, null);
428:                    //desc.setMessageType (DialogDescriptor.INFORMATION_MESSAGE);
429:                    Dialog dlg = DialogDisplayer.getDefault()
430:                            .createDialog(desc);
431:                    dlg.setVisible(true);
432:                    if (desc.getValue() == options[0]) {
433:                        devicesComboBox.removeItemListener(il);
434:                        devices = panel.getLockedDevices();
435:                        devicesComboBox.removeAllItems();
436:                        int i = 0;
437:                        StringBuffer sb = new StringBuffer();
438:                        for (ApplicationAPIDeviceWrapper elem : devices) {
439:                            devicesComboBox.addItem(elem.getName());
440:                            sb.append("DeviceID-"); //NOI18N
441:                            sb.append(i);
442:                            sb.append("="); //NOI18N
443:                            sb.append(elem.getId());
444:                            sb.append(","); //NOI18N
445:                            sb.append("DeviceName-"); //NOI18N
446:                            sb.append(i);
447:                            sb.append("="); //NOI18N
448:                            sb.append(elem.getName());
449:                            sb.append(","); //NOI18N
450:                            sb.append("DeviceCareer-"); //NOI18N
451:                            sb.append(i);
452:                            sb.append("="); //NOI18N
453:                            sb.append(elem.getCarrier());
454:                            sb.append(";"); //NOI18N
455:                            i++;
456:                        }
457:                        ApplicationAPIDeviceWrapper selected = panel
458:                                .getSelectedDevice();
459:                        devicesComboBox.setSelectedItem(selected.getName());
460:                        selectedDevice
461:                                .setText(String.valueOf(selected.getId()));
462:                        selectedDeviceCareer.setText(selected.getCarrier());
463:                        allDevices.setText(sb.toString());
464:                        devicesComboBox.addItemListener(il);
465:                    }
466:                    dlg.dispose();
467:                }
468:            }
469:
470:            ItemListener il = new ItemListener() {
471:                public void itemStateChanged(ItemEvent e) {
472:                    if (devices == null)
473:                        return;
474:                    String deviceName = (String) devicesComboBox
475:                            .getSelectedItem();
476:                    for (ApplicationAPIDeviceWrapper elem : devices) {
477:                        assert deviceName != null : "Device name must not be null here"; //NOI18N
478:                        if (deviceName.equals(elem.getName())) {
479:                            selectedDevice
480:                                    .setText(String.valueOf(elem.getId()));
481:                            selectedDeviceCareer.setText(elem.getCarrier());
482:                            return;
483:                        }
484:                    }
485:                    assert true : "Cache does not contain selected device!"; //NOI18N
486:                }
487:            };
488:
489:            DocumentListener dl = new DocumentListener() {
490:                public void changedUpdate(DocumentEvent e) {
491:                    // retriveButton.setEnabled(jTextFieldUser.getText().trim().length() != 0);
492:                }
493:
494:                public void insertUpdate(DocumentEvent e) {
495:                    changedUpdate(e);
496:                }
497:
498:                public void removeUpdate(DocumentEvent e) {
499:                    changedUpdate(e);
500:                }
501:            };
502:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.