RISE UI: Create a Framework XML File
Created: 2012-03-05 22:07:23
Last updated: 2012-03-05 22:08:31
This workflow create a framework configuration XML file based on user interaction.
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (0)
Titles (0)
Descriptions (0)
Dependencies (0)
Inputs (5)
Name |
Description |
simTime |
|
Documentation |
|
zone |
|
url |
|
port |
|
Processors (12)
Name |
Type |
Description |
Select_MA |
localworker |
Scriptimport 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() && 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 && filterLabelList != null && 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 < 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();
|
Select_VAL |
localworker |
Scriptimport 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() && 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 && filterLabelList != null && 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 < 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();
|
Select_MACRO |
localworker |
Scriptimport 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() && 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 && filterLabelList != null && 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 < 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();
|
fileExtensions_value |
stringconstant |
Valuema |
fileExtensions_value_1 |
stringconstant |
Valueval |
fileExtensions_value_2 |
stringconstant |
Valueinc |
title_value |
stringconstant |
ValueSelect MA file |
title_value_1 |
stringconstant |
ValueSelect VAL file |
title_value_2 |
stringconstant |
ValueSelect INC file |
generateXMLFilesTag |
beanshell |
ScriptString content = "";
File mafile = new File(ma);
File valfile = new File(val);
File incfile = new File(inc);
if (ma != null){
content+=""+mafile.getName()+"";
}
if (val != null){
content+=""+valfile.getName()+"";
}
if (inc != null){
content+=""+incfile.getName()+"";
}
files = content; |
TemplateXMLConf |
stringconstant |
Value {documentation} {files} {time} true {zone} |
GenerateXMLFromTemplate |
beanshell |
ScriptString content = template;
content = content.replace("{documentation}",documentation);
content = content.replace("{files}",files);
content = content.replace("{port}",port);
content = content.replace("{time}",time);
content = content.replace("{url}",url);
content = content.replace("{zone}",zone);
xml = content; |
Beanshells (2)
Name |
Description |
Inputs |
Outputs |
generateXMLFilesTag |
|
ma
val
inc
|
files
|
GenerateXMLFromTemplate |
|
url
port
zone
time
files
documentation
template
|
xml
|
Outputs (1)
Name |
Description |
Beanshell_xml |
|
Datalinks (17)
Source |
Sink |
fileExtensions_value:value |
Select_MA:fileExtensions |
title_value:value |
Select_MA:title |
fileExtensions_value_1:value |
Select_VAL:fileExtensions |
title_value_1:value |
Select_VAL:title |
fileExtensions_value_2:value |
Select_MACRO:fileExtensions |
title_value_2:value |
Select_MACRO:title |
Select_MA:selectedFile |
generateXMLFilesTag:ma |
Select_VAL:selectedFile |
generateXMLFilesTag:val |
Select_MACRO:selectedFile |
generateXMLFilesTag:inc |
generateXMLFilesTag:files |
GenerateXMLFromTemplate:files |
url |
GenerateXMLFromTemplate:url |
zone |
GenerateXMLFromTemplate:zone |
Documentation |
GenerateXMLFromTemplate:documentation |
simTime |
GenerateXMLFromTemplate:time |
port |
GenerateXMLFromTemplate:port |
TemplateXMLConf:value |
GenerateXMLFromTemplate:template |
GenerateXMLFromTemplate:xml |
Beanshell_xml |
Uploader
License
All versions of this Workflow are
licensed under:
Version 1
(of 1)
Credits (1)
(People/Groups)
Attributions (0)
(Workflows/Files)
None
Shared with Groups (0)
None
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment