http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextViewFactory.java ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextViewFactory.java b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextViewFactory.java new file mode 100644 index 0000000..a51e783 --- /dev/null +++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextViewFactory.java @@ -0,0 +1,81 @@ +/* +* 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.rest.ui.view; + +import java.util.Arrays; +import java.util.List; + +import org.apache.taverna.activities.rest.ui.servicedescription.GenericRESTTemplateService; +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 org.apache.taverna.commons.services.ServiceRegistry; +import org.apache.taverna.scufl2.api.activity.Activity; + +public class RESTActivityMainContextViewFactory implements ContextualViewFactory<Activity> { + + private EditManager editManager; + private FileManager fileManager; + private ActivityIconManager activityIconManager; + private ColourManager colourManager; + private ServiceDescriptionRegistry serviceDescriptionRegistry; + private ServiceRegistry serviceRegistry; + + public boolean canHandle(Object selection) { + return selection instanceof Activity + && ((Activity) selection).getType() + .equals(GenericRESTTemplateService.ACTIVITY_TYPE); + } + + public List<ContextualView> getViews(Activity selection) { + return Arrays.<ContextualView> asList(new RESTActivityMainContextualView(selection, + editManager, fileManager, activityIconManager, colourManager, + serviceDescriptionRegistry, serviceRegistry)); + } + + 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 setServiceRegistry(ServiceRegistry serviceRegistry) { + this.serviceRegistry = serviceRegistry; + } + +}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextualView.java ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextualView.java b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextualView.java new file mode 100644 index 0000000..3bab024 --- /dev/null +++ b/taverna-rest-activity-ui/src/main/java/org/apache/taverna/activities/rest/ui/view/RESTActivityMainContextualView.java @@ -0,0 +1,239 @@ +/* +* 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.rest.ui.view; + +import java.awt.Font; +import java.awt.Frame; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; + +import javax.swing.Action; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; + +import org.apache.taverna.activities.rest.RESTActivity; +import org.apache.taverna.activities.rest.RESTActivity.HTTP_METHOD; +import org.apache.taverna.activities.rest.RESTActivityConfigurationBean; +import org.apache.taverna.activities.rest.ui.config.RESTActivityConfigureAction; +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.commons.services.ServiceRegistry; +import org.apache.taverna.scufl2.api.activity.Activity; +import org.apache.taverna.scufl2.api.common.Scufl2Tools; +import org.apache.taverna.scufl2.api.configurations.Configuration; + +@SuppressWarnings("serial") +public class RESTActivityMainContextualView extends ContextualView { + + private final Scufl2Tools scufl2Tools = new Scufl2Tools(); + + private final Activity activity; + + private JPanel jpMainPanel; + private JTextField tfHTTPMethod; + private JTextArea taURLSignature; + private JTextField tfAcceptHeader; + private JLabel jlContentType; + private JTextField tfContentTypeHeader; + private JLabel jlSendDataAs; + private JTextField tfSendDataAs; + private JLabel jlSendHTTPExpectRequestHeader; + private JTextField tfSendHTTPExpectRequestHeader; + + private final EditManager editManager; + private final FileManager fileManager; + private final ActivityIconManager activityIconManager; + private final ColourManager colourManager; + private final ServiceDescriptionRegistry serviceDescriptionRegistry; + private final ServiceRegistry serviceRegistry; + + public RESTActivityMainContextualView(Activity activity, EditManager editManager, + FileManager fileManager, ActivityIconManager activityIconManager, + ColourManager colourManager, ServiceDescriptionRegistry serviceDescriptionRegistry, + ServiceRegistry serviceRegistry) { + this.activity = activity; + this.editManager = editManager; + this.fileManager = fileManager; + this.activityIconManager = activityIconManager; + this.colourManager = colourManager; + this.serviceDescriptionRegistry = serviceDescriptionRegistry; + this.serviceRegistry = serviceRegistry; + initView(); + } + + @Override + public JComponent getMainFrame() { + jpMainPanel = new JPanel(new GridBagLayout()); + jpMainPanel + .setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 2, + 4, 2), BorderFactory.createLineBorder( + colourManager.getPreferredColour(RESTActivity.class.getCanonicalName()), 2))); + + GridBagConstraints c = new GridBagConstraints(); + c.fill = GridBagConstraints.HORIZONTAL; + c.anchor = GridBagConstraints.WEST; + c.weighty = 0; + + c.gridx = 0; + c.gridy = 0; + c.insets = new Insets(5, 5, 5, 5); + JLabel jlHTTPMethod = new JLabel("HTTP Method:"); + jlHTTPMethod.setFont(jlHTTPMethod.getFont().deriveFont(Font.BOLD)); + jpMainPanel.add(jlHTTPMethod, c); + + c.gridx++; + c.weightx = 1.0; + tfHTTPMethod = new JTextField(); + tfHTTPMethod.setEditable(false); + jpMainPanel.add(tfHTTPMethod, c); + c.weightx = 0; + + c.gridx = 0; + c.gridy++; + JLabel jlURLSignature = new JLabel("URL Template:"); + jlURLSignature.setFont(jlURLSignature.getFont().deriveFont(Font.BOLD)); + jpMainPanel.add(jlURLSignature, c); + + c.gridx++; + taURLSignature = new JTextArea(3, 30); + taURLSignature.setEditable(false); + taURLSignature.setLineWrap(true); + JScrollPane spURLSignature = new JScrollPane(taURLSignature); + jpMainPanel.add(spURLSignature, c); + + c.gridx = 0; + c.gridy++; + JLabel jlAcceptHeader = new JLabel("'Accept' header:"); + jlAcceptHeader.setFont(jlAcceptHeader.getFont().deriveFont(Font.BOLD)); + jpMainPanel.add(jlAcceptHeader, c); + + c.gridx++; + tfAcceptHeader = new JTextField(); + tfAcceptHeader.setEditable(false); + jpMainPanel.add(tfAcceptHeader, c); + + c.gridx = 0; + c.gridy++; + jlContentType = new JLabel("'Content-Type' header:"); + jlContentType.setFont(jlContentType.getFont().deriveFont(Font.BOLD)); + jlContentType.setVisible(false); + jpMainPanel.add(jlContentType, c); + + c.gridx++; + tfContentTypeHeader = new JTextField(); + tfContentTypeHeader.setEditable(false); + tfContentTypeHeader.setVisible(false); + jpMainPanel.add(tfContentTypeHeader, c); + + c.gridx = 0; + c.gridy++; + jlSendDataAs = new JLabel("Send data as:"); + jlSendDataAs.setFont(jlSendDataAs.getFont().deriveFont(Font.BOLD)); + jlSendDataAs.setVisible(false); + jpMainPanel.add(jlSendDataAs, c); + + c.gridx++; + tfSendDataAs = new JTextField(); + tfSendDataAs.setEditable(false); + tfSendDataAs.setVisible(false); + jpMainPanel.add(tfSendDataAs, c); + + c.gridx = 0; + c.gridy++; + jlSendHTTPExpectRequestHeader = new JLabel("Send HTTP 'Expect' header:"); + jlSendHTTPExpectRequestHeader.setFont(jlSendHTTPExpectRequestHeader.getFont().deriveFont( + Font.BOLD)); + jlSendHTTPExpectRequestHeader.setVisible(false); + jpMainPanel.add(jlSendHTTPExpectRequestHeader, c); + + c.gridx++; + tfSendHTTPExpectRequestHeader = new JTextField(); + tfSendHTTPExpectRequestHeader.setEditable(false); + tfSendHTTPExpectRequestHeader.setVisible(false); + jpMainPanel.add(tfSendHTTPExpectRequestHeader, c); + + // populate the view with values + refreshView(); + + return jpMainPanel; + } + + @Override + /** + * This is the title of the contextual view - shown in the list of other available + * views (even when this contextual view is collapsed). + */ + public String getViewTitle() { + return "REST Service Details"; + } + + /** + * Typically called when the activity configuration has changed. + */ + @Override + public void refreshView() { + Configuration configuration = scufl2Tools.configurationFor(activity, activity.getParent()); + RESTActivityConfigurationBean configurationBean = new RESTActivityConfigurationBean(configuration.getJson()); + + // toggle visibility of the elements that do not always appear + HTTP_METHOD httpMethod = configurationBean.getHttpMethod(); + jlContentType.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT); + tfContentTypeHeader.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT); + jlSendDataAs.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT); + tfSendDataAs.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT); + jlSendHTTPExpectRequestHeader.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT); + tfSendHTTPExpectRequestHeader.setVisible(httpMethod == HTTP_METHOD.POST || httpMethod == HTTP_METHOD.PUT); + jpMainPanel.revalidate(); + + tfHTTPMethod.setText("" + configurationBean.getHttpMethod()); + taURLSignature.setText(configurationBean.getUrlSignature()); + tfAcceptHeader.setText(configurationBean.getAcceptsHeaderValue()); + tfContentTypeHeader.setText(configurationBean.getContentTypeForUpdates()); + tfSendDataAs.setText("" + configurationBean.getOutgoingDataFormat()); + tfSendHTTPExpectRequestHeader.setText("" + configurationBean.getSendHTTPExpectRequestHeader()); + } + + /** + * View position hint + */ + @Override + public int getPreferredPosition() { + // want to be on top, as it's the main contextual view for this activity + return 100; + } + + @Override + public Action getConfigureAction(final Frame owner) { + // "Configure" button appears because of this action being returned + return new RESTActivityConfigureAction(activity, owner, editManager, fileManager, + activityIconManager, serviceDescriptionRegistry, serviceRegistry); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider deleted file mode 100644 index a7222c4..0000000 --- a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider +++ /dev/null @@ -1 +0,0 @@ -net.sf.taverna.t2.activities.rest.ui.servicedescription.GenericRESTTemplateService \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent deleted file mode 100644 index a1e5390..0000000 --- a/taverna-rest-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.rest.ui.view.ConfigureRESTActivityMenuAction -net.sf.taverna.t2.activities.rest.ui.menu.AddRESTTemplateAction -net.sf.taverna.t2.activities.rest.ui.menu.AddRESTTemplateMenuAction \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI deleted file mode 100644 index 9440d43..0000000 --- a/taverna-rest-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.rest.ui.servicedescription.RESTActivityIcon \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-rest-activity-ui/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory deleted file mode 100644 index 5325bf1..0000000 --- a/taverna-rest-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.rest.ui.view.RESTActivityMainContextViewFactory http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider new file mode 100644 index 0000000..545e9d8 --- /dev/null +++ b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.servicedescriptions.ServiceDescriptionProvider @@ -0,0 +1 @@ +org.apache.taverna.activities.rest.ui.servicedescription.GenericRESTTemplateService \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent new file mode 100644 index 0000000..a12b9d2 --- /dev/null +++ b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.ui.menu.MenuComponent @@ -0,0 +1,3 @@ +org.apache.taverna.activities.rest.ui.view.ConfigureRESTActivityMenuAction +org.apache.taverna.activities.rest.ui.menu.AddRESTTemplateAction +org.apache.taverna.activities.rest.ui.menu.AddRESTTemplateMenuAction \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI new file mode 100644 index 0000000..8d73b41 --- /dev/null +++ b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.activityicons.ActivityIconSPI @@ -0,0 +1 @@ +org.apache.taverna.activities.rest.ui.servicedescription.RESTActivityIcon \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory new file mode 100644 index 0000000..a9a72e3 --- /dev/null +++ b/taverna-rest-activity-ui/src/main/resources/META-INF/services/org.apache.taverna.workbench.ui.views.contextualviews.activity.ContextualViewFactory @@ -0,0 +1 @@ + org.apache.taverna.activities.rest.ui.view.RESTActivityMainContextViewFactory http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context-osgi.xml ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context-osgi.xml b/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context-osgi.xml index 643d5be..8eab8f0 100644 --- a/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context-osgi.xml +++ b/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-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="RESTActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" /> + <service ref="RESTActivityIcon" interface="org.apache.taverna.workbench.activityicons.ActivityIconSPI" /> - <service ref="GenericRESTTemplateService" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" /> + <service ref="GenericRESTTemplateService" interface="org.apache.taverna.servicedescriptions.ServiceDescriptionProvider" /> <service ref="ConfigureRESTActivityMenuAction" auto-export="interfaces" /> <service ref="AddRESTTemplateAction" auto-export="interfaces" /> <service ref="AddRESTTemplateMenuAction" auto-export="interfaces" /> - <service ref="RESTActivityMainContextViewFactory" interface="net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory" /> + <service ref="RESTActivityMainContextViewFactory" 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" /> </beans:beans> http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context.xml ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context.xml b/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context.xml index 2b699e7..7df38dc 100644 --- a/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context.xml +++ b/taverna-rest-activity-ui/src/main/resources/META-INF/spring/rest-activity-ui-context.xml @@ -5,15 +5,15 @@ http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="RESTActivityIcon" - class="net.sf.taverna.t2.activities.rest.ui.servicedescription.RESTActivityIcon"> + class="org.apache.taverna.activities.rest.ui.servicedescription.RESTActivityIcon"> <property name="colourManager" ref="colourManager" /> </bean> <bean id="GenericRESTTemplateService" - class="net.sf.taverna.t2.activities.rest.ui.servicedescription.GenericRESTTemplateService" /> + class="org.apache.taverna.activities.rest.ui.servicedescription.GenericRESTTemplateService" /> <bean id="ConfigureRESTActivityMenuAction" - class="net.sf.taverna.t2.activities.rest.ui.view.ConfigureRESTActivityMenuAction"> + class="org.apache.taverna.activities.rest.ui.view.ConfigureRESTActivityMenuAction"> <property name="editManager" ref="editManager" /> <property name="fileManager" ref="fileManager" /> <property name="activityIconManager" ref="activityIconManager" /> @@ -21,7 +21,7 @@ <property name="serviceRegistry" ref="serviceRegistry" /> </bean> <bean id="AddRESTTemplateAction" - class="net.sf.taverna.t2.activities.rest.ui.menu.AddRESTTemplateAction"> + class="org.apache.taverna.activities.rest.ui.menu.AddRESTTemplateAction"> <property name="editManager" ref="editManager" /> <property name="menuManager" ref="menuManager" /> <property name="selectionManager" ref="selectionManager" /> @@ -29,7 +29,7 @@ <property name="serviceRegistry" ref="serviceRegistry" /> </bean> <bean id="AddRESTTemplateMenuAction" - class="net.sf.taverna.t2.activities.rest.ui.menu.AddRESTTemplateMenuAction"> + class="org.apache.taverna.activities.rest.ui.menu.AddRESTTemplateMenuAction"> <property name="editManager" ref="editManager" /> <property name="menuManager" ref="menuManager" /> <property name="selectionManager" ref="selectionManager" /> @@ -38,7 +38,7 @@ </bean> <bean id="RESTActivityMainContextViewFactory" - class="net.sf.taverna.t2.activities.rest.ui.view.RESTActivityMainContextViewFactory"> + class="org.apache.taverna.activities.rest.ui.view.RESTActivityMainContextViewFactory"> <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-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/information.png ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/information.png b/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/information.png deleted file mode 100644 index 12cd1ae..0000000 Binary files a/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/information.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/mediatypes.txt ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/mediatypes.txt b/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/mediatypes.txt deleted file mode 100644 index 4f0f0f4..0000000 --- a/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/config/mediatypes.txt +++ /dev/null @@ -1,65 +0,0 @@ -application/atom+xml -application/http -application/javascript -application/json -application/octet-stream -application/ogg -application/pdf -application/postscript -application/rdf+xml -application/sparql-query -application/sparql-results+xml -application/vnd.taverna.scufl+xml -application/vnd.taverna.t2flow+xml -application/x-gzip -application/x-rar-compressed -application/x-shockwave-flash -application/x-tar -application/x-www-form-urlencoded -application/xhtml+xml -application/xml -application/zip -audio/mp4 -audio/mpeg -audio/mpeg4-generic -audio/ogg -audio/vnd.wave -audio/vorbis -audio/webm -audio/x-ms-wma -image/gif -image/jpeg -image/png -image/svg+xml -image/tiff -image/vnd.microsoft.icon -message/http -message/rfc822 -multipart/alternative -multipart/byteranges -multipart/digest -multipart/encrypted -multipart/form-data -multipart/mixed -multipart/related -multipart/signed -text/css -text/csv -text/html -text/javascript -text/n3 -text/plain -text/tab-separated-values -text/turtle -text/uri-list -text/vcard -text/xml -video/H264 -video/MPV -video/mp4 -video/mpeg -video/mpeg4-generic -video/ogg -video/quicktime -video/webm -video/x-ms-wmv http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/servicedescription/service_type_rest.png ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/servicedescription/service_type_rest.png b/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/servicedescription/service_type_rest.png deleted file mode 100644 index a4276c2..0000000 Binary files a/taverna-rest-activity-ui/src/main/resources/net/sf/taverna/t2/activities/rest/ui/servicedescription/service_type_rest.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/information.png ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/information.png b/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/information.png new file mode 100644 index 0000000..12cd1ae Binary files /dev/null and b/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/information.png differ http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/mediatypes.txt ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/mediatypes.txt b/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/mediatypes.txt new file mode 100644 index 0000000..4f0f0f4 --- /dev/null +++ b/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/config/mediatypes.txt @@ -0,0 +1,65 @@ +application/atom+xml +application/http +application/javascript +application/json +application/octet-stream +application/ogg +application/pdf +application/postscript +application/rdf+xml +application/sparql-query +application/sparql-results+xml +application/vnd.taverna.scufl+xml +application/vnd.taverna.t2flow+xml +application/x-gzip +application/x-rar-compressed +application/x-shockwave-flash +application/x-tar +application/x-www-form-urlencoded +application/xhtml+xml +application/xml +application/zip +audio/mp4 +audio/mpeg +audio/mpeg4-generic +audio/ogg +audio/vnd.wave +audio/vorbis +audio/webm +audio/x-ms-wma +image/gif +image/jpeg +image/png +image/svg+xml +image/tiff +image/vnd.microsoft.icon +message/http +message/rfc822 +multipart/alternative +multipart/byteranges +multipart/digest +multipart/encrypted +multipart/form-data +multipart/mixed +multipart/related +multipart/signed +text/css +text/csv +text/html +text/javascript +text/n3 +text/plain +text/tab-separated-values +text/turtle +text/uri-list +text/vcard +text/xml +video/H264 +video/MPV +video/mp4 +video/mpeg +video/mpeg4-generic +video/ogg +video/quicktime +video/webm +video/x-ms-wmv http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/servicedescription/service_type_rest.png ---------------------------------------------------------------------- diff --git a/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/servicedescription/service_type_rest.png b/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/servicedescription/service_type_rest.png new file mode 100644 index 0000000..a4276c2 Binary files /dev/null and b/taverna-rest-activity-ui/src/main/resources/org/apache/taverna/activities/rest/ui/servicedescription/service_type_rest.png differ http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java ---------------------------------------------------------------------- diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java deleted file mode 100644 index 7ad1052..0000000 --- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2009 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.spreadsheet.actions; - -import java.awt.Frame; -import java.awt.event.ActionEvent; - -import net.sf.taverna.t2.activities.spreadsheet.views.SpreadsheetImportConfigView; -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry; -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; -import org.apache.taverna.commons.services.ServiceRegistry; -import org.apache.taverna.scufl2.api.activity.Activity; - -/** - * The configuration action for a SpreadsheetImport activity. - * - * @author David Withers - */ -@SuppressWarnings("serial") -public class SpreadsheetImportActivityConfigurationAction extends ActivityConfigurationAction { - - private static final String CONFIGURE = "Configure"; - - private final EditManager editManager; - - private final FileManager fileManager; - - private final ServiceRegistry serviceRegistry; - - public SpreadsheetImportActivityConfigurationAction(Activity activity, - Frame owner, EditManager editManager, FileManager fileManager, - ActivityIconManager activityIconManager, - ServiceDescriptionRegistry serviceDescriptionRegistry, ServiceRegistry serviceRegistry) { - super(activity, activityIconManager, serviceDescriptionRegistry); - this.editManager = editManager; - this.fileManager = fileManager; - this.serviceRegistry = serviceRegistry; - putValue(NAME, CONFIGURE); - } - - public void actionPerformed(ActionEvent e) { - final SpreadsheetImportConfigView spreadsheetConfigView = new SpreadsheetImportConfigView( - getActivity(), serviceRegistry); - final ActivityConfigurationDialog dialog = new ActivityConfigurationDialog(getActivity(), - spreadsheetConfigView, editManager); - - ActivityConfigurationAction.setDialog(getActivity(), dialog, fileManager); - - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/il8n/SpreadsheetImportUIText.java ---------------------------------------------------------------------- diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/il8n/SpreadsheetImportUIText.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/il8n/SpreadsheetImportUIText.java deleted file mode 100644 index 82f8436..0000000 --- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/il8n/SpreadsheetImportUIText.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2009 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.spreadsheet.il8n; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Access to a resource bundle containing UI text. - * - * @author David Withers - */ -public class SpreadsheetImportUIText { - private static final String BUNDLE_NAME = "net.sf.taverna.t2.activities.spreadsheet.iln8.ui-text"; - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private SpreadsheetImportUIText() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java ---------------------------------------------------------------------- diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java deleted file mode 100644 index 1304c31..0000000 --- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2009 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.spreadsheet.menu; - -import java.awt.event.ActionEvent; -import java.net.URI; - -import javax.swing.AbstractAction; -import javax.swing.Action; - -import net.sf.taverna.t2.activities.spreadsheet.il8n.SpreadsheetImportUIText; -import net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService; -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry; -import net.sf.taverna.t2.ui.menu.AbstractContextualMenuAction; -import net.sf.taverna.t2.ui.menu.MenuManager; -import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager; -import net.sf.taverna.t2.workbench.edits.EditManager; -import net.sf.taverna.t2.workbench.selection.SelectionManager; -import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView; -import org.apache.taverna.commons.services.ServiceRegistry; -import org.apache.taverna.scufl2.api.core.Workflow; - -/** - * An action to add a spreadsheet import activity + a wrapping processor to the workflow. - * - * @author David Withers - */ -@SuppressWarnings("serial") -public class SpreadsheetImportAddTemplateAction extends AbstractContextualMenuAction { - - private static final URI insertSection = URI - .create("http://taverna.sf.net/2009/contextMenu/insert"); - - private EditManager editManager; - private MenuManager menuManager; - private SelectionManager selectionManager; - private ActivityIconManager activityIconManager; - private ServiceDescriptionRegistry serviceDescriptionRegistry; - private ServiceRegistry serviceRegistry; - - public SpreadsheetImportAddTemplateAction() { - super(insertSection, 700); - } - - @Override - public boolean isEnabled() { - return super.isEnabled() && getContextualSelection().getSelection() instanceof Workflow; - } - - @Override - protected Action createAction() { - - AbstractAction action = new AbstractAction( - SpreadsheetImportUIText.getString("SpreadsheetImportAddTemplateAction.addMenu"), - activityIconManager.iconForActivity(SpreadsheetImportTemplateService.ACTIVITY_TYPE)) { - - public void actionPerformed(ActionEvent e) { - WorkflowView.importServiceDescription(serviceDescriptionRegistry - .getServiceDescription(SpreadsheetImportTemplateService.ACTIVITY_TYPE), false, - editManager, menuManager, selectionManager, serviceRegistry); - } - - }; - - return action; - } - - public void setEditManager(EditManager editManager) { - this.editManager = editManager; - } - - public void setMenuManager(MenuManager menuManager) { - this.menuManager = menuManager; - } - - public void setSelectionManager(SelectionManager selectionManager) { - this.selectionManager = selectionManager; - } - - public void setActivityIconManager(ActivityIconManager activityIconManager) { - this.activityIconManager = activityIconManager; - } - - public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) { - this.serviceDescriptionRegistry = serviceDescriptionRegistry; - } - - public void setServiceRegistry(ServiceRegistry serviceRegistry) { - this.serviceRegistry = serviceRegistry; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java ---------------------------------------------------------------------- diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java deleted file mode 100644 index ecb0cf9..0000000 --- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2007-2009 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.spreadsheet.menu; - -import java.awt.event.ActionEvent; -import java.awt.event.InputEvent; -import java.awt.event.KeyEvent; -import java.net.URI; - -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.KeyStroke; - -import net.sf.taverna.t2.activities.spreadsheet.il8n.SpreadsheetImportUIText; -import net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService; -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry; -import net.sf.taverna.t2.ui.menu.AbstractMenuAction; -import net.sf.taverna.t2.ui.menu.DesignOnlyAction; -import net.sf.taverna.t2.ui.menu.MenuManager; -import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager; -import net.sf.taverna.t2.workbench.edits.EditManager; -import net.sf.taverna.t2.workbench.selection.SelectionManager; -import net.sf.taverna.t2.workbench.ui.workflowview.WorkflowView; -import org.apache.taverna.commons.services.ServiceRegistry; - -/** - * An action to add a spreadsheet import activity + a wrapping processor to the workflow. - * - * @author Alan R Williams - */ -@SuppressWarnings("serial") -public class SpreadsheetImportAddTemplateMenuAction extends AbstractMenuAction { - - private static final URI ADD_SPREADSHEET_IMPORT_URI = URI - .create("http://taverna.sf.net/2008/t2workbench/menu#graphMenuAddSpreadsheetImport"); - - private static final URI INSERT = URI - .create("http://taverna.sf.net/2008/t2workbench/menu#insert"); - - private static String ADD_SPREADSHEET_IMPORT = SpreadsheetImportUIText - .getString("SpreadsheetImportAddTemplateAction.addMenu"); - - private EditManager editManager; - private MenuManager menuManager; - private SelectionManager selectionManager; - private ActivityIconManager activityIconManager; - private ServiceDescriptionRegistry serviceDescriptionRegistry; - private ServiceRegistry serviceRegistry; - - public SpreadsheetImportAddTemplateMenuAction() { - super(INSERT, 700, ADD_SPREADSHEET_IMPORT_URI); - } - - @Override - protected Action createAction() { - return new AddSpreadsheetImportMenuAction(); - } - - protected class AddSpreadsheetImportMenuAction extends AbstractAction implements - DesignOnlyAction { - AddSpreadsheetImportMenuAction() { - super(); - putValue(SMALL_ICON, - activityIconManager - .iconForActivity(SpreadsheetImportTemplateService.ACTIVITY_TYPE)); - putValue(NAME, ADD_SPREADSHEET_IMPORT); - putValue(SHORT_DESCRIPTION, ADD_SPREADSHEET_IMPORT); - putValue( - Action.ACCELERATOR_KEY, - KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.SHIFT_DOWN_MASK - | InputEvent.ALT_DOWN_MASK)); - - } - - public void actionPerformed(ActionEvent e) { - WorkflowView.importServiceDescription(serviceDescriptionRegistry - .getServiceDescription(SpreadsheetImportTemplateService.ACTIVITY_TYPE), false, - editManager, menuManager, selectionManager, serviceRegistry); - } - } - - public void setEditManager(EditManager editManager) { - this.editManager = editManager; - } - - public void setMenuManager(MenuManager menuManager) { - this.menuManager = menuManager; - } - - public void setSelectionManager(SelectionManager selectionManager) { - this.selectionManager = selectionManager; - } - - public void setActivityIconManager(ActivityIconManager activityIconManager) { - this.activityIconManager = activityIconManager; - } - - public void setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) { - this.serviceDescriptionRegistry = serviceDescriptionRegistry; - } - - public void setServiceRegistry(ServiceRegistry serviceRegistry) { - this.serviceRegistry = serviceRegistry; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java ---------------------------------------------------------------------- diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java deleted file mode 100644 index 1bbaa05..0000000 --- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2009 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.spreadsheet.menu; - -import javax.swing.Action; - -import org.apache.taverna.commons.services.ServiceRegistry; - -import net.sf.taverna.t2.activities.spreadsheet.actions.SpreadsheetImportActivityConfigurationAction; -import net.sf.taverna.t2.activities.spreadsheet.il8n.SpreadsheetImportUIText; -import net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService; -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionRegistry; -import net.sf.taverna.t2.workbench.activityicons.ActivityIconManager; -import net.sf.taverna.t2.workbench.activitytools.AbstractConfigureActivityMenuAction; -import net.sf.taverna.t2.workbench.edits.EditManager; -import net.sf.taverna.t2.workbench.file.FileManager; - -/** - * Menu action for SpreadsheetImport activity configuration. - * - * @author David Withers - */ -public class SpreadsheetImportConfigureMenuAction extends AbstractConfigureActivityMenuAction { - - private EditManager editManager; - private FileManager fileManager; - private ActivityIconManager activityIconManager; - private ServiceDescriptionRegistry serviceDescriptionRegistry; - private ServiceRegistry serviceRegistry; - - public SpreadsheetImportConfigureMenuAction() { - super(SpreadsheetImportTemplateService.ACTIVITY_TYPE); - } - - @Override - protected Action createAction() { - Action result = new SpreadsheetImportActivityConfigurationAction(findActivity(), - getParentFrame(), editManager, fileManager, activityIconManager, - serviceDescriptionRegistry, serviceRegistry); - result.putValue(Action.NAME, SpreadsheetImportUIText - .getString("SpreadsheetImportConfigureMenuAction.configureMenu")); - addMenuDots(result); - return result; - } - - 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 setServiceDescriptionRegistry(ServiceDescriptionRegistry serviceDescriptionRegistry) { - this.serviceDescriptionRegistry = serviceDescriptionRegistry; - } - - public void setServiceRegistry(ServiceRegistry serviceRegistry) { - this.serviceRegistry = serviceRegistry; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java ---------------------------------------------------------------------- diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java deleted file mode 100644 index 1987364..0000000 --- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2009 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.spreadsheet.servicedescriptions; - -import java.awt.Color; -import java.net.URI; - -import javax.swing.Icon; -import javax.swing.ImageIcon; - -import net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI; -import net.sf.taverna.t2.workbench.configuration.colour.ColourManager; - -/** - * UI icon for the SpreadsheetImport Activity. - * - * @author David Withers - */ -public class SpreadsheetImportActivityIcon implements ActivityIconSPI { - - public static final String SPREADSHEET_COLOUR_HTML = "#40e0d0"; - public static final Color SPREADSHEET_COLOUR = Color.decode(SPREADSHEET_COLOUR_HTML); - - private static Icon icon = null; - - @Override - public int canProvideIconScore(URI activityType) { - if (SpreadsheetImportTemplateService.ACTIVITY_TYPE.equals(activityType)) - return DEFAULT_ICON + 1; - else - return NO_ICON; - } - - @Override - public Icon getIcon(URI activityType) { - return getSpreadsheetImportIcon(); - } - - public static Icon getSpreadsheetImportIcon() { - if (icon == null) { - icon = new ImageIcon( - SpreadsheetImportActivityIcon.class.getResource("/spreadsheet-import.png")); - } - return icon; - } - - public void setColourManager(ColourManager colourManager) { - colourManager.setPreferredColour( - "http://ns.taverna.org.uk/2010/activity/spreadsheet-import", - SPREADSHEET_COLOUR); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java ---------------------------------------------------------------------- diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java deleted file mode 100644 index f03d852..0000000 --- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2009 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.spreadsheet.servicedescriptions; - -import java.net.URI; - -import javax.swing.Icon; - -import com.fasterxml.jackson.databind.node.ObjectNode; - -import net.sf.taverna.t2.activities.spreadsheet.il8n.SpreadsheetImportUIText; -import net.sf.taverna.t2.servicedescriptions.AbstractTemplateService; -import net.sf.taverna.t2.servicedescriptions.ServiceDescription; -import net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider; -import org.apache.taverna.scufl2.api.configurations.Configuration; - -/** - * Definition of the SpreadsheetImport spreadsheet import template service. - * - * @author David Withers - */ -public class SpreadsheetImportTemplateService extends AbstractTemplateService { - - public static final URI ACTIVITY_TYPE = URI - .create("http://ns.taverna.org.uk/2010/activity/spreadsheet-import"); - - private static final String SERVICE_NAME = SpreadsheetImportUIText - .getString("SpreadsheetImportTemplateService.serviceName"); - - private static final URI providerId = URI - .create("http://taverna.sf.net/2010/service-provider/spreadsheet"); - - public String getName() { - return SERVICE_NAME; - } - - @Override - public URI getActivityType() { - return ACTIVITY_TYPE; - } - - @Override - public Configuration getActivityConfiguration() { - Configuration configuration = new Configuration(); - configuration.setType(ACTIVITY_TYPE.resolve("#Config")); - ObjectNode json = (ObjectNode) configuration.getJson(); - json.put("columnRange", json.objectNode().put("start", 0).put("end", 1)); - json.put("rowRange", json.objectNode().put("start", 0).put("end", -1)); - json.put("emptyCellValue", ""); - json.put("allRows", true); - json.put("excludeFirstRow", false); - json.put("ignoreBlankRows", false); - json.put("emptyCellPolicy", "EMPTY_STRING"); - json.put("outputFormat", "PORT_PER_COLUMN"); - json.put("csvDelimiter", ","); - return configuration; - } - - @Override - public Icon getIcon() { - return SpreadsheetImportActivityIcon.getSpreadsheetImportIcon(); - } - - @Override - public String getDescription() { - return SpreadsheetImportUIText - .getString("SpreadsheetImportTemplateService.serviceDescription"); - } - - public static ServiceDescription getServiceDescription() { - SpreadsheetImportTemplateService bts = new SpreadsheetImportTemplateService(); - return bts.templateService; - } - - public String getId() { - return providerId.toString(); - } - - @Override - public ServiceDescriptionProvider newInstance() { - return new SpreadsheetImportTemplateService(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/163747de/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java ---------------------------------------------------------------------- diff --git a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java deleted file mode 100644 index 81e5381..0000000 --- a/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (C) 2009 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.spreadsheet.views; - -import java.util.HashMap; -import java.util.Map; - -import javax.swing.table.AbstractTableModel; - -import org.apache.taverna.activities.spreadsheet.SpreadsheetUtils; -import net.sf.taverna.t2.activities.spreadsheet.il8n.SpreadsheetImportUIText; - -/** - * TableModel for mapping column labels to port names. - * <p> - * The default mapping is for the port name to be the same as the column label. The - * columnToPortMapping only contains entries for port names that are not the same as the column - * label. - * - * @author David Withers - */ -@SuppressWarnings("serial") -public class SpreadsheetImportConfigTableModel extends AbstractTableModel { - - private Map<String, String> columnToPortMapping; - - private int fromColumn, toColumn; - - /** - * Constructs a TableModel that maps column labels to port names for the specified range of - * columns. - * - * @param fromColumn - * the start of the column range - * @param toColumn - * the end of the column range - * @param columnToPortMapping - * existing column to port mappings (can be null) - */ - public SpreadsheetImportConfigTableModel(String fromColumn, String toColumn, - Map<String, String> columnToPortMapping) { - if (columnToPortMapping == null) { - this.columnToPortMapping = new HashMap<String, String>(); - } else { - this.columnToPortMapping = new HashMap<String, String>(columnToPortMapping); - } - this.fromColumn = SpreadsheetUtils.getColumnIndex(fromColumn); - this.toColumn = SpreadsheetUtils.getColumnIndex(toColumn); - } - - /** - * Sets the start of the column range. - * - * @param fromColumn - * the start of the column range - */ - public void setFromColumn(int fromColumn) { - if (this.fromColumn != fromColumn) { - this.fromColumn = fromColumn; - fireTableStructureChanged(); - } - } - - /** - * Sets the end of the column range. - * - * @param toColumn - * the end of the column range - */ - public void setToColumn(int toColumn) { - if (this.toColumn != toColumn) { - this.toColumn = toColumn; - fireTableStructureChanged(); - } - } - - /** - * Returns the port name for the given column label. - * <p> - * If the columnLabel is the columnToPortMapping the value is returned; otherwise the - * columnLabel is returned. - * - * @param columnLabel - * the column to find the port name for - * @return the port name for the given column label - */ - public String getPortName(String columnLabel) { - String portName; - if (columnToPortMapping.containsKey(columnLabel)) { - portName = columnToPortMapping.get(columnLabel); - } else { - portName = columnLabel; - } - return portName; - } - - /** - * Sets the port name for the column label. - * <p> - * If the port name is not the same as the column label the port name is added the - * columnToPortMapping. - * - * @param columnLabel - * @param portName - */ - public void setPortName(String columnLabel, String portName) { - if (columnLabel.equals(portName)) { - columnToPortMapping.remove(columnLabel); - } else { - columnToPortMapping.put(columnLabel, portName); - } - } - - /** - * Returns the map of column labels to port names. - * <p> - * The map only contains entries for port names that are not the same as their corresponding - * column label. - * - * @return the map of column labels to port names - */ - public Map<String, String> getColumnToPortMapping() { - return columnToPortMapping; - } - - // TableModel methods - - @Override - public Class<?> getColumnClass(int columnIndex) { - return String.class; - } - - public int getColumnCount() { - return 2; - } - - @Override - public String getColumnName(int columnIndex) { - if (columnIndex == 0) { - return SpreadsheetImportUIText.getString("SpreadsheetImportConfigTableModel.column"); - } else { - return SpreadsheetImportUIText.getString("SpreadsheetImportConfigTableModel.portName"); - } - } - - public int getRowCount() { - return toColumn - fromColumn + 1; - } - - public Object getValueAt(int rowIndex, int columnIndex) { - String columnLabel = SpreadsheetUtils.getColumnLabel(rowIndex + fromColumn); - if (columnIndex == 0) { - return columnLabel; - } else { - return getPortName(columnLabel); - } - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return columnIndex == 1; - } - - @Override - public void setValueAt(Object value, int rowIndex, int columnIndex) { - if (columnIndex == 1) { - setPortName(SpreadsheetUtils.getColumnLabel(rowIndex + fromColumn), value.toString()); - } - } - -}
