use of org.apache.airavata.xbaya.ui.graph.GraphCanvas in project airavata by apache.
the class WorkflowFiler method saveAsWorkflow.
public void saveAsWorkflow() {
GraphCanvas graphCanvas = engine.getGUI().getGraphCanvas();
File saveAsWorkflowFile = saveAsWorkflow(graphCanvas);
if (saveAsWorkflowFile != null) {
graphCanvas.setWorkflowFile(saveAsWorkflowFile);
}
}
use of org.apache.airavata.xbaya.ui.graph.GraphCanvas in project airavata by apache.
the class WorkflowFiler method importWorkflow.
/**
* Imports a workflow from the local file to the current workflow.
*/
public void importWorkflow() {
int returnVal = this.graphFileChooser.showOpenDialog(this.engine.getGUI().getFrame());
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = this.graphFileChooser.getSelectedFile();
try {
String path = file.getPath();
Workflow importedWorkflow;
if (path.endsWith(XBayaConstants.GRAPH_FILE_SUFFIX)) {
WSGraph importedGraph = WSGraphFactory.createGraph(file);
importedWorkflow = Workflow.graphToWorkflow(importedGraph);
} else {
XmlElement importedWorkflowElement = XMLUtil.loadXML(file);
importedWorkflow = new Workflow(importedWorkflowElement);
}
GraphCanvas newGraphCanvas = engine.getGUI().newGraphCanvas(true);
newGraphCanvas.setWorkflow(importedWorkflow);
this.engine.getGUI().setWorkflow(importedWorkflow);
engine.getGUI().getGraphCanvas().setWorkflowFile(file);
} catch (IOException e) {
this.engine.getGUI().getErrorWindow().error(ErrorMessages.OPEN_FILE_ERROR, e);
} catch (GraphException e) {
this.engine.getGUI().getErrorWindow().error(ErrorMessages.GRAPH_FORMAT_ERROR, e);
} catch (ComponentException e) {
this.engine.getGUI().getErrorWindow().error(ErrorMessages.GRAPH_FORMAT_ERROR, e);
} catch (RuntimeException e) {
this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
} catch (Error e) {
this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
}
}
}
use of org.apache.airavata.xbaya.ui.graph.GraphCanvas in project airavata by apache.
the class WorkflowPropertyWindow method generateNewWorkflowName.
private String generateNewWorkflowName() {
String baseName = "Workflow";
List<String> existingNames = new ArrayList<String>();
if (this.xbayaGUI != null) {
List<GraphCanvas> graphCanvases = this.xbayaGUI.getGraphCanvases();
for (GraphCanvas graphCanvas : graphCanvases) {
existingNames.add(graphCanvas.getWorkflow().getName());
}
}
int i = 1;
String newName = baseName + i;
while (existingNames.contains(newName)) {
i++;
newName = baseName + i;
}
return newName;
}
use of org.apache.airavata.xbaya.ui.graph.GraphCanvas in project airavata by apache.
the class XBayaGUI method selectOrCreateGraphCanvas.
/**
* Selects a canvas with a specified workflow if any; otherwise create one.
*
* This method needs to be called by Swing event thread.
*
* @param workflow
*/
public void selectOrCreateGraphCanvas(Workflow workflow) {
GraphCanvas graphCanvas = null;
for (GraphCanvas canvas : this.graphCanvases) {
if (workflow == canvas.getWorkflow()) {
graphCanvas = canvas;
}
}
if (graphCanvas == null) {
graphCanvas = newGraphCanvas(true);
graphCanvas.setWorkflow(workflow);
} else {
setFocus(graphCanvas);
}
}
use of org.apache.airavata.xbaya.ui.graph.GraphCanvas in project airavata by apache.
the class XBayaGUI method activeTabChanged.
private void activeTabChanged() {
GraphCanvas graphPanel = getGraphCanvas();
if (graphPanel != null) {
// Reset the port viewers.
Port inputPort = graphPanel.getSelectedInputPort();
Port outputPort = graphPanel.getSelectedOutputPort();
this.portViewer.setInputPort(inputPort);
this.portViewer.setOutputPort(outputPort);
// Reset component viewer.
Node node = graphPanel.getSelectedNode();
Component component;
if (node != null) {
component = node.getComponent();
} else {
component = this.componentSelector.getSelectedComponent();
}
this.componentViewer.setComponent(component);
String name = graphPanel.getWorkflow().getName();
setFrameName(name);
} else {
// TODO what to do when no tabs are present???
}
}
Aggregations