@Override protected Graph doInBackground() throws Exception { final Graph graphFromFile = GPFProcessor.readGraph(new InputStreamReader(fileStream), null); setGraph(graphFromFile, addUI); notifyGraphEvent(new GraphEvent(events.REFRESH_EVENT, null)); return graphFromFile; } }
public void setGraph(final Graph graphFromFile, final boolean addUI) throws GraphException { if (graphFromFile != null) { graph = graphFromFile; graphNodeList.clear(); final XppDom presentationXML = graph.getApplicationData("Presentation"); if (presentationXML != null) { // get graph description final XppDom descXML = presentationXML.getChild("Description"); if (descXML != null && descXML.getValue() != null) { graphDescription = descXML.getValue(); } } final Node[] nodes = graph.getNodes(); for (Node n : nodes) { final GraphNode newGraphNode = new GraphNode(n); if (presentationXML != null) newGraphNode.setDisplayParameters(presentationXML); graphNodeList.add(newGraphNode); if (addUI) { OperatorUI ui = OperatorUIRegistry.CreateOperatorUI(newGraphNode.getOperatorName()); if (ui == null) { throw new GraphException("Unable to load " + newGraphNode.getOperatorName()); } newGraphNode.setOperatorUI(ui); } notifyGraphEvent(new GraphEvent(events.ADD_EVENT, newGraphNode)); } } }
public void setSelectedNode(GraphNode node) { if (node == null) return; notifyGraphEvent(new GraphEvent(events.SELECT_EVENT, node)); }
public void removeOperator(final GraphNode node) { notifyGraphEvent(new GraphEvent(events.REMOVE_EVENT, node)); removeNode(node); }
public void notifyConnection() { if(graphNodeList.getGraphNodes().length > 0) { notifyGraphEvent(new GraphEvent(events.CONNECT_EVENT, graphNodeList.getGraphNodes()[0])); } }
public GraphNode addOperator(final String opName) { String id = opName; int cnt = 1; while (graphNodeList.findGraphNode(id) != null) { ++cnt; id = opName + '(' + cnt + ')'; } final GraphNode newGraphNode = createNewGraphNode(graph, opName, id); notifyGraphEvent(new GraphEvent(events.ADD_EVENT, newGraphNode)); return newGraphNode; }