use of org.openlca.app.editors.graphical.layout.LayoutManager in project olca-app by GreenDelta.
the class GraphEditor method initializeGraphicalViewer.
@Override
protected void initializeGraphicalViewer() {
var viewer = getGraphicalViewer();
viewer.setRootEditPart(new ScalableRootEditPart() {
@Override
protected LayeredPane createPrintableLayers() {
var pane = new LayeredPane();
var models = new Layer();
models.setOpaque(false);
models.setLayoutManager(new StackLayout());
pane.add(models, PRIMARY_LAYER);
// add the connection layer on top of the
// model layer
var connections = new ConnectionLayer();
connections.setPreferredSize(new Dimension(5, 5));
pane.add(connections, CONNECTION_LAYER);
return pane;
}
});
GraphDropListener.on(this);
viewer.getEditDomain().setActiveTool(new PanningSelectionTool());
viewer.setContents(model);
var zoom = getZoomManager();
zoom.setZoomLevels(ZOOM_LEVELS);
zoom.setZoomAnimationStyle(ZoomManager.ANIMATE_ZOOM_IN_OUT);
viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.NONE), MouseWheelZoomHandler.SINGLETON);
// load the graph settings
var fileApplied = GraphFile.apply(this);
if (!fileApplied) {
// no saved settings applied =>
// try to find a good configuration
var system = systemEditor.getModel();
if (system.referenceProcess != null) {
var refNode = model.getProcessNode(system.referenceProcess.id);
if (refNode != null) {
refNode.expandLeft();
refNode.expandRight();
}
}
// initialize the tree layout
if (model != null && model.figure != null) {
var layout = model.figure.getLayoutManager();
if (layout instanceof LayoutManager) {
((LayoutManager) layout).layout(model.figure, LayoutType.TREE_LAYOUT);
}
}
}
}
use of org.openlca.app.editors.graphical.layout.LayoutManager in project olca-app by GreenDelta.
the class ProductSystemPart method createEditPolicies.
@Override
protected void createEditPolicies() {
installEditPolicy(EditPolicy.LAYOUT_ROLE, new LayoutPolicy());
installEditPolicy(EditPolicy.COMPONENT_ROLE, new ComponentEditPolicy() {
});
LayoutManager manager = new LayoutManager(getModel());
getFigure().setLayoutManager(manager);
}
use of org.openlca.app.editors.graphical.layout.LayoutManager in project olca-app by GreenDelta.
the class MassCreationCommand method execute.
@Override
public void execute() {
for (RootDescriptor process : toCreate) addNode(process);
for (ProcessLink newLink : newLinks) link(newLink);
for (ProcessNode node : sysNode.getChildren()) if (node.figure.isVisible())
oldConstraints.put(node.figure, node.figure.getBounds().getCopy());
((LayoutManager) sysNode.figure.getLayoutManager()).layout(sysNode.figure, sysNode.editor.getLayoutType());
sysNode.editor.setDirty();
if (sysNode.editor.getOutline() != null)
sysNode.editor.getOutline().refresh();
}
Aggregations