Source Code Cross Referenced for WizardPane2.java in  » Web-Services-AXIS2 » tools » org » apache » axis2 » tool » service » swing » 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 » Web Services AXIS2 » tools » org.apache.axis2.tool.service.swing.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License. You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */
019:
020:        package org.apache.axis2.tool.service.swing.ui;
021:
022:        import org.apache.axis2.tool.service.bean.Page2Bean;
023:        import org.apache.axis2.tool.service.bean.WizardBean;
024:        import org.apache.axis2.tool.service.control.Controller;
025:        import org.apache.axis2.tool.service.control.ProcessException;
026:        import org.apache.axis2.tool.util.Constants;
027:
028:        import javax.swing.ButtonGroup;
029:        import javax.swing.JButton;
030:        import javax.swing.JCheckBox;
031:        import javax.swing.JDialog;
032:        import javax.swing.JFrame;
033:        import javax.swing.JLabel;
034:        import javax.swing.JPanel;
035:        import javax.swing.JRadioButton;
036:        import javax.swing.JTextField;
037:        import java.awt.HeadlessException;
038:        import java.awt.event.ActionEvent;
039:        import java.awt.event.ActionListener;
040:        import java.awt.event.KeyEvent;
041:        import java.awt.event.KeyListener;
042:        import java.util.ArrayList;
043:
044:        public class WizardPane2 extends WizardPane {
045:
046:            private WizardBean parentBean;
047:            private Page2Bean myBean;
048:
049:            private JRadioButton selectManualFileRadioButton;
050:            private JRadioButton createAutomaticFileRadioButton;
051:            private JPanel selectionPanel;
052:
053:            public WizardPane2(WizardBean wizardBean, JFrame ownerFrame) {
054:                super (ownerFrame);
055:
056:                init();
057:
058:                parentBean = wizardBean;
059:
060:                if (wizardBean.getPage2bean() != null) {
061:                    myBean = wizardBean.getPage2bean();
062:                    //set the initial settings from the bean
063:                    setBeanValues();
064:
065:                } else {
066:                    myBean = new Page2Bean();
067:                    wizardBean.setPage2bean(myBean);
068:                    setDefaultValues();
069:                }
070:
071:            }
072:
073:            public void setBeanValues() {
074:                if (myBean.isManual()) {
075:                    this .selectManualFileRadioButton.setSelected(true);
076:                    loadScreen(new ManualSelectionPanel(true));
077:                } else {
078:                    this .createAutomaticFileRadioButton.setSelected(true);
079:                    loadScreen(new AutomaticSelectionPanel(true));
080:                }
081:            }
082:
083:            public boolean validateValues() {
084:                String text = "";
085:                String text2 = "";
086:                boolean returnValue = false;
087:                if (myBean.isManual()) {
088:                    text = myBean.getManualFileName();
089:                    returnValue = (text != null && text.trim().length() > 0);
090:                } else {
091:                    text = myBean.getAutomaticClassName();
092:                    text2 = myBean.getProviderClassName();
093:                    returnValue = (text != null && text.trim().length() > 0)
094:                            && (text2 != null && text2.trim().length() > 0);
095:                }
096:
097:                return returnValue;
098:            }
099:
100:            private void init() {
101:                this .setLayout(null);
102:                this .setSize(width, height);
103:
104:                initDescription("\n Select either the service xml file or the class that you want to \n "
105:                        + " expose as the service to auto generate a service.xml. \n "
106:                        + " Only the class files that are in the previously selected location can\n"
107:                        + " be laded from here");
108:
109:                ButtonGroup group = new ButtonGroup();
110:
111:                this .selectManualFileRadioButton = new JRadioButton(
112:                        "Select a file manually");
113:                this .selectManualFileRadioButton.setBounds(hgap, descHeight,
114:                        Constants.UIConstants.RADIO_BUTTON_WIDTH,
115:                        Constants.UIConstants.GENERAL_COMP_HEIGHT);
116:                this .add(this .selectManualFileRadioButton);
117:                group.add(selectManualFileRadioButton);
118:                this .selectManualFileRadioButton
119:                        .addActionListener(new ActionListener() {
120:                            public void actionPerformed(ActionEvent e) {
121:                                changeSelectionScreen();
122:                            }
123:                        });
124:                this .createAutomaticFileRadioButton = new JRadioButton(
125:                        "Create a file automatically");
126:                this .createAutomaticFileRadioButton.setBounds(hgap, descHeight
127:                        + vgap + Constants.UIConstants.GENERAL_COMP_HEIGHT,
128:                        Constants.UIConstants.RADIO_BUTTON_WIDTH,
129:                        Constants.UIConstants.GENERAL_COMP_HEIGHT);
130:                this .add(this .createAutomaticFileRadioButton);
131:                group.add(createAutomaticFileRadioButton);
132:                this .createAutomaticFileRadioButton
133:                        .addActionListener(new ActionListener() {
134:                            public void actionPerformed(ActionEvent e) {
135:                                changeSelectionScreen();
136:                            }
137:                        });
138:
139:                this .selectionPanel = new JPanel();
140:                this .selectionPanel.setLayout(null);
141:                this .selectionPanel.setBounds(0, descHeight + 2
142:                        * Constants.UIConstants.GENERAL_COMP_HEIGHT + 2 * vgap,
143:                        width, 100);
144:                this .add(this .selectionPanel);
145:
146:                //select manual option by default
147:
148:            }
149:
150:            private void setDefaultValues() {
151:                this .selectManualFileRadioButton.setSelected(true);
152:                loadScreen(new ManualSelectionPanel());
153:                updateBeanFlags(true);
154:            }
155:
156:            private void changeSelectionScreen() {
157:                if (selectManualFileRadioButton.isSelected()) {
158:                    loadScreen(new ManualSelectionPanel(true));
159:                    updateBeanFlags(true);
160:                } else {
161:                    loadScreen(new AutomaticSelectionPanel(true));
162:                    updateBeanFlags(false);
163:                }
164:            }
165:
166:            private void updateBeanFlags(boolean flag) {
167:                myBean.setManual(flag);
168:                myBean.setAutomatic(!flag);
169:            }
170:
171:            private void loadScreen(JPanel panel) {
172:                this .selectionPanel.removeAll();
173:                this .selectionPanel.add(panel);
174:                this .repaint();
175:            }
176:
177:            private class ManualSelectionPanel extends JPanel {
178:
179:                private JLabel serverXMLFileLocationLabel;
180:                private JTextField serverXMLFileLocationTextBox;
181:                private JButton browseButton;
182:
183:                public ManualSelectionPanel() {
184:                    init();
185:                }
186:
187:                public ManualSelectionPanel(boolean loadVals) {
188:                    init();
189:                    if (loadVals) {
190:                        this .serverXMLFileLocationTextBox.setText(myBean
191:                                .getManualFileName());
192:                    }
193:                }
194:
195:                private void init() {
196:                    this .setLayout(null);
197:                    this .setSize(width, 100);
198:
199:                    this .serverXMLFileLocationLabel = new JLabel("Service File");
200:                    this .add(this .serverXMLFileLocationLabel);
201:                    this .serverXMLFileLocationLabel.setBounds(hgap, vgap,
202:                            Constants.UIConstants.LABEL_WIDTH,
203:                            Constants.UIConstants.GENERAL_COMP_HEIGHT);
204:
205:                    this .serverXMLFileLocationTextBox = new JTextField();
206:                    this .add(this .serverXMLFileLocationTextBox);
207:                    this .serverXMLFileLocationTextBox.setBounds(
208:                            Constants.UIConstants.LABEL_WIDTH + 2 * hgap, vgap,
209:                            Constants.UIConstants.TEXT_BOX_WIDTH,
210:                            Constants.UIConstants.GENERAL_COMP_HEIGHT);
211:                    this .serverXMLFileLocationTextBox
212:                            .addActionListener(new ActionListener() {
213:                                public void actionPerformed(ActionEvent e) {
214:                                    setOutFileName();
215:                                }
216:                            });
217:                    this .serverXMLFileLocationTextBox
218:                            .addKeyListener(new KeyListener() {
219:                                public void keyTyped(KeyEvent e) {
220:                                }
221:
222:                                public void keyPressed(KeyEvent e) {
223:                                }
224:
225:                                public void keyReleased(KeyEvent e) {
226:                                    setOutFileName();
227:                                }
228:                            });
229:
230:                    this .browseButton = new JButton(".");
231:                    this .add(this .browseButton);
232:                    this .browseButton.setBounds(
233:                            Constants.UIConstants.LABEL_WIDTH + 2 * hgap
234:                                    + Constants.UIConstants.TEXT_BOX_WIDTH,
235:                            vgap, Constants.UIConstants.BROWSE_BUTTON_WIDTH,
236:                            Constants.UIConstants.GENERAL_COMP_HEIGHT);
237:                    this .browseButton.addActionListener(new ActionListener() {
238:                        public void actionPerformed(ActionEvent e) {
239:                            serverXMLFileLocationTextBox
240:                                    .setText(browseForAFile("xml"));
241:                            setOutFileName();
242:                        }
243:                    });
244:
245:                }
246:
247:                private void setOutFileName() {
248:                    myBean.setManualFileName(serverXMLFileLocationTextBox
249:                            .getText());
250:                }
251:            }
252:
253:            private class AutomaticSelectionPanel extends JPanel {
254:
255:                private JLabel classFileListLable;
256:                private JLabel providerClassLable;
257:                private JTextField classFileNameTextBox;
258:                private JTextField providerClassNameTextBox;
259:                private JButton loadButton;
260:                private JButton advancedButton;
261:
262:                public AutomaticSelectionPanel() {
263:                    init();
264:                }
265:
266:                public AutomaticSelectionPanel(boolean loadVals) {
267:                    init();
268:                    if (loadVals) {
269:                        this .classFileNameTextBox.setText(myBean
270:                                .getAutomaticClassName());
271:                        this .providerClassNameTextBox.setText(myBean
272:                                .getProviderClassName());
273:                    }
274:                }
275:
276:                private void init() {
277:                    this .setLayout(null);
278:                    this .setSize(width, 100);
279:
280:                    this .classFileListLable = new JLabel("Class Name");
281:                    this .add(this .classFileListLable);
282:                    this .classFileListLable.setBounds(hgap, vgap,
283:                            Constants.UIConstants.LABEL_WIDTH,
284:                            Constants.UIConstants.GENERAL_COMP_HEIGHT);
285:
286:                    this .classFileNameTextBox = new JTextField();
287:                    this .add(this .classFileNameTextBox);
288:                    this .classFileNameTextBox.setBounds(
289:                            Constants.UIConstants.LABEL_WIDTH + 2 * hgap, vgap,
290:                            Constants.UIConstants.TEXT_BOX_WIDTH,
291:                            Constants.UIConstants.GENERAL_COMP_HEIGHT);
292:                    this .classFileNameTextBox
293:                            .addActionListener(new ActionListener() {
294:                                public void actionPerformed(ActionEvent e) {
295:                                    setClassName();
296:                                }
297:                            });
298:                    this .classFileNameTextBox.addKeyListener(new KeyListener() {
299:                        public void keyTyped(KeyEvent e) {
300:                        }
301:
302:                        public void keyPressed(KeyEvent e) {
303:                        }
304:
305:                        public void keyReleased(KeyEvent e) {
306:                            setClassName();
307:                        }
308:                    });
309:
310:                    this .providerClassLable = new JLabel("Provider Class Name");
311:                    this .add(this .providerClassLable);
312:                    this .providerClassLable.setBounds(hgap,
313:                            (Constants.UIConstants.GENERAL_COMP_HEIGHT + vgap),
314:                            Constants.UIConstants.LABEL_WIDTH,
315:                            Constants.UIConstants.GENERAL_COMP_HEIGHT);
316:
317:                    this .providerClassNameTextBox = new JTextField();
318:                    this .add(this .providerClassNameTextBox);
319:                    this .providerClassNameTextBox
320:                            .setBounds(
321:                                    Constants.UIConstants.LABEL_WIDTH + 2
322:                                            * hgap,
323:                                    (Constants.UIConstants.GENERAL_COMP_HEIGHT + vgap * 2),
324:                                    Constants.UIConstants.TEXT_BOX_WIDTH,
325:                                    Constants.UIConstants.GENERAL_COMP_HEIGHT);
326:                    this .providerClassNameTextBox
327:                            .addActionListener(new ActionListener() {
328:                                public void actionPerformed(ActionEvent e) {
329:                                    setProviderClassName();
330:                                }
331:                            });
332:                    this .providerClassNameTextBox
333:                            .addKeyListener(new KeyListener() {
334:                                public void keyTyped(KeyEvent e) {
335:                                }
336:
337:                                public void keyPressed(KeyEvent e) {
338:                                }
339:
340:                                public void keyReleased(KeyEvent e) {
341:                                    setProviderClassName();
342:                                }
343:                            });
344:
345:                    this .loadButton = new JButton("Load");
346:                    this .add(this .loadButton);
347:                    this .loadButton.setBounds(hgap,
348:                            (Constants.UIConstants.GENERAL_COMP_HEIGHT + vgap)
349:                                    * 2 + vgap,
350:                            Constants.UIConstants.GENERAL_BUTTON_WIDTH,
351:                            Constants.UIConstants.GENERAL_COMP_HEIGHT);
352:                    this .loadButton.addActionListener(new ActionListener() {
353:                        public void actionPerformed(ActionEvent e) {
354:                            loadAllMethods();
355:                        }
356:                    });
357:                    loadButton.setEnabled(false);
358:
359:                    this .advancedButton = new JButton("Advanced");
360:                    this .add(this .advancedButton);
361:                    this .advancedButton.setBounds(2 * hgap
362:                            + Constants.UIConstants.GENERAL_BUTTON_WIDTH,
363:                            (Constants.UIConstants.GENERAL_COMP_HEIGHT + vgap)
364:                                    * 2 + vgap,
365:                            Constants.UIConstants.GENERAL_BUTTON_WIDTH,
366:                            Constants.UIConstants.GENERAL_COMP_HEIGHT);
367:                    this .advancedButton.addActionListener(new ActionListener() {
368:                        public void actionPerformed(ActionEvent e) {
369:                            openDialog();
370:                        }
371:                    });
372:                    this .advancedButton.setEnabled(false);
373:                }
374:
375:                private void loadAllMethods() {
376:                    try {
377:                        ArrayList methodList = new Controller()
378:                                .getMethodList(parentBean);
379:                        myBean.setSelectedMethodNames(methodList);
380:                        loadButton.setEnabled(false);
381:                        advancedButton.setEnabled(true);
382:                    } catch (ProcessException e) {
383:                        showErrorMessage(e.getMessage());
384:                    }
385:                }
386:
387:                private void openDialog() {
388:                    try {
389:                        new AdvancedSelectionDialog().show();
390:                    } catch (ProcessException e) {
391:                        showErrorMessage(e.getMessage());
392:                    }
393:                }
394:
395:                private void setClassName() {
396:                    loadButton.setEnabled(true);
397:                    advancedButton.setEnabled(false);
398:                    myBean
399:                            .setAutomaticClassName(classFileNameTextBox
400:                                    .getText());
401:                }
402:
403:                private void setProviderClassName() {
404:                    //loadButton.setEnabled(true);
405:                    //advancedButton.setEnabled(false);
406:                    myBean.setProviderClassName(providerClassNameTextBox
407:                            .getText());
408:                }
409:
410:            }
411:
412:            private class AdvancedSelectionDialog extends JDialog {
413:
414:                private JPanel lablePanel;
415:                private JButton okButton;
416:                private JButton cancelButton;
417:                private boolean[] selectedValues;
418:                private ArrayList completeMethodList;
419:
420:                public AdvancedSelectionDialog() throws HeadlessException,
421:                        ProcessException {
422:                    super ();
423:                    super .setModal(true);
424:                    super .setTitle("Select Methods");
425:                    this .getContentPane().setLayout(null);
426:                    init();
427:                }
428:
429:                private void init() throws ProcessException {
430:                    //load the class file list
431:                    this .completeMethodList = new Controller()
432:                            .getMethodList(parentBean);
433:                    int methodCount = this .completeMethodList.size();
434:                    int panelHeight = methodCount
435:                            * (Constants.UIConstants.GENERAL_COMP_HEIGHT + vgap);
436:
437:                    this .lablePanel = new JPanel();
438:                    this .lablePanel.setLayout(null);
439:                    this .lablePanel.setBounds(0, 0, width, panelHeight);
440:                    this .getContentPane().add(this .lablePanel);
441:
442:                    ArrayList currentSelectedList = myBean
443:                            .getSelectedMethodNames();
444:                    //create check boxes for all the methods and add them to the panel
445:                    JCheckBox tempCheckBox;
446:                    boolean currentSelection;
447:                    this .selectedValues = new boolean[methodCount];
448:
449:                    for (int i = 0; i < methodCount; i++) {
450:                        tempCheckBox = new JCheckBox(this .completeMethodList
451:                                .get(i).toString());
452:                        currentSelection = currentSelectedList
453:                                .contains(this .completeMethodList.get(i));
454:                        tempCheckBox.setSelected(currentSelection);
455:                        selectedValues[i] = currentSelection;
456:                        tempCheckBox
457:                                .setBounds(
458:                                        hgap,
459:                                        vgap
460:                                                + (Constants.UIConstants.GENERAL_COMP_HEIGHT + vgap)
461:                                                * i,
462:                                        Constants.UIConstants.LABEL_WIDTH * 3,
463:                                        Constants.UIConstants.GENERAL_COMP_HEIGHT);
464:                        tempCheckBox
465:                                .addActionListener(new CheckBoxActionListner(
466:                                        tempCheckBox, i));
467:                        this .lablePanel.add(tempCheckBox);
468:
469:                    }
470:
471:                    okButton = new JButton("OK");
472:                    this .getContentPane().add(this .okButton);
473:                    this .okButton.setBounds(hgap, panelHeight + vgap,
474:                            Constants.UIConstants.GENERAL_BUTTON_WIDTH,
475:                            Constants.UIConstants.GENERAL_COMP_HEIGHT);
476:                    this .okButton.addActionListener(new ActionListener() {
477:                        public void actionPerformed(ActionEvent e) {
478:                            loadValuesToBean();
479:                            closeMe();
480:                        }
481:                    });
482:
483:                    cancelButton = new JButton("Cancel");
484:                    this .getContentPane().add(this .cancelButton);
485:                    this .cancelButton.setBounds(hgap * 2
486:                            + Constants.UIConstants.GENERAL_BUTTON_WIDTH,
487:                            panelHeight + vgap,
488:                            Constants.UIConstants.GENERAL_BUTTON_WIDTH,
489:                            Constants.UIConstants.GENERAL_COMP_HEIGHT);
490:                    this .cancelButton.addActionListener(new ActionListener() {
491:                        public void actionPerformed(ActionEvent e) {
492:                            closeMe();
493:                        }
494:                    });
495:
496:                    this .setSize(width, panelHeight + 2
497:                            * Constants.UIConstants.GENERAL_COMP_HEIGHT + 30);
498:                    this .setResizable(false);
499:                }
500:
501:                private void updateSelection(JCheckBox checkBox, int index) {
502:                    if (checkBox.isSelected()) {
503:                        selectedValues[index] = true;
504:                    } else {
505:                        selectedValues[index] = false;
506:                    }
507:
508:                }
509:
510:                private void loadValuesToBean() {
511:                    ArrayList modifiedMethodList = new ArrayList();
512:                    for (int i = 0; i < selectedValues.length; i++) {
513:                        if (selectedValues[i])
514:                            modifiedMethodList.add(completeMethodList.get(i));
515:                    }
516:
517:                    myBean.setSelectedMethodNames(modifiedMethodList);
518:                }
519:
520:                private void closeMe() {
521:                    this .dispose();
522:                }
523:
524:                private class CheckBoxActionListner implements  ActionListener {
525:                    private JCheckBox checkBox;
526:                    private int index;
527:
528:                    public CheckBoxActionListner(JCheckBox checkBox, int index) {
529:                        this .index = index;
530:                        this .checkBox = checkBox;
531:                    }
532:
533:                    public void actionPerformed(ActionEvent e) {
534:                        updateSelection(checkBox, index);
535:                    }
536:
537:                }
538:            }
539:
540:        }
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.