Source Code Cross Referenced for ServiceXMLFileSelectionPage.java in  » Web-Services-AXIS2 » tools » org » apache » ideaplugin » frames » 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.ideaplugin.frames 
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:        package org.apache.ideaplugin.frames;
020:
021:        import org.apache.axis2.tools.component.WizardPanel;
022:        import org.apache.axis2.tools.component.WizardComponents;
023:        import org.apache.axis2.tools.wizardframe.CodegenFrame;
024:        import org.apache.ideaplugin.bean.ArchiveBean;
025:        import org.apache.ideaplugin.bean.XmlFileFilter;
026:
027:        import javax.swing.*;
028:        import javax.swing.border.EmptyBorder;
029:        import java.awt.*;
030:        import java.awt.event.ActionListener;
031:        import java.awt.event.ActionEvent;
032:        import java.io.File;
033:        import java.io.ByteArrayOutputStream;
034:        import java.io.FileInputStream;
035:        import java.io.IOException;
036:
037:        /**
038:         * Created by IntelliJ IDEA.
039:         * User: shivantha
040:         * Date: 17/07/2007
041:         * Time: 09:45:03
042:         * To change this template use File | Settings | File Templates.
043:         */
044:        public class ServiceXMLFileSelectionPage extends WizardPanel {
045:            /**
046:             * varialbales
047:             */
048:            private JLabel lblXmlLocation;
049:            private JTextField txtServiceXml;
050:            private JButton butSelect;
051:            private JCheckBox chkBoxIncludeXml;
052:            private JButton btnHint;
053:            private JTextArea txaHint;
054:            private boolean flag = false;
055:            private String hint = "";
056:            private final JFileChooser fileChooser = new JFileChooser();
057:            private ArchiveBean archiveBean;
058:            private String value;
059:
060:            /**
061:             * Constructor
062:             * @param wizardComponents
063:             */
064:            public ServiceXMLFileSelectionPage(
065:                    WizardComponents wizardComponents, ArchiveBean archiveBean) {
066:                super (wizardComponents,
067:                        "Axis2 Idea Plugin Service Archiver Creator Wizards");
068:                setPanelTopTitle("Service Archiver");
069:                setPanelBottomTitle("Select the service.xml file");
070:                this .archiveBean = archiveBean;
071:                init();
072:            }
073:
074:            /**
075:             * initiate panel
076:             */
077:            private void init() {
078:
079:                txaHint = new JTextArea();
080:                txaHint.setBorder(null);
081:                txaHint.setFocusable(false);
082:                txaHint.setLineWrap(true);
083:                txaHint.setWrapStyleWord(true);
084:                txaHint.setOpaque(false);
085:
086:                btnHint = new JButton("Hint >>");
087:                btnHint.setBorder(new EmptyBorder(new Insets(0, 0, 0, 0)));
088:                lblXmlLocation = new JLabel("set the Service XML file");
089:                lblXmlLocation.setEnabled(false);
090:                txtServiceXml = new JTextField();
091:                txtServiceXml.setEnabled(false);
092:                butSelect = new JButton("Browse..");
093:                butSelect.setEnabled(false);
094:                chkBoxIncludeXml = new JCheckBox(
095:                        "Generate service xml automatically", true);
096:
097:                setBackButtonEnabled(true);
098:                setNextButtonEnabled(false);
099:                setFinishButtonEnabled(false);
100:                setPageComplete(false);
101:
102:                this .setLayout(new GridBagLayout());
103:
104:                this .add(chkBoxIncludeXml, new GridBagConstraints(0, 0,
105:                        GridBagConstraints.REMAINDER, 1, 0.0, 0.0,
106:                        GridBagConstraints.CENTER,
107:                        GridBagConstraints.HORIZONTAL, new Insets(5, 1, 1, 1),
108:                        0, 0));
109:                chkBoxIncludeXml.addActionListener(new ActionListener() {
110:                    public void actionPerformed(ActionEvent e) {
111:                        setChangeEnabled();
112:                        update();
113:                    }
114:                });
115:                this 
116:                        .add(lblXmlLocation, new GridBagConstraints(0, 1, 1, 1,
117:                                0.1, 0.0, GridBagConstraints.WEST,
118:                                GridBagConstraints.NONE,
119:                                new Insets(5, 10, 0, 0), 0, 0));
120:
121:                this .add(txtServiceXml, new GridBagConstraints(1, 1,
122:                        GridBagConstraints.RELATIVE, 1, 1.0, 0.0,
123:                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
124:                        new Insets(5, 1, 0, 0), 0, 0));
125:
126:                txtServiceXml.addActionListener(new ActionListener() {
127:                    public void actionPerformed(ActionEvent e) {
128:                        update();
129:                    }
130:                });
131:
132:                this 
133:                        .add(butSelect, new GridBagConstraints(2, 1, 1, 1, 0.1,
134:                                0.0, GridBagConstraints.CENTER,
135:                                GridBagConstraints.NONE,
136:                                new Insets(5, 0, 1, 10), 0, 0));
137:
138:                butSelect.addActionListener(new ActionListener() {
139:                    public void actionPerformed(ActionEvent e) {
140:                        browseXmlFile();
141:                        setNextButtonEnabled(true);
142:                        setPageComplete(true);
143:                        update();
144:                    }
145:                });
146:                this .add(btnHint, new GridBagConstraints(0, 2,
147:                        GridBagConstraints.REMAINDER, 1, 0.1, 0.0,
148:                        GridBagConstraints.WEST, GridBagConstraints.NONE,
149:                        new Insets(5, 10, 0, 10), 0, 0));
150:                btnHint.addActionListener(new ActionListener() {
151:                    public void actionPerformed(ActionEvent e) {
152:                        if (flag) {
153:                            btnHint.setText("Hint >>");
154:                            txaHint.setText("");
155:                            flag = false;
156:                        } else {
157:                            btnHint.setText("Hint <<");
158:                            txaHint.setText(hint);
159:                            flag = true;
160:                        }
161:                        update();
162:                    }
163:                });
164:
165:                this .add(txaHint, new GridBagConstraints(0, 3,
166:                        GridBagConstraints.REMAINDER, 1, 0.1, 1.0,
167:                        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
168:                        new Insets(5, 10, 10, 10), 0, 0));
169:
170:            }
171:
172:            //next
173:            public void next() {
174:                if (!chkBoxIncludeXml.isSelected()) {
175:                    switchPanel(CodegenFrame.PANEL_LAST_C);
176:                } else {
177:                    switchPanel(CodegenFrame.PANEL_LOAD_C);
178:                }
179:                setNextButtonEnabled(false);
180:
181:            }
182:
183:            //back
184:            public void back() {
185:                switchPanel(CodegenFrame.PANEL_THIRD_C);
186:            }
187:
188:            //update
189:            public void update() {
190:                fillBean();
191:                setPageComplete(true);
192:                setNextButtonEnabled(true);
193:            }
194:
195:            //get page type
196:            public int getPageType() {
197:                return WizardPanel.SERVICE_ARCHIVE_TYPE;
198:            }
199:
200:            private void browseXmlFile() {
201:                fileChooser.setFileFilter(new XmlFileFilter());
202:                fileChooser.setCurrentDirectory(archiveBean.getClassLoc());
203:                int returnVal = fileChooser.showOpenDialog(butSelect);
204:                if (returnVal == JFileChooser.APPROVE_OPTION) {
205:                    File xmlfile = fileChooser.getSelectedFile();
206:                    txtServiceXml.setText(xmlfile.getAbsolutePath());
207:                    byte[] buf = new byte[1024];
208:                    int read;
209:                    ByteArrayOutputStream out;
210:                    try {
211:                        FileInputStream in = new FileInputStream(xmlfile);
212:
213:                        out = new ByteArrayOutputStream();
214:                        while ((read = in.read(buf)) > 0) {
215:                            out.write(buf, 0, read);
216:                        }
217:                        in.close();
218:                        value = new String(out.toByteArray());
219:                    } catch (IOException e1) {
220:                    }
221:
222:                } else {
223:                    txtServiceXml.setText("");
224:                }
225:            }
226:
227:            private void setChangeEnabled() {
228:                if (chkBoxIncludeXml.isSelected()) {
229:                    lblXmlLocation.setEnabled(false);
230:                    txtServiceXml.setEnabled(false);
231:                    butSelect.setEnabled(false);
232:                } else {
233:                    lblXmlLocation.setEnabled(true);
234:                    txtServiceXml.setEnabled(true);
235:                    butSelect.setEnabled(true);
236:                }
237:            }
238:
239:            private void fillBean() {
240:                if (!chkBoxIncludeXml.isSelected()) {
241:                    if (value != null)
242:                        archiveBean.setServiceXML(value);
243:                }
244:
245:            }
246:
247:            public boolean isIncludeXml() {
248:                return this.chkBoxIncludeXml.isSelected();
249:            }
250:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.