use of org.openlca.app.editors.graphical.command.LayoutCommand in project olca-app by GreenDelta.
the class GraphEditor method expand.
/**
* Expands all process nodes in the graphical editor.
*/
public void expand() {
model = new ProductSystemNode(this);
var system = getProductSystem();
// create the process nodes
var ref = system.referenceProcess;
for (var id : system.processes) {
if (id == null)
continue;
// was already added
if (ref != null && ref.id == id)
continue;
var node = ProcessNode.create(this, id);
if (node != null) {
model.add(node);
}
}
// set the viewer content and expand the nodes
var viewer = getGraphicalViewer();
if (viewer == null)
return;
viewer.deselectAll();
viewer.setContents(model);
for (var node : model.getChildren()) {
node.expandLeft();
node.expandRight();
}
getCommandStack().execute(new LayoutCommand(this, LayoutType.TREE_LAYOUT));
}
use of org.openlca.app.editors.graphical.command.LayoutCommand in project olca-app by GreenDelta.
the class GraphEditor method collapse.
/**
* Collapse all process nodes in the editor. Only the reference process will be
* added.
*/
public void collapse() {
model = new ProductSystemNode(this);
var viewer = getGraphicalViewer();
if (viewer == null)
return;
viewer.deselectAll();
viewer.setContents(model);
getCommandStack().execute(new LayoutCommand(this, LayoutType.TREE_LAYOUT));
}
Aggregations