You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by th...@apache.org on 2007/07/12 11:37:12 UTC
svn commit: r555548 - in
/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache:
axis2/tools/idea/ axis2/tools/wizardframe/ ideaplugin/frames/
Author: thilina
Date: Thu Jul 12 02:37:10 2007
New Revision: 555548
URL: http://svn.apache.org/viewvc?view=rev&rev=555548
Log:
applying the patch given at AXIS2-2901... thanx Shivantha..
Added:
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/CodegenPlugin.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/CodegenPluginAction.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/WSDL2JavaOutputPanel.java
Removed:
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/Java2CodeFrame.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/OutPutPane.java
webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/SecondFrame.java
Modified:
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/FirstPanel.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/idea/SecondPanel.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/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=diff&rev=555548&r1=555547&r2=555548
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ChooserPanel.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/ChooserPanel.java Thu Jul 12 02:37:10 2007
@@ -69,7 +69,7 @@
, new Insets(10, 20, 0,0), 0, 0));
// option button for java2wsdl
- optionW2JRadioButton.setEnabled(false);
+ optionW2JRadioButton.setEnabled(true);
this.add(optionW2JRadioButton
, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0
, GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
@@ -147,7 +147,7 @@
*/
public void next() {
if (selectedOption == 'A') {
- // switchPanel(CodegenFrame.PANEL_FIRST_A) ;
+ switchPanel(CodegenFrame.PANEL_FIRST_A) ;
} else if (selectedOption == 'B') {
switchPanel(CodegenFrame.PANEL_FIRST_B );
Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/CodegenPlugin.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/CodegenPlugin.java?view=auto&rev=555548
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/CodegenPlugin.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/CodegenPlugin.java Thu Jul 12 02:37:10 2007
@@ -0,0 +1,123 @@
+/*
+ * 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 com.intellij.openapi.components.ApplicationComponent;
+import com.intellij.openapi.options.Configurable;
+import com.intellij.openapi.options.ConfigurationException;
+import com.intellij.openapi.project.Project;
+
+import javax.swing.*;
+import javax.xml.stream.XMLInputFactory;
+
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
+
+/**
+ * <h3>SampleApplicationPlugin</h3>
+ * <p/>
+ * Application level plugin sample showing IDEA <b>OpenAPI</b> basics.<br>
+ * Implements <code>ApplicationComponent</code> interface.
+ */
+public class CodegenPlugin implements ApplicationComponent , Configurable {
+
+ private CodegenFrame form;
+ private ImageIcon myIcon;
+
+ /**
+ * Method is called after plugin is already created and configured. Plugin can start to communicate with
+ * other plugins only in this method.
+ */
+ public void initComponent() {
+ try {
+ XMLInputFactory.newInstance();
+ } catch (Exception e) {
+ //Fixing class loading issue
+ } catch (Throwable e) {
+ ////Fixing class loading issue
+ }
+
+ if (form == null) {
+ form = new CodegenFrame();
+ form.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ form.setSize(500,500);
+ }
+ if (myIcon == null) {
+ java.net.URL resource = CodegenFrame.class.getResource("/icons/icon.png");
+ myIcon = new ImageIcon(resource);
+ }
+ }
+
+ /**
+ * This method is called on plugin disposal.
+ */
+ public void disposeComponent() {
+ }
+
+ /**
+ * Returns the name of component
+ *
+ * @return String representing component name. Use PluginName.ComponentName notation
+ * to avoid conflicts.
+ */
+ public String getComponentName() {
+ return "ActionsSample.CodegenPlugin";
+ }
+
+ public String getDisplayName() {
+ return "Axis2 Codegen Plug-ins";
+ }
+
+ public Icon getIcon() {
+ return myIcon;
+ }
+
+ public String getHelpTopic() {
+ return "No help available";
+ }
+
+ public JComponent createComponent() {
+ if (form == null) {
+ form = new CodegenFrame();
+ }
+ return form.getRootComponent();
+ }
+
+ public boolean isModified() {
+ return false;
+ }
+
+ public void apply() throws ConfigurationException {
+
+ }
+
+ public void reset() {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void disposeUIResources() {
+ form = null;
+ }
+
+ public void showTool(Project project) {
+ form.setProject(project);
+ form.showUI();
+
+ }
+}
\ No newline at end of file
Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/CodegenPluginAction.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/CodegenPluginAction.java?view=auto&rev=555548
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/CodegenPluginAction.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/CodegenPluginAction.java Thu Jul 12 02:37:10 2007
@@ -0,0 +1,49 @@
+package org.apache.axis2.tools.idea;
+
+import com.intellij.openapi.actionSystem.*;
+import com.intellij.openapi.application.Application;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.project.Project;
+
+import javax.swing.*;
+
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: shivantha
+ * Date: 9/07/2007
+ * Time: 17:40:25
+ * To change this template use File | Settings | File Templates.
+ */
+public class CodegenPluginAction extends AnAction {
+
+ private ImageIcon myIcon;
+
+ public CodegenPluginAction() {
+ super("GC", "Axis2 Code Generator", null);
+ }
+
+ public void actionPerformed(AnActionEvent anActionEvent) {
+ Application application =
+ ApplicationManager.getApplication();
+ Project project = (Project) anActionEvent.getDataContext().getData(DataConstants.PROJECT);
+
+ CodegenPlugin axis2component =
+ (CodegenPlugin) application.getComponent(CodegenPlugin.class);
+ axis2component.showTool(project);
+ }
+
+ public void update(AnActionEvent event) {
+ super.update(event);
+ Presentation presentation = event.getPresentation();
+ if (ActionPlaces.MAIN_TOOLBAR.equals(event.getPlace())) {
+ if (myIcon == null) {
+ java.net.URL resource = CodegenPluginAction.class.getResource("/icons/icon.png");
+ myIcon = new ImageIcon(resource);
+ }
+ presentation.setIcon(myIcon);
+ }
+ }
+
+}
+
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=555548&r1=555547&r2=555548
==============================================================================
--- 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 Thu Jul 12 02:37:10 2007
@@ -19,14 +19,16 @@
package org.apache.axis2.tools.idea;
import org.apache.axis2.tools.bean.CodegenBean;
+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.filechooser.FileFilter;
+import javax.swing.border.EmptyBorder;
+import javax.wsdl.WSDLException;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
import java.io.File;
/**
@@ -34,177 +36,135 @@
* Date: Jul 20, 2005
* Time: 3:35:47 PM
*/
-public class FirstPanel extends JPanel implements ActionListener, MouseListener {
+public class FirstPanel extends WizardPanel {
- JLabel lblWSDL;
- JTextField txtWSDL;
- JButton btnBrowse;
- final JFileChooser fc = new JFileChooser();
- private CodegenBean codegenBean;
+ private JLabel lblWSDL;
+ private JTextField txtWSDL;
+ private JButton btnBrowse;
+ private JButton btnHint;
+ private JLabel lblHint;
+ private boolean flag=false;
+ final private String hint="You can select only *.wsdl/*.xml file location.";
- public FirstPanel(CodegenBean codegenBean) {
- this.codegenBean = codegenBean;
- FirstPanelLayout customLayout = new FirstPanelLayout();
- setLayout(customLayout);
-
- setFont(new Font("Helvetica", Font.PLAIN, 12));
- lblWSDL = new JLabel("WSDL File");
- add(lblWSDL);
-
- txtWSDL = new JTextField("");
- add(txtWSDL);
- txtWSDL.addActionListener(this);
- txtWSDL.addMouseListener(this);
-
- btnBrowse = new JButton("Browse...");
- add(btnBrowse);
- btnBrowse.addActionListener(this);
-
-
- Dimension dim = new Dimension(450, 600);
- setSize(dim);
- fc.setFileFilter(new WSDLFileFilter());
+ final JFileChooser FileChooser =new JFileChooser();
- }
+ private CodegenBean codegenBean;
- public void actionPerformed(ActionEvent e) {
- Object obj = e.getSource();
- if (obj == btnBrowse) {
-
- int returnVal = fc.showOpenDialog(this);
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = fc.getSelectedFile();
- txtWSDL.setText(file.getAbsolutePath());
- BottomPanel.setEnable(false,true, false, true);
- codegenBean.setWSDLFileName(file.getAbsolutePath());
- }
- } else if (obj == txtWSDL) {
- if (txtWSDL.getText() != null && !txtWSDL.getText().trim().equals("")) {
- BottomPanel.setEnable(false,true, false, true);
- codegenBean.setWSDLFileName(txtWSDL.getText().trim());
+ public FirstPanel(WizardComponents wizardComponents,CodegenBean codegenBean) {
+ super(wizardComponents, "Option was choosed");
+ this.codegenBean=codegenBean;
+ setPanelTopTitle("WSDL selection page");
+ setPanelBottomTitle("please Select the WSDl file location");
+ init();
+ }
+
+ private void init(){
+
+ lblHint =new JLabel("");
+ btnHint =new JButton("Hint >>");
+ btnHint.setBorder(new EmptyBorder(new Insets(0,0,0,0)));
+
+ this.setLayout(new GridBagLayout());
+ lblWSDL =new JLabel("WSDL File Location");
+ txtWSDL =new JTextField();
+ btnBrowse = new JButton("Browse");
+
+ this.setLayout(new GridBagLayout());
+ this.add(lblWSDL
+ , new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,10), 0, 0));
+
+ this.add(txtWSDL
+ , new GridBagConstraints(1, 0, GridBagConstraints.RELATIVE, 1, 2.0, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0, 10), 0, 0));
+
+ this.add(btnBrowse
+ , new GridBagConstraints(2, 0, 1, 1, 0.1, 0.0
+ , GridBagConstraints.CENTER , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,10), 0, 0));
+ btnBrowse.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ FileChooser.setFileFilter(new WSDLFileFilter());
+ int returnVal = FileChooser.showOpenDialog(btnBrowse);
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = FileChooser.getSelectedFile();
+ txtWSDL.setText(file.getAbsolutePath());
+ codegenBean.setWSDLFileName(file.getAbsolutePath());
+ update();
+ }
}
+ });
- }
-
- }
-
- public void mouseClicked(MouseEvent e) {
- Object obj = e.getSource();
- if (obj == txtWSDL) {
- if (txtWSDL.getText() != null && !txtWSDL.getText().trim().equals("")) {
- BottomPanel.setEnable(false,true, false, true);
- codegenBean.setWSDLFileName(txtWSDL.getText().trim());
+ this.add(btnHint,
+ new GridBagConstraints(0, 1, 1, 1, 0.1,0.0
+ , GridBagConstraints.NORTHWEST, GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 10), 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;
+ }
}
- }
- }
+ });
- public void mouseEntered(MouseEvent e) {
- }
-
- public void mouseExited(MouseEvent e) {
- Object obj = e.getSource();
- if (obj == txtWSDL) {
- if (txtWSDL.getText() != null && !txtWSDL.getText().trim().equals("")) {
- BottomPanel.setEnable(false,true, false, true);
- codegenBean.setWSDLFileName(txtWSDL.getText().trim());
- }
- }
+ this.add(lblHint ,
+ new GridBagConstraints(0, 2, GridBagConstraints.REMAINDER, 1, 0.1, 1.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0,10), 0, 0));
+
+ this.setPageComplete(false);
}
- public void mousePressed(MouseEvent e) {
- Object obj = e.getSource();
- if (obj == txtWSDL) {
- if (txtWSDL.getText() != null && !txtWSDL.getText().trim().equals("")) {
- BottomPanel.setEnable(false,true, false, true);
- codegenBean.setWSDLFileName(txtWSDL.getText().trim());
- }
- }
- }
- public void mouseReleased(MouseEvent e) {
- Object obj = e.getSource();
- if (obj == txtWSDL) {
- if (txtWSDL.getText() != null && !txtWSDL.getText().trim().equals("")) {
- BottomPanel.setEnable(false,true, false, true);
- codegenBean.setWSDLFileName(txtWSDL.getText().trim());
+ public void next() {
+ if(txtWSDL.getText()!=null && isPageComplete()){
+ codegenBean.setWSDLFileName(txtWSDL.getText());
+ switchPanel(CodegenFrame.PANEL_OPTION_A );
+ } else
+ switchPanel(CodegenFrame.PANEL_FIRST_A );
+ }
+ public void back() {
+ switchPanel(CodegenFrame.PANEL_CHOOSER );
+ }
+
+ public void update(){
+ if(!txtWSDL.getText().trim().equals("")){
+ try {
+ codegenBean.readWSDL();
+ setNextButtonEnabled(true);
+ setFinishButtonEnabled(false);
+ setPageComplete(true);
+ } catch (WSDLException e) {
+ setNextButtonEnabled(false);
+ setFinishButtonEnabled(false);
+ setPageComplete(false);
+ JOptionPane.showMessageDialog(this, "An error occured while parsing the " +
+ "specified WSDL. Please make sure that the selected file is a valid WSDL.",
+ "Error!", JOptionPane.ERROR_MESSAGE);
}
+ }else{
+ setNextButtonEnabled(false);
+ setFinishButtonEnabled(false);
+ setPageComplete(false);
}
- }
-}
-
-/*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;
- }
-
-}*/
-
-class FirstPanelLayout implements LayoutManager {
-
- public FirstPanelLayout() {
- }
-
- 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 = 541 + insets.left + insets.right;
- dim.height = 600 + insets.top + insets.bottom;
-
- return dim;
- }
+ setBackButtonEnabled(true);
- 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 + 8, insets.top + 8, 72, 24);
- }
- c = parent.getComponent(1);
- if (c.isVisible()) {
- c.setBounds(insets.left + 88, insets.top + 8, 350, 24);
- }
- c = parent.getComponent(2);
- if (c.isVisible()) {
- c.setBounds(insets.left + 448, insets.top + 8, 90, 24);
- }
+ public int getPageType() {
+ return WizardPanel.WSDL_2_JAVA_TYPE;
}
+ public String getWSDLFileName(){
+ return txtWSDL.getText().trim();
+ }
}
+
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=555548&r1=555547&r2=555548
==============================================================================
--- 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 Thu Jul 12 02:37:10 2007
@@ -22,7 +22,8 @@
import java.awt.*;
import java.lang.reflect.InvocationTargetException;
-public class ProgressBarPanel extends JPanel {
+public class
+ ProgressBarPanel extends JPanel {
private volatile boolean stop = false;
private static int DELAY = 100;
public volatile String val=null;
@@ -77,12 +78,12 @@
int maximum =progressSent.getMaximum();
Runnable runner = new Runnable() {
public void run() {
- if(stop && progressSent .getValue()<100){
+ if(stop && progressSent .getValue()<75){
progressSent .setIndeterminate(false);
int value = progressSent .getValue();
- progressSent .setValue(value+10);
- setProgressValue(value+9);
+ progressSent .setValue(value+4);
+ setProgressValue(value+4);
progressDescription .setText("Genarate Code. Please wait.....");
} else if(!stop){
progressSent .setIndeterminate(true);
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/SecondPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/SecondPanel.java?view=diff&rev=555548&r1=555547&r2=555548
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/SecondPanel.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/SecondPanel.java Thu Jul 12 02:37:10 2007
@@ -18,73 +18,686 @@
*/
package org.apache.axis2.tools.idea;
+import org.apache.axis2.tools.bean.CodegenBean;
+import org.apache.axis2.tools.wizardframe.CodegenFrame;
+import org.apache.axis2.tools.component.WizardPanel;
+import org.apache.axis2.tools.component.WizardComponents;
+import org.apache.axis2.util.URLProcessor;
+
+import javax.swing.*;
+import javax.xml.namespace.QName;
+import javax.wsdl.WSDLException;
import java.awt.*;
+import java.awt.event.ItemListener;
+import java.awt.event.ItemEvent;
+import java.util.Iterator;
+import java.util.Collection;
+import java.util.List;
+
+public class SecondPanel extends WizardPanel {
-class SecondPanelLayout implements LayoutManager {
+ private JComboBox cmbCodeGenOption;
+ private JComboBox cmbLan;
+ private JComboBox cmbServiceName;
+ private JComboBox cmbPortName;
+ private JTextField txtPacakgeName;
+ private JComboBox cmbdbtype;
+ private JCheckBox chkTestCase;
+ private JRadioButton clientSide;
+ private JRadioButton rdBoth;
+ private JRadioButton rdsyn;
+ private JRadioButton rdasync;
+ private JRadioButton serverSide;
+ private JCheckBox serviceXML;
+ private JCheckBox serverSideInterface;
+ private JRadioButton all;
+ private JTable table;
+ private JScrollPane spTable;
+ private List serviceNameList;
+ private PackageNameTableModel model;
+ private CodegenBean codegenBean;
- public SecondPanelLayout() {
+ public SecondPanel(WizardComponents wizardComponents,CodegenBean codegenBean) {
+ super(wizardComponents, "Option was choosed");
+ this.codegenBean=codegenBean;
+ setPanelTopTitle("Options");
+ setPanelBottomTitle("Set the options for the code generator. If you wish to edit the codegen options, Select custom");
+ init();
}
- public void addLayoutComponent(String name, Component comp) {
+ private void init(){
+
+ cmbLan = new JComboBox();
+ cmbLan.addItem("java");
+ cmbLan.setToolTipText("Select the language of the generated code");
+
+ cmbServiceName = new JComboBox();
+ add(cmbServiceName);
+ cmbServiceName.setToolTipText("Select the name of the service that the code should be generated for");
+
+ cmbPortName = new JComboBox();
+ cmbPortName.setToolTipText("Select the port name that the code should be generated for");
+
+ txtPacakgeName = new JTextField("org.axis2");
+ txtPacakgeName.setToolTipText("Set the package name of the generated code");
+
+ cmbdbtype = new JComboBox();
+ cmbdbtype.addItem("adb");
+ cmbdbtype.addItem("xmlbeans");
+ cmbdbtype.addItem("none");
+ cmbdbtype.setToolTipText("Select the databinding framework to be used in the generation process");
+
+ chkTestCase = new JCheckBox("Generate Test Case", false);
+ chkTestCase.setVisible(true);
+ chkTestCase.setToolTipText("A test case will be generated if this is checked");
+
+ ButtonGroup generationType = new ButtonGroup();
+
+ clientSide = new JRadioButton("Generate Client Side",true);
+ generationType.add(clientSide);
+
+ ButtonGroup buttonGroup = new ButtonGroup();
+
+ rdBoth = new JRadioButton("Generate both sync and async", true);
+ buttonGroup.add(rdBoth);
+
+ rdsyn = new JRadioButton("Generate sync only", false);
+ buttonGroup.add(rdsyn);
+
+ rdasync = new JRadioButton("Generate async only", false);
+ buttonGroup.add(rdasync);
+
+ serverSide = new JRadioButton("Generate Server Side");
+ generationType.add(serverSide);
+
+ serviceXML = new JCheckBox("Generate default service.xml", false);
+
+ serverSideInterface = new JCheckBox("Generate an interface for skeleton", false);
+
+ all = new JRadioButton("Generate All");
+ generationType.add(all);
+
+ model = new PackageNameTableModel(new Object [1][2]);
+ table = new JTable(model);
+ spTable=new JScrollPane(table);
+
+ cmbCodeGenOption =new JComboBox();
+ cmbCodeGenOption .addItem("default");
+ cmbCodeGenOption .addItem("custom");
+ cmbCodeGenOption .setToolTipText("Select the Codegen option");
+
+
+ this.setLayout(new GridBagLayout());
+
+ this.add(new JLabel("Cogen Option")
+ , new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(1, 10, 0,10), 0, 0));
+
+ this.add(cmbCodeGenOption
+ , new GridBagConstraints(1, 0, GridBagConstraints.REMAINDER, 1, 1.0, 0.0
+ , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL
+ , new Insets(1, 5, 0,10), 0, 0));
+ cmbCodeGenOption.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ setEnabledForCodegenType();
+ update();
+ }
+ }
+ });
+
+ this.add(new JLabel("Out put lang")
+ , new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(1,10, 0,10), 0, 0));
+
+ this.add(cmbLan
+ , new GridBagConstraints(1, 1, GridBagConstraints.REMAINDER, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(1, 5, 0,10), 0, 0));
+
+ this.add(new JLabel("Service name")
+ , new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(1, 10, 0,10), 0, 0));
+
+ this.add(cmbServiceName
+ , new GridBagConstraints(1, 2, GridBagConstraints.REMAINDER, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(1, 5, 0,10), 0, 0));
+
+ this.add(new JLabel("port Name")
+ , new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(1, 10, 0,10), 0, 0));
+ this.add(cmbPortName
+ , new GridBagConstraints(1, 3, GridBagConstraints.REMAINDER, 1,1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(1, 5, 0,10), 0, 0));
+ this.add(new JLabel("DataBinding")
+ , new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(1, 10, 0,10), 0, 0));
+ this.add(cmbdbtype
+ , new GridBagConstraints(1, 4, GridBagConstraints.REMAINDER, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(1, 5, 0,10), 0, 0));
+ this.add(new JLabel("Custom Packege")
+ , new GridBagConstraints(0, 5, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(1, 10, 0,10), 0, 0));
+ this.add(txtPacakgeName
+ , new GridBagConstraints(1, 5, GridBagConstraints.REMAINDER, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(1, 5, 0,10), 0, 0));
+ this.add(chkTestCase
+ , new GridBagConstraints(0, 6, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(1, 10, 0,10), 0, 0));
+ this.add(new JSeparator()
+ , new GridBagConstraints(0, 7, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.BOTH
+ , new Insets(1, 10, 1,1), 0, 0));
+
+
+ this.add(clientSide
+ , new GridBagConstraints(0, 8, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(1, 10, 0,10), 0, 0));
+ clientSide.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ setEnabledForCustom();
+ update();
+ }
+ }
+ });
+ this.add(rdBoth
+ , new GridBagConstraints(0, 9, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(1, 10, 0,10), 0, 0));
+ this.add(rdsyn
+ , new GridBagConstraints(1, 9, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(1, 5, 0,10), 0, 0));
+ this.add(rdasync
+ , new GridBagConstraints(2, 9, 1, 1, 1.0,0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(1, 5, 0,10), 0, 0));
+
+
+ this.add(new JSeparator()
+ , new GridBagConstraints(0, 10, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.BOTH
+ , new Insets(1, 10, 1,1), 0, 0));
+
+ this.add(serverSide
+ , new GridBagConstraints(0, 11, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(1, 10, 0,10), 0, 0));
+ serverSide.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ setEnabledForCustom();
+ update();
+ }
+ }
+ });
+ this.add(serviceXML
+ , new GridBagConstraints(0, 12, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(1, 10, 0,10), 0, 0));
+ this.add(serverSideInterface
+ , new GridBagConstraints(1, 12, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(1, 5, 0,10), 0, 0));
+
+
+ this.add(new JSeparator()
+ , new GridBagConstraints(0, 13, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.BOTH
+ , new Insets(1, 10, 1,1), 0, 0));
+
+
+ this.add(all
+ , new GridBagConstraints(0, 14, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(1,10, 0,10), 0, 0));
+ all.addItemListener(new ItemListener() {
+ public void itemStateChanged(ItemEvent e) {
+ if (e.getStateChange() == ItemEvent.SELECTED) {
+ setEnabledForCustom();
+ update();
+ }
+ }
+ });
+ this.add(new JSeparator()
+ , new GridBagConstraints(0, 15, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.BOTH
+ , new Insets(1, 10, 1,1), 0, 0));
+
+ this.add(new JLabel("Namespace to Package Mapping")
+ , new GridBagConstraints(0, 16, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(1,10, 0,10), 0, 0));
+
+ this.add(spTable
+ , new GridBagConstraints(0, 17, GridBagConstraints.REMAINDER, 1, 1.0, 1.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.BOTH
+ , new Insets(1,10, 20,10), 0, 0));
+
+ setNextButtonEnabled(false);
+ setEnabledForCodegenType();
+
}
+ public void next() {
+ switchPanel(CodegenFrame.PANEL_LAST_A );
+ }
+ public void back() {
+ switchPanel(CodegenFrame.PANEL_FIRST_A );
+ }
+
+ public void update(){
+ checkPageComlete();
+ populateParamsFromWSDL();
- public void removeLayoutComponent(Component comp) {
}
- public Dimension preferredLayoutSize(Container parent) {
- Dimension dim = new Dimension(0, 0);
+ private void loadNamespaces(Collection namespaceMap){
- Insets insets = parent.getInsets();
- dim.width = 565 + insets.left + insets.right;
- dim.height = 300 + insets.top + insets.bottom;
+ Iterator namespaces = namespaceMap.iterator();
+ Object tableData [][] = new Object[namespaceMap.size()][2];
+ int i = 0;
+ while(namespaces.hasNext()){
- return dim;
- }
+ String namespace = (String)namespaces.next();
+ tableData[i][0] = namespace;
+ tableData[i][1] = getPackageFromNamespace(namespace);
+ i++;
+ }
- public Dimension minimumLayoutSize(Container parent) {
- return new Dimension(0, 0);
+ model.setTableData(tableData);
+
+
+ }
+ private void setEnabledForCodegenType(){
+ if(cmbCodeGenOption.getSelectedItem().equals("default") ){
+ cmbdbtype.setEnabled(false);
+ cmbLan.setEnabled(false);
+ cmbPortName .setEnabled(false);
+ cmbServiceName.setEnabled(false);
+ txtPacakgeName.setEnabled(false);
+ cmbdbtype.setEnabled(false);
+ if(chkTestCase.isSelected()) {
+ chkTestCase.setEnabled(false);
+ chkTestCase.setSelected(false);
+ } else
+ chkTestCase.setEnabled(false);
+ clientSide.setEnabled(false);
+ rdBoth .setEnabled(false);
+ rdsyn.setEnabled(false);
+ rdasync.setEnabled(false);
+ serverSide.setEnabled(false);
+ table.setEnabled(false);
+ spTable.setEnabled(false);
+ serviceXML.setEnabled(false);
+ serverSideInterface.setEnabled(false);
+ all.setEnabled(false);
+ }else{
+ cmbdbtype.setEnabled(true);
+ cmbLan.setEnabled(true);
+ cmbPortName .setEnabled(true);
+ cmbServiceName.setEnabled(true);
+ txtPacakgeName.setEnabled(true);
+ cmbdbtype.setEnabled(true);
+ if(!clientSide.isSelected()) {
+ clientSide.setEnabled(true);
+ clientSide.setSelected(true);
+ } else
+ clientSide.setEnabled(true);
+ serverSide.setEnabled(true);
+ table.setEnabled(true);
+ spTable.setEnabled(true);
+ all.setEnabled(true);
+ setEnabledForCustom();
+ }
+ }
+ private void setEnabledForCustom(){
+ if(clientSide.isSelected()){
+ if(serviceXML.isSelected()||serverSideInterface.isSelected()){
+ serverSide.setSelected(false);
+ serverSideInterface.setSelected(false);
+ serviceXML.setEnabled(false);
+ serverSideInterface.setEnabled(false);
+ }else{
+ serviceXML.setEnabled(false);
+ serverSideInterface.setEnabled(false);
+ }
+ if(!rdasync.isSelected()){
+ rdasync.setEnabled(true);
+ rdasync.setSelected(true);
+ }else{
+ rdasync.setEnabled(true);
+ }
+ if(rdBoth.isSelected()){
+ rdBoth.setEnabled(true);
+ rdBoth.setSelected(false);
+ }else{
+ rdBoth.setEnabled(true);
+ }
+ if(rdsyn.isSelected()){
+ rdsyn.setEnabled(true);
+ rdsyn.setSelected(false);
+ }else{
+ rdsyn.setEnabled(true);
+ }
+ chkTestCase.setEnabled(true);
+ }else if(serverSide.isSelected()){
+ if(serviceXML.isSelected()||serverSideInterface.isSelected()){
+ serverSide.setSelected(false);
+ serverSideInterface.setSelected(false);
+ serviceXML.setEnabled(true);
+ serverSideInterface.setEnabled(true);
+ }else{
+ serviceXML.setEnabled(true);
+ serverSideInterface.setEnabled(true);
+ }
+ if( rdasync.isSelected()||rdBoth.isSelected()||rdsyn.isSelected()) {
+ rdasync.setSelected(false);
+ rdBoth.setSelected(false);
+ rdsyn.setSelected(false);
+ rdasync.setEnabled(false);
+ rdBoth.setEnabled(false);
+ rdsyn .setEnabled(false);
+ } else{
+ rdasync.setEnabled(false);
+ rdBoth.setEnabled(false);
+ rdsyn .setEnabled(false);
+ }
+ if(chkTestCase.isSelected()) {
+ chkTestCase.setEnabled(false);
+ chkTestCase.setSelected(false);
+ } else
+ chkTestCase.setEnabled(false);
+ }else if(all.isSelected()){
+ chkTestCase.setEnabled(true);
+ if(serviceXML.isSelected()||serverSideInterface.isSelected()){
+ serverSide.setSelected(false);
+ serverSideInterface.setSelected(false);
+ serviceXML.setEnabled(false);
+ serverSideInterface.setEnabled(false);
+ }else{
+ serviceXML.setEnabled(false);
+ serverSideInterface.setEnabled(false);
+ }
+ if( rdasync.isSelected()||rdBoth.isSelected()||rdsyn.isSelected()) {
+ rdasync.setSelected(false);
+ rdBoth.setSelected(false);
+ rdsyn.setSelected(false);
+ rdasync.setEnabled(false);
+ rdBoth.setEnabled(false);
+ rdsyn .setEnabled(false);
+ } else{
+ rdasync.setEnabled(false);
+ rdBoth.setEnabled(false);
+ rdsyn .setEnabled(false);
+ }
+ }
}
+ public String getPackageFromNamespace(String namespace){
+ return URLProcessor.makePackageName(namespace);
+ }
+ public int getPageType() {
+ return WizardPanel.WSDL_2_JAVA_TYPE;
+ }
+ private void checkPageComlete(){
+ if(cmbCodeGenOption.getSelectedItem().equals("default")){
+ setPageComplete(true);
+ setNextButtonEnabled(true);
+ } else{
+ if(txtPacakgeName.getText().equals("")){
+ setPageComplete(false);
+ setNextButtonEnabled(false);
+ } else{
+ setPageComplete(true);
+ setNextButtonEnabled(true);
+ }
+ }
+ }
+ /**
+ * populate the service and the port from the WSDL this needs to be public
+ * since the WSDLselection page may call this
+ */
+ public void populateParamsFromWSDL() {
+ try {
+ String lname = codegenBean.getWSDLFileName();
+ if (!"".equals(lname.trim())) {
+
+ codegenBean.readWSDL();
+
+ // enable the combo's
+ // setComboBoxEnable(true);
- public void layoutContainer(Container parent) {
- Insets insets = parent.getInsets();
+ this.serviceNameList = codegenBean.getServiceList();
+ if (!serviceNameList.isEmpty()) {
+ cmbServiceName.removeAll();
+ for (int i = 0; i < serviceNameList.size(); i++) {
+ // add the local part of the
+ cmbServiceName.addItem(((QName) serviceNameList.get(i))
+ .getLocalPart());
+ };
+ // select the first one as the default
+ cmbServiceName.setSelectedIndex(0);
+ //setComboBoxEnable(false);
+ // load the ports
+ loadPortNames();
+ //Todo error message null
+ } else {
+ // service name list being empty means we are switching to
+ // the interface mode
+ if (cmbServiceName!=null) cmbServiceName .removeAll();
+ if (cmbPortName!=null) cmbPortName.removeAll();
+ // disable the combo's
+ // setComboBoxEnable(false);
+ //this is not an error
+ //Todo error message null
- Component c;
- c = parent.getComponent(0);
- if (c.isVisible()) {
- c.setBounds(insets.left, insets.top + 5, 200, 20);
+ }
+
+ populatePackageName();
+
+ //populate the namespacess
+ loadNamespaces(codegenBean.getDefinitionNamespaceMap());
+ }
+ } catch (WSDLException e) {
+ // disable the combo's
+ setComboBoxEnable(false);
+ //Todo error message "Specified WSDL is invalid!, Please select a validated *.wsdl/*.xml file on previous page."
}
- c = parent.getComponent(1);
- if (c.isVisible()) {
- c.setBounds(insets.left + 210, insets.top + 5, 160, 20);
+ catch (Exception e) {
+ // disable the combo's
+ setComboBoxEnable(false);
+ //Todo error message "Specified WSDL is not found!, Please Check whether you have entered the correct path to a *.wsdl on previous page."
}
- c = parent.getComponent(2);
- if (c.isVisible()) {
- c.setBounds(insets.left + 8, insets.top + 30, 250, 24);
+
+ }
+ private void populatePackageName() {
+ this.txtPacakgeName.setText(codegenBean.packageFromTargetNamespace());
+ }
+ private void setComboBoxEnable(boolean b) {
+ if (cmbServiceName != null) {
+ cmbServiceName .setEnabled(b);
+ cmbPortName .setEnabled(b);
}
- c = parent.getComponent(3);
- if (c.isVisible()) {
- c.setBounds(insets.left + 280, insets.top + 30, 150, 24);
+ }
+ private void loadPortNames() {
+ int selectionIndex = cmbServiceName.getSelectedIndex();
+ if (selectionIndex != -1) {
+ java.util.List ports = codegenBean.getPortNameList((QName) serviceNameList
+ .get(selectionIndex));
+ if (!ports.isEmpty()) {
+ cmbPortName.removeAll();
+ for (int i = 0; i < ports.size(); i++) {
+ // add the local part of the
+ cmbPortName.addItem(ports.get(i).toString());
+ }
+ cmbPortName.setSelectedIndex(0);
+ } else {
+ //Todo error message null
+ }
}
- c = parent.getComponent(4);
- if (c.isVisible()) {
- c.setBounds(insets.left + 8, insets.top + 55, 150, 24);
+ }
+ public void populateOptions(){
+ populateParamsFromWSDL();
+ }
+ private void dialogChanged() {
+ String fileName = getPackageName();
+
+ if (fileName.length() == 0) {
+ //Todo error message "File name should be specified"
+ setError("File name should be specified",true);
+ setPageComplete(false);
+ return;
+ }
+
+ //try populate the options
+ // getWizardComponents().getWizardPanel(3).populateOptions();
+ setPageComplete(true);
+ // update the status
+ //Todo error message null
+
+ }
+ public String getSelectedLanguage() {
+ return cmbLan.getSelectedItem().toString();
+ }
+ /**
+ * the async only status
+ *
+ * @return true if "Generate asynchronous code only" is checked
+ */
+ public boolean isAsyncOnlyOn() {
+ return rdasync.isSelected();
+ }
+ /**
+ * the sync only status
+ *
+ * @return true if "Generate synchronous code only" is checked
+ */
+ public boolean isSyncOnlyOn() {
+ return rdsyn.isSelected();
+ }
+ /**
+ * return the package name
+ *
+ * @return a string containing the package name to use for code generation
+ */
+ public String getPackageName() {
+ if ("".equals(txtPacakgeName.getText().trim())){
+ //we do not allow the packaging to be empty
+ //if the user sets it to empty we set it to
+ //the default
+ return URLProcessor.DEFAULT_PACKAGE;
}
- c = parent.getComponent(5);
- if (c.isVisible()) {
- c.setBounds(insets.left + 8, insets.top + 80, 200, 24);
+ return this.txtPacakgeName.getText();
+ }
+ /**
+ * The serverside status
+ *
+ * @return true if "Generate Server-Side" is checked
+ */
+ public boolean isServerside() {
+ return this.serverSide.isSelected();
+ }
+ /**
+ *
+ * @return true if "Generate XML configuration file" is checked
+ */
+ public boolean isServerXML() {
+ if (this.serviceXML.isEnabled())
+ return this.serviceXML.isSelected();
+ else
+ return false;
+ }
+ /**
+ *
+ * @return true if "Generate test case" is checked
+ */
+ public boolean isGenerateTestCase() {
+ return this.chkTestCase.isSelected();
+ }
+ /**
+ *
+ * @return null if portname is empty
+ */
+ public String getPortName() {
+ int selectionIndex = cmbPortName.getSelectedIndex();
+ if (selectionIndex != -1) {
+ String text = this.cmbPortName.getSelectedItem().toString();
+ if (text == null || text.trim().equals("")) {
+ return null;
+ }
+ return text;
+ } else {
+ return null;
}
- c = parent.getComponent(6);
- if (c.isVisible()) {
- c.setBounds(insets.left + 210, insets.top + 80, 160, 24);
+ }
+ /**
+ * @return null if the text is empty
+ *
+ */
+ public String getServiceName() {
+ int selectionIndex = cmbServiceName.getSelectedIndex();
+ // cater for the scenario where the combo's can be empty
+ if (selectionIndex != -1) {
+ String text = this.cmbServiceName.getSelectedItem().toString();
+
+ if (text == null || text.trim().equals("")) {
+ return null;
+ }
+ return text;
+ } else {
+ return null;
}
- c = parent.getComponent(7);
- if (c.isVisible()) {
- c.setBounds(insets.left + 8, insets.top + 110, 200, 24);
+ }
+
+ public String getDatabinderName() {
+ return this.cmbdbtype.getSelectedItem().toString();
+
+ }
+
+ public boolean getGenerateServerSideInterface() {
+ return this.serverSideInterface.isSelected();
+ }
+
+ public boolean getGenerateAll() {
+ return this.all.isSelected();
+ }
+
+ public String getNs2PkgMapping(){
+ String returnList="";
+ String packageValue;
+ for (int i=0;i<table.getRowCount() ;i++){
+ packageValue = table.getValueAt(i,1).toString();
+ if (packageValue!=null && !"".equals(packageValue)){
+ returnList = returnList +
+ ("".equals(returnList)?"":",") +
+ table.getValueAt(i,0).toString()+ "=" + packageValue;
+ }
}
- c = parent.getComponent(8);
- if (c.isVisible()) {
- c.setBounds(insets.left + 210, insets.top + 110, 200, 24);
+ return "".equals(returnList)?null:returnList;
+ }
+
+ private void handleCustomPackageNameModifyEvent() {
+ // This method is add as a tempory fix for the Axis2-1368
+ // TODO fix this permanantly.
+ String text = this.txtPacakgeName.getText();
+ if ((text == null) || (text.trim().equals(""))|| (text.endsWith(".")) || (text.startsWith("."))) {
+ //Todo error message "Invalid package name. Please enter a valid package name."
+ return;
}
+ //Todo error message null
}
+
}
Added: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/WSDL2JavaOutputPanel.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/WSDL2JavaOutputPanel.java?view=auto&rev=555548
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/WSDL2JavaOutputPanel.java (added)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/idea/WSDL2JavaOutputPanel.java Thu Jul 12 02:37:10 2007
@@ -0,0 +1,602 @@
+/*
+ * 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 com.intellij.openapi.module.Module;
+import com.intellij.openapi.project.Project;
+import org.apache.axis2.tools.bean.CodegenBean;
+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.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+
+/**
+ * Author : Deepal Jayasinghe
+ * Date: Jul 22, 2005
+ * Time: 12:52:31 PM
+ */
+public class WSDL2JavaOutputPanel extends WizardPanel {
+
+ private JTextField txtoutput;
+ private JTextField txtaxisHome;
+ private JTextField txtjarFileName;
+ private JButton btnBrowseOutput;
+ private JButton btnBrowseAxisHome;
+ private JButton btnCheckLib;
+ private JRadioButton radCurrentProject;
+ private JRadioButton radCustomLocation;
+ private JCheckBox chbAddAxisCodegenJar;
+ private JCheckBox chbAddAxisLib;
+ private JCheckBox chbCreateJar;
+ private JLabel lblMessage;
+ private JTextArea txtaTilte;
+ private JComboBox cmbCurrentProject;
+ private JComboBox cmbModuleSrc;
+ private JLabel lblAsixHome;
+ private JLabel lblJarFileName;
+ private JLabel lbloutput;
+ private JLabel lblModule;
+ private JLabel lblDirectory;
+ final JFileChooser DirChooser=new JFileChooser();
+ final private String title="Select one of below to save the codegen output either on idea workspace project or on file " +
+ "system and then browse to enter the output path";
+ final private String hint="If you have Axis2 binary distribution or Axis source, then you can add those libs also to the" +
+ " resulted codegen project by checking the \"Add Axis2 Libraries to the codegen resulted project\"" +
+ " check box and specifying the Axis2 home. Another option you have is to compile the codegen " +
+ " result project and add it as a jar file in the lib directory of the resulted project, for that you can" +
+ " check the \"Create a jar file of codegen result project and add to resulted project lib folder\"" +
+ " checkbox and then give the jar file name that you prefer. \n" +
+ " If you are adding the codegen result to a eclipse project on current eclipse workspace," +
+ " please make sure to refresh that particular eclipse project.\n" +
+ " Also if you select the options to add libs to the project, make sure to add those libs to the" +
+ " project library path.";
+
+ private CodegenBean codegenBean;
+ private boolean flag = true;
+ private Project project;
+ private JButton btnHint;
+ private JTextArea txaHint;
+ private boolean jarFileCopyOption = false;
+ private String axis2LibsLocation = null;
+
+
+ public WSDL2JavaOutputPanel(WizardComponents wizardComponents,CodegenBean codegenBean, Project project) {
+ super(wizardComponents, "Output");
+ this.codegenBean=codegenBean;
+ this.project=project;
+ setPanelTopTitle("output");
+ setPanelBottomTitle("set the out location for the generated code");
+ init();
+ }
+ private void init(){
+ txaHint =new JTextArea();
+ txaHint.setBorder(null);
+ txaHint.setFocusable(false);
+ txaHint.setLineWrap(true);
+ txaHint.setWrapStyleWord(true);
+ txaHint.setOpaque(false);
+ btnHint =new JButton("Hint >>");
+ btnHint.setBorder(new EmptyBorder(new Insets(0,0,0,0)));
+ lblMessage = new JLabel();
+ lblMessage.setOpaque(true);
+ lblMessage.setBackground(Color.white);
+ btnBrowseAxisHome =new JButton("Browse..");
+ btnBrowseOutput =new JButton("Browse..");
+ btnCheckLib =new JButton("Check Libs..");
+ cmbCurrentProject =new JComboBox();
+ cmbCurrentProject.setEnabled(false);
+ cmbModuleSrc=new JComboBox();
+ cmbModuleSrc.setEnabled(false);
+ txtoutput=new JTextField();
+ txtaxisHome =new JTextField("Unpacked Axis2 binary home Or Axis2 source location");
+ txtjarFileName =new JTextField();
+ txtaTilte =new JTextArea(title);
+ txtaTilte.setBorder(null);
+ txtaTilte.setFocusable(false);
+ txtaTilte.setLineWrap(true);
+ txtaTilte.setWrapStyleWord(true);
+ txtaTilte.setOpaque(false);
+ lblAsixHome=new JLabel("Axis2 Home");
+ lblAsixHome.setEnabled(false);
+ lblJarFileName = new JLabel("Jar File Name");
+ lblJarFileName.setEnabled(false);
+ lblDirectory= new JLabel("Select the Directory");
+ lblModule = new JLabel("Select the Module");
+ lbloutput =new JLabel("Out put path");
+ chbAddAxisCodegenJar =new JCheckBox("Add the Axis2 Codegen jars to the codegen resulted project");
+ chbAddAxisLib =new JCheckBox(" Add Axis2 libraries to the codegen result project ");
+ chbCreateJar=new JCheckBox(" Create a jar file of codegen result project and add to resulted project lib folder(Default :CodegenResults.jar)");
+ chbAddAxisLib.setEnabled(false);//Todo after writing include axis2 jar file it must remove
+ radCurrentProject =new JRadioButton("Browse and select a project on current idea workspace");
+ radCustomLocation =new JRadioButton("Browse and select location on local file system");
+ ButtonGroup buttonGroup= new ButtonGroup();
+ buttonGroup.add(radCurrentProject );
+ buttonGroup.add(radCustomLocation);
+
+ codegenBean.setProject(project);
+ setNextButtonEnabled(false);
+ this.setLayout(new GridBagLayout() );
+
+ this.add(txtaTilte
+ , new GridBagConstraints(0, 0, GridBagConstraints.REMAINDER , 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0,10), 0, 0));
+ this.add(radCurrentProject
+ , new GridBagConstraints(0, 1, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,10), 0, 0));
+ radCurrentProject.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ cmbCurrentProject.setEnabled(true);
+ cmbModuleSrc.setEnabled(true);
+ txtoutput.setEnabled(false);
+ btnBrowseOutput.setEnabled(false);
+ loadCmbCurrentProject();
+ loadcmbModuleSrcProject();
+ setFinishButtonEnabled(true);
+ update();
+ }
+ });
+ this.add(lblModule
+ , new GridBagConstraints(0, 2, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 0), 0, 0));
+
+ this.add(cmbCurrentProject
+ , new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 0, 0,0), 0, 0));
+ cmbCurrentProject.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ loadcmbModuleSrcProject();
+ update();
+ }
+ });
+ this.add(lblDirectory
+ , new GridBagConstraints(0, 3, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0, 0), 0, 0));
+
+ this.add(cmbModuleSrc
+ , new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 0, 0,0), 0, 0));
+ cmbModuleSrc.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ update();
+ }
+ });
+ this.add(radCustomLocation
+ , new GridBagConstraints(0, 4, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0,10), 0, 0));
+ radCustomLocation.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ cmbCurrentProject.setEnabled(false);
+ cmbModuleSrc.setEnabled(false);
+ txtoutput.setEnabled(true);
+ btnBrowseOutput.setEnabled(true);
+ setEnabledForCustomProject();
+ update();
+ }
+ });
+ this.add(lbloutput
+ , new GridBagConstraints(0, 5, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,0), 0, 0));
+ this.add(txtoutput
+ , new GridBagConstraints(1, 5, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 0, 0,0), 0, 0));
+ this.add(btnBrowseOutput
+ , new GridBagConstraints(2, 5, 1, 1, 0.1, 0.0
+ , GridBagConstraints.EAST , GridBagConstraints.NONE
+ , new Insets(5, 0, 0,10), 0, 0));
+ btnBrowseOutput .addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ DirChooser .setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ int returnVal = DirChooser.showOpenDialog(btnBrowseOutput );
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ DirChooser.setFileSelectionMode(JFileChooser .FILES_ONLY );
+ File newfile = DirChooser.getSelectedFile();
+ txtoutput.setText(newfile.getAbsolutePath() );
+ }
+ setFinishButtonEnabled(true);
+ update();
+ }
+ });
+ this.add(chbAddAxisCodegenJar
+ , new GridBagConstraints(0, 6, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0,10), 0, 0));
+ chbAddAxisCodegenJar.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ update();
+ }
+ });
+ this.add(new JSeparator()
+ , new GridBagConstraints(0, 7, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 1, 0,1), 0, 0));
+
+ this.add(chbAddAxisLib
+ , new GridBagConstraints(0, 8, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0,10), 0, 0));
+ chbAddAxisLib .addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ setEnabledForAddAxisLib();
+ handleLoadLibsBrowse();
+ update();
+ }
+ });
+ this.add(lblAsixHome
+ , new GridBagConstraints(0, 9, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,10), 0, 0));
+ this.add(txtaxisHome
+ , new GridBagConstraints(1, 9, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 0, 0,0), 0, 0));
+ this.add(btnBrowseAxisHome
+ , new GridBagConstraints(2, 9, 1, 1, 0.1, 0.0
+ , GridBagConstraints.EAST , GridBagConstraints.NONE
+ , new Insets(5, 0, 0,10), 0, 0));
+ btnBrowseAxisHome .addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ DirChooser .setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ int returnVal = DirChooser.showOpenDialog(btnBrowseAxisHome );
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ DirChooser.setFileSelectionMode(JFileChooser .FILES_ONLY );
+ File newfile = DirChooser.getSelectedFile();
+ txtaxisHome .setText(newfile.getAbsolutePath() );
+ }
+ update();
+ }
+ });
+ this.add(btnCheckLib
+ , new GridBagConstraints(0, 10, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,10), 0, 0));
+ btnCheckLib .addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ handleLoadLibsBrowse();
+ update();
+ }
+ });
+ this.add(lblMessage
+ , new GridBagConstraints(1, 10, 1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 0, 0,0), 0, 0));
+ this.add(new JSeparator()
+ , new GridBagConstraints(0, 11, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 1, 0,1), 0, 0));
+ this.add(chbCreateJar
+ , new GridBagConstraints(0, 12, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 10, 0,10), 0, 0));
+ chbCreateJar.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ update();
+ }
+ });
+ this.add(lblJarFileName
+ , new GridBagConstraints(0, 13, 1, 1, 0.1, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 10, 0,10), 0, 0));
+ this.add(txtjarFileName
+ , new GridBagConstraints(1, 13,1, 1, 1.0, 0.0
+ , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL
+ , new Insets(5, 0, 0,0), 0, 0));
+ this.add(new JSeparator()
+ , new GridBagConstraints(0, 14, GridBagConstraints.REMAINDER, 1, 0.0, 0.0
+ , GridBagConstraints.WEST , GridBagConstraints.HORIZONTAL
+ , new Insets(5, 1, 0,1), 0, 0));
+
+ // hint button
+ this.add(btnHint,
+ new GridBagConstraints(0,15, 1, 1, 0.1,0.0
+ , GridBagConstraints.WEST , GridBagConstraints.NONE
+ , new Insets(5, 20, 0,0), 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();
+ }
+ });
+
+ // hint lable
+ this.add(txaHint,
+ new GridBagConstraints(0, 16, GridBagConstraints.REMAINDER, 1, 0.1, 1.0
+ , GridBagConstraints.NORTHWEST , GridBagConstraints.BOTH
+ , new Insets(10, 20, 0,0), 0, 0));
+
+ }
+ public void back() {
+ switchPanel(CodegenFrame.PANEL_OPTION_A );
+ }
+ public void next() {
+ }
+
+ public void update(){
+ setNextButtonEnabled(false);
+ checkPageComlete();
+ setEnabledForAddAxisLib();
+
+ }
+ public void loadCmbCurrentProject() {
+ Module modules[] = codegenBean .getModules();
+
+ if (modules != null) {
+ for(int count = 0; count < modules.length; count++) {
+ cmbCurrentProject.addItem(modules[count].getName());
+ }
+ }
+
+ }
+ public void loadcmbModuleSrcProject() {
+ String module = null;
+ module = (String) cmbCurrentProject.getSelectedItem();
+ cmbModuleSrc.removeAllItems();
+ int count = 0;
+ if (module != null) {
+ String src[] = codegenBean.getModuleSrc(module);
+ for ( count = 0; count < src.length; count++) {
+ cmbModuleSrc.addItem(src[count]);
+ }
+ count = src.length;
+ }
+ if (flag)
+ {
+ if (count == 0) {
+ flag =false;
+ setEnabledForCustomProject();
+ }
+ else{
+ setEnabledForCurrentProject();
+ }
+ }
+ }
+
+ private void setEnabledForCurrentProject(){
+ radCurrentProject.setSelected(true);
+ radCurrentProject.setEnabled(true);
+ cmbCurrentProject.setEnabled(true);
+ cmbModuleSrc.setEnabled(true);
+ lblDirectory.setEnabled(true);
+ lblModule .setEnabled(true);
+ radCurrentProject.setSelected(true);
+ txtoutput.setEnabled(false);
+ lbloutput.setEnabled(false);
+ btnBrowseOutput.setEnabled(false);
+ }
+ private void setEnabledForCustomProject(){
+ if(!flag){
+ radCurrentProject.setEnabled(false);
+ }else{
+ radCurrentProject.setEnabled(true);
+ radCurrentProject.setSelected(true);
+ }
+ cmbCurrentProject.setEnabled(false);
+ cmbModuleSrc.setEnabled(false);
+ lblDirectory.setEnabled(false);
+ lblModule .setEnabled(false);
+ radCustomLocation.setSelected(true);
+ txtoutput.setEnabled(true);
+ lbloutput.setEnabled(true);
+ btnBrowseOutput .setEnabled(true);
+ }
+ private void setEnabledForAddAxisLib(){
+ if(chbAddAxisLib.isSelected()){
+ lblAsixHome.setEnabled(true);
+ lblMessage.setEnabled(true);
+ lblJarFileName.setEnabled(true);
+ txtaxisHome.setEnabled(true);
+ txtjarFileName.setEnabled(true);
+ chbCreateJar.setEnabled(true);
+ btnBrowseAxisHome.setEnabled(true);
+ btnCheckLib .setEnabled(true);
+ }else{
+ lblAsixHome.setEnabled(false);
+ lblMessage.setEnabled(false);
+ lblJarFileName.setEnabled(false);
+ txtaxisHome.setEnabled(false);
+ txtjarFileName.setEnabled(false);
+ chbCreateJar.setEnabled(false);
+ btnBrowseAxisHome.setEnabled(false);
+ btnCheckLib .setEnabled(false);
+ txtaxisHome.setText("Unpacked Axis2 binary home Or Axis2 source location");
+ lblMessage.setBackground(Color.WHITE);
+ }
+ }
+
+ private void handleLoadLibsBrowse(){
+ if(txtaxisHome.getText().equals("")){
+ lblMessage.setText("Axis libs are not available !! ");
+ jarFileCopyOption=false;
+ //error message
+ }else{
+ String axis_home = txtaxisHome.getText().trim();
+ String axis_target_lib=axis_home+File.separator+"target"+File.separator+"lib";
+ String axis_std_lib_directory=axis_home+File.separator+"lib";
+
+ File axis_target_libs_directory = new File(axis_target_lib);
+ File axis_libs_directory = new File(axis_std_lib_directory);
+ if (axis_libs_directory.isDirectory() || axis_target_libs_directory.isDirectory()) {
+ lblMessage.setText("Axis libs loaded successfully!!");
+ if(axis_libs_directory.isDirectory()){
+ axis2LibsLocation=axis_std_lib_directory;
+ }
+ else if(axis_target_libs_directory.isDirectory()){
+ axis2LibsLocation=axis_target_lib;
+ }
+ jarFileCopyOption =true;
+ lblMessage.setBackground(Color.WHITE);
+ }else{
+ lblMessage.setText("Axis libs are not available !! ");
+ lblMessage.setBackground(Color.RED);
+ jarFileCopyOption=false;
+ }
+ }
+ }
+
+ /**
+ * get the output location
+ */
+
+ public String getOutputLocation() {
+ if(radCurrentProject.isSelected())
+ return cmbModuleSrc.getSelectedItem().toString();
+ else
+ return txtoutput.getText();
+
+ }
+
+ public String getAxisHomeLocation() {
+ return txtaxisHome.getText();
+ }
+
+ public String getJarFilename() {
+ return txtjarFileName.getText();
+ }
+
+ public boolean getAxis2PluginLibCopyCheckBoxSelection(){
+ return this.chbAddAxisCodegenJar.isSelected();
+ }
+
+ public boolean getAxisLibCopyCheckBoxSelection(){
+ return this.chbAddAxisLib.isSelected();
+ }
+
+ public boolean getCreateJarCheckBoxSelection(){
+ return this.chbCreateJar.isSelected();
+ }
+
+ public String getAxisJarsLocation(){
+ return this.axis2LibsLocation;
+ }
+
+ public boolean oktoLoadLibs(){
+ return this.jarFileCopyOption;
+ }
+
+ public void setJarFileName(String jarFileName){
+ this.txtjarFileName.setText(jarFileName);
+ }
+
+ /**
+ * this algorithm used for set page complete and Enabled finsh button
+ */
+ private void checkPageComlete(){
+ if(getAxisLibCopyCheckBoxSelection()){
+ if(radCurrentProject.isSelected()) {
+ if(jarFileCopyOption){
+ setPageComplete(true);
+ setFinishButtonEnabled(true);
+ codegenBean.setOutput(getOutputLocation());
+ }else{
+ setPageComplete(false);
+ setFinishButtonEnabled(false);
+ }
+ }else{
+ if(!getOutputLocation().equals("")){
+ if(jarFileCopyOption){
+ setPageComplete(true);
+ setFinishButtonEnabled(true);
+ codegenBean.setOutput(getOutputLocation());
+ }else{
+ setPageComplete(false);
+ setFinishButtonEnabled(false);
+ }
+ }else{
+ setPageComplete(false);
+ setFinishButtonEnabled(false);
+ }
+ }
+ }else{
+ if(radCurrentProject.isSelected()) {
+ setPageComplete(true);
+ setFinishButtonEnabled(true);
+ codegenBean.setOutput(getOutputLocation());
+ }else{
+ if(!getOutputLocation().equals("")){
+ setPageComplete(true);
+ setFinishButtonEnabled(true);
+ codegenBean.setOutput(getOutputLocation());
+ }else{
+ setPageComplete(false);
+ setFinishButtonEnabled(false);
+ }
+ }
+ }
+ }
+ /**
+ * get page type
+ */
+ public int getPageType() {
+ return WizardPanel.WSDL_2_JAVA_TYPE;
+ }
+
+ private void handleModifyEvent() {
+ String text = this.txtoutput.getText();
+ if ((text == null) || (text.trim().equals(""))) {
+ //Todo error message "output location needs to be specified"
+ return;
+ }
+ //Todo error message null
+ }
+ private void handleAxisHomeModifyEvent() {
+ String text = this.txtaxisHome.getText();
+ if ((text == null) || (text.trim().equals(""))) {
+ //Todo error message "output location needs to be specified"
+ return;
+ }
+ //Todo error message null
+ }
+ private void handleJarNameModifyEvent() {
+ String text = this.txtjarFileName.getText();
+ if ((text == null) || (text.trim().equals(""))) {
+ //Todo error message "output location needs to be specified"
+ return;
+ }
+ //Todo error message null
+ }
+}
+
+
+
+
+
+
+
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/CodegenFrame.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/CodegenFrame.java?view=diff&rev=555548&r1=555547&r2=555548
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/CodegenFrame.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/CodegenFrame.java Thu Jul 12 02:37:10 2007
@@ -22,6 +22,8 @@
import org.apache.axis2.tools.bean.CodegenBean;
import org.apache.axis2.tools.idea.FirstPanel;
import org.apache.axis2.tools.idea.ChooserPanel;
+import org.apache.axis2.tools.idea.SecondPanel;
+import org.apache.axis2.tools.idea.WSDL2JavaOutputPanel;
import org.apache.axis2.tools.component.Utilities;
import org.apache.axis2.tools.component.WizardPanel;
import org.apache.axis2.tools.java2wsdl.MiddlePanel;
@@ -38,15 +40,14 @@
* variable
*/
public static final int PANEL_CHOOSER = 0;
- public static final int PANEL_FIRST_A = 1; //
- public static final int PANEL_FIRST_B = 1;
- public static final int PANEL_OPTION_A =2;
- public static final int PANEL_OPTION_B = 2;
- public static final int PANEL_LAST_A = 3;
- public static final int PANEL_LAST_B = 3;
+ public static final int PANEL_FIRST_A = 1;
+ public static final int PANEL_FIRST_B = 2;
+ public static final int PANEL_OPTION_A =3;
+ public static final int PANEL_OPTION_B = 4;
+ public static final int PANEL_LAST_A = 5;
+ public static final int PANEL_LAST_B = 6;
- public CodegenFrame(Project project) {
- super(project);
+ public CodegenFrame() {
init();
}
@@ -60,26 +61,26 @@
panel = new ChooserPanel(getWizardComponents());
getWizardComponents().addWizardPanel(PANEL_CHOOSER , panel);
- /*
+
panel = new FirstPanel(getWizardComponents(),codegenBean);
getWizardComponents().addWizardPanel(PANEL_FIRST_A , panel);
- */
+
panel = new MiddlePanel(getWizardComponents(),wsdlgenBean );
getWizardComponents().addWizardPanel(PANEL_FIRST_B, panel);
- /* panel = new SecondPanel(getWizardComponents(),codegenBean);
+ panel = new SecondPanel(getWizardComponents(),codegenBean);
getWizardComponents().addWizardPanel(PANEL_OPTION_A , panel);
- */
+
panel = new OptionPanel(getWizardComponents(),wsdlgenBean);
getWizardComponents().addWizardPanel(PANEL_OPTION_B , panel);
- /*
- panel = new OutPutPanel(getWizardComponents(),codegenBean);
+
+ panel = new WSDL2JavaOutputPanel(getWizardComponents(),codegenBean,project);
getWizardComponents().addWizardPanel(PANEL_LAST_A , panel);
- */
+
panel = new OutputPanel(getWizardComponents(),wsdlgenBean,project);
getWizardComponents().addWizardPanel(PANEL_LAST_B , panel);
- setSize(550,700);
+ setSize(getPreferredSize());
Utilities.centerComponentOnScreen(this);
}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/WizardFrame.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/WizardFrame.java?view=diff&rev=555548&r1=555547&r2=555548
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/WizardFrame.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/axis2/tools/wizardframe/WizardFrame.java Thu Jul 12 02:37:10 2007
@@ -22,6 +22,9 @@
import org.apache.axis2.tools.bean.WsdlgenBean;
import org.apache.axis2.tools.bean.CodegenBean;
import org.apache.axis2.tools.idea.ProgressBarPanel;
+import org.apache.axis2.tools.idea.FirstPanel;
+import org.apache.axis2.tools.idea.SecondPanel;
+import org.apache.axis2.tools.idea.WSDL2JavaOutputPanel;
import javax.swing.*;
import java.awt.*;
@@ -53,8 +56,7 @@
protected Project project;
private ProgressBarPanel progress;
- public WizardFrame(Project project) {
- this.project=project;
+ public WizardFrame() {
init();
}
@@ -82,7 +84,7 @@
this.getContentPane().add(progress
, new GridBagConstraints(0, 3, 1, 1, 1.0, 0.0
, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL
- , new Insets(10, 5, 5, 5), 0, 0));
+ , new Insets(0, 0, 0, 0), 0, 0));
this.getContentPane().add(new JSeparator()
, new GridBagConstraints(0, 4, 1, 1, 1.0, 0.0
@@ -146,7 +148,7 @@
panelImageLabel.setIcon(image );
}
- protected JPanel createTitlePanel() {
+ protected JPanel createTitlePanel() {
JPanel panel = new JPanel(new GridBagLayout() );
@@ -252,34 +254,37 @@
}
protected void handlePragress(){
- progress.setVisible(true);
- progress.aboutToDisplayPanel();
- progress.displayingPanel();
- new java.util.Timer(true).schedule(new TimerTask() {
- public void run() {
- progress .requestStop();
- }
- }, 1000);
- }
+ wizardComponents.getFinishButton().setEnabled(false);
+ progress.setVisible(true);
+ progress.aboutToDisplayPanel();
+ progress.displayingPanel();
+ new java.util.Timer(true).schedule(new TimerTask() {
+ public void run() {
+ progress.requestStop();
+ }
+ }, 1000);
+ }
- protected void handleSuccess(){
+ protected void handleSuccess(){
StringWriter writer = new StringWriter();
- JOptionPane.showMessageDialog(errorPanel ,
+ JOptionPane.showMessageDialog(this ,
"Code genaration Successful !" + writer.toString(),
"Axis2 code generation",
JOptionPane.INFORMATION_MESSAGE );
+ dispose();
}
- protected void handleError(){
+ protected void handleError(){
+ wizardComponents.getFinishButton().setEnabled(true);
StringWriter writer = new StringWriter();
- JOptionPane.showMessageDialog(errorPanel ,
+ JOptionPane.showMessageDialog(this ,
"Code genaration failed! !" + writer.toString(),
"Axis2 code generation",
JOptionPane.ERROR_MESSAGE );
}
private void addLibsToProjectLib(String libDirectory, String outputLocation){
- String newOutputLocation = outputLocation+File.separator+"aaaa";
+ String newOutputLocation = outputLocation+File.separator+"lib";
//Create a lib directory; all ancestor directories must exist
boolean success = (new File(newOutputLocation)).mkdir();
if (!success) {
@@ -349,34 +354,71 @@
new java.util.Timer(true).schedule(new TimerTask() {
public void run() {
try {
- // wsdlgenBean.generate(); ToDO
+ FirstPanel first=(FirstPanel)wizardComponents.getWizardPanel(1);
+ SecondPanel option=(SecondPanel)wizardComponents.getWizardPanel(3);
+ WSDL2JavaOutputPanel output=(WSDL2JavaOutputPanel)wizardComponents.getWizardPanel(5);
+ boolean isServerside,isServiceXML,isGenerateServerSideInterface = false;
+ if (option.getGenerateAll()){
+ isServerside = true;
+ isServiceXML = true;
+ isGenerateServerSideInterface = true;
+ }else{
+ isServerside = option.isServerside();
+ isServiceXML =option.isServerXML();
+ isGenerateServerSideInterface = option.getGenerateServerSideInterface();
+ }
+ codegenBean.setPackageName(option.getPackageName());
+ codegenBean.setLanguage(option.getSelectedLanguage());
+ codegenBean.setPortName(option.getPortName());
+ codegenBean.setServiceName(option.getServiceName());
+ codegenBean.setDatabindingName(option.getDatabinderName());
+ codegenBean.setAsyncOnly(option.isAsyncOnlyOn());
+ codegenBean.setSyncOnly(option.isSyncOnlyOn());
+ codegenBean.setTestCase(option.isGenerateTestCase());
+ codegenBean.setGenerateAll(option.getGenerateAll());
+ codegenBean.setServerXML(isServiceXML);
+ codegenBean.setServerSide(isServerside);
+ codegenBean.setServerSideInterface(isGenerateServerSideInterface);
+ codegenBean.setOutput(output.getOutputLocation());
+ codegenBean.setNamespace2packageList(option.getNs2PkgMapping());
+ codegenBean.setWSDLFileName(first.getWSDLFileName());
+ codegenBean.generate();
progress.setVisible(false);
handleSuccess();
- dispose();
- } catch (Exception e1) {
+ }catch (Exception e1) {
progress.setVisible(false);
handleError();
- dispose();
}
-
}
- }, 3100);
+ }, 1000);
+
}
- protected void doFinishJava2WSDL(){
+
+ protected void doFinishJava2WSDL(){
handlePragress();
new java.util.Timer(true).schedule(new TimerTask() {
public void run() {
- try {
+ try {
wsdlgenBean.generate();
progress.setVisible(false);
handleSuccess();
- dispose();
} catch (Exception e1) {
progress.setVisible(false);
handleError();
- dispose();
}
}
}, 3100);
}
+ public void setProject(Project project){
+ this.project=project;
+ }
+ public JComponent getRootComponent() {
+ return this.getRootPane();
+ }
+ public void showUI() {
+ pack();
+ this.setVisible(true);
+ show();
+ }
+
}
Modified: webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/Axi2PluginPage.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/Axi2PluginPage.java?view=diff&rev=555548&r1=555547&r2=555548
==============================================================================
--- webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/Axi2PluginPage.java (original)
+++ webservices/axis2/trunk/java/modules/tool/axis2-idea-plugin/src/main/java/org/apache/ideaplugin/frames/Axi2PluginPage.java Thu Jul 12 02:37:10 2007
@@ -130,8 +130,9 @@
this.hide();
setVisible(false);
if (codeGen.isSelected()) {
- codegenFrame = new CodegenFrame(project);
- codegenFrame.setVisible(true);
+ codegenFrame = new CodegenFrame();
+ codegenFrame.setProject(project);
+ codegenFrame.setVisible(true);
codegenFrame .setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}else{
ServiceArciveFrame window = new ServiceArciveFrame();
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org