You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/17 12:48:53 UTC
[34/50] [abbrv] incubator-taverna-workbench-common-activities git
commit: taverna-spreadsheet-import-activity-ui/
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/fa8b5b3d/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportContextualViewFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportContextualViewFactory.java b/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportContextualViewFactory.java
deleted file mode 100644
index 7e49168..0000000
--- a/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportContextualViewFactory.java
+++ /dev/null
@@ -1,87 +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.Arrays;
-import java.util.List;
-
-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.configuration.colour.ColourManager;
-import net.sf.taverna.t2.workbench.edits.EditManager;
-import net.sf.taverna.t2.workbench.file.FileManager;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.ContextualView;
-import net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory;
-import uk.org.taverna.commons.services.ServiceRegistry;
-import uk.org.taverna.scufl2.api.activity.Activity;
-
-/**
- * Factory for creating contextual a view of the SpreadsheetImport Activity
- *
- * @author David Withers
- */
-public class SpreadsheetImportContextualViewFactory 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 object) {
- return object instanceof Activity
- && ((Activity) object).getType().equals(
- SpreadsheetImportTemplateService.ACTIVITY_TYPE);
- }
-
- public List<ContextualView> getViews(Activity activity) {
- return Arrays.asList(new ContextualView[] { new SpreadsheetImportContextualView(activity,
- 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/fa8b5b3d/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider b/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
deleted file mode 100644
index b1628b6..0000000
--- a/src/main/resources/META-INF/services/net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/fa8b5b3d/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent b/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
deleted file mode 100644
index 6720b04..0000000
--- a/src/main/resources/META-INF/services/net.sf.taverna.t2.ui.menu.MenuComponent
+++ /dev/null
@@ -1,3 +0,0 @@
-net.sf.taverna.t2.activities.spreadsheet.menu.SpreadsheetImportAddTemplateAction
-net.sf.taverna.t2.activities.spreadsheet.menu.SpreadsheetImportConfigureMenuAction
-net.sf.taverna.t2.activities.spreadsheet.menu.SpreadsheetImportAddTemplateMenuAction
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/fa8b5b3d/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI b/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
deleted file mode 100644
index 2dd012f..0000000
--- a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI
+++ /dev/null
@@ -1 +0,0 @@
-net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportActivityIcon
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/fa8b5b3d/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory b/src/main/resources/META-INF/services/net.sf.taverna.t2.workbench.ui.views.contextualviews.activity.ContextualViewFactory
deleted file mode 100644
index 4b9dd11..0000000
--- a/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.spreadsheet.views.SpreadsheetImportContextualViewFactory
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/fa8b5b3d/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context-osgi.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context-osgi.xml b/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context-osgi.xml
deleted file mode 100644
index 72ffb77..0000000
--- a/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context-osgi.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:beans="http://www.springframework.org/schema/beans"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/osgi
- http://www.springframework.org/schema/osgi/spring-osgi.xsd">
-
- <service ref="SpreadsheetImportActivityIcon" interface="net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI" />
-
- <service ref="SpreadsheetImportTemplateService" interface="net.sf.taverna.t2.servicedescriptions.ServiceDescriptionProvider" />
-
- <service ref="SpreadsheetImportAddTemplateAction" auto-export="interfaces" />
- <service ref="SpreadsheetImportConfigureMenuAction" auto-export="interfaces" />
- <service ref="SpreadsheetImportAddTemplateMenuAction" auto-export="interfaces" />
-
- <service ref="SpreadsheetImportContextualViewFactory" interface="net.sf.taverna.t2.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="serviceRegistry" interface="uk.org.taverna.commons.services.ServiceRegistry" />
-
-</beans:beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/fa8b5b3d/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context.xml
----------------------------------------------------------------------
diff --git a/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context.xml b/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context.xml
deleted file mode 100644
index 7fdba26..0000000
--- a/src/main/resources/META-INF/spring/spreadsheet-import-activity-ui-context.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
-
- <bean id="SpreadsheetImportActivityIcon" class="net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportActivityIcon">
- <property name="colourManager" ref="colourManager" />
- </bean>
-
- <bean id="SpreadsheetImportTemplateService" class="net.sf.taverna.t2.activities.spreadsheet.servicedescriptions.SpreadsheetImportTemplateService" />
-
- <bean id="SpreadsheetImportAddTemplateAction" class="net.sf.taverna.t2.activities.spreadsheet.menu.SpreadsheetImportAddTemplateAction">
- <property name="editManager" ref="editManager" />
- <property name="menuManager" ref="menuManager" />
- <property name="selectionManager" ref="selectionManager" />
- <property name="activityIconManager" ref="activityIconManager" />
- <property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
- <property name="serviceRegistry" ref="serviceRegistry" />
- </bean>
- <bean id="SpreadsheetImportAddTemplateMenuAction" class="net.sf.taverna.t2.activities.spreadsheet.menu.SpreadsheetImportAddTemplateMenuAction">
- <property name="editManager" ref="editManager" />
- <property name="menuManager" ref="menuManager" />
- <property name="selectionManager" ref="selectionManager" />
- <property name="activityIconManager" ref="activityIconManager" />
- <property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
- <property name="serviceRegistry" ref="serviceRegistry" />
- </bean>
- <bean id="SpreadsheetImportConfigureMenuAction" class="net.sf.taverna.t2.activities.spreadsheet.menu.SpreadsheetImportConfigureMenuAction">
- <property name="editManager" ref="editManager" />
- <property name="fileManager" ref="fileManager" />
- <property name="activityIconManager" ref="activityIconManager" />
- <property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
- <property name="serviceRegistry" ref="serviceRegistry" />
- </bean>
-
- <bean id="SpreadsheetImportContextualViewFactory" class="net.sf.taverna.t2.activities.spreadsheet.views.SpreadsheetImportContextualViewFactory">
- <property name="editManager" ref="editManager" />
- <property name="fileManager" ref="fileManager" />
- <property name="activityIconManager" ref="activityIconManager" />
- <property name="colourManager" ref="colourManager" />
- <property name="serviceDescriptionRegistry" ref="serviceDescriptionRegistry" />
- <property name="serviceRegistry" ref="serviceRegistry" />
- </bean>
-
-</beans>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/fa8b5b3d/src/main/resources/net/sf/taverna/t2/activities/spreadsheet/iln8/ui-text.properties
----------------------------------------------------------------------
diff --git a/src/main/resources/net/sf/taverna/t2/activities/spreadsheet/iln8/ui-text.properties b/src/main/resources/net/sf/taverna/t2/activities/spreadsheet/iln8/ui-text.properties
deleted file mode 100644
index 2a4480f..0000000
--- a/src/main/resources/net/sf/taverna/t2/activities/spreadsheet/iln8/ui-text.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-SpreadsheetImportActivityConfigurationAction.canceButton=Cancel
-SpreadsheetImportActivityConfigurationAction.dialogTitle=Spreadsheet Import Configuration
-SpreadsheetImportActivityConfigurationAction.okButton=Finish
-SpreadsheetImportAddTemplateAction.addMenu=Spreadsheet import
-SpreadsheetImportConfigureMenuAction.configureMenu=Configure Spreadsheet Import
-SpreadsheetImportConfigTableModel.column=Column
-SpreadsheetImportConfigTableModel.portName=Port Name
-SpreadsheetImportConfigView.nextButton=Next
-SpreadsheetImportConfigView.backButton=Back
-SpreadsheetImportConfigView.columnMappingSectionLabel=Column to Port Name Mapping
-SpreadsheetImportConfigView.outputFormatSectionLabel=Output Format
-SpreadsheetImportConfigView.columnSectionLabel=Columns
-SpreadsheetImportConfigView.DEFAULT_MESSAGE=Select the data range
-SpreadsheetImportConfigView.DUPLICATE_PORT_NAME_ERROR_MESSAGE=Duplicate activity port name
-SpreadsheetImportConfigView.EMPTY_FROM_COLUMN_ERROR_MESSAGE='From' column must be specified
-SpreadsheetImportConfigView.EMPTY_FROM_ROW_ERROR_MESSAGE='From' row must be specified
-SpreadsheetImportConfigView.EMPTY_TO_COLUMN_ERROR_MESSAGE='To' column must be specified
-SpreadsheetImportConfigView.emptyCellSectionLabel=Empty cells
-SpreadsheetImportConfigView.emptyStringOption=Use an empty string
-SpreadsheetImportConfigView.excludeHeaderRowOption=Exclude header row
-SpreadsheetImportConfigView.from=From
-SpreadsheetImportConfigView.FROM_COLUMN_ERROR_MESSAGE='From' column can only contain characters A-Z
-SpreadsheetImportConfigView.FROM_ROW_ERROR_MESSAGE='From' row must be a number greater than 0
-SpreadsheetImportConfigView.generateErrorOption=Generate an error value
-SpreadsheetImportConfigView.ignoreBlankRowsOption=Ignore blank rows
-SpreadsheetImportConfigView.multiplePortOption=Multiple outputs (one per spreadsheet column)
-SpreadsheetImportConfigView.singlePortOption=A single CSV formatted output
-SpreadsheetImportConfigView.userDefinedCsvDelimiter=Use this value delimiter character:
-SpreadsheetImportConfigView.INCONSISTENT_COLUMN_MESSAGE='To' column must not be less than 'from' column
-SpreadsheetImportConfigView.INCONSISTENT_ROW_MESSAGE='To'row must not be less than 'from' row
-SpreadsheetImportConfigView.panelTitle=Configure spreadsheet file import
-SpreadsheetImportConfigView.rowSectionLabel=Rows
-SpreadsheetImportConfigView.selectAllRowsOption=All rows
-SpreadsheetImportConfigView.to=to
-SpreadsheetImportConfigView.TO_COLUMN_ERROR_MESSAGE='To' column can only contain characters A-Z
-SpreadsheetImportConfigView.TO_ROW_ERROR_MESSAGE='To' row must be a number greater than 0
-SpreadsheetImportConfigView.userDefinedOption=Use this value:
-SpreadsheetImportContextualView.activityName=Spreadsheet Import Activity
-SpreadsheetImportContextualView.depth=Depth
-SpreadsheetImportContextualView.inputPortName=Input Port Name
-SpreadsheetImportContextualView.outputPortName=Output Port Name
-SpreadsheetImportTemplateService.serviceDescription=A service that imports data from spreadsheets
-SpreadsheetImportTemplateService.serviceName=SpreadsheetImport
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/fa8b5b3d/src/main/resources/spreadsheet-import.png
----------------------------------------------------------------------
diff --git a/src/main/resources/spreadsheet-import.png b/src/main/resources/spreadsheet-import.png
deleted file mode 100644
index 886fac3..0000000
Binary files a/src/main/resources/spreadsheet-import.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/fa8b5b3d/taverna-spreadsheet-import-activity-ui/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-spreadsheet-import-activity-ui/pom.xml b/taverna-spreadsheet-import-activity-ui/pom.xml
new file mode 100644
index 0000000..1672ebf
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/pom.xml
@@ -0,0 +1,107 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>net.sf.taverna</groupId>
+ <artifactId>taverna-parent</artifactId>
+ <version>3.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>net.sf.taverna.t2.ui-activities</groupId>
+ <artifactId>spreadsheet-import-activity-ui</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <name>Taverna 2 Spreadsheet Import Activity UI</name>
+ <dependencies>
+ <dependency>
+ <groupId>net.sf.taverna.t2.activities</groupId>
+ <artifactId>spreadsheet-import-activity</artifactId>
+ <version>${t2.activities.version}</version>
+ </dependency>
+ <!-- taverna lang -->
+ <dependency>
+ <groupId>net.sf.taverna.t2.lang</groupId>
+ <artifactId>ui</artifactId>
+ <version>${t2.lang.version}</version>
+ </dependency>
+ <!-- taverna ui-api -->
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>activity-icons-api</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>activity-palette-api</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>contextual-views-api</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>file-api</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>menu-api</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-api</groupId>
+ <artifactId>activity-tools</artifactId>
+ <version>${t2.ui.api.version}</version>
+ </dependency>
+ <!-- taverna ui-components -->
+ <dependency>
+ <groupId>net.sf.taverna.t2.ui-components</groupId>
+ <artifactId>workflow-view</artifactId>
+ <version>${t2.ui.components.version}
+ </version>
+ </dependency>
+ <dependency>
+ <groupId>uk.org.taverna.scufl2</groupId>
+ <artifactId>scufl2-api</artifactId>
+ <version>${scufl2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${jackson-databind.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>com.springsource.org.apache.commons.lang</artifactId>
+ <version>${commons.lang.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.log4j</groupId>
+ <artifactId>com.springsource.org.apache.log4j</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <releases />
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <id>mygrid-repository</id>
+ <name>myGrid Repository</name>
+ <url>http://www.mygrid.org.uk/maven/repository
+ </url>
+ </repository>
+ <repository>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots />
+ <id>mygrid-snapshot-repository</id>
+ <name>myGrid Snapshot Repository</name>
+ <url>http://www.mygrid.org.uk/maven/snapshot-repository</url>
+ </repository>
+ </repositories>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/fa8b5b3d/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
new file mode 100644
index 0000000..0a70680
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/actions/SpreadsheetImportActivityConfigurationAction.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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 uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.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/fa8b5b3d/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
new file mode 100644
index 0000000..82f8436
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/il8n/SpreadsheetImportUIText.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * 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/fa8b5b3d/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
new file mode 100644
index 0000000..3073acb
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateAction.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * 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 uk.org.taverna.commons.services.ServiceRegistry;
+import uk.org.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/fa8b5b3d/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
new file mode 100644
index 0000000..048073a
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportAddTemplateMenuAction.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * 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 uk.org.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/fa8b5b3d/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
new file mode 100644
index 0000000..7d1fa0a
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/menu/SpreadsheetImportConfigureMenuAction.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * 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 uk.org.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/fa8b5b3d/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
new file mode 100644
index 0000000..1987364
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportActivityIcon.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * 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/fa8b5b3d/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
new file mode 100644
index 0000000..8057f2d
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/servicedescriptions/SpreadsheetImportTemplateService.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * 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 uk.org.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();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-workbench-common-activities/blob/fa8b5b3d/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
new file mode 100644
index 0000000..0409b8e
--- /dev/null
+++ b/taverna-spreadsheet-import-activity-ui/src/main/java/net/sf/taverna/t2/activities/spreadsheet/views/SpreadsheetImportConfigTableModel.java
@@ -0,0 +1,190 @@
+/*******************************************************************************
+ * 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 net.sf.taverna.t2.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());
+ }
+ }
+
+}