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/07/03 14:02:45 UTC
svn commit: r552799 [1/2] - in
/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache:
axis2/tools/bean/ axis2/tools/component/ axis2/tools/idea/
axis2/tools/java2wsdl/ axis2/tools/wizardframe/ ideaplugin/frames/
Author: sandakith
Date: Tue Jul 3 05:02:43 2007
New Revision: 552799
URL: http://svn.apache.org/viewvc?view=rev&rev=552799
Log:
Committing the Idea Plugin improvement , layout corrected java2wsdl part of the plugin, thanks Shivantha
Added:
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ChooserPanel.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/WSDLFileFilter.java
Modified:
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/WsdlgenBean.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/component/DefaultWizardComponents.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/component/WizardPanel.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/BarThread.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/BottomPanel.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/FirstPanel.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ImagePanel.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ProgressBarPanel.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/BottomPanel.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/Java2WSDLFrame.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/MiddlePanel.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OptionPanel.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OutputPanel.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/CodegenFrame.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/WizardFrame.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/Axi2PluginPage.java
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/CodegenBean.java Tue Jul 3 05:02:43 2007
@@ -69,7 +69,7 @@
private boolean defaultClient = true;
- Project project;
+ private Project project;
private boolean isServerSideInterface = true;
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/WsdlgenBean.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/WsdlgenBean.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/WsdlgenBean.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/bean/WsdlgenBean.java Tue Jul 3 05:02:43 2007
@@ -24,6 +24,12 @@
import java.util.HashMap;
import java.util.Map;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.module.Module;
+import com.intellij.openapi.module.ModuleManager;
+import com.intellij.openapi.roots.ModuleRootManager;
+import com.intellij.openapi.vfs.VirtualFile;
+
public class WsdlgenBean {
private String ClassName;
@@ -35,6 +41,7 @@
private String SchemaTargetNamespacePrefix;
private String OutputLocation ;
private String OutputWSDLName ;
+ private Project project;
public String getClassName() {
@@ -174,5 +181,36 @@
throw new Exception("Code generation failed due to " + e.getLocalizedMessage());
}
+ }
+ public Project getActiveProject() {
+ return project;
+
+ }
+
+ public void setProject(Project project) {
+ this.project = project;
+ }
+ public Module[] getModules() {
+
+ Project project = getActiveProject();
+ if (project != null) {
+ return ModuleManager.getInstance(project).getModules();
+ }
+ return null;
+ }
+
+ public String[] getModuleSrc(String name) {
+ Project project = getActiveProject();
+ if (project != null) {
+ Module module = ModuleManager.getInstance(project).findModuleByName(name);
+ ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
+ VirtualFile virtualFiles[] = moduleRootManager.getSourceRoots();
+ String src[] = new String[virtualFiles.length];
+ for (int count = 0; count < src.length; count++) {
+ src[count] = virtualFiles[count].getPresentableUrl();
+ }
+ return src;
+ }
+ return null;
}
}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/component/DefaultWizardComponents.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/component/DefaultWizardComponents.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/component/DefaultWizardComponents.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/component/DefaultWizardComponents.java Tue Jul 3 05:02:43 2007
@@ -31,8 +31,6 @@
* this is used for default wizard components
*/
public class DefaultWizardComponents implements WizardComponents {
- private java.util.ResourceBundle resourceBundle =
- java.util.ResourceBundle.getBundle("icons/i18n");
private JButton backButton;
private JButton nextButton;
@@ -155,32 +153,32 @@
currentIndex = 0;
wizardPanelsContainer = new JPanel();
- backButton.setText(resourceBundle.getString("L_BackButton"));
- backButton.setMnemonic(resourceBundle.getString("L_BackButtonMnem").charAt(0));
+ backButton.setText("< Back");
+ backButton.setMnemonic("B".charAt(0));
backButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
backButton_actionPerformed(e);
}
});
- nextButton.setText(resourceBundle.getString("L_NextButton"));
- nextButton.setMnemonic(resourceBundle.getString("L_NextButtonMnem").charAt(0));
+ nextButton.setText("Next >");
+ nextButton.setMnemonic("N".charAt(0));
nextButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
nextButton_actionPerformed(e);
}
});
- cancelButton.setText(resourceBundle.getString("L_CancelButton"));
- cancelButton.setMnemonic(resourceBundle.getString("L_CancelButtonMnem").charAt(0));
+ cancelButton.setText("Cancel");
+ cancelButton.setMnemonic("C".charAt(0));
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
cancelButton_actionPerformed(e);
}
});
- finishButton.setText(resourceBundle.getString("L_FinishButton"));
- finishButton.setMnemonic(resourceBundle.getString("L_FinishButtonMnem").charAt(0));
+ finishButton.setText("Finish");
+ finishButton.setMnemonic("F".charAt(0));
finishButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
finishButton_actionPerformed(e);
@@ -200,7 +198,10 @@
void nextButton_actionPerformed(ActionEvent e) {
try {
- getCurrentPanel().next();
+ if(getCurrentPanel().isPageComplete()){
+ getCurrentPanel().next();
+ }
+
} catch (Exception ex) {
ex.printStackTrace();
}
@@ -338,19 +339,5 @@
propertyChangeListeners.removePropertyChangeListener(listener);
}
- /**
- * @return Returns the resourceBundle.
- */
- public java.util.ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-
- /**
- * @param resourceBundle The resourceBundle to set.
- */
- public void setResourceBundle(
- java.util.ResourceBundle resourceBundle) {
- this.resourceBundle = resourceBundle;
- }
-
+
}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/component/WizardPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/component/WizardPanel.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/component/WizardPanel.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/component/WizardPanel.java Tue Jul 3 05:02:43 2007
@@ -34,7 +34,10 @@
private String error;
private boolean flag;
private boolean progressFlag;
- // private ProgressBarPanel progressBar;
+ public static final int WSDL_2_JAVA_TYPE = 1;
+ public static final int JAVA_2_WSDL_TYPE = 2;
+ public static final int UNSPECIFIED_TYPE = 3;
+ private boolean isPageComplete = false;
public WizardPanel(WizardComponents wizardComponents) {
this(wizardComponents, null);
@@ -107,12 +110,6 @@
public boolean getProgressPanelVisible() {
return progressFlag;
}
- /* public void setProgressPanel(ProgressBarPanel panel) {
- this.progressBar = panel;
- }
- public ProgressBarPanel getProgressPanel() {
- return (ProgressBarPanel)progressBar;
- }*/
// next
protected boolean goNext() {
@@ -134,12 +131,12 @@
return false;
}
}
-
+
protected void switchPanel(int panelIndex) {
getWizardComponents().setCurrentIndex(panelIndex);
getWizardComponents().updateComponents();
}
-
+ /** this method used for set Button Enabled */
protected void setBackButtonEnabled(boolean set) {
wizardComponents.getBackButton().setEnabled(set);
}
@@ -150,6 +147,19 @@
protected void setFinishButtonEnabled(boolean set) {
wizardComponents.getFinishButton().setEnabled(set);
+ }
+
+ /** this method used for to get type of wizard panel*/
+ public int getPageType() {
+ return WizardPanel.UNSPECIFIED_TYPE;
+ }
+ /** this method used for check is page complete */
+ public boolean isPageComplete() {
+ return isPageComplete;
+ }
+ /** this method used for set page complete*/
+ public void setPageComplete(boolean complete) {
+ isPageComplete = complete;
}
}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/BarThread.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/BarThread.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/BarThread.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/BarThread.java Tue Jul 3 05:02:43 2007
@@ -1,73 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.axis2.tools.idea;
-
-import javax.swing.*;
-import java.lang.reflect.InvocationTargetException;
-
-
-public class BarThread extends Thread {
-
- private volatile boolean stop = false;
- private static int DELAY = 100;
- public volatile String val=null;
- protected JProgressBar progressBar;
- protected JLabel lblprogress ;
- protected JLabel lbltitle;
-
- public BarThread(ProgressBarPanel bar) {
- progressBar = bar.getProgressBar();
- lblprogress =bar.getLabelProgress();
- lbltitle= bar.getLabelTitle();
- }
-
- public void requestStop() {
- stop = true;
- }
-
- public void run() {
- int minimum = progressBar.getMinimum();
- int maximum = progressBar.getMaximum();
- Runnable runner = new Runnable() {
- public void run() {
- if(stop && progressBar.getValue()<100){
-
- progressBar.setIndeterminate(false);
- int value = progressBar.getValue();
- progressBar.setValue(value+10);
- lblprogress.setText(String.valueOf(value+9)+" %");
- lbltitle.setText("Genarate Code. Please wait.....");
- } else if(!stop){
-
- progressBar.setIndeterminate(true);
-
- }
- }
- };
- for (int i=minimum; i<maximum; i++) {
- try {
- SwingUtilities.invokeAndWait(runner);
- // Our task for each step is to just sleep
- Thread.sleep(DELAY);
- } catch (InterruptedException ignoredException) {
- } catch (InvocationTargetException ignoredException) {
- }
- }
- }
-}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/BottomPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/BottomPanel.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/BottomPanel.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/BottomPanel.java Tue Jul 3 05:02:43 2007
@@ -99,14 +99,14 @@
final String selected = java2CodeFrame.secondPanel.cmbCodeGenOption.getSelectedItem().toString() ;
java2CodeFrame.outputpane.progressBar.setVisible(true);
- final BarThread stepper = new BarThread(java2CodeFrame.outputpane.progressBar);
- stepper.start();
- new java.util.Timer(true).schedule(new TimerTask() {
- public void run() {
- stepper.requestStop();
-
- }
- }, 1000);
+// final BarThread stepper = new BarThread(java2CodeFrame.outputpane.progressBar);
+// stepper.start();
+// new java.util.Timer(true).schedule(new TimerTask() {
+// public void run() {
+// stepper.requestStop();
+//
+// }
+// }, 1000);
new Thread(){public void run(){
if (selected.equalsIgnoreCase("default")) {
Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ChooserPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ChooserPanel.java?view=auto&rev=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ChooserPanel.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ChooserPanel.java Tue Jul 3 05:02:43 2007
@@ -0,0 +1,163 @@
+package org.apache.axis2.tools.idea;
+
+import org.apache.axis2.tools.component.WizardPanel;
+import org.apache.axis2.tools.component.WizardComponents;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import java.awt.*;
+import java.awt.event.ItemListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ActionEvent;
+
+/**
+ * this panel used for as chooser
+ * java2wsdl codegen option
+ * wsdl2java codegen option
+ *
+ * extend from wizardPanel calss
+ */
+
+public class ChooserPanel extends WizardPanel {
+ /**
+ * varialbales
+ */
+ private JButton btnHint;
+ private JLabel lblHint;
+ private boolean flag=false;
+ private JRadioButton optionJ2WRadioButton;
+ private JRadioButton optionW2JRadioButton;
+ private ButtonGroup bg;
+ private char selectedOption = 'A'; // 'N' is no option selected 'A', 'B' & 'F' stands for options
+ final private String hint="You can generate java code from a WSDL or WSDL from a java source file.";
+ /**
+ * construct method for chooserPanel
+ * @param wizardComponents
+ */
+
+ public ChooserPanel(WizardComponents wizardComponents){
+
+ super(wizardComponents, "ChooserPanel");
+ setPanelTopTitle("Select the wizard");
+ setPanelBottomTitle("Welcome to the Axis2 code generator wizard");
+ init();
+ }
+
+ /**
+ * Panel initial method
+ */
+ private void init(){
+
+ lblHint =new JLabel("");
+ btnHint =new JButton("Hint >>");
+ btnHint.setBorder(new EmptyBorder(new Insets(0,0,0,0)));
+
+ optionW2JRadioButton = new JRadioButton("Generate java sorce code from a WSDl file.",true);
+ optionJ2WRadioButton = new JRadioButton("Generate a WSDl from a java source file",false);
+ ButtonGroup bg = new ButtonGroup();
+ bg.add(optionJ2WRadioButton);
+ bg.add(optionW2JRadioButton);
+
+ this.setLayout(new GridBagLayout() );
+
+
+ this.add(new JLabel("Please specify what you want to do.")
+ , new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
+ , new Insets(10, 20, 0,0), 0, 0));
+
+ // option button for java2wsdl
+ optionW2JRadioButton.setEnabled(false);
+ this.add(optionW2JRadioButton
+ , new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
+ , new Insets(10, 20, 0,0), 0, 0));
+ optionW2JRadioButton.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ selectedOption = 'A';
+ update();
+ }
+ }
+ });
+
+ // option button for wsdl2java
+
+ this.add(optionJ2WRadioButton
+ , new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
+ , new Insets(10, 20, 0,0), 0, 0));
+ optionJ2WRadioButton.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ selectedOption = 'B';
+ update();
+ }
+ }
+ });
+
+ // hint button
+
+ this.add(btnHint,
+ new GridBagConstraints(0,3, 1, 1, 1.0,0.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
+ , new Insets(10, 20, 0,0), 0, 0));
+ btnHint.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if(flag){
+ btnHint.setText("Hint >>");
+ lblHint.setText("");
+ flag=false;
+ }else{
+ btnHint.setText("Hint <<");
+ lblHint.setText(hint);
+ flag=true;
+ }
+ update();
+ }
+ });
+
+ // hint lable
+
+ this.add(lblHint,
+ new GridBagConstraints(0, 4, 1, 1, 1.0, 1.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
+ , new Insets(10, 20, 0,0), 0, 0));
+
+
+ setNextButtonEnabled((selectedOption == 'A') || (selectedOption == 'B') );
+
+ }
+
+ /**
+ * method for update when panel has some change
+ */
+
+ public void update() {
+ setNextButtonEnabled((selectedOption == 'A') || (selectedOption == 'B') );
+ setBackButtonEnabled(false); // there is no way back
+ setProgressPanelVisible(false);
+ setPageComplete(true);
+ }
+
+ /**
+ * method for next button
+ */
+ public void next() {
+ if (selectedOption == 'A') {
+ // switchPanel(CodegenFrame.PANEL_FIRST_A) ;
+
+ } else if (selectedOption == 'B') {
+ switchPanel(CodegenFrame.PANEL_FIRST_B );
+ setNextButtonEnabled(false);
+ }
+ }
+
+ /**
+ * methodd for back button
+ */
+ public void back() {
+ }
+}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/FirstPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/FirstPanel.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/FirstPanel.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/FirstPanel.java Tue Jul 3 05:02:43 2007
@@ -133,7 +133,7 @@
}
}
-class WSDLFileFilter extends FileFilter {
+/*class WSDLFileFilter extends FileFilter {
public boolean accept(File f) {
if (f.isDirectory()) {
@@ -163,7 +163,7 @@
return ext;
}
-}
+}*/
class FirstPanelLayout implements LayoutManager {
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ImagePanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ImagePanel.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ImagePanel.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ImagePanel.java Tue Jul 3 05:02:43 2007
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.axis2.tools.idea;
-
-import javax.swing.*;
-import java.awt.*;
-
-/**
- * Author : Deepal Jayasinghe
- * Date: Jul 20, 2005
- * Time: 9:33:14 PM
- */
-public class ImagePanel extends JPanel {
- JLabel lblImage;
- JLabel labTop;
- JLabel lblBottom;
- ImageIcon apachelogo;
-
- public ImagePanel() {
- ImageLayout customLayout = new ImageLayout();
- setLayout(customLayout);
-
- java.net.URL resource = ImagePanel.class.getResource("/icons/asf-feather.png");
- apachelogo = new ImageIcon(resource);
-
- lblImage = new JLabel(apachelogo);
- add(lblImage);
- lblImage.setBackground(Color.white);
-
- labTop = new JLabel();
- labTop.setBackground(Color.white);
- add(labTop);
- labTop.setFont(new Font("Helvetica", Font.BOLD, 12));
-
- lblBottom = new JLabel();
- add(lblBottom);
- lblBottom.setBackground(Color.white);
- lblBottom.setFont(new Font("Helvetica", Font.PLAIN, 10));
-
- setSize(getPreferredSize());
- this.setBackground(Color.white);
- }
-
- public void setCaptions(String lbl1, String lbl2) {
- labTop.setText(lbl1);
- lblBottom.setText(lbl2);
- }
-}
-
-class ImageLayout implements LayoutManager {
-
- public ImageLayout() {
- }
-
- public void addLayoutComponent(String name, Component comp) {
- }
-
- public void removeLayoutComponent(Component comp) {
- }
-
- public Dimension preferredLayoutSize(Container parent) {
- Dimension dim = new Dimension(0, 0);
-
- Insets insets = parent.getInsets();
- dim.width = 535 + insets.left + insets.right;
- dim.height = 77 + insets.top + insets.bottom;
-
- return dim;
- }
-
- public Dimension minimumLayoutSize(Container parent) {
- return new Dimension(0, 0);
- }
-
- public void layoutContainer(Container parent) {
- Insets insets = parent.getInsets();
-
- Component c;
- c = parent.getComponent(0);
- if (c.isVisible()) {
- c.setBounds(insets.left + 368, insets.top, 168, 80);
- }
- c = parent.getComponent(1);
- if (c.isVisible()) {
- c.setBounds(insets.left, insets.top, 368, 40);
- }
- c = parent.getComponent(2);
- if (c.isVisible()) {
- c.setBounds(insets.left, insets.top + 40, 368, 40);
- }
- }
-}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ProgressBarPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ProgressBarPanel.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ProgressBarPanel.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ProgressBarPanel.java Tue Jul 3 05:02:43 2007
@@ -20,87 +20,87 @@
import javax.swing.*;
import java.awt.*;
+import java.lang.reflect.InvocationTargetException;
-public class ProgressBarPanel extends JPanel {
- protected JLabel lbltitle;
- protected JProgressBar progressBar;
- protected JLabel lblprogress;
-
- public ProgressBarPanel(){
-
- ProgressLayout customLayout = new ProgressLayout();
-
- setLayout(customLayout);
-
- lbltitle =new JLabel("Scanning files .......");
- add(lbltitle );
-
- progressBar =new JProgressBar(0,100);
- progressBar.setBorderPainted(true);
- progressBar.setStringPainted(true);
- Dimension dim=new Dimension();
- dim.setSize(440,24);
- progressBar.setPreferredSize(dim);
- add(progressBar );
-
- lblprogress=new JLabel();
- add(lblprogress);
-
-
-
- setSize(getPreferredSize());
-
- }
- public JProgressBar getProgressBar(){
- return progressBar;
- }
- public JLabel getLabelProgress(){
- return lblprogress;
- }
- public JLabel getLabelTitle(){
- return lblprogress;
- }
-
-}
-class ProgressLayout implements LayoutManager {
- public ProgressLayout() {
- }
-
- public void addLayoutComponent(String name, Component comp) {
- }
-
- public void removeLayoutComponent(Component comp) {
- }
-
- public Dimension preferredLayoutSize(Container parent) {
- Dimension dim = new Dimension(0, 0);
-
- Insets insets = parent.getInsets();
- dim.width = 500 + insets.left + insets.right;
- dim.height = 100 + insets.top + insets.bottom;
-
- return dim;
- }
-
- public Dimension minimumLayoutSize(Container parent) {
- return new Dimension(0, 0);
- }
-
- public void layoutContainer(Container parent) {
- Insets insets = parent.getInsets();
-
- Component c;
- c = parent.getComponent(1);
- if (c.isVisible()) {
- c.setBounds(insets.left +8, insets.top + 30, 440, 24);
- }
- c = parent.getComponent(2);
- if (c.isVisible()) {
- c.setBounds(insets.left + 460, insets.top + 30, 30, 24);
- }
- c = parent.getComponent(0);
- if (c.isVisible()) {
- c.setBounds(insets.left +8, insets.top , 200, 24);
- }
+public class ProgressBarPanel extends JPanel {
+ private volatile boolean stop = false;
+ private static int DELAY = 100;
+ public volatile String val=null;
+ private JLabel progressDescription;
+ private JProgressBar progressSent;
+
+ public ProgressBarPanel (){
+ init();
+ }
+ public void requestStop() {
+ stop = true;
+ }
+ private void init(){
+ setVisible(false);
+ progressDescription =new JLabel();
+ progressDescription.setText("");
+ progressSent =new JProgressBar();
+ progressSent.setStringPainted(true);
+ this.setLayout(new GridBagLayout());
+
+ this.add(progressDescription
+ , new GridBagConstraints(0, 0, GridBagConstraints.REMAINDER, 1, 1.0, 1.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(10, 10, 0, 10), 0, 0));
+
+ this.add(progressSent
+ , new GridBagConstraints(0, 1, GridBagConstraints.REMAINDER, 1, 1.0, 1.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(10, 10, 0,10), 0, 0));
+
+ }
+ public void setProgressText(String s) {
+ progressDescription.setText(s);
+ }
+
+ public void setProgressValue(int i) {
+ progressSent.setValue(i);
+ }
+ public void aboutToDisplayPanel() {
+
+ setProgressValue(0);
+ setProgressText("Connecting to Server...");
+
+ }
+ public void displayingPanel() {
+
+ Thread t = new Thread() {
+
+ public void run() {
+
+ int minimum = progressSent.getMinimum();
+ int maximum =progressSent.getMaximum();
+ Runnable runner = new Runnable() {
+ public void run() {
+ if(stop && progressSent .getValue()<100){
+
+ progressSent .setIndeterminate(false);
+ int value = progressSent .getValue();
+ progressSent .setValue(value+10);
+ setProgressValue(value+9);
+ progressDescription .setText("Genarate Code. Please wait.....");
+ } else if(!stop){
+ progressSent .setIndeterminate(true);
+
+ }
+ }
+ };
+ for (int i=minimum; i<maximum; i++) {
+ try {
+ SwingUtilities.invokeAndWait(runner);
+ // Our task for each step is to just sleep
+ Thread.sleep(DELAY);
+ } catch (InterruptedException ignoredException) {
+ } catch (InvocationTargetException ignoredException) {
+ }
+ }
+ }
+ };
+ t.start();
}
}
Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/WSDLFileFilter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/WSDLFileFilter.java?view=auto&rev=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/WSDLFileFilter.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/WSDLFileFilter.java Tue Jul 3 05:02:43 2007
@@ -0,0 +1,40 @@
+package org.apache.axis2.tools.idea;
+
+
+import javax.swing.filechooser.FileFilter;
+import java.io.File;
+
+/**
+ * this class use for filter file
+ */
+public class WSDLFileFilter extends FileFilter {
+
+ public boolean accept(File f) {
+ if (f.isDirectory()) {
+ return true;
+ }
+ String extension = getExtension(f);
+ if (extension != null) {
+ return extension.equals("wsdl");
+ }
+
+ return false;
+
+ }
+
+ public String getDescription() {
+ return ".wsdl";
+ }
+
+ private String getExtension(File f) {
+ String ext = null;
+ String s = f.getName();
+ int i = s.lastIndexOf('.');
+
+ if (i > 0 && i < s.length() - 1) {
+ ext = s.substring(i + 1).toLowerCase();
+ }
+ return ext;
+ }
+
+}
\ No newline at end of file
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/BottomPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/BottomPanel.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/BottomPanel.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/BottomPanel.java Tue Jul 3 05:02:43 2007
@@ -1,233 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.axis2.tools.java2wsdl;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.io.File;
-import java.io.StringWriter;
-
-
-public class BottomPanel extends JPanel implements ActionListener {
- public static JButton btnBack;
- public static JButton btnNext;
- public static JButton btnFinish;
- public static JButton btnCancel;
- // public static
-
- private Java2WSDLFrame java2WSDLFrame;
- final JFileChooser fc=new JFileChooser();
-
- public BottomPanel(Java2WSDLFrame java2WSDLFrame) {
-
- this.java2WSDLFrame = java2WSDLFrame;
-
- setFont(new Font("Helvetica", Font.PLAIN, 12));
- BottomLayout customLayout = new BottomLayout();
- setLayout(customLayout);
-
- btnBack = new JButton("< Back");
- btnBack.setEnabled(true);
- btnBack.addActionListener(this);
- add(btnBack);
-
- btnNext = new JButton("Next >");
- btnNext.addActionListener(this);
- add(btnNext);
-
- btnFinish = new JButton("Finish");
- btnFinish.addActionListener(this);
- add(btnFinish);
-
- btnCancel = new JButton("Cancel");
- btnCancel.addActionListener(this);
- add(btnCancel);
-
- setSize(getPreferredSize());
-
- }
-
-
- public static void setEnable(boolean back,boolean next, boolean finish, boolean cancel) {
-
- btnBack.setEnabled(back);
- btnNext.setEnabled(next);
- btnFinish.setEnabled(finish);
- btnCancel.setEnabled(cancel);
- }
-
- public void actionPerformed(ActionEvent e) {
- Object obj = e.getSource();
- if (obj == btnNext) {
- if (java2WSDLFrame.plMiddle .isVisible() ) {
-
- if(java2WSDLFrame.plMiddle.testLoading()){
-
- java2WSDLFrame.setPanel();
- }else
- setEnable(false,false,false,true);
-
- }else if(java2WSDLFrame.opPanel.isVisible()){
-
- 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();
- }
-
- }
-
- } else if(obj == btnBack){
-
- java2WSDLFrame.backButtonImpl();
-
- } else if (obj == btnCancel) {
-
- java2WSDLFrame.dispose();
- Thread.currentThread().setContextClassLoader(java2WSDLFrame.getClassLoader());
-
- } else if(obj ==btnFinish ){
-
- 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 );
-
- java2WSDLFrame.dispose();
-
- } catch (Exception e1) {
-
- StringWriter writer = new StringWriter();
- JOptionPane.showMessageDialog(java2WSDLFrame,
- "Code genaration failed!" + writer.toString(),
- "Axis2 code generation",
- JOptionPane.ERROR_MESSAGE);
- java2WSDLFrame.dispose();
-
- }
- }
-
- }
-}
-
-class BottomLayout implements LayoutManager {
- public BottomLayout() {
- }
-
- public void addLayoutComponent(String name, Component comp) {
- }
-
- public void removeLayoutComponent(Component comp) {
- }
-
- public Dimension preferredLayoutSize(Container parent) {
- Dimension dim = new Dimension(0, 0);
-
- Insets insets = parent.getInsets();
- dim.width = 475 + insets.left + insets.right;
- dim.height = 60 + insets.top + insets.bottom;
-
- return dim;
- }
-
- public Dimension minimumLayoutSize(Container parent) {
- return new Dimension(0, 0);
- }
-
- public void layoutContainer(Container parent) {
- Insets insets = parent.getInsets();
-
- Component c;
- c = parent.getComponent(0);
- if (c.isVisible()) {
- c.setBounds(insets.left + 152, insets.top + 10, 80, 24);
- }
- c = parent.getComponent(1);
- if (c.isVisible()) {
- c.setBounds(insets.left + 232, insets.top + 10, 80, 24);
- }
- c = parent.getComponent(2);
- if (c.isVisible()) {
- c.setBounds(insets.left + 312, insets.top + 10, 80, 24);
- }
- c = parent.getComponent(3);
- if (c.isVisible()) {
- c.setBounds(insets.left + 395, insets.top + 10, 80, 24);
- }
- }
-}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/Java2WSDLFrame.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/Java2WSDLFrame.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/Java2WSDLFrame.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/Java2WSDLFrame.java Tue Jul 3 05:02:43 2007
@@ -1,292 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.axis2.tools.java2wsdl;
-
-import org.apache.axis2.tools.bean.WsdlgenBean;
-import com.intellij.openapi.project.Project;
-import javax.swing.*;
-import java.awt.*;
-
-
-public class Java2WSDLFrame extends JFrame {
-
- // first panel
- // ImagePanel imgPanel;
- MiddlePanel plMiddle;
- BottomPanel plBottom;
- OptionPanel opPanel;
- OutputPanel outPanel;
-
-
- private int panleID = 1;
- private ClassLoader classLoader;
- Project project;
-
- private WsdlgenBean wsdlgenBean;
- private int defaultCloseOperation;
- public Java2WSDLFrame (){
-
- windowLayout customLayout = new windowLayout(1);
-
- setTitle("Axis2 Codegen Wizard ");
-
- getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
- getContentPane().setLayout(customLayout);
-
- wsdlgenBean=new WsdlgenBean();
- //add image panel
-
- /* imgPanel = new ImagePanel();
- imgPanel.setCaptions(" Java source/classpath selection"
- , " Welcome to the Axis2 Java source code generation wizard.");
- getContentPane().add(imgPanel);*/
-
- //add bottom panel
-
- plBottom = new BottomPanel(this);
- BottomPanel.setEnable(false,false, false, true);
- getContentPane().add(plBottom);
-
- //add middle panel
-
- plMiddle = new MiddlePanel(this,wsdlgenBean);
- getContentPane().add(plMiddle);
-
- //add option panel
-
- opPanel =new OptionPanel(this,wsdlgenBean);
- opPanel.setVisible(false);
- getContentPane().add(opPanel);
-
- //add option panel
-
- outPanel=new OutputPanel(this,wsdlgenBean);
- outPanel .setVisible(false);
- getContentPane() .add(outPanel);
-
- //add progress panel
-
-
-
- Dimension dim = new Dimension(550, 550);
- setSize(dim);
- setBounds(200, 200, dim.width, dim.height);
-
-
- }
-
- public void setDefaultCloseOperation(int operation) {
- if (operation != DO_NOTHING_ON_CLOSE &&
- operation != HIDE_ON_CLOSE &&
- operation != DISPOSE_ON_CLOSE &&
- operation != EXIT_ON_CLOSE) {
- throw new IllegalArgumentException("defaultCloseOperation must be one of: DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE, DISPOSE_ON_CLOSE, or EXIT_ON_CLOSE");
- }
- if (this.defaultCloseOperation != operation) {
- if (operation == EXIT_ON_CLOSE) {
- SecurityManager security = System.getSecurityManager();
- if (security != null) {
- security.checkExit(0);
- }
- }
- int oldValue = this.defaultCloseOperation;
- this.defaultCloseOperation = operation;
- firePropertyChange("defaultCloseOperation", oldValue, operation);
- }
- }
-
- public void setProject(Project project) {
- this.project = project;
- }
-
- public Project getActiveProject() {
- return project;
-
- }
-
- public ClassLoader getClassLoader() {
- return classLoader;
- }
- public void setClassLoader(ClassLoader classLoader) {
- this.classLoader = classLoader;
- }
-
- public void generatecode() throws Exception {
-
- wsdlgenBean.generate();
- }
-
-
- public void setPanel(){
-
- panleID++;
-
- switch (panleID) {
- case 1:{
- /*this.imgPanel .setCaptions(" Java source/classpath selection" ,
- " Select the classes and the libraries.");
-*/
- this.plMiddle .setVisible(true);
-
- this.opPanel.setVisible(false);
-
- this.outPanel .setVisible(false);
-
- plBottom.setEnable(false,false,false, true);
-
- break;
- }
- case 2: {
- /* this.imgPanel .setCaptions(" Java to WSDL Options " ,
- " Set the Options for the generator.");
- this.plMiddle .setVisible(false);
-*/
- this.opPanel.setVisible(true);
-
- this.outPanel .setVisible(false);
-
- plBottom.setEnable(true,true, true, true);
-
- break;
- }
- case 3: {
- /* this.imgPanel .setCaptions(" WSDL file Output location " ,
- " Select the location for the generated WSDL.");
- this.plMiddle .setVisible(false);
-*/
- this.opPanel.setVisible(false);
-
- this.outPanel .setVisible(true);
-
- plBottom.setEnable(true,false, true, true);
-
- break;
- }
- }
-
- }
- public void backButtonImpl(){
- panleID--;
- switch (panleID) {
- case 1: {
-
- /* this.imgPanel .setCaptions(" Java source/classpath selection" ,
- " Select the classes and the libraries.");
-*/
- this.opPanel.setVisible(false);
-
- this.plMiddle.setVisible(true);
-
- this.outPanel.setVisible(false);
-
- BottomPanel.setEnable(false,true, false, true);
-
- break;
- }
-
- case 2: {
-
- /* this.imgPanel .setCaptions(" Java to WSDL Options " ,
- " Set the Options for the generator.");
-*/
- this.plMiddle .setVisible(false);
-
- this.outPanel.setVisible(false);
-
- this.opPanel.setVisible(true);
-
- BottomPanel.setEnable(true,true, true, true);
-
- break;
- }
-
- case 3: {
-
- /* this.imgPanel .setCaptions(" WSDL file Output location " ,
- " Select the location for the generated WSDL.");
-*/
- this.plMiddle .setVisible(false);
-
- this.outPanel.setVisible(true);
-
- this.opPanel.setVisible(false);
-
- BottomPanel.setEnable(true,false, true, true);
-
- break;
-
- }
-
- }
-
- }
-
-}
-
-class windowLayout implements LayoutManager{
-
- int paneID;
-
- public windowLayout(int panelid) {
- paneID = panelid;
- }
- public void addLayoutComponent(String name, Component comp) {
- }
- public void removeLayoutComponent(Component comp) {
- }
- public Dimension preferredLayoutSize(Container parent) {
- Dimension dim = new Dimension(0, 0);
-
- Insets insets = parent.getInsets();
- dim.width = 550+ insets.left + insets.right;
- dim.height = 600 + insets.top + insets.bottom;
-
- return dim;
- }
- public Dimension minimumLayoutSize(Container parent) {
- return new Dimension(0, 0);
- }
- public void layoutContainer(Container parent) {
- Insets insets = parent.getInsets();
-
- Component c;
- /* c = parent.getComponent(0);
- if (c.isVisible()) {
- c.setBounds(insets.left, insets.top, 550, 80);
- }*/
- c = parent.getComponent(1);
- if (c.isVisible()) {
- c.setBounds(insets.left, insets.top + 80, 500, 450);
- }
- c = parent.getComponent(2);
- if (c.isVisible()) {
- c.setBounds(insets.left, insets.top + 80, 500, 450);
- }
- c = parent.getComponent(3);
- if (c.isVisible()) {
- c.setBounds(insets.left, insets.top + 80, 500, 450);
- }
- c = parent.getComponent(0);
- if (c.isVisible()) {
- c.setBounds(insets.left, insets.top + 525, 500, 50);
- }
-
- }
-
-}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/MiddlePanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/MiddlePanel.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/MiddlePanel.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/MiddlePanel.java Tue Jul 3 05:02:43 2007
@@ -20,227 +20,260 @@
import org.apache.axis2.tools.bean.ClassLoadingTestBean;
import org.apache.axis2.tools.bean.WsdlgenBean;
+import org.apache.axis2.tools.bean.NamespaceFinder;
+import org.apache.axis2.tools.component.WizardPanel;
+import org.apache.axis2.tools.component.WizardComponents;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
import javax.swing.*;
+import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
-import com.intellij.openapi.ui.MultiLineLabelUI;
-
-
-public class MiddlePanel extends JPanel implements ActionListener, MouseListener {
-
- JLabel lblClass;
- JLabel lblPath;
- JLabel lblTest;
- JLabel lblHint;
-
- JTextField txtClass;
-
- JButton btnFolder;
- JButton btnJar;
- JButton btnRemove;
- JButton btnTest;
-
- JList listPathDisply;
- DefaultListModel listModel;
-
- private String hint ="Hint : Please give the fully qualified class name, example :com.foo.BarService\n" +
- " Then add the folder or the jar file which contains that class file.\n" +
- " Finally check whether the class file can be loaded from the plugin.\n\n" +
- " If the class that you are going to load contains any dependencies\n" +
- " on other axis2 libraries ( for example like axiom*.jar), please add those\n" +
- " libraries as well and try to load the class.";
+/**
+ * this is the first panel of java2wsdl wizard
+ */
+public class MiddlePanel extends WizardPanel {
+ /**
+ * varibale
+ */
+ private JTextField txtClass;
+ private JButton btnFolder;
+ private JButton btnJar;
+ private JButton btnRemove;
+ private JButton btnTest;
+ private JButton btnHint;
+ private JTextArea txaHint;
+ private boolean flag=false;
+ private JList listPathDisply;
+ private DefaultListModel listModel;
+ private JLabel lblTest;
+ private String hint ="Please give the fully qualified class name, example :com.foo.BarService" +
+ " Then add the folder or the jar file which contains that class file." +
+ " Finally check whether the class file can be loaded from the plugin." +
+ " If the class that you are going to load contains any dependencies" +
+ " on other axis2 libraries ( for example like axiom*.jar), please add those" +
+ " libraries as well and try to load the class.";
final JFileChooser FileChooser =new JFileChooser();
final JFileChooser DirChooser=new JFileChooser();
-
private WsdlgenBean wsdlgenBean;
- private Java2WSDLFrame java2WSDLFrame;
-
- public MiddlePanel (Java2WSDLFrame java2WSDLFrame,WsdlgenBean wsdlgenBean){
- this.wsdlgenBean = wsdlgenBean;
- this.java2WSDLFrame =java2WSDLFrame;
-
- MiddleLayout customLayout=new MiddleLayout();
- setLayout(customLayout);
-
- setFont(new Font("Helvetica", Font.PLAIN, 12));
- //add class lable and comboBox
+ /**
+ * Constructor
+ * @param wizardComponents
+ * @param wsdlgenBean
+ */
+ public MiddlePanel(WizardComponents wizardComponents ,WsdlgenBean wsdlgenBean) {
+ super(wizardComponents, "Java source / classpath selection");
+ setPanelTopTitle("Java source / classpath selection");
+ setPanelBottomTitle("Select the classes and the libraries");
+ this.wsdlgenBean=wsdlgenBean;
+ init();
+ }
+
+ /**
+ * initiate panel
+ */
+ private void init(){
+
+ txaHint =new JTextArea();
+ txaHint.setBorder(null);
+ txaHint.setFocusable(false);
+ txaHint.setLineWrap(true);
+ txaHint.setWrapStyleWord(true);
+ txaHint.setOpaque(false);
- lblClass=new JLabel("Fully Qualified Class Name : ");
- add(lblClass);
-
- txtClass=new JTextField();
- txtClass.addActionListener(this);
- txtClass.addMouseListener(this);
- add(txtClass);
-
- //add folder and jar display
-
- lblPath =new JLabel("Java class path entries.Select either folders or jar files ");
- add(lblPath);
+ btnHint =new JButton("Hint >>");
+ btnHint.setBorder(new EmptyBorder(new Insets(0,0,0,0)));
btnFolder=new JButton("Add Folder");
- btnFolder .addActionListener(this);
- add(btnFolder);
-
btnJar=new JButton("Add Jar");
- btnJar.addActionListener(this);
- add(btnJar);
-
btnRemove=new JButton("Remove");
- btnRemove.addActionListener(this);
- add(btnRemove);
-
- listModel = new DefaultListModel();
- listPathDisply =new JList(listModel);
- add(listPathDisply);
-
- //testting class loading
-
btnTest=new JButton("Test Class Loading");
- btnTest .addActionListener(this);
- add(btnTest);
-
- lblTest=new JLabel(" ");
- add(lblTest);
- //Hint Area
-
-
-
- lblHint =new JLabel(hint);
- lblHint .setHorizontalTextPosition( SwingConstants.LEFT );
- lblHint .setUI( new MultiLineLabelUI() );
- add(lblHint );
-
-
- setSize(getPreferredSize());
-
- }
-
-
-
- public void actionPerformed(ActionEvent e) {
- Object obj=e.getSource();
- if(obj == btnFolder ) {
- DirChooser .setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int returnVal = DirChooser.showOpenDialog(this);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- DirChooser.setFileSelectionMode(JFileChooser .FILES_ONLY );
- File newfile = DirChooser.getSelectedFile();
- listModel.addElement(newfile.getAbsolutePath() );
- BottomPanel.setEnable(false,true, false, true);
- setDefaultPathAndName(newfile );
- updateStatusTextField( false,"");
+ txtClass =new JTextField();
+ lblTest= new JLabel();
+ listModel =new DefaultListModel();
+ listPathDisply =new JList(listModel);
+ listPathDisply.setAutoscrolls(true);
+ listPathDisply.setOpaque(false);
+ listPathDisply.setBorder(BorderFactory.createBevelBorder(1) );
+ listPathDisply.setFocusable(false);
+
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(false);
+ setFinishButtonEnabled(false);
+ setPageComplete(false);
+
+ this.setLayout(new GridBagLayout());
+
+ this.add(new JLabel("Fully Qualified Class Name :")
+ , new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,10), 0, 0));
+
+ this.add(txtClass
+ , new GridBagConstraints(1, 0, GridBagConstraints.REMAINDER, 1, 1.0, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 1, 0, 10), 0, 0));
+
+ this.add(new JLabel("java class path Entries.select either folders or jar files ")
+ , new GridBagConstraints(0, 1, GridBagConstraints.REMAINDER, 1,0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0,10), 0, 0));
+
+ this.add(btnFolder
+ , new GridBagConstraints(0, 2, 1, 1, 0.1, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.HORIZONTAL
+ , new Insets(5,10, 1,1), 0, 0));
+
+ btnFolder.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ DirChooser .setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ int returnVal = DirChooser.showOpenDialog(btnFolder );
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ DirChooser.setFileSelectionMode(JFileChooser .FILES_ONLY );
+ File newfile = DirChooser.getSelectedFile();
+ listModel.addElement(newfile.getAbsolutePath() );
+ setDefaultPathAndName(newfile );
+ updateStatusTextField( false,"");
+ }
+ update();
}
+ });
- }else if(obj == btnJar ) {
-
- FileChooser.setFileFilter(new JarFileFilter() );
- int returnVal= FileChooser.showOpenDialog(this);
- if(returnVal == JFileChooser .APPROVE_OPTION ){
- File file = FileChooser.getSelectedFile();
- listModel.addElement(file.getAbsolutePath() );
- BottomPanel.setEnable(false,true, false, true);
- setDefaultPathAndName(file );
- updateStatusTextField(false,"");
+ this.add(btnJar
+ , new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 1, 1,1), 0, 0));
+ btnJar.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+
+ FileChooser.setFileFilter(new JarFileFilter() );
+ int returnVal= FileChooser.showOpenDialog(btnJar);
+ if(returnVal == JFileChooser .APPROVE_OPTION ){
+ File file = FileChooser.getSelectedFile();
+ listModel.addElement(file.getAbsolutePath() );
+ setDefaultPathAndName(file );
+ updateStatusTextField( false,"");
+ }
+ update();
}
+ });
- } else if( obj == btnRemove){
-
- handleRemove();
-
- }else if(obj == btnTest ){
- if(!testLoading()){
- BottomPanel.setEnable(false,false,false,true);
-
- }else {
- BottomPanel.setEnable(false,true,true,true);
- wsdlgenBean.setClassPathList(getClassPathlist());
- wsdlgenBean.setClassName(txtClass.getText().trim() );
+ this.add(btnRemove
+ , new GridBagConstraints(2, 2, 1, 1, 1.0, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 1, 1,10), 0, 0));
+ btnRemove.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ handleRemove();
+ update();
}
+ });
- }else if(obj ==txtClass ){
- if (txtClass.getText() != null && !txtClass.getText().trim().equals("")) {
- BottomPanel.setEnable(false,true, false, true);
- wsdlgenBean.setClassName(txtClass.getText().trim());
+ this.add(new JScrollPane(listPathDisply)
+ , new GridBagConstraints(0, 3, GridBagConstraints.REMAINDER, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 1,10), 0, 0));
+
+ this.add(btnTest
+ , new GridBagConstraints(0, 4, 1, 1, 0.1, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 1,1), 0, 0));
+ btnTest.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if(!testLoading()){
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(false);
+ setFinishButtonEnabled(false);
+ }else {
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(true);
+ setFinishButtonEnabled(false);
+ wsdlgenBean.setClassPathList(getClassPathlist());
+ wsdlgenBean.setClassName(txtClass.getText().trim() );
+ setPageComplete(true);
+ }
+ update();
}
- }
- }
- private void setDefaultPathAndName(File file) {
- String defualtOutPutPath=file.getParent();
- java2WSDLFrame.outPanel.txtLocation .setText(defualtOutPutPath);
- java2WSDLFrame.outPanel .txtFileName .setText("services.wsdl");
-
- }
+ });
- public void mouseClicked(MouseEvent e) {
- Object obj = e.getSource();
- if (obj == txtClass) {
- if (txtClass.getText() != null && !txtClass.getText().trim().equals("")) {
- BottomPanel.setEnable(false,true, false, true);
- // set wsdlgen FileName
- wsdlgenBean.setClassName(txtClass.getText().trim());
+ this.add(lblTest
+ , new GridBagConstraints(1, 4, GridBagConstraints.REMAINDER, 1, 1.0, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 1, 1,10), 0, 0));
+
+ this.add(new JSeparator()
+ , new GridBagConstraints(0, 5, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 1, 1,1), 0, 0));
+
+ this.add(btnHint,
+ new GridBagConstraints(0, 6, 1, 1, 0.1,0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 10), 0, 0));
+ btnHint.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ if(flag){
+ btnHint.setText("Hint >>");
+ txaHint.setText("");
+ flag=false;
+ }else{
+ btnHint.setText("Hint <<");
+ txaHint.setText(hint);
+ flag=true;
+ }
+ update();
}
- }
+ });
- }
+ this.add(txaHint
+ , new GridBagConstraints(0, 7, GridBagConstraints.REMAINDER, 1, 0.1,1.0
+ , GridBagConstraints.CENTER , GridBagConstraints.BOTH
+ , new Insets(5, 10, 10, 10), 0, 0));
- public void mouseEntered(MouseEvent e){
}
- public void mouseExited(MouseEvent e) {
- Object obj = e.getSource();
- if (obj == txtClass) {
- if (txtClass.getText() != null && !txtClass.getText().trim().equals("")) {
- BottomPanel.setEnable(false,true, false, true);
- // set wsdlgen FileName
- wsdlgenBean.setClassName(txtClass.getText().trim());
- }
- }
+ //next
+ public void next() {
+ if(txtClass.getText()!=null && isPageComplete()){
+ switchPanel(CodegenFrame.PANEL_OPTION_B );
+ } else
+ switchPanel(CodegenFrame.PANEL_FIRST_B );
}
-
- public void mousePressed(MouseEvent e) {
- Object obj = e.getSource();
- if (obj == txtClass) {
- if (txtClass.getText() != null && !txtClass.getText().trim().equals("")) {
- BottomPanel.setEnable(false,true, false, true);
- // set wsdlgen FileName
- wsdlgenBean.setClassName(txtClass.getText().trim());
- }
- }
+ //back
+ public void back() {
+ switchPanel(CodegenFrame.PANEL_CHOOSER );
}
-
- public void mouseReleased(MouseEvent e) {
- Object obj = e.getSource();
- if (obj == txtClass) {
- if (txtClass.getText() != null && !txtClass.getText().trim().equals("")) {
- BottomPanel.setEnable(false,true, false, true);
-
- // set wsdlgen FileName
- wsdlgenBean.setClassName(txtClass.getText().trim());
- }
+ //update
+ public void update() {
+ }
+ //set default path and name
+ private void setDefaultPathAndName(File file) {
+ if(file.getParent()!=null){
+ wsdlgenBean.setOutputLocation(file.getParent());
+ wsdlgenBean.setOutputWSDLName("Services.wsdl");
}
}
-
+ // update next page
public void updateStatusTextField(boolean success,String text){
if (success){
- java2WSDLFrame.opPanel.setDefaultNamespaces(txtClass.getText());
+ wsdlgenBean.setServiceName(NamespaceFinder.getServiceNameText(txtClass.getText()) );
+ wsdlgenBean.setTargetNamespace(NamespaceFinder.getTargetNamespaceFromClass(txtClass.getText()));
+ wsdlgenBean.setTargetNamespacePrefix(NamespaceFinder.getDefaultNamespacePrefix());
+ wsdlgenBean.setSchemaTargetNamespace(NamespaceFinder.getSchemaTargetNamespaceFromClass(txtClass.getText()));
+ wsdlgenBean.setSchemaTargetNamespacePrefix(NamespaceFinder.getDefaultSchemaNamespacePrefix());
}
lblTest.setText(text);
}
-
// Pops up the file browse dialog box
private void handleRemove() {
@@ -249,8 +282,10 @@
listModel .remove(selectionIndices[i]);
}
updateStatusTextField(false,"");
+ update();
}
+ //get class path list
public String[] getClassPathlist(){
Object [] listObject = listModel.toArray() ;
String [] listString =new String[listObject.length];
@@ -259,7 +294,7 @@
}
return listString ;
}
-
+ // test loading
public boolean testLoading(){
java.util.List errorListener = new ArrayList();
String [] listString =getClassPathlist() ;
@@ -270,92 +305,17 @@
String errorMessage = nextObject==null? "Unknown error!" :nextObject.toString();
lblTest .setText(errorMessage );
updateStatusTextField(false,errorMessage);
+ update();
}
return false;
}else{
-
- java2WSDLFrame.opPanel.setDefaultNamespaces(txtClass.getText().trim() );
updateStatusTextField(true,"Class file loaded successfully");
return true;
}
}
-
-
-}
-class MiddleLayout implements LayoutManager{
-
- public MiddleLayout (){
-
- }
- public void addLayoutComponent(String name, Component comp) {
+ //get page type
+ public int getPageType() {
+ return WizardPanel.JAVA_2_WSDL_TYPE;
}
- public void removeLayoutComponent(Component comp) {
- }
- public Dimension preferredLayoutSize(Container parent) {
- Dimension dim = new Dimension(0, 0);
-
- Insets insets = parent.getInsets();
- dim.width = 450 + insets.left + insets.right;
- dim.height = 500 + insets.top + insets.bottom;
-
- return dim;
- }
- public Dimension minimumLayoutSize(Container parent) {
- return new Dimension(0, 0);
- }
-
- public void layoutContainer(Container parent) {
- Insets insets = parent.getInsets();
-
- Component c;
- //class
- c = parent.getComponent(0);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 20, 180, 24);
- }
- c = parent.getComponent(1);
- if (c.isVisible()) {
- c.setBounds(insets.left + 200, insets.top + 20, 300, 24);
- }
- //folders and jar
- c = parent.getComponent(2);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 54, 500, 24);
- }
- c = parent.getComponent(3);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 88, 144, 24);
- }
- c = parent.getComponent(4);
- if (c.isVisible()) {
- c.setBounds(insets.left + 190, insets.top + 88,144, 24);
- }
- c = parent.getComponent(5);
- if (c.isVisible()) {
- c.setBounds(insets.left + 355, insets.top + 88, 144, 24);
- }
- c = parent.getComponent(6);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 130 , 475, 150);
- }
- //test class loading
- c= parent.getComponent(7);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 300 , 144 , 24);
- }
- c= parent.getComponent(8);
- if (c.isVisible()) {
- c.setBounds(insets.left + 180, insets.top + 300 , 475 , 24);
- }
- //hint Area
- c= parent.getComponent(9);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 330 , 500 ,100);
- }
-
- }
-
-
-
}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OptionPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OptionPanel.java?view=diff&rev=552799&r1=552798&r2=552799
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OptionPanel.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/java2wsdl/OptionPanel.java Tue Jul 3 05:02:43 2007
@@ -18,246 +18,150 @@
*/
package org.apache.axis2.tools.java2wsdl;
-import javax.swing.*;
-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,MouseListener {
-
- private JLabel lblNsp;
- private JLabel lblNspPrefix;
- private JLabel lblSchemaTargetNsp;
- private JLabel lblSchemaTargetNspPrefix;
- private JLabel lblService;
-
- JTextField txtNsp;
- JTextField txtNspPrefix;
- JTextField txtSchemaTargetNsp;
- JTextField txtSchemaTargetNspPrefix;
- JTextField txtService;
- Java2WSDLFrame java2WSDLFrame;
- WsdlgenBean wsdlgenBean;
+import org.apache.axis2.tools.bean.WsdlgenBean;
+import org.apache.axis2.tools.component.WizardPanel;
+import org.apache.axis2.tools.component.WizardComponents;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
- public OptionPanel(Java2WSDLFrame java2WSDLFrame,WsdlgenBean wsdlgenBean){
+import javax.swing.*;
+import java.awt.*;
- this.java2WSDLFrame =java2WSDLFrame ;
+/**
+ * this is the first panel of java2wsdl wizard
+ */
+public class
+ OptionPanel extends WizardPanel{
+ /**
+ * variable
+ */
+ private JTextField txtNsp;
+ private JTextField txtNspPrefix;
+ private JTextField txtSchemaTargetNsp;
+ private JTextField txtSchemaTargetNspPrefix;
+ private JTextField txtService;
+ private WsdlgenBean wsdlgenBean;
+
+ /**
+ * Construct method
+ * @param wizardComponents
+ * @param wsdlgenBean
+ */
+ public OptionPanel(WizardComponents wizardComponents,WsdlgenBean wsdlgenBean){
+ super(wizardComponents, "Option was choosed");
+ setPanelTopTitle("Java to WSDL Options");
+ setPanelBottomTitle("Set the Option for the generation");
this.wsdlgenBean=wsdlgenBean;
+ init();
+ }
+ /** initaite method*/
+ public void init(){
- OptionLayout customLayout=new OptionLayout();
- setLayout(customLayout);
-
- setFont(new Font("Helvetica", Font.PLAIN, 12));
-
- //add lable and textfield
-
- lblNsp =new JLabel("Target Namespace");
- add(lblNsp);
-
- txtNsp=new JTextField();
- add(txtNsp);
-
- lblNspPrefix =new JLabel("Target Namespace Prefix");
- add(lblNspPrefix );
+ txtNsp =new JTextField();
txtNspPrefix =new JTextField();
- add(txtNspPrefix);
-
- lblSchemaTargetNsp=new JLabel("Schema Target Namespace");
- add(lblSchemaTargetNsp);
txtSchemaTargetNsp =new JTextField();
- add(txtSchemaTargetNsp);
-
- lblSchemaTargetNspPrefix =new JLabel("Schema Target Namespace Prefix");
- add(lblSchemaTargetNspPrefix);
txtSchemaTargetNspPrefix =new JTextField();
- add(txtSchemaTargetNspPrefix);
-
- lblService =new JLabel("Service Name");
- add(lblService );
txtService =new JTextField();
- add(txtService );
- txtService .addActionListener(this);
- txtService.addMouseListener(this);
-
- setSize(getPreferredSize());
-
- }
- public String getTargetNamespace() {
- return txtNsp.getText() ;
- }
-
- public String getTargetNamespacePrefix() {
- return txtNspPrefix .getText() ;
- }
-
-
- public String getSchemaTargetNamespace() {
- return txtSchemaTargetNsp.getText() ;
- }
-
- public String getSchemaTargetNamespacePrefix () {
- return txtSchemaTargetNspPrefix .getText() ;
- }
- public String getServiceName(){
- return txtService .getText() ;
- }
-
-
- 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());
- }
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(true);
+ setFinishButtonEnabled(false);
+ this.setLayout(new GridBagLayout());
+
+ this.add(new JLabel("Target Namespace")
+ , new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 20, 0,0), 0, 0));
+
+ this.add(txtNsp
+ , new GridBagConstraints(1, 0, 2, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 5, 0,20), 0, 0));
+
+ this.add(new JLabel("Target Namespace Prefix")
+ , new GridBagConstraints(0, 1, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 20, 0, 0), 0, 0));
+
+ this.add(txtNspPrefix
+ , new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 5, 0,20), 0, 0));
+
+ this.add(new JLabel("Schema Target Namespace")
+ , new GridBagConstraints(0, 2, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 20, 0,0), 0, 0));
+
+ this.add(txtSchemaTargetNsp
+ , new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 5, 0,20), 0, 0));
+
+ this.add(new JLabel("Schema Target Namespace Prefix")
+ , new GridBagConstraints(0, 3, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 20, 0, 0), 0, 0));
+
+ this.add(txtSchemaTargetNspPrefix
+ , new GridBagConstraints(1, 3, 2, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 5, 0,20), 0, 0));
+
+ this.add(new JLabel("Service Name")
+ , new GridBagConstraints(0, 4, 1, 1, 0.1, 1.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
+ , new Insets(5, 20, 0, 0), 0, 0));
+
+ this.add(txtService
+ , new GridBagConstraints(1, 4, 2, 1, 1.0, 1.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 5, 0,20), 0, 0));
+
+ }
+ //next
+ public void next() {
+ switchPanel(CodegenFrame.PANEL_LAST_B );
+ }
+ //back
+ public void back() {
+ switchPanel(CodegenFrame.PANEL_FIRST_B );
+ }
+ //update
+ public void update() {
+ if(wsdlgenBean.getTargetNamespace()!=null )
+ txtNsp.setText(wsdlgenBean.getTargetNamespace());
+ if(wsdlgenBean.getTargetNamespacePrefix()!=null )
+ txtNspPrefix .setText(wsdlgenBean.getTargetNamespacePrefix());
+ if(wsdlgenBean.getSchemaTargetNamespace()!=null )
+ txtSchemaTargetNsp .setText(wsdlgenBean.getSchemaTargetNamespace());
+ if(wsdlgenBean.getSchemaTargetNamespacePrefix()!=null )
+ txtSchemaTargetNspPrefix.setText(wsdlgenBean.getSchemaTargetNamespacePrefix());
+ if(wsdlgenBean.getServiceName()!=null )
+ txtService.setText(wsdlgenBean.getServiceName());
+ setBackButtonEnabled(true);
+ setNextButtonEnabled(true);
+ setFinishButtonEnabled(false);
+ setPageComplete(isComplete());
+ }
+ // get page type
+ public int getPageType() {
+ return WizardPanel.JAVA_2_WSDL_TYPE;
+ }
+
+ private boolean isComplete(){
+ if(txtNsp.getText()!=null
+ && txtNspPrefix.getText()!=null
+ && txtSchemaTargetNsp.getText()!=null
+ && txtSchemaTargetNspPrefix.getText()!=null
+ && txtService.getText()!=null){
+ return true;
+ }else{
+ return false;
}
- }
-
- 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) );
- this.txtNspPrefix .setText(NamespaceFinder.getDefaultNamespacePrefix() );
- this.txtSchemaTargetNspPrefix .setText(NamespaceFinder.getDefaultSchemaNamespacePrefix() );
- this.txtService .setText(NamespaceFinder.getServiceNameText(fullyQualifiedClassName) );
- setNamespaceDefaults();
- }
-
- public void setNamespaceDefaults(){
- wsdlgenBean.setTargetNamespace(txtNsp.getText() );
- wsdlgenBean.setTargetNamespacePrefix(txtNspPrefix .getText() );
- wsdlgenBean.setSchemaTargetNamespace(txtSchemaTargetNsp .getText() );
- wsdlgenBean.setSchemaTargetNamespacePrefix(txtSchemaTargetNspPrefix .getText() );
- wsdlgenBean.setServiceName(txtService .getText() );
- }
-}
-
-
-class OptionLayout implements LayoutManager {
-
- public OptionLayout (){
-
- }
- public void addLayoutComponent(String name, Component comp){
-
- }
-
- public void removeLayoutComponent(Component comp){
-
- }
- public Dimension preferredLayoutSize(Container parent) {
- Dimension dim = new Dimension(0, 0);
-
- Insets insets = parent.getInsets();
- dim.width = 500 + insets.left + insets.right;
- dim.height =500 + insets.top + insets.bottom;
-
- return dim;
- }
- public Dimension minimumLayoutSize(Container parent) {
- return new Dimension(0, 0);
- }
-
- public void layoutContainer(Container parent) {
-
- Insets insets = parent.getInsets();
-
- Component c;
-
- c = parent.getComponent(0);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top +20,200, 24);
- }
- c = parent.getComponent(1);
- if (c.isVisible()) {
- c.setBounds(insets.left + 225, insets.top + 20, 275, 24);
- }
- c = parent.getComponent(2);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 60, 200, 24);
- }
- c = parent.getComponent(3);
- if (c.isVisible()) {
- c.setBounds(insets.left + 225, insets.top + 60, 275, 24);
- }
- c = parent.getComponent(4);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 100, 200, 24);
- }
- c = parent.getComponent(5);
- if (c.isVisible()) {
- c.setBounds(insets.left + 225, insets.top + 100, 275, 24);
- }
- c = parent.getComponent(6);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 140, 200, 24);
- }
- c = parent.getComponent(7);
- if (c.isVisible()) {
- c.setBounds(insets.left + 225, insets.top + 140, 275, 24);
- }
- c = parent.getComponent(8);
- if (c.isVisible()) {
- c.setBounds(insets.left + 24, insets.top + 180, 200, 24);
- }
- c = parent.getComponent(9);
- if (c.isVisible()) {
- c.setBounds(insets.left + 225, insets.top + 180, 275, 24);
- }
-
-
-
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org