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 aj...@apache.org on 2005/05/25 06:14:59 UTC
svn commit: r178360 - in
/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool: bean/
control/ service/bean/ service/control/ service/eclipse/
service/eclipse/plugin/ service/eclipse/ui/ service/resource/
service/swing/ service/swing/ui/ ui/
Author: ajith
Date: Tue May 24 21:14:57 2005
New Revision: 178360
URL: http://svn.apache.org/viewcvs?rev=178360&view=rev
Log:
Refactoring and adding the servie archiver tool
Added:
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page1Bean.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page2Bean.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page3Bean.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/WizardBean.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/control/
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/control/Controller.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/control/ProcessException.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/plugin/
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/plugin/ServiceArchiver.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/ServiceArchiveWizard.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane1.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane2.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane3.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane4.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/resource/
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/resource/ServiceResources.properties
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/resource/ServiceResources_de.properties
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/MainWindow.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane1.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane2.java
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane3.java
Removed:
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/bean/
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/control/
webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/ui/
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page1Bean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page1Bean.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page1Bean.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page1Bean.java Tue May 24 21:14:57 2005
@@ -0,0 +1,28 @@
+package org.apache.axis.tool.service.bean;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class Page1Bean {
+ private String fileLocation;
+
+ public String getFileLocation() {
+ return fileLocation;
+ }
+
+ public void setFileLocation(String fileLocation) {
+ this.fileLocation = fileLocation;
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page2Bean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page2Bean.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page2Bean.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page2Bean.java Tue May 24 21:14:57 2005
@@ -0,0 +1,90 @@
+package org.apache.axis.tool.service.bean;
+
+import java.util.ArrayList;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class Page2Bean {
+ private boolean manual;
+ private boolean automatic;
+
+ private String manualFileName;
+ private String automaticClassName;
+ private String providerClassName;
+
+ private ArrayList selectedMethodNames;
+
+ public String getProviderClassName() {
+ return providerClassName;
+ }
+
+ public void setProviderClassName(String providerClassName) {
+ this.providerClassName = providerClassName;
+ }
+
+ public Page2Bean() {
+ selectedMethodNames = new ArrayList();
+ }
+
+ public boolean isManual() {
+ return manual;
+ }
+
+ public void setManual(boolean manual) {
+ this.manual = manual;
+ }
+
+ public boolean isAutomatic() {
+ return automatic;
+ }
+
+ public void setAutomatic(boolean automatic) {
+ this.automatic = automatic;
+ }
+
+ public String getManualFileName() {
+ return manualFileName;
+ }
+
+ public void setManualFileName(String manualFileName) {
+ this.manualFileName = manualFileName;
+ }
+
+ public String getAutomaticClassName() {
+ return automaticClassName;
+ }
+
+ public void setAutomaticClassName(String automaticClassName) {
+ this.automaticClassName = automaticClassName;
+ }
+ public int getMethodNameCount(){
+ return selectedMethodNames.size();
+ }
+ public void setSelectedMethodNames(ArrayList list){
+ this.selectedMethodNames = list;
+ }
+ public String getMethodName(int index) {
+ return selectedMethodNames.get(index).toString();
+ }
+
+ public void addMethodName(String selectedMethodName) {
+ this.selectedMethodNames.add(selectedMethodNames);
+ }
+
+ public ArrayList getSelectedMethodNames() {
+ return selectedMethodNames;
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page3Bean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page3Bean.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page3Bean.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/Page3Bean.java Tue May 24 21:14:57 2005
@@ -0,0 +1,38 @@
+package org.apache.axis.tool.service.bean;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class Page3Bean {
+ private String outputFolderName;
+ private String outputFileName;
+
+ public String getOutputFolderName() {
+ return outputFolderName;
+ }
+
+ public void setOutputFolderName(String outputFolderName) {
+ this.outputFolderName = outputFolderName;
+ }
+
+ public String getOutputFileName() {
+ return outputFileName;
+ }
+
+ public void setOutputFileName(String outputFileName) {
+ this.outputFileName = outputFileName;
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/WizardBean.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/WizardBean.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/WizardBean.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/bean/WizardBean.java Tue May 24 21:14:57 2005
@@ -0,0 +1,47 @@
+package org.apache.axis.tool.service.bean;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class WizardBean {
+ private Page1Bean page1bean;
+ private Page2Bean page2bean;
+ private Page3Bean page3bean;
+
+ public Page1Bean getPage1bean() {
+ return page1bean;
+ }
+
+ public void setPage1bean(Page1Bean page1bean) {
+ this.page1bean = page1bean;
+ }
+
+ public Page2Bean getPage2bean() {
+ return page2bean;
+ }
+
+ public void setPage2bean(Page2Bean page2bean) {
+ this.page2bean = page2bean;
+ }
+
+ public Page3Bean getPage3bean() {
+ return page3bean;
+ }
+
+ public void setPage3bean(Page3Bean page3bean) {
+ this.page3bean = page3bean;
+ }
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/control/Controller.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/control/Controller.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/control/Controller.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/control/Controller.java Tue May 24 21:14:57 2005
@@ -0,0 +1,117 @@
+package org.apache.axis.tool.control;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import org.apache.axis.tool.bean.Page1Bean;
+import org.apache.axis.tool.bean.Page2Bean;
+import org.apache.axis.tool.bean.Page3Bean;
+import org.apache.axis.tool.bean.WizardBean;
+import org.apache.axis.tool.core.ClassFileHandler;
+import org.apache.axis.tool.core.FileCopier;
+import org.apache.axis.tool.core.JarFileWriter;
+import org.apache.axis.tool.core.ServiceFileCreator;
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class Controller {
+
+ public ArrayList getMethodList(WizardBean bean) throws ProcessException{
+ ArrayList returnList = null;
+ try {
+ returnList = new ClassFileHandler().getMethodNamesFromClass(bean.getPage2bean().getAutomaticClassName(),
+ bean.getPage1bean().getFileLocation());
+ } catch (IOException e) {
+ throw new ProcessException("IO Error, The class file location may be faulty!",e);
+ } catch (ClassNotFoundException e) {
+ throw new ProcessException(" The specified class does not exist!!!");
+ } catch (Exception e){
+ throw new ProcessException("Unknown Error! See whether all parameters are available");
+ }
+ return returnList;
+ }
+
+
+ public void process(WizardBean bean) throws ProcessException,Exception{
+
+ Page1Bean page1Bean = bean.getPage1bean();
+ Page2Bean page2Bean = bean.getPage2bean();
+ Page3Bean page3Bean = bean.getPage3bean();
+
+ File serviceFile = null;
+ File classFileFolder = null;
+ File outputFolder =null;
+ String outputFileName = null;
+ boolean isServiceCreated = false;
+
+ //see if the class file location is valid
+ classFileFolder = new File(page1Bean.getFileLocation());
+ if (!classFileFolder.exists()){
+ throw new ProcessException("Specified Class file location is empty!!");
+ }
+ if (!classFileFolder.isDirectory()){
+ throw new ProcessException("The class file location must be a folder!");
+ }
+
+ //see if the service.xml file is valid
+ if (page2Bean.isManual()){
+ serviceFile = new File(page2Bean.getManualFileName());
+ if (!serviceFile.exists()){
+ throw new ProcessException("Specified Service XML file is missing!");
+ }
+ }else{
+ ArrayList methodList = page2Bean.getSelectedMethodNames();
+ if (methodList.isEmpty()){
+ throw new ProcessException("There are no methods selected to generate the service!!");
+ }
+ serviceFile=new ServiceFileCreator().createServiceFile(page2Bean.getProviderClassName(),
+ page2Bean.getAutomaticClassName(),
+ page2Bean.getSelectedMethodNames());//create the file here
+ isServiceCreated = true;
+ }
+
+ outputFolder = new File(page3Bean.getOutputFolderName());
+ outputFileName = page3Bean.getOutputFileName();
+ if (!outputFileName.toLowerCase().endsWith(".jar")){
+ outputFileName = outputFileName + ".jar";
+ }
+
+ File tempFileFolder =null;
+
+ try {
+ //create a temporary directory and copy the files
+ tempFileFolder = new File("Service-copy");
+ tempFileFolder.mkdir();
+ File metaInfFolder = new File(tempFileFolder,"META-INF");
+ metaInfFolder.mkdir();
+
+ new FileCopier().copyFiles(classFileFolder,tempFileFolder);
+ new FileCopier().copyFiles(serviceFile,metaInfFolder);
+
+ //jar the temp directory. the output folder will be created if missing
+ new JarFileWriter().writeJarFile(outputFolder,outputFileName,tempFileFolder);
+ } catch (Exception e) {
+ throw new ProcessException(e);
+ } finally {
+ tempFileFolder.delete();
+ if (isServiceCreated)
+ serviceFile.delete();
+
+
+ }
+
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/control/ProcessException.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/control/ProcessException.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/control/ProcessException.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/control/ProcessException.java Tue May 24 21:14:57 2005
@@ -0,0 +1,33 @@
+package org.apache.axis.tool.control;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class ProcessException extends Exception{
+ public ProcessException() {
+ }
+
+ public ProcessException(String message) {
+ super(message);
+ }
+
+ public ProcessException(Throwable cause) {
+ super(cause);
+ }
+
+ public ProcessException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/plugin/ServiceArchiver.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/plugin/ServiceArchiver.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/plugin/ServiceArchiver.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/plugin/ServiceArchiver.java Tue May 24 21:14:57 2005
@@ -0,0 +1,94 @@
+ /**
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.axis.tool.service.eclipse.plugin;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class ServiceArchiver extends AbstractUIPlugin {
+ //The shared instance.
+ private static ServiceArchiver plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+ private static ImageDescriptor wizardImageDescriptor;
+ /**
+ * The constructor.
+ */
+ public ServiceArchiver() {
+ super();
+ plugin = this;
+ try {
+ resourceBundle = ResourceBundle.getBundle("org.apache.axis.tool.resource.ServiceResources");
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static ServiceArchiver getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = ServiceArchiver.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+
+ public static ImageDescriptor getWizardImageDescriptor(){
+ if (wizardImageDescriptor==null){
+ wizardImageDescriptor =ServiceArchiver.imageDescriptorFromPlugin("Axis_Service_Archiver","icons/asf-feather.gif");
+ }
+ return wizardImageDescriptor;
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/ServiceArchiveWizard.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/ServiceArchiveWizard.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/ServiceArchiveWizard.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/ServiceArchiveWizard.java Tue May 24 21:14:57 2005
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.axis.tool.service.eclipse.ui;
+
+
+import org.apache.axis.tool.eclipse.plugin.ServiceArchiver;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+
+/**
+ * @author Ajith
+ *
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class ServiceArchiveWizard extends Wizard implements INewWizard {
+
+ private WizardPane1 wizardPane1;
+ private WizardPane2 wizardPane2;
+ private WizardPane3 wizardPane3;
+ private WizardPane4 wizardPane4;
+
+
+ /**
+ *
+ */
+ public ServiceArchiveWizard() {
+ super();
+ setWindowTitle(ServiceArchiver.getResourceString("main.title"));
+ }
+
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
+ */
+ public IWizardPage getNextPage(IWizardPage page) {
+ IWizardPage pageout = super.getNextPage(page);
+ if (page.equals(wizardPane2)){
+ if (((WizardPane2)page).isSkipNextPage()){
+ pageout = super.getNextPage(pageout);
+ }
+ }
+ return pageout;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizard#canFinish()
+ */
+ public boolean canFinish() {
+ return false;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizard#addPages()
+ */
+ public void addPages() {
+ wizardPane1 = new WizardPane1();
+ this.addPage(wizardPane1);
+ wizardPane2 = new WizardPane2();
+ this.addPage(wizardPane2);
+ wizardPane3 = new WizardPane3();
+ this.addPage(wizardPane3);
+ wizardPane4 = new WizardPane4();
+ this.addPage(wizardPane4);
+ }
+ /* (non-Javadobc)
+ * @see org.eclipse.jface.wizard.IWizard#performFinish()
+ */
+ public boolean performFinish() {
+ return true;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ // TODO Auto-generated method stub
+
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane1.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane1.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane1.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane1.java Tue May 24 21:14:57 2005
@@ -0,0 +1,109 @@
+/**
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.axis.tool.service.eclipse.ui;
+
+
+import org.apache.axis.tool.eclipse.plugin.ServiceArchiver;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+
+public class WizardPane1 extends WizardPage {
+
+ private Text classFileLocationText;
+ private Button browseButton;
+
+ private boolean pageComplete;
+
+ public WizardPane1(){
+ super("page1");
+ this.setTitle(ServiceArchiver.getResourceString("page1.title"));
+ this.setDescription(ServiceArchiver.getResourceString("page1.welcometext"));
+ this.setImageDescriptor(ServiceArchiver.getWizardImageDescriptor());
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns=3;
+ container.setLayout(layout);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ Label lable = new Label(container,SWT.NULL);
+ lable.setText(ServiceArchiver.getResourceString("page1.fileLocationLabel"));
+
+ classFileLocationText = new Text(container,SWT.BORDER);
+ classFileLocationText.setLayoutData(gd);
+ classFileLocationText.addModifyListener(new ModifyListener(){
+ public void modifyText(ModifyEvent e){
+ handleModify();
+ }
+ });
+
+ browseButton = new Button(container,SWT.PUSH);
+ browseButton.setText(ServiceArchiver.getResourceString("general.browse"));
+ browseButton.addMouseListener(new MouseAdapter(){
+ public void mouseUp(MouseEvent e) {
+ handleBrowse();
+ }
+ });
+
+ setControl(container);
+
+ }
+
+
+ private void handleBrowse(){
+ DirectoryDialog dirDialog = new DirectoryDialog(this.getShell());
+ dirDialog.setMessage(ServiceArchiver.getResourceString("page1.filedialogTitle"));
+ String returnText = dirDialog.open();
+ if (returnText!=null){
+ this.classFileLocationText.setText(returnText);
+ }
+ }
+
+ private void handleModify(){
+ String classLocationText = this.classFileLocationText.getText().trim();
+ if (classLocationText.equals("")){
+ updateMessage("Filename should not be empty");
+// }else if (classLocationText.matches("[\\w\\W]*")){
+// updateMessage("Filename should be valid");
+ }else{
+ updateMessage(null);
+ }
+ }
+
+ private void updateMessage(String str){
+ this.setErrorMessage(str);
+ this.pageComplete = (str==null);
+ }
+
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane2.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane2.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane2.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane2.java Tue May 24 21:14:57 2005
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.axis.tool.service.eclipse.ui;
+
+import org.apache.axis.tool.service.eclipse.plugin.ServiceArchiver;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class WizardPane2 extends WizardPage {
+
+ private Text serviceXMLText;
+ private Label manualSelectionLabel;
+ private Button browseButton;
+ private Button selectAutoFileGenerationCheckBox;
+
+ private boolean skipNextPage=true;
+ private boolean pageComplete;
+
+ public WizardPane2(){
+ super("page2");
+ this.setTitle(ServiceArchiver.getResourceString("page2.title"));
+ this.setDescription(ServiceArchiver.getResourceString("page2.welcometext"));
+ this.setImageDescriptor(ServiceArchiver.getWizardImageDescriptor());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns=3;
+ container.setLayout(layout);
+
+ manualSelectionLabel = new Label(container,SWT.NULL);
+ manualSelectionLabel.setText("Set the service XML file");
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ serviceXMLText = new Text(container,SWT.BORDER);
+ serviceXMLText.setLayoutData(gd);
+ serviceXMLText.addModifyListener(new ModifyListener(){
+ public void modifyText(ModifyEvent e){
+ handleModify();
+ }
+ });
+
+ browseButton = new Button(container,SWT.PUSH);
+ browseButton.setText("Browse...");
+ browseButton.addMouseListener(new MouseAdapter(){
+ public void mouseUp(MouseEvent e) {
+ handleBrowse();
+ }
+ });
+
+ gd = new GridData();
+ gd.horizontalSpan = 2;
+ selectAutoFileGenerationCheckBox = new Button(container,SWT.CHECK);
+ selectAutoFileGenerationCheckBox.setLayoutData(gd);
+ selectAutoFileGenerationCheckBox.setText("Generate the service xml automatically");
+ selectAutoFileGenerationCheckBox.addSelectionListener(new SelectionListener(){
+ public void widgetSelected(SelectionEvent e){
+ handleSelection();
+ }
+ public void widgetDefaultSelected(SelectionEvent e){}
+ });
+ setControl(container);
+
+ }
+
+ private void handleBrowse(){
+ FileDialog fileDialog = new FileDialog(this.getShell());
+ fileDialog.setFilterExtensions(new String[]{"service.xml"});
+ String returnFileName = fileDialog.open() ;
+ if (returnFileName!=null){
+ this.serviceXMLText.setText(returnFileName);
+ }
+ }
+
+ private void handleSelection(){
+ if (this.selectAutoFileGenerationCheckBox.getSelection()){
+ changeManualSelectionStatus(false);
+ this.skipNextPage = false;
+ updateMessage(null);
+ }else{
+ changeManualSelectionStatus(true);
+ this.skipNextPage = true;
+ handleModify();
+
+ }
+ }
+
+ private void changeManualSelectionStatus(boolean state){
+ this.serviceXMLText.setEnabled(state);
+ this.browseButton.setEnabled(state);
+ this.manualSelectionLabel.setEnabled(state);
+ }
+
+ private void handleModify(){
+ String serviceXMLString =serviceXMLText.getText().trim().toLowerCase();
+ if (serviceXMLString.equals("")){
+ this.updateMessage("Service XML should not be empty");
+ }else if(!serviceXMLString.endsWith("service.xml")){
+ this.updateMessage("Please select a file named service.xml");
+ }else{
+ this.updateMessage(null);
+ }
+ }
+
+ private void updateMessage(String str){
+ this.setErrorMessage(str);
+ this.pageComplete = (str==null);
+ }
+
+ /**
+ * @return Returns the skipNextPage.
+ */
+ public boolean isSkipNextPage() {
+ return skipNextPage;
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane3.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane3.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane3.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane3.java Tue May 24 21:14:57 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.axis.tool.service.eclipse.ui;
+
+import org.apache.axis.tool.eclipse.plugin.ServiceArchiver;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+
+public class WizardPane3 extends WizardPage{
+
+ public WizardPane3(){
+ super("page3");
+ this.setTitle(ServiceArchiver.getResourceString("page2.title"));
+ this.setDescription(ServiceArchiver.getResourceString("Generate the service XML file"));
+ this.setImageDescriptor(ServiceArchiver.getWizardImageDescriptor());
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns=3;
+ container.setLayout(layout);
+
+ Label manualSelectionLabel = new Label(container,SWT.NULL);
+ manualSelectionLabel.setText("Make the service XML file");
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+
+ setControl(container);
+
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizardPage#canFlipToNextPage()
+ */
+ public boolean canFlipToNextPage() {
+ // TODO Auto-generated method stub
+ return super.canFlipToNextPage();
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane4.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane4.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane4.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/eclipse/ui/WizardPane4.java Tue May 24 21:14:57 2005
@@ -0,0 +1,96 @@
+ /*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.axis.tool.service.eclipse.ui;
+
+import org.apache.axis.tool.eclipse.plugin.ServiceArchiver;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+public class WizardPane4 extends WizardPage {
+
+ private Text outputFileNameTextBox;
+ private Button browseButton;
+ private Text outputFileName;
+
+ public WizardPane4(){
+ super("Page4");
+ this.setTitle(ServiceArchiver.getResourceString("page3.title"));
+ this.setDescription(ServiceArchiver.getResourceString("page3.welcometext"));
+ this.setImageDescriptor(ServiceArchiver.getWizardImageDescriptor());
+
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns=3;
+ container.setLayout(layout);
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.grabExcessHorizontalSpace = true;
+
+ Label lable = new Label(container,SWT.NULL);
+ lable.setText(ServiceArchiver.getResourceString("page3.outputlocation.label"));
+
+ outputFileNameTextBox = new Text(container,SWT.BORDER);
+ outputFileNameTextBox.setLayoutData(gd);
+
+ gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
+
+ browseButton = new Button(container,SWT.PUSH);
+ browseButton.setText("Browse...");
+ browseButton.setLayoutData(gd);
+ browseButton.addMouseListener(new MouseAdapter(){
+ public void mouseUp(MouseEvent e) {
+ handleBrowse();
+ }
+ });
+
+ lable = new Label(container,SWT.NULL);
+ lable.setText("Output file name");
+
+ gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 2;
+
+ outputFileName = new Text(container,SWT.BORDER);
+ outputFileName.setLayoutData(gd);
+
+ setControl(container);
+
+
+ }
+
+ private void handleBrowse(){
+ DirectoryDialog dirDialog = new DirectoryDialog(this.getShell());
+ dirDialog.setMessage("Browse for the output location");
+ String returnText = dirDialog.open();
+ if (returnText!=null){
+ this.outputFileNameTextBox.setText(returnText);
+ this.outputFileNameTextBox.setToolTipText(returnText);
+ }
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/resource/ServiceResources.properties
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/resource/ServiceResources.properties?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/resource/ServiceResources.properties (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/resource/ServiceResources.properties Tue May 24 21:14:57 2005
@@ -0,0 +1,39 @@
+################################################################
+################## Resources for the interface ###############
+###################### Default en_us ##########################
+#
+# Main page title
+main.title=Apache Axis Service Archiver
+
+#general texts
+#Ok button caption
+general.ok=Ok
+#Cancle button caption
+general.cancle=Cancel
+#Next button caption
+general.next=Next
+#Previous button caption
+general.prev=Prev
+#Finish button caption
+general.finish=Finish
+#browse
+general.browse=Browse...
+###############################################################################
+#Firstpage title
+page1.title=Service Archiver
+# First page welcome text
+page1.welcometext=Welcome to the new AXIS Service packager Wizard Interface.Insert the location for the class files here.This should be a folder with the compiled classes
+# First page
+page1.fileLocationLabel=Class File Location
+page1.filedialogTitle=Browse for the class file location
+
+
+# second page
+page2.title=Service Archiver
+page2.welcometext=Select the Service XML file to be included in the Service archive
+
+#third page
+page3.title=Service Archiver
+page3.welcometext=Set the output loacation and the output file name
+page3.outputlocation.label=Output file location
+page3.
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/resource/ServiceResources_de.properties
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/resource/ServiceResources_de.properties?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/resource/ServiceResources_de.properties (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/resource/ServiceResources_de.properties Tue May 24 21:14:57 2005
@@ -0,0 +1,23 @@
+################################################################
+################## Resources for the interface ###############
+###################### German de ##########################
+#
+# Main page title
+main.title=Apache Axis Service Archiver
+
+#general texts
+#Ok button caption
+general.ok=gOk
+#Cancle button caption
+general.cancle=gCancel
+#Next button caption
+general.next=gNext
+#Previous button caption
+general.prev=gPrev
+#Finish button caption
+general.finish=gFinish
+
+
+# First page welcome text
+page1.welcometext=gWelcome to the new AXIS Service packager Wizard Interface.\n\n Insert the location for the class files here.This should be a folder with \n the compiled classes
+# First page
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/MainWindow.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/MainWindow.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/MainWindow.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/MainWindow.java Tue May 24 21:14:57 2005
@@ -0,0 +1,202 @@
+package org.apache.axis.tool.service.swing.ui;
+
+import java.awt.HeadlessException;
+import java.awt.Toolkit;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+
+import org.apache.axis.tool.bean.WizardBean;
+import org.apache.axis.tool.control.Controller;
+import org.apache.axis.tool.control.ProcessException;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class MainWindow extends JFrame {
+
+ private JPanel wizardPaneContainer;
+ private JButton nextButton;
+ private JButton previousButton;
+ private JButton cancelButton;
+ private JButton finishButton;
+ private int currentPage;
+ private WizardPane currentWizardPane;
+
+ private static final int PAGE_1=1;
+ private static final int PAGE_2=2;
+ private static final int PAGE_3=3;
+ //private static final int PAGE_4=4;
+
+
+ private WizardBean wizardBean = new WizardBean();
+
+ public MainWindow() throws HeadlessException {
+ super("Axis 2 - Service Jar Builder");
+ init();
+
+ }
+
+ private void init(){
+ this.getContentPane().setLayout(null);
+
+ this.setBounds((int)Toolkit.getDefaultToolkit().getScreenSize().getWidth()/2 - 400/2,
+ (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight()/2 - 360/2,
+ 400,360);
+ this.setResizable(false);
+ this.setDefaultCloseOperation(EXIT_ON_CLOSE);
+
+ int hgap = 5;
+ int vgap = 5;
+ int bWidth = 80;
+ int bHeight = 20;
+
+ this.wizardPaneContainer = new JPanel(null);
+ this.getContentPane().add(this.wizardPaneContainer);
+ this.wizardPaneContainer.setBounds(0,0,400,300);
+
+ this.previousButton = new JButton("Previous");
+ this.getContentPane().add(this.previousButton);
+ this.previousButton.setBounds(hgap,300+vgap,bWidth,bHeight);
+ this.previousButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ moveBackWard();
+ }
+
+ });
+//
+ this.nextButton= new JButton("Next");
+ this.getContentPane().add(this.nextButton);
+ this.nextButton.setBounds(hgap +bWidth + hgap,300 + vgap,bWidth,bHeight);
+ this.nextButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ moveForward();
+ }
+ });
+
+ this.cancelButton= new JButton("Close");
+ this.getContentPane().add(this.cancelButton) ;
+ this.cancelButton.setBounds(hgap + (bWidth + hgap)*2,300 + vgap,bWidth,bHeight);
+ this.cancelButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ if (confirmExit())
+ System.exit(0);
+ }
+ });
+
+ this.finishButton= new JButton("Finish");
+ this.getContentPane().add(this.finishButton) ;
+ this.finishButton.setBounds(hgap + (bWidth + hgap)*3,300 + vgap,bWidth,bHeight);
+ this.finishButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ processFinish();
+ }
+ });
+
+
+
+ this.currentPage = PAGE_1;
+ moveToPage(currentPage); //add the first page as default
+ }
+
+ private void showErrorMessage(){
+ JOptionPane.showMessageDialog(this,"Required Value Not set!!!","Error",JOptionPane.ERROR_MESSAGE);
+ }
+
+ private void showErrorMessage(String message){
+ JOptionPane.showMessageDialog(this,message,"Error",JOptionPane.ERROR_MESSAGE);
+ }
+
+ private void showSuccessMessage(String message){
+ JOptionPane.showMessageDialog(this,message,"Error",JOptionPane.INFORMATION_MESSAGE);
+ }
+
+ private boolean confirmExit(){
+ int returnType = JOptionPane.showOptionDialog(this,
+ "Are you sure you want to exit?",
+ "Exit service builder",
+ JOptionPane.YES_NO_OPTION,
+ JOptionPane.WARNING_MESSAGE,
+ null,null,null);
+ return (returnType==JOptionPane.YES_OPTION);
+ }
+
+ private void moveForward(){
+ if (currentWizardPane.validateValues()){
+ this.currentPage ++;
+ moveToPage(this.currentPage);
+ }else{
+ showErrorMessage();
+ }
+ }
+
+ private void moveBackWard(){
+ this.currentPage --;
+ moveToPage(this.currentPage);
+
+ }
+
+ private void moveToPage(int page){
+ switch(page){
+ case PAGE_1:
+ processPage(new WizardPane1(this.wizardBean, this),false,true,false);
+ break;
+ case PAGE_2:
+ processPage(new WizardPane2(this.wizardBean, this),true,true,false);
+ break;
+ case PAGE_3:
+ processPage(new WizardPane3(this.wizardBean, this),true,false,true);
+ break;
+ default:
+ return;
+ }
+ }
+ private void processFinish(){
+ if (currentWizardPane.validateValues()){
+ try {
+ new Controller().process(wizardBean);
+ showSuccessMessage(" jar file creation successful! ");
+ } catch (ProcessException e) {
+ showErrorMessage(e.getMessage());
+ } catch (Exception e) {
+ showErrorMessage("Unknown Error! " +e.getMessage() );
+ }
+ }else{
+ showErrorMessage();
+ }
+ }
+
+ private void processPage(WizardPane pane,boolean prevButtonState,boolean nextButtonState,boolean finishButtonState){
+ this.wizardPaneContainer.removeAll();
+ currentWizardPane = pane;
+ this.wizardPaneContainer.add(pane);
+ this.previousButton.setEnabled(prevButtonState);
+ this.nextButton.setEnabled(nextButtonState);
+ this.finishButton.setEnabled(finishButtonState);
+ this.repaint();
+ }
+
+
+ public static void main(String[] args) {
+ new MainWindow().show();
+ }
+
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane.java Tue May 24 21:14:57 2005
@@ -0,0 +1,108 @@
+package org.apache.axis.tool.service.swing.ui;
+
+import java.awt.LayoutManager;
+import java.io.File;
+
+import javax.swing.JFileChooser;
+import javax.swing.JFrame;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTextArea;
+import javax.swing.filechooser.FileFilter;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public abstract class WizardPane extends JPanel {
+ protected JTextArea descriptionLabel;
+ protected JFrame ownerFrame;
+
+ protected int descWidth=400;
+ protected int descHeight=100;
+ protected int width=400;
+ protected int height=300;
+ protected int hgap=5;
+ protected int vgap=5;
+
+ protected WizardPane() {
+ }
+
+ protected WizardPane(JFrame ownerFrame) {
+ this.ownerFrame = ownerFrame;
+ }
+
+ protected WizardPane(boolean isDoubleBuffered) {
+ super(isDoubleBuffered);
+ }
+
+ protected WizardPane(LayoutManager layout) {
+ super(layout);
+ }
+
+ protected WizardPane(LayoutManager layout, boolean isDoubleBuffered) {
+ super(layout, isDoubleBuffered);
+ }
+
+ protected void initDescription(String desc){
+ this.descriptionLabel = new JTextArea(desc);
+ this.descriptionLabel.setOpaque(false);
+ this.descriptionLabel.setEditable(false);
+ this.descriptionLabel.setAutoscrolls(true);
+ this.descriptionLabel.setBounds(0,0,descWidth,descHeight);
+ this.add(this.descriptionLabel);
+ }
+
+ public abstract boolean validateValues();
+
+ protected void showErrorMessage(String message){
+ JOptionPane.showMessageDialog(this,message,"Error",JOptionPane.ERROR_MESSAGE);
+ }
+
+
+ protected String browseForAFile(final String extension){
+ String str="";
+ JFileChooser fc=new JFileChooser();
+ fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
+ fc.addChoosableFileFilter(new FileFilter(){
+ public boolean accept(File f) {
+ if (f.getName().endsWith(extension) || f.isDirectory())
+ return true;
+ else
+ return false;
+ }
+
+ public String getDescription() {
+ return extension + " file filter ";
+ }
+ });
+
+ int returnVal = fc.showOpenDialog(this);
+ if(returnVal == JFileChooser.APPROVE_OPTION) {
+ str=fc.getSelectedFile().getAbsolutePath().trim();
+ }
+ return str;
+ }
+
+ protected String browseForAFolder(){
+ String str="";
+ JFileChooser fc=new JFileChooser();
+ fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ int returnVal = fc.showOpenDialog(this);
+ if(returnVal == JFileChooser.APPROVE_OPTION) {
+ str=fc.getSelectedFile().getAbsolutePath().trim();
+ }
+ return str;
+ }
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane1.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane1.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane1.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane1.java Tue May 24 21:14:57 2005
@@ -0,0 +1,109 @@
+package org.apache.axis.tool.service.swing.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+
+import org.apache.axis.tool.bean.Page1Bean;
+import org.apache.axis.tool.bean.WizardBean;
+import org.apache.axis.tool.util.Constants;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class WizardPane1 extends WizardPane{
+
+ private Page1Bean myBean = null;
+
+ private JLabel classFileLocationLabel;
+ private JTextField classFileLocationTextBox;
+ private JButton browseButton;
+
+ public WizardPane1(WizardBean wizardBean, JFrame ownerFrame) {
+
+ super(ownerFrame);
+
+ init();
+
+ if (wizardBean.getPage1bean()!= null){
+ myBean = wizardBean.getPage1bean();
+ this.classFileLocationTextBox.setText(myBean.getFileLocation());
+ }else{
+ myBean = new Page1Bean();
+ wizardBean.setPage1bean(myBean);
+ }
+
+
+ }
+
+ public boolean validateValues() {
+ String text = myBean.getFileLocation();
+ return (text!=null && text.trim().length()>0);
+ }
+
+ private void init(){
+ this.setLayout(null);
+ this.setSize(width,height);
+
+ initDescription("Welcome to the new AXIS Service packager Wizard Interface.\n\n " +
+ "Insert the location for the class files here.This should be a folder with \n" +
+ " the compiled classes");
+
+
+ this.classFileLocationLabel = new JLabel("class file location");
+ this.add(this.classFileLocationLabel);
+ this.classFileLocationLabel.setBounds(hgap,descHeight,Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+
+ this.classFileLocationTextBox = new JTextField();
+ this.add(this.classFileLocationTextBox);
+ this.classFileLocationTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,descHeight,Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.classFileLocationTextBox.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ handleTextBoxChange();
+ }
+ });
+ this.classFileLocationTextBox.addKeyListener(new KeyListener(){
+ public void keyTyped(KeyEvent e) { }
+ public void keyPressed(KeyEvent e) { }
+ public void keyReleased(KeyEvent e) { handleTextBoxChange();}
+ });
+
+ this.browseButton = new JButton(".");
+ this.add(this.browseButton);
+ this.browseButton.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap +Constants.UIConstants.TEXT_BOX_WIDTH,descHeight,Constants.UIConstants.BROWSE_BUTTON_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.browseButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ classFileLocationTextBox.setText(browseForAFolder());
+ handleTextBoxChange();
+ }
+ });
+ }
+
+
+ private void handleTextBoxChange() {
+ String text = classFileLocationTextBox.getText();
+ if (text!=null){
+ this.myBean.setFileLocation(text);
+ }
+ }
+
+
+}
\ No newline at end of file
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane2.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane2.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane2.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane2.java Tue May 24 21:14:57 2005
@@ -0,0 +1,455 @@
+package org.apache.axis.tool.service.swing.ui;
+
+import java.awt.HeadlessException;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.util.ArrayList;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JTextField;
+
+import org.apache.axis.tool.bean.Page2Bean;
+import org.apache.axis.tool.bean.WizardBean;
+import org.apache.axis.tool.control.Controller;
+import org.apache.axis.tool.control.ProcessException;
+import org.apache.axis.tool.util.Constants;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+public class WizardPane2 extends WizardPane {
+
+ private WizardBean parentBean;
+ private Page2Bean myBean;
+
+ private JRadioButton selectManualFileRadioButton;
+ private JRadioButton createAutomaticFileRadioButton;
+ private JPanel selectionPanel;
+
+
+ public WizardPane2(WizardBean wizardBean, JFrame ownerFrame) {
+ super(ownerFrame);
+
+ init();
+
+ parentBean = wizardBean;
+
+ if (wizardBean.getPage2bean()!=null){
+ myBean = wizardBean.getPage2bean();
+ //set the initial settings from the bean
+ setBeanValues();
+
+ }else{
+ myBean = new Page2Bean();
+ wizardBean.setPage2bean(myBean);
+ setDefaultValues();
+ }
+
+ }
+
+ public void setBeanValues(){
+ if (myBean.isManual()){
+ this.selectManualFileRadioButton.setSelected(true);
+ loadScreen(new ManualSelectionPanel(true));
+ }else{
+ this.createAutomaticFileRadioButton.setSelected(true);
+ loadScreen(new AutomaticSelectionPanel(true));
+ }
+ }
+
+
+ public boolean validateValues() {
+ String text = "";
+ String text2="";
+ boolean returnValue = false;
+ if (myBean.isManual()){
+ text = myBean.getManualFileName();
+ returnValue = (text!=null && text.trim().length()>0);
+ }else{
+ text = myBean.getAutomaticClassName();
+ text2 = myBean.getProviderClassName();
+ returnValue = (text!=null && text.trim().length()>0) &&
+ (text2!=null && text2.trim().length()>0) ;
+ }
+
+ return returnValue;
+ }
+
+ private void init(){
+ this.setLayout(null);
+ this.setSize(width,height);
+
+ initDescription("\n Select either the service xml file or the class that you want to \n " +
+ " expose as the service to auto generate a service.xml. \n " +
+ " Only the class files that are in the previously selected location can\n" +
+ " be laded from here");
+
+ ButtonGroup group = new ButtonGroup();
+
+ this.selectManualFileRadioButton = new JRadioButton("Select a file manually");
+ this.selectManualFileRadioButton.setBounds(hgap,descHeight,Constants.UIConstants.RADIO_BUTTON_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.add(this.selectManualFileRadioButton);
+ group.add(selectManualFileRadioButton);
+ this.selectManualFileRadioButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ changeSelectionScreen();
+ }
+ });
+ this.createAutomaticFileRadioButton = new JRadioButton("Create a file automatically");
+ this.createAutomaticFileRadioButton.setBounds(hgap,descHeight+vgap +Constants.UIConstants.GENERAL_COMP_HEIGHT ,Constants.UIConstants.RADIO_BUTTON_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.add(this.createAutomaticFileRadioButton);
+ group.add(createAutomaticFileRadioButton);
+ this.createAutomaticFileRadioButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ changeSelectionScreen();
+ }
+ });
+
+ this.selectionPanel = new JPanel();
+ this.selectionPanel.setLayout(null);
+ this.selectionPanel.setBounds(0,descHeight + 2*Constants.UIConstants.GENERAL_COMP_HEIGHT +2*vgap,width,100);
+ this.add(this.selectionPanel);
+
+ //select manual option by default
+
+
+
+ }
+ private void setDefaultValues(){
+ this.selectManualFileRadioButton.setSelected(true);
+ loadScreen(new ManualSelectionPanel());
+ updateBeanFlags(true);
+ }
+ private void changeSelectionScreen(){
+ if (selectManualFileRadioButton.isSelected()){
+ loadScreen(new ManualSelectionPanel(true));
+ updateBeanFlags(true);
+ } else{
+ loadScreen(new AutomaticSelectionPanel(true));
+ updateBeanFlags(false);
+ }
+ }
+ private void updateBeanFlags(boolean flag){
+ myBean.setManual(flag);myBean.setAutomatic(!flag);
+ }
+
+ private void loadScreen(JPanel panel){
+ this.selectionPanel.removeAll();
+ this.selectionPanel.add(panel);
+ this.repaint();
+ }
+
+
+
+ private class ManualSelectionPanel extends JPanel{
+
+ private JLabel serverXMLFileLocationLabel;
+ private JTextField serverXMLFileLocationTextBox;
+ private JButton browseButton;
+
+ public ManualSelectionPanel() {
+ init();
+ }
+
+ public ManualSelectionPanel(boolean loadVals) {
+ init();
+ if (loadVals){
+ this.serverXMLFileLocationTextBox.setText(myBean.getManualFileName());
+ }
+ }
+
+ private void init(){
+ this.setLayout(null);
+ this.setSize(width,100);
+
+ this.serverXMLFileLocationLabel = new JLabel("Service File");
+ this.add(this.serverXMLFileLocationLabel);
+ this.serverXMLFileLocationLabel.setBounds(hgap,vgap,Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+
+ this.serverXMLFileLocationTextBox = new JTextField();
+ this.add(this.serverXMLFileLocationTextBox);
+ this.serverXMLFileLocationTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,vgap,Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.serverXMLFileLocationTextBox.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ setOutFileName();
+ }
+ });
+ this.serverXMLFileLocationTextBox.addKeyListener(new KeyListener(){
+ public void keyTyped(KeyEvent e) { }
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) { setOutFileName();}
+ });
+
+ this.browseButton = new JButton(".");
+ this.add(this.browseButton);
+ this.browseButton.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap +Constants.UIConstants.TEXT_BOX_WIDTH,vgap,Constants.UIConstants.BROWSE_BUTTON_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.browseButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ serverXMLFileLocationTextBox.setText(browseForAFile("xml"));
+ setOutFileName();
+ }
+ });
+
+ }
+
+ private void setOutFileName(){
+ myBean.setManualFileName(serverXMLFileLocationTextBox.getText());
+ }
+ }
+
+ private class AutomaticSelectionPanel extends JPanel{
+
+ private JLabel classFileListLable;
+ private JLabel providerClassLable;
+ private JTextField classFileNameTextBox;
+ private JTextField providerClassNameTextBox;
+ private JButton loadButton;
+ private JButton advancedButton;
+
+ public AutomaticSelectionPanel() {
+ init();
+ }
+
+ public AutomaticSelectionPanel(boolean loadVals) {
+ init();
+ if (loadVals){
+ this.classFileNameTextBox.setText(myBean.getAutomaticClassName());
+ this.providerClassNameTextBox.setText(myBean.getProviderClassName());
+ }
+ }
+ private void init(){
+ this.setLayout(null);
+ this.setSize(width,100);
+
+ this.classFileListLable = new JLabel("Class Name");
+ this.add(this.classFileListLable);
+ this.classFileListLable.setBounds(hgap,vgap,Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+
+ this.classFileNameTextBox = new JTextField();
+ this.add(this.classFileNameTextBox);
+ this.classFileNameTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,vgap,Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.classFileNameTextBox.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ setClassName();
+ }
+ });
+ this.classFileNameTextBox.addKeyListener(new KeyListener(){
+ public void keyTyped(KeyEvent e) {}
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {setClassName();}
+ });
+
+ this.providerClassLable = new JLabel("Provider Class Name");
+ this.add(this.providerClassLable);
+ this.providerClassLable.setBounds(hgap,(Constants.UIConstants.GENERAL_COMP_HEIGHT+vgap),Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+
+ this.providerClassNameTextBox = new JTextField();
+ this.add(this.providerClassNameTextBox);
+ this.providerClassNameTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,(Constants.UIConstants.GENERAL_COMP_HEIGHT+vgap*2),Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.providerClassNameTextBox.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ setProviderClassName();
+ }
+ });
+ this.providerClassNameTextBox.addKeyListener(new KeyListener(){
+ public void keyTyped(KeyEvent e) {}
+ public void keyPressed(KeyEvent e) {}
+ public void keyReleased(KeyEvent e) {setProviderClassName();}
+ });
+
+ this.loadButton = new JButton("Load");
+ this.add(this.loadButton);
+ this.loadButton.setBounds(hgap,(Constants.UIConstants.GENERAL_COMP_HEIGHT+vgap)*2 + vgap,
+ Constants.UIConstants.GENERAL_BUTTON_WIDTH,
+ Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.loadButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ loadAllMethods();
+ }
+ });
+ loadButton.setEnabled(false);
+
+ this.advancedButton = new JButton("Advanced");
+ this.add(this.advancedButton);
+ this.advancedButton.setBounds(2*hgap +Constants.UIConstants.GENERAL_BUTTON_WIDTH
+ ,(Constants.UIConstants.GENERAL_COMP_HEIGHT+vgap)*2 + vgap,
+ Constants.UIConstants.GENERAL_BUTTON_WIDTH,
+ Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.advancedButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ openDialog();
+ }
+ });
+ this.advancedButton.setEnabled(false);
+ }
+
+ private void loadAllMethods(){
+ try {
+ ArrayList methodList = new Controller().getMethodList(parentBean);
+ myBean.setSelectedMethodNames(methodList);
+ loadButton.setEnabled(false);
+ advancedButton.setEnabled(true);
+ } catch (ProcessException e) {
+ showErrorMessage(e.getMessage());
+ }
+ }
+
+ private void openDialog(){
+ try {
+ new AdvancedSelectionDialog().show();
+ } catch (ProcessException e) {
+ showErrorMessage(e.getMessage());
+ }
+ }
+ private void setClassName(){
+ loadButton.setEnabled(true);
+ advancedButton.setEnabled(false);
+ myBean.setAutomaticClassName(classFileNameTextBox.getText());
+ }
+
+ private void setProviderClassName(){
+ //loadButton.setEnabled(true);
+ //advancedButton.setEnabled(false);
+ myBean.setProviderClassName(providerClassNameTextBox.getText());
+ }
+
+
+
+ }
+
+
+ private class AdvancedSelectionDialog extends JDialog{
+
+ private JPanel lablePanel;
+ private JButton okButton;
+ private JButton cancelButton;
+ private boolean[] selectedValues;
+ private ArrayList completeMethodList;
+
+
+ public AdvancedSelectionDialog() throws HeadlessException,ProcessException {
+ super();
+ super.setModal(true);
+ super.setTitle("Select Methods");
+ this.getContentPane().setLayout(null);
+ init();
+ }
+
+ private void init() throws ProcessException{
+ //load the class file list
+ this.completeMethodList = new Controller().getMethodList(parentBean);
+ int methodCount = this.completeMethodList.size();
+ int panelHeight = methodCount*(Constants.UIConstants.GENERAL_COMP_HEIGHT + vgap);
+
+ this.lablePanel = new JPanel();
+ this.lablePanel.setLayout(null);
+ this.lablePanel.setBounds(0,0,width,panelHeight);
+ this.getContentPane().add(this.lablePanel);
+
+ ArrayList currentSelectedList = myBean.getSelectedMethodNames();
+ //create check boxes for all the methods and add them to the panel
+ JCheckBox tempCheckBox;
+ boolean currentSelection;
+ this.selectedValues = new boolean[methodCount];
+
+ for (int i = 0; i < methodCount; i++) {
+ tempCheckBox = new JCheckBox(this.completeMethodList.get(i).toString());
+ currentSelection = currentSelectedList.contains(this.completeMethodList.get(i));
+ tempCheckBox.setSelected(currentSelection);
+ selectedValues[i] = currentSelection;
+ tempCheckBox.setBounds(hgap,vgap + (Constants.UIConstants.GENERAL_COMP_HEIGHT+vgap)*i,
+ Constants.UIConstants.LABEL_WIDTH*3,
+ Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ tempCheckBox.addActionListener(new CheckBoxActionListner(tempCheckBox,i));
+ this.lablePanel.add(tempCheckBox);
+
+ }
+
+ okButton = new JButton("OK");
+ this.getContentPane().add (this.okButton);
+ this.okButton.setBounds(hgap,panelHeight+vgap,
+ Constants.UIConstants.GENERAL_BUTTON_WIDTH,
+ Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.okButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ loadValuesToBean();
+ closeMe();
+ }
+ });
+
+ cancelButton = new JButton("Cancel");
+ this.getContentPane().add (this.cancelButton);
+ this.cancelButton.setBounds(hgap*2 +Constants.UIConstants.GENERAL_BUTTON_WIDTH ,panelHeight+vgap,
+ Constants.UIConstants.GENERAL_BUTTON_WIDTH,
+ Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.cancelButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ closeMe();
+ }
+ });
+
+ this.setSize(width,panelHeight+2*Constants.UIConstants.GENERAL_COMP_HEIGHT + 30);
+ this.setResizable(false);
+ }
+
+ private void updateSelection(JCheckBox checkBox,int index){
+ if (checkBox.isSelected()){
+ selectedValues[index] = true;
+ }else{
+ selectedValues[index] = false;
+ }
+
+ }
+
+ private void loadValuesToBean(){
+ ArrayList modifiedMethodList = new ArrayList();
+ for (int i = 0; i < selectedValues.length; i++) {
+ if( selectedValues[i])
+ modifiedMethodList.add(completeMethodList.get(i));
+ }
+
+ myBean.setSelectedMethodNames(modifiedMethodList);
+ }
+ private void closeMe(){
+ this.dispose();
+ }
+
+ private class CheckBoxActionListner implements ActionListener{
+ private JCheckBox checkBox;
+ private int index;
+
+ public CheckBoxActionListner(JCheckBox checkBox,int index) {
+ this.index = index;
+ this.checkBox = checkBox;
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ updateSelection(checkBox,index);
+ }
+
+ }
+ }
+
+
+}
Added: webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane3.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane3.java?rev=178360&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane3.java (added)
+++ webservices/axis/trunk/java/modules/tool/src/org/apache/axis/tool/service/swing/ui/WizardPane3.java Tue May 24 21:14:57 2005
@@ -0,0 +1,140 @@
+package org.apache.axis.tool.service.swing.ui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JTextField;
+
+import org.apache.axis.tool.bean.Page3Bean;
+import org.apache.axis.tool.bean.WizardBean;
+import org.apache.axis.tool.util.Constants;
+
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+public class WizardPane3 extends WizardPane{
+
+ private Page3Bean myBean;
+
+ private JLabel outputFileLocationLabel;
+ private JTextField outputFileLocationTextBox;
+ private JButton browseButton;
+
+ private JLabel outputFileNameLabel;
+ private JTextField outputFileNameTextBox;
+
+ public WizardPane3(WizardBean bean, JFrame ownerFrame) {
+ super(ownerFrame);
+ init();
+ if (bean.getPage3bean()!=null){
+ this.myBean = bean.getPage3bean();
+ setBeanValues();
+ }else{
+ this.myBean = new Page3Bean();
+ bean.setPage3bean(myBean);
+ }
+ }
+
+ public boolean validateValues() {
+ String text1 = myBean.getOutputFileName();
+ String text2 = myBean.getOutputFolderName();
+ boolean text1Validity = (text1!=null && text1.trim().length()>0);
+ boolean text2Validity = (text2!=null && text2.trim().length()>0);
+
+ return text1Validity && text2Validity;
+ }
+
+ private void setBeanValues(){
+ this.outputFileLocationTextBox.setText(myBean.getOutputFolderName());
+ this.outputFileNameTextBox.setText(myBean.getOutputFileName());
+ }
+
+ private void init(){
+ this.setLayout(null);
+ this.setSize(width,height);
+
+ initDescription("\nInput the location for the output file and the name for \n" +
+ "the compiled jar file " );
+
+
+ this.outputFileLocationLabel = new JLabel("Output Folder");
+ this.add(this.outputFileLocationLabel);
+ this.outputFileLocationLabel.setBounds(hgap,descHeight,Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+
+ this.outputFileLocationTextBox = new JTextField();
+ this.add(this.outputFileLocationTextBox);
+ this.outputFileLocationTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,descHeight,Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.outputFileLocationTextBox.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ handleLocationChange();
+ }
+ });
+ this.outputFileLocationTextBox.addKeyListener(new KeyListener(){
+ public void keyTyped(KeyEvent e) { }
+ public void keyPressed(KeyEvent e) {
+ handleLocationChange();
+ }
+ public void keyReleased(KeyEvent e) {}
+ });
+
+
+ this.browseButton = new JButton(".");
+ this.add(this.browseButton);
+ this.browseButton.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap +Constants.UIConstants.TEXT_BOX_WIDTH,descHeight,Constants.UIConstants.BROWSE_BUTTON_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.browseButton.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ outputFileLocationTextBox.setText(browseForAFolder());
+ handleLocationChange();
+
+ }
+ });
+
+
+
+ this.outputFileNameLabel = new JLabel("Out File Name");
+ this.add(this.outputFileNameLabel);
+ this.outputFileNameLabel.setBounds(hgap,descHeight +Constants.UIConstants.GENERAL_COMP_HEIGHT +vgap,Constants.UIConstants.LABEL_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+
+ this.outputFileNameTextBox = new JTextField();
+ this.add(this.outputFileNameTextBox);
+ this.outputFileNameTextBox.setBounds(Constants.UIConstants.LABEL_WIDTH + 2*hgap ,descHeight+Constants.UIConstants.GENERAL_COMP_HEIGHT +vgap,Constants.UIConstants.TEXT_BOX_WIDTH,Constants.UIConstants.GENERAL_COMP_HEIGHT);
+ this.outputFileNameTextBox.addActionListener(new ActionListener(){
+ public void actionPerformed(ActionEvent e) {
+ handleFileNameChange();
+ }
+ });
+ this.outputFileNameTextBox.addKeyListener(new KeyListener(){
+ public void keyTyped(KeyEvent e) { }
+ public void keyPressed(KeyEvent e) { }
+ public void keyReleased(KeyEvent e) { handleFileNameChange();}
+ });
+
+ }
+
+ private void handleLocationChange(){
+ myBean.setOutputFolderName(outputFileLocationTextBox.getText());
+ }
+
+ private void handleFileNameChange(){
+ myBean.setOutputFileName(outputFileNameTextBox.getText());
+ }
+
+}