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

UIComponentSPI

If a service of a given type needs configuration, for example a Beanshell, then it normally has a UI component that is shown to allow user interaction.

A new way to configure a specific service type can be added to Taverna 1.7.x by a class that implements the org.embl.ebi.escience.scuflui.spi.UIComponentSPI interface.

Example

org.embl.ebi.escience.scuflworkers.beanshell.BeanshellConfigPanel implements the org.embl.ebi.escience.scuflui.spi.UIComponentSPI interface.

public class BeanshellConfigPanel extends JPanel implements UIComponentSPI,
	ScuflModelEventListener {

        ...

	public String getName() {
		if (processor == null) {
			return "Beanshell config panel for unknown processor";
		} else {
			return "Configuring beanshell for " + processor.getName();
		}
	}

	public ImageIcon getIcon() {
		return ProcessorHelper.getPreferredIcon(processor);
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see org.embl.ebi.escience.scufl.ScuflModelEventListener#receiveModelEvent
	(org.embl.ebi.escience.scufl.ScuflModelEvent)
	 */
	public void receiveModelEvent(ScuflModelEvent event) {
		inputTable.tableChanged(new TableModelEvent(inputTable.getModel()));
		outputTable.tableChanged(new TableModelEvent(outputTable.getModel()));
	}

	boolean isValidName(String name) {
		if (name.matches("\\w+")) {
			Port[] ports = processor.getPorts();
			for (int index = 0; index < ports.length; index++) {
				if (ports[index].getName().equals(name)) {
					return false;
				}
			}
			return true;
		}
		return false;
	}

	public void onDisplay() {
		// TODO Auto-generated method stub

	}

	public void onDispose() {
		// TODO Auto-generated method stub

	}
}