http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/servicedescriptions/BeanshellTemplateService.java ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/servicedescriptions/BeanshellTemplateService.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/servicedescriptions/BeanshellTemplateService.java new file mode 100644 index 0000000..e5cec36 --- /dev/null +++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/servicedescriptions/BeanshellTemplateService.java @@ -0,0 +1,82 @@ +/* +* 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.taverna.activities.beanshell.servicedescriptions; + +import java.net.URI; + +import javax.swing.Icon; + +import org.apache.taverna.servicedescriptions.AbstractTemplateService; +import org.apache.taverna.servicedescriptions.ServiceDescription; +import org.apache.taverna.servicedescriptions.ServiceDescriptionProvider; +import org.apache.taverna.scufl2.api.configurations.Configuration; + +public class BeanshellTemplateService extends AbstractTemplateService { + + public static final URI ACTIVITY_TYPE = URI.create("http://ns.taverna.org.uk/2010/activity/beanshell"); + + private static final String BEANSHELL = "Beanshell"; + + private static final URI providerId = URI + .create("http://taverna.sf.net/2010/service-provider/beanshell"); + + public String getName() { + return BEANSHELL; + } + + @Override + public URI getActivityType() { + return ACTIVITY_TYPE; + } + + @Override + public Configuration getActivityConfiguration() { + Configuration configuration = new Configuration(); + configuration.setType(ACTIVITY_TYPE.resolve("#Config")); + configuration.getJsonAsObjectNode().put("script", ""); + configuration.getJsonAsObjectNode().put("classLoaderSharing", "workflow"); + return configuration; + } + + @Override + public Icon getIcon() { + return BeanshellActivityIcon.getBeanshellIcon(); + } + + @Override + public String getDescription() { + return "A service that allows Beanshell scripts, with dependencies on libraries"; + } + + public static ServiceDescription getServiceDescription() { + BeanshellTemplateService bts = new BeanshellTemplateService(); + return bts.templateService; + } + + public String getId() { + return providerId.toString(); + } + + @Override + public ServiceDescriptionProvider newInstance() { + return new BeanshellTemplateService(); + } + +}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellActivityViewFactory.java ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellActivityViewFactory.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellActivityViewFactory.java new file mode 100644 index 0000000..f00d6af --- /dev/null +++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellActivityViewFactory.java @@ -0,0 +1,83 @@ +/* +* 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.taverna.activities.beanshell.views; + +import java.net.URI; +import java.util.Arrays; +import java.util.List; + +import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry; +import org.apache.taverna.workbench.activityicons.ActivityIconManager; +import org.apache.taverna.workbench.configuration.colour.ColourManager; +import org.apache.taverna.workbench.edits.EditManager; +import org.apache.taverna.workbench.file.FileManager; +import org.apache.taverna.workbench.ui.views.contextualviews.ContextualView; +import org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory; +import uk.org.taverna.configuration.app.ApplicationConfiguration; +import org.apache.taverna.scufl2.api.activity.Activity; + +public class BeanshellActivityViewFactory implements ContextualViewFactory<Activity> { + + private static final URI ACTIVITY_TYPE = URI + .create("http://ns.taverna.org.uk/2010/activity/beanshell"); + + private EditManager editManager; + private FileManager fileManager; + private ActivityIconManager activityIconManager; + private ColourManager colourManager; + private ServiceDescriptionRegistry serviceDescriptionRegistry; + + private ApplicationConfiguration applicationConfiguration; + + public boolean canHandle(Object object) { + return object instanceof Activity && ((Activity) object).getType().equals(ACTIVITY_TYPE); + } + + public List<ContextualView> getViews(Activity activity) { + return Arrays.asList(new ContextualView[] { new BeanshellContextualView(activity, + editManager, fileManager, activityIconManager, colourManager, + serviceDescriptionRegistry, applicationConfiguration) }); + } + + public void setEditManager(EditManager editManager) { + this.editManager = editManager; + } + + public void setFileManager(FileManager fileManager) { + this.fileManager = fileManager; + } + + public void setActivityIconManager(ActivityIconManager activityIconManager) { + this.activityIconManager = activityIconManager; + } + + public void setColourManager(ColourManager colourManager) { + this.colourManager = colourManager; + } + + public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) { + this.serviceDescriptionRegistry = serviceDescriptionRegistry; + } + + public void setApplicationConfiguration(ApplicationConfiguration applicationConfiguration) { + this.applicationConfiguration = applicationConfiguration; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellConfigurationPanel.java ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellConfigurationPanel.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellConfigurationPanel.java new file mode 100644 index 0000000..5edcbc6 --- /dev/null +++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellConfigurationPanel.java @@ -0,0 +1,230 @@ +/* +* 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.taverna.activities.beanshell.views; + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.io.File; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JSpinner; +import javax.swing.SpinnerNumberModel; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; + +import org.apache.taverna.lang.ui.EditorKeySetUtil; +import org.apache.taverna.workbench.ui.views.contextualviews.activity.ActivityPortConfiguration; +import org.apache.taverna.workbench.ui.views.contextualviews.activity.DependencyConfigurationPanel; +import org.apache.taverna.workbench.ui.views.contextualviews.activity.ListConfigurationComponent; +import org.apache.taverna.workbench.ui.views.contextualviews.activity.MultiPageActivityConfigurationPanel; +import org.apache.taverna.workbench.ui.views.contextualviews.activity.ScriptConfigurationComponent; +import org.apache.taverna.workbench.ui.views.contextualviews.activity.ValidatingTextField; +import org.apache.taverna.workbench.ui.views.contextualviews.activity.ValidatingTextGroup; +import uk.org.taverna.configuration.app.ApplicationConfiguration; +import org.apache.taverna.scufl2.api.activity.Activity; +import org.apache.taverna.scufl2.api.port.InputActivityPort; +import org.apache.taverna.scufl2.api.port.OutputActivityPort; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ArrayNode; + +/** + * Component for configuring a Beanshell activity. + * + * @author David Withers + */ +@SuppressWarnings("serial") +public class BeanshellConfigurationPanel extends MultiPageActivityConfigurationPanel { + + private ScriptConfigurationComponent scriptConfigurationComponent; + private ValidatingTextGroup inputTextGroup, outputTextGroup; + private DependencyConfigurationPanel dependencyConfigurationPanel; + private File libDir; + + public BeanshellConfigurationPanel(Activity activity, + ApplicationConfiguration applicationConfiguration) { + super(activity); + libDir = new File(applicationConfiguration.getApplicationHomeDir(), "lib"); + if (!libDir.exists()) { + libDir.mkdir(); + } + initialise(); + } + + @Override + protected void initialise() { + super.initialise(); + removeAllPages(); + addPage("Script", createScriptEditPanel()); + addPage("Input ports", createInputPanel()); + addPage("Output ports", createOutputPanel()); + addPage("Dependencies", createDependenciesPanel()); + setPreferredSize(new Dimension(600, 500)); + } + + @Override + public void noteConfiguration() { + setProperty("script", scriptConfigurationComponent.getScript()); + setProperty("classLoaderSharing", dependencyConfigurationPanel.getClassLoaderSharing()); + List<String> localDependencies = dependencyConfigurationPanel.getLocalDependencies(); + if (localDependencies == null || localDependencies.isEmpty()) { + getJson().remove("localDependency"); + } else { + ArrayNode localDependenciesArray = getJson().arrayNode(); + for (String localDependency : localDependencies) { + localDependenciesArray.add(localDependency); + } + getJson().put("localDependency", localDependenciesArray); + } + } + + @Override + public boolean checkValues() { + return true; + } + + private Component createScriptEditPanel() { + Set<String> keywords = EditorKeySetUtil.loadKeySet(getClass().getResourceAsStream( + "keys.txt")); + Set<String> ports = new HashSet<>(); + for (InputActivityPort ip : getActivity().getInputPorts()) { + ports.add(ip.getName()); + } + for (OutputActivityPort op : getActivity().getOutputPorts()) { + ports.add(op.getName()); + } + scriptConfigurationComponent = new ScriptConfigurationComponent(getProperty("script"), + keywords, ports, "Beanshell", ".bsh"); + return scriptConfigurationComponent; + } + + private Component createInputPanel() { + inputTextGroup = new ValidatingTextGroup(); + ListConfigurationComponent<ActivityPortConfiguration> inputPanel = new ListConfigurationComponent<ActivityPortConfiguration>( + "Input Port", getInputPorts()) { + @Override + protected Component createItemComponent(ActivityPortConfiguration port) { + return new PortComponent(port, inputTextGroup); + } + + @Override + protected ActivityPortConfiguration createDefaultItem() { + return new ActivityPortConfiguration("in", 0); + } + }; + return inputPanel; + } + + private Component createOutputPanel() { + outputTextGroup = new ValidatingTextGroup(); + ListConfigurationComponent<ActivityPortConfiguration> inputPanel = new ListConfigurationComponent<ActivityPortConfiguration>( + "Output Port", getOutputPorts()) { + @Override + protected Component createItemComponent(ActivityPortConfiguration port) { + return new PortComponent(port, outputTextGroup); + } + + @Override + protected ActivityPortConfiguration createDefaultItem() { + return new ActivityPortConfiguration("out", 0); + } + }; + return inputPanel; + } + + private Component createDependenciesPanel() { + String classLoaderSharing = getProperty("classLoaderSharing"); + List<String> localDependencies = new ArrayList<>(); + if (getJson().has("localDependency")) { + for (JsonNode localDependency : getJson().get("localDependency")) { + localDependencies.add(localDependency.textValue()); + } + } + dependencyConfigurationPanel = new DependencyConfigurationPanel(classLoaderSharing, + localDependencies, libDir); + return dependencyConfigurationPanel; + } + + class PortComponent extends JPanel { + + private ValidatingTextField nameField; + private SpinnerNumberModel depthModel; + private final ValidatingTextGroup validatingTextGroup; + + public PortComponent(final ActivityPortConfiguration portConfiguration, + ValidatingTextGroup validatingTextGroup) { + this.validatingTextGroup = validatingTextGroup; + + nameField = new ValidatingTextField(portConfiguration.getName()); + nameField.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void removeUpdate(DocumentEvent e) { + portConfiguration.setName(nameField.getText()); + } + + @Override + public void insertUpdate(DocumentEvent e) { + portConfiguration.setName(nameField.getText()); + } + + @Override + public void changedUpdate(DocumentEvent e) { + portConfiguration.setName(nameField.getText()); + } + }); + validatingTextGroup.addValidTextComponent(nameField); + depthModel = new SpinnerNumberModel(portConfiguration.getDepth(), 0, 100, 1); + depthModel.addChangeListener(new ChangeListener() { + @Override + public void stateChanged(ChangeEvent e) { + portConfiguration.setDepth(depthModel.getNumber().intValue()); + } + }); + + setLayout(new GridBagLayout()); + GridBagConstraints c = new GridBagConstraints(); + c.anchor = GridBagConstraints.WEST; + add(new JLabel("Name"), c); + c.fill = GridBagConstraints.HORIZONTAL; + c.weightx = 1; + add(nameField, c); + c.fill = GridBagConstraints.NONE; + c.weightx = 0; + add(new JLabel("Depth"), c); + add(new JSpinner(depthModel), c); + + } + + public void removeNotify() { + validatingTextGroup.removeTextComponent(nameField); + } + + } + +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellContextualView.java ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellContextualView.java b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellContextualView.java new file mode 100644 index 0000000..cf276fa --- /dev/null +++ b/taverna-beanshell-activity-ui/src/main/java/org/apache/taverna/activities/beanshell/views/BeanshellContextualView.java @@ -0,0 +1,103 @@ +/* +* 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.taverna.activities.beanshell.views; + +import java.awt.Frame; + +import javax.swing.Action; + +import org.apache.taverna.activities.beanshell.actions.BeanshellActivityConfigurationAction; +import org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry; +import org.apache.taverna.workbench.activityicons.ActivityIconManager; +import org.apache.taverna.workbench.configuration.colour.ColourManager; +import org.apache.taverna.workbench.edits.EditManager; +import org.apache.taverna.workbench.file.FileManager; +import org.apache.taverna.workbench.ui.actions.activity.HTMLBasedActivityContextualView; +import uk.org.taverna.configuration.app.ApplicationConfiguration; +import org.apache.taverna.scufl2.api.activity.Activity; +import org.apache.taverna.scufl2.api.port.InputActivityPort; +import org.apache.taverna.scufl2.api.port.OutputActivityPort; + +/** + * A simple non editable HTML table view over a {@link BeanshellActivity}. + * Clicking on the configure button shows the editable {@link BeanshellConfigView} + * + * @author Ian Dunlop + * @author Stuart Owen + * @author David Withers + */ +@SuppressWarnings("serial") +public class BeanshellContextualView extends HTMLBasedActivityContextualView { + + private EditManager editManager; + private FileManager fileManager; + private final ActivityIconManager activityIconManager; + private final ServiceDescriptionRegistry serviceDescriptionRegistry; + private final ApplicationConfiguration applicationConfiguration; + + public BeanshellContextualView(Activity activity, EditManager editManager, + FileManager fileManager, ActivityIconManager activityIconManager, + ColourManager colourManager, ServiceDescriptionRegistry serviceDescriptionRegistry, + ApplicationConfiguration applicationConfiguration) { + super(activity, colourManager); + this.editManager = editManager; + this.fileManager = fileManager; + this.activityIconManager = activityIconManager; + this.serviceDescriptionRegistry = serviceDescriptionRegistry; + this.applicationConfiguration = applicationConfiguration; + init(); + } + + private void init() { + } + + @Override + protected String getRawTableRowsHtml() { + StringBuilder html = new StringBuilder(); + html.append("<tr><th>Input Port Name</th><th>Depth</th></tr>"); + for (InputActivityPort inputActivityPort : getActivity().getInputPorts()) { + html.append("<tr><td>" + inputActivityPort.getName() + "</td><td>"); + html.append(inputActivityPort.getDepth() + "</td></tr>"); + } + html.append("<tr><th>Output Port Name</th><th>Depth</th></tr>"); + for (OutputActivityPort outputActivityPort : getActivity().getOutputPorts()) { + html.append("<tr><td>" + outputActivityPort.getName() + "</td><td>"); + html.append(outputActivityPort.getDepth() + "</td></tr>"); + } + return html.toString(); + } + + @Override + public String getViewTitle() { + return "Beanshell service"; + } + + @Override + public Action getConfigureAction(Frame owner) { + return new BeanshellActivityConfigurationAction(getActivity(), owner, editManager, + fileManager, activityIconManager, serviceDescriptionRegistry, applicationConfiguration); + } + + @Override + public int getPreferredPosition() { + return 100; + } + +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider deleted file mode 100644 index a77db8d..0000000 --- a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider +++ /dev/null @@ -1 +0,0 @@ -net.sf.taverna.t2.activities.beanshell.servicedescriptions.BeanshellTemplateService http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent deleted file mode 100644 index a3c71cd..0000000 --- a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent +++ /dev/null @@ -1,3 +0,0 @@ -net.sf.taverna.t2.activities.beanshell.menu.AddBeanshellTemplateAction -net.sf.taverna.t2.activities.beanshell.menu.AddBeanshellTemplateMenuAction -net.sf.taverna.t2.activities.beanshell.menu.ConfigureBeanshellMenuAction http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI deleted file mode 100644 index a268bf1..0000000 --- a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI +++ /dev/null @@ -1 +0,0 @@ -net.sf.taverna.t2.activities.beanshell.servicedescriptions.BeanshellActivityIcon \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory deleted file mode 100644 index dcdf598..0000000 --- a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory +++ /dev/null @@ -1 +0,0 @@ -net.sf.taverna.t2.activities.beanshell.views.BeanshellActivityViewFactory \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider new file mode 100644 index 0000000..ef61c0a --- /dev/null +++ b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider @@ -0,0 +1 @@ +org.apache.taverna.activities.beanshell.servicedescriptions.BeanshellTemplateService http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent new file mode 100644 index 0000000..8cfb456 --- /dev/null +++ b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent @@ -0,0 +1,3 @@ +org.apache.taverna.activities.beanshell.menu.AddBeanshellTemplateAction +org.apache.taverna.activities.beanshell.menu.AddBeanshellTemplateMenuAction +org.apache.taverna.activities.beanshell.menu.ConfigureBeanshellMenuAction http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI new file mode 100644 index 0000000..27a2447 --- /dev/null +++ b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI @@ -0,0 +1 @@ +org.apache.taverna.activities.beanshell.servicedescriptions.BeanshellActivityIcon \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory new file mode 100644 index 0000000..7cbd7c2 --- /dev/null +++ b/taverna-beanshell-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory @@ -0,0 +1 @@ +org.apache.taverna.activities.beanshell.views.BeanshellActivityViewFactory \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context-osgi.xml ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context-osgi.xml b/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context-osgi.xml index 58a3e18..30b0534 100644 --- a/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context-osgi.xml +++ b/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context-osgi.xml @@ -6,23 +6,23 @@ http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"> - <service ref="BeanshellActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" /> + <service ref="BeanshellActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" /> - <service ref="BeanshellTemplateService" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" /> + <service ref="BeanshellTemplateService" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionProvider" /> <service ref="AddBeanshellTemplateAction" auto-export="interfaces" /> <service ref="AddBeanshellTemplateMenuAction" auto-export="interfaces" /> <service ref="ConfigureBeanshellMenuAction" auto-export="interfaces" /> - <service ref="BeanshellActivityViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" /> + <service ref="BeanshellActivityViewFactory" interface="org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory" /> - <reference id="editManager" interface="net.sf.taverna.t2.workbench.edits.EditManager" /> - <reference id="fileManager" interface="net.sf.taverna.t2.workbench.file.FileManager" /> - <reference id="menuManager" interface="net.sf.taverna.t2.ui.menu.MenuManager" /> - <reference id="selectionManager" interface="net.sf.taverna.t2.workbench.selection.SelectionManager" /> - <reference id="activityIconManager" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconManager" /> - <reference id="colourManager" interface="net.sf.taverna.t2.workbench.configuration.colour.ColourManager" /> - <reference id="serviceDescriptionRegistry" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry" /> + <reference id="editManager" interface="org.apache.taverna.workbench.edits.EditManager" /> + <reference id="fileManager" interface="org.apache.taverna.workbench.file.FileManager" /> + <reference id="menuManager" interface="org.apache.taverna.ui.menu.MenuManager" /> + <reference id="selectionManager" interface="org.apache.taverna.workbench.selection.SelectionManager" /> + <reference id="activityIconManager" interface="org.apache.taverna.workbench.activityicons.ActivityIconManager" /> + <reference id="colourManager" interface="org.apache.taverna.workbench.configuration.colour.ColourManager" /> + <reference id="serviceDescriptionRegistry" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionRegistry" /> <reference id="serviceRegistry" interface="uk.org.taverna.commons.services.ServiceRegistry" /> <reference id="applicationConfiguration" interface="uk.org.taverna.configuration.app.ApplicationConfiguration" /> http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context.xml ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context.xml b/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context.xml index fc6d5d4..620456e 100644 --- a/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context.xml +++ b/taverna-beanshell-activity-ui/src/main/resources/META-INF/spring/beanshell-activity-ui-context.xml @@ -3,11 +3,11 @@ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> - <bean id="BeanshellActivityIcon" class="net.sf.taverna.t2.activities.beanshell.servicedescriptions.BeanshellActivityIcon" /> + <bean id="BeanshellActivityIcon" class="org.apache.taverna.activities.beanshell.servicedescriptions.BeanshellActivityIcon" /> - <bean id="BeanshellTemplateService" class="net.sf.taverna.t2.activities.beanshell.servicedescriptions.BeanshellTemplateService" /> + <bean id="BeanshellTemplateService" class="org.apache.taverna.activities.beanshell.servicedescriptions.BeanshellTemplateService" /> - <bean id="AddBeanshellTemplateAction" class="net.sf.taverna.t2.activities.beanshell.menu.AddBeanshellTemplateAction"> + <bean id="AddBeanshellTemplateAction" class="org.apache.taverna.activities.beanshell.menu.AddBeanshellTemplateAction"> <property name="editManager" ref="editManager" /> <property name="menuManager" ref="menuManager" /> <property name="selectionManager" ref="selectionManager" /> @@ -15,7 +15,7 @@ <property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" /> <property name="serviceRegistry" ref="serviceRegistry" /> </bean> - <bean id="AddBeanshellTemplateMenuAction" class="net.sf.taverna.t2.activities.beanshell.menu.AddBeanshellTemplateMenuAction"> + <bean id="AddBeanshellTemplateMenuAction" class="org.apache.taverna.activities.beanshell.menu.AddBeanshellTemplateMenuAction"> <property name="editManager" ref="editManager" /> <property name="menuManager" ref="menuManager" /> <property name="selectionManager" ref="selectionManager" /> @@ -23,7 +23,7 @@ <property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" /> <property name="serviceRegistry" ref="serviceRegistry" /> </bean> - <bean id="ConfigureBeanshellMenuAction" class="net.sf.taverna.t2.activities.beanshell.menu.ConfigureBeanshellMenuAction"> + <bean id="ConfigureBeanshellMenuAction" class="org.apache.taverna.activities.beanshell.menu.ConfigureBeanshellMenuAction"> <property name="editManager" ref="editManager" /> <property name="fileManager" ref="fileManager" /> <property name="activityIconManager" ref="activityIconManager" /> @@ -31,7 +31,7 @@ <property name="applicationConfiguration" ref="applicationConfiguration" /> </bean> - <bean id="BeanshellActivityViewFactory" class="net.sf.taverna.t2.activities.beanshell.views.BeanshellActivityViewFactory"> + <bean id="BeanshellActivityViewFactory" class="org.apache.taverna.activities.beanshell.views.BeanshellActivityViewFactory"> <property name="editManager" ref="editManager" /> <property name="fileManager" ref="fileManager" /> <property name="activityIconManager" ref="activityIconManager" /> http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/net/sf/taverna/t2/activities/beanshell/views/keys.txt ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/resources/net/sf/taverna/t2/activities/beanshell/views/keys.txt b/taverna-beanshell-activity-ui/src/main/resources/net/sf/taverna/t2/activities/beanshell/views/keys.txt deleted file mode 100644 index 15cb51b..0000000 --- a/taverna-beanshell-activity-ui/src/main/resources/net/sf/taverna/t2/activities/beanshell/views/keys.txt +++ /dev/null @@ -1,90 +0,0 @@ -++ --- -+ -- -~ -! -* -/ -% -<< ->> ->>> -< -> -<= ->= -== -!= -& -^ -| -&& -|| -: -= -+= --= -*= -/= -%= -&= -^= -|= -<<= ->>= ->>>= -= -abstract -assert -boolean -break -byte -case -catch -char -class -const -continue -default -do -double -else -enum -extends -false -final -finally -float -for -goto -if -implements -import -instanceof -int -interface -long -native -new -null -package -private -protected -public -return -short -static -strictfp -super -switch -synchronized -this -throw -throws -transient -true -try -void -volatile -while \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-beanshell-activity-ui/src/main/resources/org/apache/taverna/activities/beanshell/views/keys.txt ---------------------------------------------------------------------- diff --git a/taverna-beanshell-activity-ui/src/main/resources/org/apache/taverna/activities/beanshell/views/keys.txt b/taverna-beanshell-activity-ui/src/main/resources/org/apache/taverna/activities/beanshell/views/keys.txt new file mode 100644 index 0000000..15cb51b --- /dev/null +++ b/taverna-beanshell-activity-ui/src/main/resources/org/apache/taverna/activities/beanshell/views/keys.txt @@ -0,0 +1,90 @@ +++ +-- ++ +- +~ +! +* +/ +% +<< +>> +>>> +< +> +<= +>= +== +!= +& +^ +| +&& +|| +: += ++= +-= +*= +/= +%= +&= +^= +|= +<<= +>>= +>>>= += +abstract +assert +boolean +break +byte +case +catch +char +class +const +continue +default +do +double +else +enum +extends +false +final +finally +float +for +goto +if +implements +import +instanceof +int +interface +long +native +new +null +package +private +protected +public +return +short +static +strictfp +super +switch +synchronized +this +throw +throws +transient +true +try +void +volatile +while \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/pom.xml ---------------------------------------------------------------------- diff --git a/taverna-external-tool-activity-ui/pom.xml b/taverna-external-tool-activity-ui/pom.xml index 80170e5..039a80b 100644 --- a/taverna-external-tool-activity-ui/pom.xml +++ b/taverna-external-tool-activity-ui/pom.xml @@ -67,6 +67,24 @@ <version>${junit.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.apache.taverna.workbench</groupId> + <artifactId>taverna-activity-tools</artifactId> + <version>3.1.0-incubating-SNAPSHOT</version> + <type>jar</type> + </dependency> + <dependency> + <groupId>javax.help</groupId> + <artifactId>javahelp</artifactId> + <version>2.0.02</version> + <type>jar</type> + </dependency> + <dependency> + <groupId>org.apache.taverna.workbench</groupId> + <artifactId>renderers-impl</artifactId> + <version>3.1.0-incubating-SNAPSHOT</version> + <type>jar</type> + </dependency> </dependencies> <repositories> <repository> http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/actions/ExternalToolActivityConfigureAction.java ---------------------------------------------------------------------- diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/actions/ExternalToolActivityConfigureAction.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/actions/ExternalToolActivityConfigureAction.java deleted file mode 100644 index 3e45fa2..0000000 --- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/actions/ExternalToolActivityConfigureAction.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2009 Hajo Nils Krabbenhoeft, INB, University of Luebeck - * modified 2010 Hajo Nils Krabbenhoeft, spratpix GmbH & Co. KG - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - ******************************************************************************/ - -package net.sf.taverna.t2.activities.externaltool.actions; - -import java.awt.Frame; -import java.awt.event.ActionEvent; - -import javax.swing.Action; - -import org.apache.taverna.activities.externaltool.ExternalToolActivity; -import org.apache.taverna.activities.externaltool.ExternalToolActivityConfigurationBean; -import net.sf.taverna.t2.activities.externaltool.views.ExternalToolConfigView; -import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager; -import net.sf.taverna.t2.workbench.edits.EditManager; -import net.sf.taverna.t2.workbench.file.FileManager; -import net.sf.taverna.t2.workbench.ui.actions.activity.ActivityConfigurationAction; -import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ActivityConfigurationDialog; - -/** - * This class implements an ActivityConfigurationAction to configure the ExternalToolActivity - * plugin. The configuration action is called "Configure UseCase invocation" and is implemented in - * the KnowARCConfigurationDialog inside the knowarc-usecases maven artifact. - * - * @author Hajo Nils Krabbenhoeft - */ -@SuppressWarnings("serial") -public class ExternalToolActivityConfigureAction extends - ActivityConfigurationAction {// <ExternalToolActivity, ExternalToolActivityConfigurationBean> { - - private final Frame owner; - private final EditManager editManager; - private final FileManager fileManager; - - public ExternalToolActivityConfigureAction(ExternalToolActivity activity, Frame owner, - EditManager editManager, FileManager fileManager, ActivityIconManager activityIconManager) { - super(activity, activityIconManager); - this.editManager = editManager; - this.fileManager = fileManager; - putValue(Action.NAME, "Configure tool invocation"); - this.owner = owner; - } - - public void actionPerformed(ActionEvent e) { - /* - * if (getActivity().getConfiguration() instanceof - * RegisteredExternalToolActivityConfigurationBean) { new KnowARCConfigurationDialog(owner, - * false, KnowARCConfigurationFactory.getConfiguration()).setVisible(true); } else - */{ - ActivityConfigurationDialog currentDialog = ActivityConfigurationAction - .getDialog(getActivity()); - if (currentDialog != null) { - currentDialog.toFront(); - return; - } - final ExternalToolConfigView externalToolConfigView = new ExternalToolConfigView( - (ExternalToolActivity) getActivity()); - final ActivityConfigurationDialog<ExternalToolActivity, ExternalToolActivityConfigurationBean> dialog = new ActivityConfigurationDialog<ExternalToolActivity, ExternalToolActivityConfigurationBean>( - getActivity(), externalToolConfigView, editManager, fileManager); - - ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/configuration/ToolInvocationConfiguration.java ---------------------------------------------------------------------- diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/configuration/ToolInvocationConfiguration.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/configuration/ToolInvocationConfiguration.java deleted file mode 100644 index 0877045..0000000 --- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/configuration/ToolInvocationConfiguration.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * - */ -package net.sf.taverna.t2.activities.externaltool.configuration; - -import java.util.HashMap; -import java.util.Map; - -import uk.org.taverna.configuration.AbstractConfigurable; - - -/** - * @author alanrw - * - */ -public class ToolInvocationConfiguration extends AbstractConfigurable { - - private static ToolInvocationConfiguration instance; - - private Map<String, String> defaultPropertyMap; - - public static ToolInvocationConfiguration getInstance() { - if (instance == null) { - instance = new ToolInvocationConfiguration(); - } - return instance; - } - - @Override - public String getCategory() { - return "general"; - } - - @Override - public Map<String, String> getDefaultPropertyMap() { - if (defaultPropertyMap == null) { - defaultPropertyMap = new HashMap<String, String>(); - } - return defaultPropertyMap; - } - - @Override - public String getDisplayName() { - return "Tool invocation"; - } - - @Override - public String getFilePrefix() { - return "ToolInvocation"; - } - - @Override - public String getUUID() { - return "B611F5C2-EB49-479E-B01A-7F3F56E6918A"; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/GroupPanel.java ---------------------------------------------------------------------- diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/GroupPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/GroupPanel.java deleted file mode 100644 index 8f62787..0000000 --- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/GroupPanel.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2007 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - ******************************************************************************/ -package net.sf.taverna.t2.activities.externaltool.manager; - -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; - -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.border.EmptyBorder; - -import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl; - -/** - * UI for creating/editing dataflow input ports. - * - * @author David Withers - */ -public class GroupPanel extends JPanel { - - private static final long serialVersionUID = 1L; - - private JTextField groupNameField; - - private JComboBox mechanismComboBox; - - private static InvocationGroupManager manager = InvocationGroupManagerImpl.getInstance(); - - public GroupPanel(Object[] mechanisms) { - super(new GridBagLayout()); - - groupNameField = new JTextField(); - - - setBorder(new EmptyBorder(10, 10, 10, 10)); - - GridBagConstraints constraints = new GridBagConstraints(); - - constraints.anchor = GridBagConstraints.WEST; - constraints.gridx = 0; - constraints.gridy = 0; - constraints.ipadx = 10; - add(new JLabel("Name:"), constraints); - - constraints.gridx = 1; - constraints.gridwidth = 2; - constraints.ipadx = 0; - constraints.weightx = 1d; - constraints.fill = GridBagConstraints.HORIZONTAL; - add(groupNameField, constraints); - - constraints.gridx = 0; - constraints.gridy = 1; - constraints.gridwidth = 1; - constraints.weightx = 0d; - constraints.fill = GridBagConstraints.NONE; - constraints.ipadx = 10; - constraints.insets = new Insets(10, 0, 0, 0); - add(new JLabel("Explicit location:"), constraints); - - mechanismComboBox = new JComboBox(mechanisms); - mechanismComboBox.setSelectedItem(manager.getDefaultMechanism()); - - constraints.gridx = 1; - constraints.gridwidth = 2; - constraints.ipadx = 0; - add(mechanismComboBox, constraints); - } - - /** - * Returns the portNameField. - * - * @return the portNameField - */ - public JTextField getGroupNameField() { - return groupNameField; - } - - /** - * Returns the group name. - * - * @return the group name - */ - public String getGroupName() { - return groupNameField.getText(); - } - - public InvocationMechanism getSelectedMechanism() { - return (InvocationMechanism) mechanismComboBox.getSelectedItem(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java ---------------------------------------------------------------------- diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java deleted file mode 100644 index 3d54b26..0000000 --- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerShutdownHook.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * - */ -package net.sf.taverna.t2.activities.externaltool.manager; - -import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl; -import net.sf.taverna.t2.workbench.ShutdownSPI; - -/** - * @author alanrw - * - */ -public class InvocationGroupManagerShutdownHook implements ShutdownSPI { - - /* (non-Javadoc) - * @see net.sf.taverna.t2.workbench.ShutdownSPI#positionHint() - */ - @Override - public int positionHint() { - return 710; - } - - /* (non-Javadoc) - * @see net.sf.taverna.t2.workbench.ShutdownSPI#shutdown() - */ - @Override - public boolean shutdown() { - InvocationGroupManager manager = InvocationGroupManagerImpl.getInstance(); - manager.saveConfiguration(); - manager.persistInvocations(); - return true; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerStartupHook.java ---------------------------------------------------------------------- diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerStartupHook.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerStartupHook.java deleted file mode 100644 index 43cf4df..0000000 --- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationGroupManagerStartupHook.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2010 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - ******************************************************************************/ -package net.sf.taverna.t2.activities.externaltool.manager; - -import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl; -import net.sf.taverna.t2.workbench.StartupSPI; - -/** - * Load previously saved workflow ids that were scheduled to be deleted before - * previous Taverna shutdown, and initiate deletion of them now. - * - * @see StoreRunIdsToDeleteLaterShutdownHook - * @see DatabaseCleanup - * - * @author Stian Soiland-Reyes - * - */ -public class InvocationGroupManagerStartupHook implements StartupSPI { - - public int positionHint() { - return 900; - } - - public boolean startup() { - InvocationGroupManagerImpl.getInstance().loadInvocations(); - return true; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationMechanismEditor.java ---------------------------------------------------------------------- diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationMechanismEditor.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationMechanismEditor.java deleted file mode 100644 index 495d22b..0000000 --- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/InvocationMechanismEditor.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * - */ -package net.sf.taverna.t2.activities.externaltool.manager; - -import javax.swing.JPanel; - -/** - * @author alanrw - * - */ -public abstract class InvocationMechanismEditor<T extends InvocationMechanism> extends JPanel { - - public abstract String getName(); - - public abstract boolean canShow(Class<?> c); - - public abstract void show(T invocationMechanism); - - public abstract T updateInvocationMechanism(); - - public abstract InvocationMechanism createMechanism(String mechanismName); - - public boolean isSingleton() { - return false; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/MechanismPanel.java ---------------------------------------------------------------------- diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/MechanismPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/MechanismPanel.java deleted file mode 100644 index c068d56..0000000 --- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/MechanismPanel.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2007 The University of Manchester - * - * Modifications to the initial code base are copyright of their - * respective authors, or their employers as appropriate. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License - * as published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - ******************************************************************************/ -package net.sf.taverna.t2.activities.externaltool.manager; - -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.util.List; - -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.border.EmptyBorder; - -/** - * UI for creating/editing dataflow input ports. - * - * @author David Withers - */ -public class MechanismPanel extends JPanel { - - private static final long serialVersionUID = 1L; - - private JTextField mechanismNameField; - - private JComboBox mechanismTypeSelector; - - public MechanismPanel(List<InvocationMechanismEditor<?>> invocationMechanismEditors) { - super(new GridBagLayout()); - - mechanismNameField = new JTextField(); - - - setBorder(new EmptyBorder(10, 10, 10, 10)); - - GridBagConstraints constraints = new GridBagConstraints(); - - constraints.anchor = GridBagConstraints.WEST; - constraints.gridx = 0; - constraints.gridy = 0; - constraints.ipadx = 10; - add(new JLabel("Name:"), constraints); - - constraints.gridx = 1; - constraints.gridwidth = 2; - constraints.ipadx = 0; - constraints.weightx = 1d; - constraints.fill = GridBagConstraints.HORIZONTAL; - add(mechanismNameField, constraints); - - constraints.gridx = 0; - constraints.gridy = 1; - constraints.gridwidth = 1; - constraints.weightx = 0d; - constraints.fill = GridBagConstraints.NONE; - constraints.ipadx = 10; - constraints.insets = new Insets(10, 0, 0, 0); - add(new JLabel("Type:"), constraints); - - mechanismTypeSelector = new JComboBox(); - for (InvocationMechanismEditor<?> ime : invocationMechanismEditors) { - if (!ime.isSingleton()) { - mechanismTypeSelector.addItem(ime.getName()); - } - } - constraints.gridx = 1; - constraints.gridwidth = 2; - constraints.ipadx = 0; - add(mechanismTypeSelector, constraints); - - - } - - /** - * Returns the portNameField. - * - * @return the portNameField - */ - public JTextField getMechanismNameField() { - return mechanismNameField; - } - - /** - * Returns the port name. - * - * @return the port name - */ - public String getMechanismName() { - return mechanismNameField.getText(); - } - - public String getMechanismTypeName() { - return (String) mechanismTypeSelector.getSelectedItem(); - } - - public Component getMechanismTypeSelector() { - return mechanismTypeSelector; - } - - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationPanel.java ---------------------------------------------------------------------- diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationPanel.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationPanel.java deleted file mode 100644 index 5b3c783..0000000 --- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationPanel.java +++ /dev/null @@ -1,379 +0,0 @@ -/** - * - */ -package net.sf.taverna.t2.activities.externaltool.manager; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import javax.swing.AbstractAction; -import javax.swing.DefaultListCellRenderer; -import javax.swing.DefaultListModel; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextArea; -import javax.swing.ListSelectionModel; -import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; - -import net.sf.taverna.t2.activities.externaltool.manager.impl.InvocationGroupManagerImpl; -import org.apache.taverna.lang.observer.Observable; -import org.apache.taverna.lang.observer.Observer; -import net.sf.taverna.t2.lang.ui.DeselectingButton; -import net.sf.taverna.t2.lang.ui.ValidatingUserInputDialog; -import net.sf.taverna.t2.workbench.helper.Helper; - -/** - * @author alanrw - * - */ -public class ToolInvocationConfigurationPanel extends JPanel implements - Observer<InvocationManagerEvent> { - - public static final String HEADER_TEXT = "A tool can be set to run at an explicit location (e.g. on a specificic machine or one of a set of machines). Alternatively, it can be set to run at a symbolic location, which means the tool will then be run at the explicit location pointed to by the symbolic location."; - - private static InvocationGroupManagerImpl manager = InvocationGroupManagerImpl.getInstance(); - - private final List<InvocationMechanismEditor<?>> invocationMechanismEditors; - - private JTextArea headerText; - - private static String EXPLICIT_LOCATIONS = "explicit locations"; - private static String SYMBOLIC_LOCATIONS = "symbolic locations"; - - private List<MechanismCreator> mechanismCreators; - - JList locationList = new JList(); - - DefaultListModel groupListModel = new DefaultListModel(); - DefaultListModel mechanismListModel = new DefaultListModel(); - JComboBox locationTypeCombo = new JComboBox(new String[] { EXPLICIT_LOCATIONS, - SYMBOLIC_LOCATIONS }); - - public ToolInvocationConfigurationPanel(List<MechanismCreator> mechanismCreators, - List<InvocationMechanismEditor<?>> invocationMechanismEditors) { - super(); - this.mechanismCreators = mechanismCreators; - this.invocationMechanismEditors = invocationMechanismEditors; - manager.addObserver(this); - - this.setLayout(new GridBagLayout()); - GridBagConstraints gbc = new GridBagConstraints(); - - headerText = new JTextArea(HEADER_TEXT); - headerText.setLineWrap(true); - headerText.setWrapStyleWord(true); - headerText.setEditable(false); - headerText.setFocusable(false); - headerText.setBorder(new EmptyBorder(10, 10, 10, 10)); - - gbc.anchor = GridBagConstraints.WEST; - gbc.insets = new Insets(0, 0, 10, 0); - gbc.gridx = 0; - gbc.gridy = 0; - gbc.gridwidth = 1; - gbc.weightx = 1.0; - gbc.weighty = 0.0; - gbc.fill = GridBagConstraints.HORIZONTAL; - add(headerText, gbc); - - JPanel locationPanel = new JPanel(new BorderLayout()); - JPanel subPanel = new JPanel(new FlowLayout()); - JLabel modify = new JLabel("Modify:"); - - locationTypeCombo.setSelectedItem(EXPLICIT_LOCATIONS); - locationTypeCombo.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - switchList(); - } - }); - subPanel.add(modify); - subPanel.add(locationTypeCombo); - - populateLists(); - switchList(); - locationList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - locationList.setCellRenderer(new DefaultListCellRenderer() { - public Component getListCellRendererComponent(JList list, Object value, int index, - boolean isSelected, boolean cellHasFocus) { - Object toShow = value; - if (value instanceof InvocationGroup) { - InvocationGroup invocationGroup = (InvocationGroup) value; - toShow = invocationGroup.getName() + " --> " - + invocationGroup.getMechanismName(); - } - return super.getListCellRendererComponent(list, toShow, index, isSelected, - cellHasFocus); - } - }); - locationPanel.add(new JScrollPane(locationList), BorderLayout.CENTER); - locationPanel.add(subPanel, BorderLayout.NORTH); - - JPanel buttonPanel = new JPanel(new FlowLayout()); - JButton helpButton = new DeselectingButton("Help", new AbstractAction() { - - public void actionPerformed(ActionEvent e) { - Helper.showHelp(ToolInvocationConfigurationPanel.this); - } - }); - - buttonPanel.add(helpButton); - - buttonPanel.add(addLocationButton()); - buttonPanel.add(removeLocationButton()); - buttonPanel.add(editLocationButton()); - locationPanel.add(buttonPanel, BorderLayout.SOUTH); - - gbc.gridy++; - gbc.weighty = 1; - - gbc.fill = GridBagConstraints.BOTH; - gbc.anchor = GridBagConstraints.SOUTH; - gbc.insets = new Insets(10, 0, 0, 0); - this.add(locationPanel, gbc); - } - - private void switchList() { - if (isShowingGroups()) { - locationList.setModel(groupListModel); - } else { - locationList.setModel(mechanismListModel); - } - } - - private void populateLists() { - poopulateGroupList(); - populateMechanismList(); - } - - private void populateMechanismList() { - Object currentSelection = locationList.getSelectedValue(); - ArrayList<InvocationMechanism> mechanisms = new ArrayList<InvocationMechanism>(); - mechanisms.addAll(manager.getMechanisms()); - Collections.sort(mechanisms, new Comparator<InvocationMechanism>() { - - @Override - public int compare(InvocationMechanism o1, InvocationMechanism o2) { - return o1.getName().compareTo(o2.getName()); - } - }); - mechanismListModel.clear(); - for (InvocationMechanism m : mechanisms) { - mechanismListModel.addElement(m); - } - if ((currentSelection != null) && !isShowingGroups()) { - locationList.setSelectedValue(currentSelection, true); - } - } - - private void poopulateGroupList() { - Object currentSelection = locationList.getSelectedValue(); - ArrayList<InvocationGroup> groups = new ArrayList<InvocationGroup>(); - groups.addAll(manager.getInvocationGroups()); - Collections.sort(groups, new Comparator<InvocationGroup>() { - - @Override - public int compare(InvocationGroup o1, InvocationGroup o2) { - return o1.getName().compareTo(o2.getName()); - } - }); - groupListModel.clear(); - for (InvocationGroup g : groups) { - groupListModel.addElement(g); - } - if ((currentSelection != null) && isShowingGroups()) { - locationList.setSelectedValue(currentSelection, true); - } - } - - private boolean isShowingGroups() { - return (locationTypeCombo.getSelectedItem().equals(SYMBOLIC_LOCATIONS)); - } - - private JButton addLocationButton() { - final JButton result = new DeselectingButton("Add", new AbstractAction() { - - @Override - public void actionPerformed(ActionEvent e) { - if (isShowingGroups()) { - Set<String> usedGroupNames = new HashSet<String>(); - for (InvocationGroup g : manager.getInvocationGroups()) { - usedGroupNames.add(g.getName()); - } - - GroupPanel inputPanel = new GroupPanel(mechanismListModel.toArray()); - - ValidatingUserInputDialog vuid = new ValidatingUserInputDialog( - "Add symbolic location", inputPanel); - vuid.addTextComponentValidation(inputPanel.getGroupNameField(), - "Set the symbolic location name.", usedGroupNames, - "Duplicate symbolic location name.", "[\\p{L}\\p{Digit}_.]+", - "Invalid symbolic location name."); - vuid.setSize(new Dimension(400, 250)); - - if (vuid.show(ToolInvocationConfigurationPanel.this)) { - String groupName = inputPanel.getGroupName(); - InvocationGroup newGroup = new InvocationGroup(mechanismCreators); - newGroup.setName(groupName); - newGroup.setMechanism(inputPanel.getSelectedMechanism()); - manager.addInvocationGroup(newGroup); - locationList.setSelectedValue(newGroup, true); - } - } else { - Set<String> usedNames = new HashSet<String>(); - for (InvocationMechanism m : manager.getMechanisms()) { - usedNames.add(m.getName()); - } - - MechanismPanel inputPanel = new MechanismPanel(invocationMechanismEditors); - - ValidatingUserInputDialog vuid = new ValidatingUserInputDialog( - "Add explicit location", inputPanel); - vuid.addTextComponentValidation(inputPanel.getMechanismNameField(), - "Set the explicit location name.", usedNames, - "Duplicate explicit location name.", "[\\p{L}\\p{Digit}_.]+", - "Invalid explicit location name."); - vuid.addMessageComponent(inputPanel.getMechanismTypeSelector(), - "Set the location name and type."); - vuid.setSize(new Dimension(400, 250)); - - if (vuid.show(ToolInvocationConfigurationPanel.this)) { - String mechanismName = inputPanel.getMechanismName(); - String mechanismTypeName = inputPanel.getMechanismTypeName(); - InvocationMechanismEditor ime = findEditor(mechanismTypeName); - InvocationMechanism newMechanism = ime.createMechanism(mechanismName); - manager.addMechanism(newMechanism); - ime.show(newMechanism); - ime.setPreferredSize(new Dimension(550, 500)); - int answer = JOptionPane.showConfirmDialog( - ToolInvocationConfigurationPanel.this, ime, - "New explicit location", JOptionPane.OK_CANCEL_OPTION, - JOptionPane.PLAIN_MESSAGE, null); - if (answer == JOptionPane.OK_OPTION) { - ime.updateInvocationMechanism(); - InvocationGroupManagerImpl.getInstance().mechanismChanged(newMechanism); - } - locationList.setSelectedValue(newMechanism, true); - } - } - } - }); - return result; - } - - private JButton removeLocationButton() { - JButton result = new DeselectingButton("Remove", new AbstractAction() { - - @Override - public void actionPerformed(ActionEvent e) { - if (isShowingGroups()) { - InvocationGroup toRemove = (InvocationGroup) locationList.getSelectedValue(); - if ((toRemove != null) && !toRemove.equals(manager.getDefaultGroup())) { - manager.removeInvocationGroup(toRemove); - } - locationList.setSelectedValue(manager.getDefaultGroup(), true); - } else { - InvocationMechanism toRemove = (InvocationMechanism) locationList - .getSelectedValue(); - if ((toRemove != null) && !toRemove.equals(manager.getDefaultMechanism())) { - manager.removeMechanism(toRemove); - locationList.setSelectedValue(manager.getDefaultMechanism(), true); - } - } - } - }); - return result; - } - - private JButton editLocationButton() { - final JButton result = new DeselectingButton("Edit", new AbstractAction() { - - @Override - public void actionPerformed(ActionEvent e) { - if (isShowingGroups()) { - InvocationGroup toEdit = (InvocationGroup) locationList.getSelectedValue(); - if (toEdit != null) { - InvocationMechanism chosenMechanism = (InvocationMechanism) JOptionPane - .showInputDialog(ToolInvocationConfigurationPanel.this, - "Select an explicit location", "Edit symbolic location", - JOptionPane.PLAIN_MESSAGE, null, - mechanismListModel.toArray(), toEdit.getMechanism()); - if (chosenMechanism != null) { - toEdit.setMechanism(chosenMechanism); - manager.groupChanged(toEdit); - } - } - } else { - InvocationMechanism toEdit = (InvocationMechanism) locationList - .getSelectedValue(); - if (toEdit != null) { - InvocationMechanismEditor ime = findEditor(toEdit.getClass()); - ime.show(toEdit); - ime.setPreferredSize(new Dimension(550, 500)); - int answer = JOptionPane.showConfirmDialog( - ToolInvocationConfigurationPanel.this, ime, - "Edit explicit location", JOptionPane.OK_CANCEL_OPTION, - JOptionPane.PLAIN_MESSAGE, null); - if (answer == JOptionPane.OK_OPTION) { - ime.updateInvocationMechanism(); - InvocationGroupManagerImpl.getInstance().mechanismChanged(toEdit); - } - } - } - } - }); - return result; - } - - protected InvocationMechanismEditor findEditor(String name) { - for (InvocationMechanismEditor ime : invocationMechanismEditors) { - if (ime.getName().equalsIgnoreCase(name)) { - return ime; - } - } - return null; - } - - protected InvocationMechanismEditor findEditor(Class c) { - for (InvocationMechanismEditor ime : invocationMechanismEditors) { - if (ime.canShow(c)) { - return ime; - } - } - return null; - } - - @Override - public void notify(Observable<InvocationManagerEvent> arg0, InvocationManagerEvent arg1) - throws Exception { - if (SwingUtilities.isEventDispatchThread()) { - populateLists(); - } else { - SwingUtilities.invokeLater(new Runnable() { - public void run() { - populateLists(); - } - }); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationUIFactory.java ---------------------------------------------------------------------- diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationUIFactory.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationUIFactory.java deleted file mode 100644 index 82dd443..0000000 --- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ToolInvocationConfigurationUIFactory.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * - */ -package net.sf.taverna.t2.activities.externaltool.manager; - -import java.util.List; - -import javax.swing.JPanel; - -import uk.org.taverna.configuration.Configurable; -import uk.org.taverna.configuration.ConfigurationUIFactory; - -import net.sf.taverna.t2.activities.externaltool.configuration.ToolInvocationConfiguration; - -/** - * @author alanrw - * - */ -public class ToolInvocationConfigurationUIFactory implements ConfigurationUIFactory { - - private List<MechanismCreator> mechanismCreators; - private List<InvocationMechanismEditor<?>> invocationMechanismEditors; - - private ToolInvocationConfigurationPanel configPanel; - - @Override - public boolean canHandle(String uuid) { - return uuid.equals(getConfigurable().getUUID()); - } - - @Override - public Configurable getConfigurable() { - return ToolInvocationConfiguration.getInstance(); - } - - @Override - public JPanel getConfigurationPanel() { - if (configPanel == null) { - configPanel = new ToolInvocationConfigurationPanel(mechanismCreators, - invocationMechanismEditors); - } - return configPanel; - } - - public void setMechanismCreators(List<MechanismCreator> mechanismCreators) { - this.mechanismCreators = mechanismCreators; - } - - public void setInvocationMechanismEditors( - List<InvocationMechanismEditor<?>> invocationMechanismEditors) { - this.invocationMechanismEditors = invocationMechanismEditors; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/local/LocalInvocationMechanismEditor.java ---------------------------------------------------------------------- diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/local/LocalInvocationMechanismEditor.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/local/LocalInvocationMechanismEditor.java deleted file mode 100644 index 64fcc36..0000000 --- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/local/LocalInvocationMechanismEditor.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * - */ -package net.sf.taverna.t2.activities.externaltool.manager.local; - -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; - -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -import net.sf.taverna.t2.activities.externaltool.local.ExternalToolLocalInvocationMechanism; -import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanism; -import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanismEditor; - -/** - * @author alanrw - * - */ -public final class LocalInvocationMechanismEditor extends - InvocationMechanismEditor<ExternalToolLocalInvocationMechanism> { - - private ExternalToolLocalInvocationMechanism invocationMechanism; - - private JTextField directoryField = new JTextField(30); - - private JTextField shellPrefixField = new JTextField(30); - - private JTextField linkCommandField = new JTextField(30); - - private JCheckBox retrieveDataField = new JCheckBox(); - - - @Override - public boolean canShow(Class<?> c) { - return ExternalToolLocalInvocationMechanism.class.isAssignableFrom(c); - } - - @Override - public String getName() { - return ("Local"); - } - - @Override - public void show(ExternalToolLocalInvocationMechanism invocationMechanism) { - this.invocationMechanism = invocationMechanism; - this.removeAll(); - final JPanel innerPanel = new JPanel(new GridBagLayout()); - final GridBagConstraints inputConstraint = new GridBagConstraints(); -// inputConstraint.insets = new Insets(5,5,5,5); - inputConstraint.anchor = GridBagConstraints.FIRST_LINE_START; - inputConstraint.gridx = 0; - inputConstraint.gridy = 0; - inputConstraint.weightx = 0.1; - inputConstraint.fill = GridBagConstraints.BOTH; - innerPanel.add(new JLabel("Working directory: "), inputConstraint); - inputConstraint.gridx++; - directoryField.setText(invocationMechanism.getDirectory()); - innerPanel.add(directoryField, inputConstraint); - inputConstraint.gridx = 0; - inputConstraint.gridy++; - innerPanel.add(new JLabel("Shell: "), inputConstraint); - inputConstraint.gridx++; - shellPrefixField.setText(invocationMechanism.getShellPrefix()); - innerPanel.add(shellPrefixField, inputConstraint); - - inputConstraint.gridx = 0; - inputConstraint.gridy++; - innerPanel.add(new JLabel("Link command: "), inputConstraint); - inputConstraint.gridx++; - linkCommandField.setText(invocationMechanism.getLinkCommand()); - innerPanel.add(linkCommandField, inputConstraint); - - inputConstraint.gridx = 0; - inputConstraint.gridy++; - innerPanel.add(new JLabel("Fetch data: "), inputConstraint); - inputConstraint.gridx++; - retrieveDataField.setSelected(invocationMechanism.isRetrieveData()); - innerPanel.add(retrieveDataField, inputConstraint); - - this.add(innerPanel); - } - - @Override - public ExternalToolLocalInvocationMechanism updateInvocationMechanism() { - if ((directoryField.getText() == null) || (directoryField.getText().length() == 0)) { - invocationMechanism.setDirectory(null); - } else { - invocationMechanism.setDirectory(directoryField.getText()); - } - if ((shellPrefixField.getText() == null) || (shellPrefixField.getText().length() == 0)) { - invocationMechanism.setShellPrefix(null); - } else { - invocationMechanism.setShellPrefix(shellPrefixField.getText()); - } - if ((shellPrefixField.getText() == null) || (shellPrefixField.getText().length() == 0)) { - invocationMechanism.setShellPrefix(null); - } else { - invocationMechanism.setShellPrefix(shellPrefixField.getText()); - } - if ((linkCommandField.getText() == null) || (linkCommandField.getText().length() == 0)) { - invocationMechanism.setLinkCommand(null); - } else { - invocationMechanism.setLinkCommand(linkCommandField.getText()); - } - invocationMechanism.setRetrieveData(retrieveDataField.isSelected()); - return invocationMechanism; - } - - @Override - public InvocationMechanism createMechanism(String mechanismName) { - ExternalToolLocalInvocationMechanism result = new ExternalToolLocalInvocationMechanism(); - result.setName(mechanismName); - return(result); - } - - public boolean isSingleton() { - return true; - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ssh/ExternalToolSshNodeViewer.java ---------------------------------------------------------------------- diff --git a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ssh/ExternalToolSshNodeViewer.java b/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ssh/ExternalToolSshNodeViewer.java deleted file mode 100644 index fb837c5..0000000 --- a/taverna-external-tool-activity-ui/src/main/java/net/sf/taverna/t2/activities/externaltool/manager/ssh/ExternalToolSshNodeViewer.java +++ /dev/null @@ -1,110 +0,0 @@ -/** - * - */ -package net.sf.taverna.t2.activities.externaltool.manager.ssh; - -import javax.swing.JCheckBox; -import javax.swing.JTextField; - -import net.sf.taverna.t2.activities.externaltool.manager.InvocationMechanism; - -import de.uni_luebeck.inb.knowarc.usecases.invocation.ssh.SshNode; - - - -/** - * @author alanrw - * - */ -public class ExternalToolSshNodeViewer { - - private JTextField hostnameField; - private JTextField portField; - private JTextField directoryField; - private JTextField linkCommandField; - private JTextField copyCommandField; - private JCheckBox retrieveDataField; - - public ExternalToolSshNodeViewer(SshNode node) { - this(); - hostnameField.setText(node.getHost()); - portField.setText(Integer.toString(node.getPort())); - if (node.getDirectory() != null) { - directoryField.setText(node.getDirectory()); - } else { - directoryField.setText(""); - } - if (node.getLinkCommand() != null) { - linkCommandField.setText(node.getLinkCommand()); - } else { - linkCommandField.setText(""); - } - if (node.getCopyCommand() != null) { - copyCommandField.setText(node.getCopyCommand()); - } else { - copyCommandField.setText(""); - } - retrieveDataField.setSelected(node.isRetrieveData()); - } - - public ExternalToolSshNodeViewer() { - hostnameField = new JTextField(30); - hostnameField.setText(SshNode.DEFAULT_HOST); - portField = new JTextField(3); - portField.setText("" + SshNode.DEFAULT_PORT); - directoryField = new JTextField(30); - directoryField.setText(SshNode.DEFAULT_DIRECTORY); - linkCommandField = new JTextField(30); - linkCommandField.setText(InvocationMechanism.UNIX_LINK); - copyCommandField = new JTextField(30); - copyCommandField.setText(InvocationMechanism.UNIX_COPY); - retrieveDataField = new JCheckBox(); - } - - public JTextField getHostnameField() { - return hostnameField; - } - - public JTextField getPortField() { - return portField; - } - - public JTextField getDirectoryField() { - return directoryField; - } - - public JTextField getLinkCommandField() { - return linkCommandField; - } - - public JTextField getCopyCommandField() { - return copyCommandField; - } - - public String getHostname() { - return hostnameField.getText(); - } - - public int getPort() { - return Integer.parseInt(portField.getText()); - } - - public String getDirectory() { - return directoryField.getText(); - } - - public String getLinkCommand() { - return linkCommandField.getText(); - } - - public String getCopyCommand() { - return copyCommandField.getText(); - } - - /** - * @return the retrieveDataField - */ - public JCheckBox getRetrieveDataField() { - return retrieveDataField; - } -}
