Taverna has now moved to the Apache Software Foundation. For updated information, see Apache Taverna (incubating).

ActivityIconSPI

An ActivityIconSPI provides the icon for an Activity. This determines the icon associated with a service of a specific type.

A new ActivityIconSPI can be added to Taverna 2.x by a class that implements the net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI interface.

The name of the new class must be specified in a net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI file within the appropriate resources/META-INF/services directory.

Example

net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLActivityIcon implements the net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI interface.

public class WSDLActivityIcon implements ActivityIconSPI{

	private static Icon icon;

 	public int canProvideIconScore(Activity<?> activity) {
 		if (activity.getClass().getName().equals(WSDLActivity.class.getName()))
 			return DEFAULT_ICON + 1;
 		else
 			return NO_ICON;
 	}

 	public Icon getIcon(Activity<?> activity) {
 		return getWSDLIcon();
 	}

	public static Icon getWSDLIcon() {
 		if (icon == null) {
			icon = new ImageIcon(
				WSDLActivityIcon.class.getResource("/wsdl.png"));
 		}
 		return icon;
 	}
}

The file named net.sf.taverna.t2.workbench.activityicons.ActivityIconSPI must contain the line:

net.sf.taverna.t2.activities.wsdl.servicedescriptions.WSDLActivityIcon