blob: e594b7ffbeeb75855c6bd498f884a30b5570d444 [file] [log] [blame]
<activity xmlns="http://taverna.sf.net/2008/xml/t2flow"><class>net.sf.taverna.t2.activities.localworker.LocalworkerActivity</class><inputMap /><outputMap /><configBean encoding="xstream"><net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean xmlns="">
<script>import java.awt.CardLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import javax.swing.ImageIcon;
import javax.swing.JEditorPane;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.filechooser.FileFilter;
class FileExtFilter extends FileFilter {
public FileExtFilter(String ext, String label, boolean includeDir) {
this.ext = ext;
this.label = label;
this.includeDir = includeDir;
}
public String getDescription() {
return this.label;
}
public boolean accept(File file) {
if (file.isDirectory() &amp;&amp; includeDir) {
return true;
} else {
return file.getName().endsWith(this.ext);
}
}
String ext, label;
boolean includeDir;
}
if (title == void) {
title = null;
}
if ((fileExtensions == void) || (fileExtensions == null)) {
fileExtensions = "";
}
if ((fileExtLabels == void) || (fileExtLabels == null)) {
fileExtLabels = "";
}
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(title);
String[] fileTypeList = fileExtensions.split(",");
String[] filterLabelList = fileExtLabels.split(",");
if (fileTypeList != null &amp;&amp; filterLabelList != null &amp;&amp; fileTypeList.length != filterLabelList.length) {
throw new RuntimeException("The list of extensions and file filter labels must be the same length");
}
// create the file filters
for (int i = 0; i &lt; fileTypeList.length; i++) {
FileExtFilter filter = new FileExtFilter(fileTypeList[i], filterLabelList[i], true);
chooser.setFileFilter(filter);
}
chooser.showOpenDialog(null);
File file = chooser.getSelectedFile();
selectedFile = file.getAbsolutePath();
</script>
<dependencies />
<inputs>
<net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
<name>title</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
</net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
<name>fileExtensions</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
</net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
<handledReferenceSchemes />
<translatedElementType>java.lang.String</translatedElementType>
<allowsLiteralValues>true</allowsLiteralValues>
<name>fileExtLabels</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
</net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityInputPortDefinitionBean>
</inputs>
<outputs>
<net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
<granularDepth>0</granularDepth>
<name>selectedFile</name>
<depth>0</depth>
<mimeTypes>
<string>'text/plain'</string>
</mimeTypes>
</net.sf.taverna.t2.workflowmodel.processor.activity.config.ActivityOutputPortDefinitionBean>
</outputs>
</net.sf.taverna.t2.activities.localworker.LocalworkerActivityConfigurationBean></configBean></activity>