You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2007/03/30 05:41:07 UTC
svn commit: r523927 - in
/webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl:
BottomPanel.java FileFilter.java Java2WSDLFrame.java MiddlePanel.java
OptionPanel.java OutputPanel.java
Author: sandakith
Date: Thu Mar 29 20:41:06 2007
New Revision: 523927
URL: http://svn.apache.org/viewvc?view=rev&rev=523927
Log:
Apply Axis2 2433, Bug fix
Added:
webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/FileFilter.java
Modified:
webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/BottomPanel.java
webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/Java2WSDLFrame.java
webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/MiddlePanel.java
webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OptionPanel.java
webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OutputPanel.java
Modified: webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/BottomPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/BottomPanel.java?view=diff&rev=523927&r1=523926&r2=523927
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/BottomPanel.java (original)
+++ webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/BottomPanel.java Thu Mar 29 20:41:06 2007
@@ -69,7 +69,18 @@
}else if(java2WSDLFrame.opPanel.isVisible()){
- java2WSDLFrame.setPanel();
+ if( java2WSDLFrame.opPanel .txtService .getText().trim().equals("")){
+ JOptionPane.showMessageDialog(java2WSDLFrame,
+ " Service name should be specified. ",
+ "Error!",
+ JOptionPane.ERROR_MESSAGE);
+ java2WSDLFrame.repaint();
+ setEnable(true,false,false,true);
+ return;
+ }else{
+ setEnable(true,true,true,true);
+ java2WSDLFrame.setPanel();
+ }
}
@@ -83,20 +94,71 @@
Thread.currentThread().setContextClassLoader(java2WSDLFrame.getClassLoader());
} else if(obj ==btnFinish ){
- try {
+ java2WSDLFrame.outPanel.setOutput();
+ java2WSDLFrame.opPanel .setNamespaceDefaults();
+
+ File outputDir = new File(java2WSDLFrame.outPanel .txtLocation .getText().trim());
+ String outputName=java2WSDLFrame.outPanel.txtFileName.getText().trim();
+
+ if(java2WSDLFrame.opPanel.txtService .getText() .trim() .equals("") ){
+ JOptionPane.showMessageDialog(java2WSDLFrame,
+ " Service name should be specified. ",
+ "Error!",
+ JOptionPane.ERROR_MESSAGE);
+ java2WSDLFrame.repaint();
+ setEnable(true,false,false,true);
+ return;
+ }
+
+ if (java2WSDLFrame.outPanel .rbtnSave .isSelected() )
+ {
+ if(!outputDir.isDirectory() && !new FileFilter() .accept(outputName )){
+ JOptionPane.showMessageDialog(java2WSDLFrame,
+ "Input a proper location for the output and name for WSDL.",
+ "Error!",
+ JOptionPane.ERROR_MESSAGE);
+ java2WSDLFrame.repaint();
+ setEnable(true,false,false,true);
+ return;
+ }
+ if (!outputDir.isDirectory())
+ {
+ JOptionPane.showMessageDialog(java2WSDLFrame,
+ "The Output Directory specified is invalid. Please provide a valid directory",
+ "Error!",
+ JOptionPane.ERROR_MESSAGE);
+ java2WSDLFrame.repaint();
+ setEnable(true,false,false,true);
+ return;
+ }
+ if(!new FileFilter() .accept(outputName ) ){
+ JOptionPane.showMessageDialog(java2WSDLFrame,
+ "Input a valid file name , Example : services.wsdl or services.xml",
+ "Error!",
+ JOptionPane.ERROR_MESSAGE);
+ java2WSDLFrame.repaint();
+ setEnable(true,false,false,true);
+ return;
+ }
+ }
+ try {
java2WSDLFrame.generatecode();
StringWriter writer = new StringWriter();
- JOptionPane.showMessageDialog(java2WSDLFrame, "Code genaration Successful !" + writer.toString(),
- "Axis2 code generation", JOptionPane.INFORMATION_MESSAGE );
+ JOptionPane.showMessageDialog(java2WSDLFrame,
+ "Code genaration Successful !" + writer.toString(),
+ "Axis2 code generation",
+ JOptionPane.INFORMATION_MESSAGE );
java2WSDLFrame.dispose();
} catch (Exception e1) {
StringWriter writer = new StringWriter();
- JOptionPane.showMessageDialog(java2WSDLFrame, "Code genaration failed!" + writer.toString(),
- "Axis2 code generation", JOptionPane.ERROR_MESSAGE);
+ JOptionPane.showMessageDialog(java2WSDLFrame,
+ "Code genaration failed!" + writer.toString(),
+ "Axis2 code generation",
+ JOptionPane.ERROR_MESSAGE);
java2WSDLFrame.dispose();
}
Added: webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/FileFilter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/FileFilter.java?view=auto&rev=523927
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/FileFilter.java (added)
+++ webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/FileFilter.java Thu Mar 29 20:41:06 2007
@@ -0,0 +1,31 @@
+package org.apache.axis2.tools.java2wsdl;
+
+
+public class FileFilter {
+
+ public boolean accept(String fileName ) {
+
+ String extension = getExtension(fileName);
+ if (extension != null && extension.equals("wsdl")) {
+ return true;
+ }else if(extension != null && extension.equals("xml")) {
+ return true;
+ }
+ return false;
+ }
+
+ public String getDescription() {
+ return ".wsdl";
+ }
+
+ private String getExtension(String extension) {
+ String ext = null;
+ int i = extension.lastIndexOf('.');
+
+ if (i > 0 && i < extension.length() - 1) {
+ ext = extension.substring(i + 1).toLowerCase();
+ }
+ return ext;
+ }
+
+}
Modified: webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/Java2WSDLFrame.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/Java2WSDLFrame.java?view=diff&rev=523927&r1=523926&r2=523927
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/Java2WSDLFrame.java (original)
+++ webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/Java2WSDLFrame.java Thu Mar 29 20:41:06 2007
@@ -59,7 +59,7 @@
//add option panel
- outPanel=new OutputPanel(wsdlgenBean);
+ outPanel=new OutputPanel(this,wsdlgenBean);
outPanel .setVisible(false);
getContentPane() .add(outPanel);
@@ -76,6 +76,12 @@
public void setProject(Project project) {
this.project = project;
}
+
+ public Project getActiveProject() {
+ return project;
+
+ }
+
public ClassLoader getClassLoader() {
return classLoader;
}
Modified: webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/MiddlePanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/MiddlePanel.java?view=diff&rev=523927&r1=523926&r2=523927
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/MiddlePanel.java (original)
+++ webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/MiddlePanel.java Thu Mar 29 20:41:06 2007
@@ -4,7 +4,6 @@
import org.apache.axis2.tools.bean.WsdlgenBean;
import javax.swing.*;
-import javax.swing.border.EtchedBorder;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
@@ -162,8 +161,8 @@
}
private void setDefaultPathAndName(File file) {
String defualtOutPutPath=file.getParent();
- wsdlgenBean.setOutputLocation(defualtOutPutPath );
- wsdlgenBean.setOutputWSDLName("services.wsdl");
+ java2WSDLFrame.outPanel.txtLocation .setText(defualtOutPutPath);
+ java2WSDLFrame.outPanel .txtFileName .setText("services.wsdl");
}
@@ -219,7 +218,6 @@
public void updateStatusTextField(boolean success,String text){
if (success){
java2WSDLFrame.opPanel.setDefaultNamespaces(txtClass.getText());
- // java2WSDLFrame.outPanel.setNamespaceDefaults();
}
lblTest.setText(text);
}
Modified: webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OptionPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OptionPanel.java?view=diff&rev=523927&r1=523926&r2=523927
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OptionPanel.java (original)
+++ webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OptionPanel.java Thu Mar 29 20:41:06 2007
@@ -4,12 +4,13 @@
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
-
+import java.awt.event.MouseListener ;
+import java.awt.event.MouseEvent ;
import org.apache.axis2.tools.bean.NamespaceFinder ;
import org.apache.axis2.tools.bean.WsdlgenBean;
-public class OptionPanel extends JPanel implements ActionListener {
+public class OptionPanel extends JPanel implements ActionListener,MouseListener {
private JLabel lblNsp;
private JLabel lblNspPrefix;
@@ -17,11 +18,11 @@
private JLabel lblSchemaTargetNspPrefix;
private JLabel lblService;
- private JTextField txtNsp;
- private JTextField txtNspPrefix;
- private JTextField txtSchemaTargetNsp;
- private JTextField txtSchemaTargetNspPrefix;
- private JTextField txtService;
+ JTextField txtNsp;
+ JTextField txtNspPrefix;
+ JTextField txtSchemaTargetNsp;
+ JTextField txtSchemaTargetNspPrefix;
+ JTextField txtService;
Java2WSDLFrame java2WSDLFrame;
WsdlgenBean wsdlgenBean;
@@ -67,6 +68,8 @@
txtService =new JTextField();
add(txtService );
+ txtService .addActionListener(this);
+ txtService.addMouseListener(this);
setSize(getPreferredSize());
@@ -94,10 +97,57 @@
public void actionPerformed(ActionEvent e) {
-
+ Object obj=e.getSource();
+ if(obj ==txtService ){
+ if (txtService .getText() != null && !txtService.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,true, true, true);
+ wsdlgenBean.setServiceName(txtService.getText().trim());
+ }
+ }
+ }
+
+ public void mouseClicked(MouseEvent e) {
+ Object obj = e.getSource();
+ if(obj ==txtService ){
+ if (txtService .getText() != null && !txtService.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,true, true, true);
+ wsdlgenBean.setServiceName(txtService.getText().trim());
+ }
+ }
+ }
+
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ public void mouseExited(MouseEvent e) {
+ Object obj = e.getSource();
+ if(obj ==txtService ){
+ if (txtService .getText() != null && !txtService.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,true, true, true);
+ wsdlgenBean.setServiceName(txtService.getText().trim());
+ }
+ }
+ }
+
+ public void mousePressed(MouseEvent e) {
+ Object obj = e.getSource();
+ if(obj ==txtService ){
+ if (txtService .getText() != null && !txtService.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,true, true, true);
+ wsdlgenBean.setServiceName(txtService.getText().trim());
+ }
+ }
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ Object obj = e.getSource();
+ if(obj ==txtService ){
+ if (txtService .getText() != null && !txtService.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,true, true, true);
+ wsdlgenBean.setServiceName(txtService.getText().trim());
+ }
+ }
}
-
-
public void setDefaultNamespaces(String fullyQualifiedClassName){
this.txtNsp.setText(NamespaceFinder.getTargetNamespaceFromClass(fullyQualifiedClassName));
this.txtSchemaTargetNsp .setText(NamespaceFinder.getSchemaTargetNamespaceFromClass(fullyQualifiedClassName) );
@@ -107,7 +157,7 @@
setNamespaceDefaults();
}
- private void setNamespaceDefaults(){
+ public void setNamespaceDefaults(){
wsdlgenBean.setTargetNamespace(txtNsp.getText() );
wsdlgenBean.setTargetNamespacePrefix(txtNspPrefix .getText() );
wsdlgenBean.setSchemaTargetNamespace(txtSchemaTargetNsp .getText() );
Modified: webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OutputPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OutputPanel.java?view=diff&rev=523927&r1=523926&r2=523927
==============================================================================
--- webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OutputPanel.java (original)
+++ webservices/axis2/branches/java/1_2/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OutputPanel.java Thu Mar 29 20:41:06 2007
@@ -1,14 +1,17 @@
package org.apache.axis2.tools.java2wsdl;
import org.apache.axis2.tools.bean.WsdlgenBean;
-
import javax.swing.*;
+import java.awt.event.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
+import java.awt.event.MouseListener ;
+import java.awt.event.MouseEvent ;
import java.awt.*;
+import java.io.File;
-public class OutputPanel extends JPanel implements ActionListener {
+public class OutputPanel extends JPanel implements ActionListener,MouseListener {
JLabel lblTitle;
JLabel lblLocation;
@@ -22,13 +25,14 @@
JButton btnBrowes;
- final JFileChooser fc = new JFileChooser();
+ final JFileChooser DirChooser=new JFileChooser();
private WsdlgenBean wsdlgenBean;
+ private Java2WSDLFrame java2WSDLFrame;
- public OutputPanel(WsdlgenBean wsdlgenBean){
+ public OutputPanel(Java2WSDLFrame java2WSDLFrame,WsdlgenBean wsdlgenBean){
this.wsdlgenBean=wsdlgenBean;
-
+ this.java2WSDLFrame=java2WSDLFrame;
OutputLayout customLayout=new OutputLayout();
setLayout(customLayout);
@@ -40,28 +44,44 @@
rbtnAdd =new JRadioButton("Browes and Add the WSDL to a project on current workspace");
add(rbtnAdd );
+ rbtnAdd .setSelected(false);
+ rbtnAdd .addActionListener(this);
+
rbtnSave =new JRadioButton("Browes and Save the WSDL file on local filesystem ");
add(rbtnSave );
+ rbtnSave .addActionListener(this);
+ rbtnSave .setSelected(true);
+
+
lblLocation =new JLabel("OutPut Location");
add(lblLocation );
txtLocation =new JTextField();
add(txtLocation );
+ txtLocation .setEnabled(true);
+ txtLocation .addActionListener(this);
+ txtLocation.addMouseListener(this);
+
btnBrowes=new JButton("Browse...");
add(btnBrowes);
+ btnBrowes.setEnabled(true);
+ btnBrowes.addActionListener(this);
+
lblFileName =new JLabel("OutPut File Name");
add(lblFileName );
txtFileName =new JTextField();
add(txtFileName );
+ txtFileName .setEnabled(true);
+ txtFileName .addActionListener(this);
+ txtFileName .addMouseListener(this);
- setSize(getPreferredSize());
- initializeDefaultSettings();
+ setSize(getPreferredSize());
}
@@ -71,16 +91,114 @@
txtFileName.setText(wsdlgenBean.getOutputWSDLName());
}
- public void setNamespace(){
- wsdlgenBean.setTargetNamespace(txtLocation .getText() );
- wsdlgenBean.setTargetNamespacePrefix(txtFileName .getText() );
+ public void setOutput(){
+
+ wsdlgenBean.setOutputLocation(txtLocation .getText() );
+ wsdlgenBean.setOutputWSDLName(txtFileName .getText() );
}
public void actionPerformed(ActionEvent e){
+ Object obj=e.getSource();
+ if(obj==btnBrowes) {
+ DirChooser .setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ int returnVal = DirChooser.showOpenDialog(this);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ DirChooser.setFileSelectionMode(JFileChooser .FILES_ONLY );
+ File newfile = DirChooser.getSelectedFile();
+ BottomPanel.setEnable(true,false, true, true);
+ txtLocation.setText(newfile.getAbsolutePath());
+ }
+ } else if(obj == rbtnAdd ) {
+ rbtnSave .setSelected(false);
+ txtLocation .setEnabled(false);
+ btnBrowes.setEnabled(false);
+ txtFileName .setEnabled(false);
+ BottomPanel.setEnable(true,false, true, true);
+ wsdlgenBean.setOutputLocation(java2WSDLFrame .getActiveProject().getProjectFilePath() );
+ wsdlgenBean.setOutputWSDLName("Services.wsdl" );
+ }else if(obj == rbtnSave ) {
+ rbtnAdd .setSelected(false);
+ txtLocation .setEnabled(true);
+ btnBrowes.setEnabled(true);
+ txtFileName .setEnabled(true);
+
+ } else if(obj ==txtFileName ){
+ if (txtFileName .getText() != null && !txtFileName.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,false, true, true);
+ wsdlgenBean.setServiceName(txtFileName.getText().trim());
+ }
+ } else if(obj ==txtLocation ){
+ if (txtLocation .getText() != null && !txtLocation.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,false, true, true);
+ wsdlgenBean.setServiceName(txtLocation.getText().trim());
+ }
+ }
+ }
+ public void mouseClicked(MouseEvent e) {
+ Object obj = e.getSource();
+ if(obj ==txtFileName ){
+ if (txtFileName .getText() != null && !txtFileName.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,false, true, true);
+ wsdlgenBean.setServiceName(txtFileName.getText().trim());
+ }
+ } else if(obj ==txtLocation ){
+ if (txtLocation .getText() != null && !txtLocation.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,false, true, true);
+ wsdlgenBean.setServiceName(txtLocation.getText().trim());
+ }
+ }
+ }
+ public void mouseEntered(MouseEvent e) {
+ }
+
+ public void mouseExited(MouseEvent e) {
+ Object obj = e.getSource();
+ if(obj ==txtFileName ){
+ if (txtFileName .getText() != null && !txtFileName.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,false, true, true);
+ wsdlgenBean.setServiceName(txtFileName.getText().trim());
+ }
+ } else if(obj ==txtLocation ){
+ if (txtLocation .getText() != null && !txtLocation.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,false, true, true);
+ wsdlgenBean.setServiceName(txtLocation.getText().trim());
+ }
+ }
+ }
+
+ public void mousePressed(MouseEvent e) {
+ Object obj = e.getSource();
+ if(obj ==txtFileName ){
+ if (txtFileName .getText() != null && !txtFileName.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,false, true, true);
+ wsdlgenBean.setServiceName(txtFileName.getText().trim());
+ }
+ } else if(obj ==txtLocation ){
+ if (txtLocation .getText() != null && !txtLocation.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,false, true, true);
+ wsdlgenBean.setServiceName(txtLocation.getText().trim());
+ }
+ }
+ }
+
+ public void mouseReleased(MouseEvent e) {
+ Object obj = e.getSource();
+ if(obj ==txtFileName ){
+ if (txtFileName .getText() != null && !txtFileName.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,false, true, true);
+ wsdlgenBean.setServiceName(txtFileName.getText().trim());
+ }
+ } else if(obj ==txtLocation ){
+ if (txtLocation .getText() != null && !txtLocation.getText().trim().equals("")) {
+ BottomPanel.setEnable(true,false, true, true);
+ wsdlgenBean.setServiceName(txtLocation.getText().trim());
+ }
+ }
}
}
+
class OutputLayout implements LayoutManager{
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org