Skip to content
Snippets Groups Projects
Commit e2913893 authored by BIGARET Sebastien's avatar BIGARET Sebastien
Browse files

Added a transient field 'copiedFromResults' for copy/paste support

(diff -w to view)
parent 97520f2d
Branches enhancing_results_view
Tags
No related merge requests found
Pipeline #63 failed
......@@ -367,13 +367,19 @@ public class Workflow {
@Override
public Workflow clone() {
Workflow clone;
try {
return new Workflow(toXMLDocument(), new XMLWarnings());
clone = new Workflow(toXMLDocument(), new XMLWarnings());
} catch (InvalidXMLException e) {
// Sounds impossible. If this happens, there's something wrong in the implementation itself!
Log.log.log(Level.SEVERE, "Ooops, unable to clone() ?!!", e);
return null;
}
// when cloned inside the GUI, we should take care of the wf input's copiedFromResults status
// (see comments for this field for details)
for (WorkflowInput input: this.getInputs())
clone.getInputWithId(this.getIdForInput(input)).copiedFromResults = input.copiedFromResults;
return clone;
}
/**
......
......@@ -40,6 +40,13 @@ public class WorkflowInput
protected transient ArrayList<Parameter> parameters = new ArrayList<Parameter>();
/**
* This field is only used to mark the files copied from a result into the clipboard. When pasting such an
* input into a workflow, the file itself should be copied into an other location, so that the original file,
* belonging to a result, is not subject to changes.
*/
public transient boolean copiedFromResults = false;
void addOutput(Parameter p)
{
parameters.add(p);
......@@ -262,10 +269,18 @@ public class WorkflowInput
propChgSupport.firePropertyChange("name", oldName, name);
}
/**
* Sets the content of this object.
* @param content
* the content to set. A {@code null} value is equivalent to the empty array.
*/
public void setContent(List <String> content) {
if ( type == INPUT_TYPE.FILE || type == INPUT_TYPE.DIRECTORY)
{
List<String> _filepaths = this.filepaths;
if (content == null)
filepaths = new ArrayList<String>();
else
filepaths = new ArrayList<String>(content);
propChgSupport.firePropertyChange("filepaths", _filepaths, filepaths);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment