use of org.eclipse.zest.layouts.constraints.BasicEntityConstraint in project archi by archimatetool.
the class SimpleNode method populateLayoutConstraint.
/**
* Populate the specified layout constraint
*/
@Override
public void populateLayoutConstraint(LayoutConstraint constraint) {
if (constraint instanceof LabelLayoutConstraint) {
LabelLayoutConstraint labelConstraint = (LabelLayoutConstraint) constraint;
labelConstraint.label = realObject.toString();
labelConstraint.pointSize = 18;
} else if (constraint instanceof BasicEntityConstraint) {
// noop
} else if (constraint instanceof EntityPriorityConstraint) {
EntityPriorityConstraint priorityConstraint = (EntityPriorityConstraint) constraint;
priorityConstraint.priority = Math.random() * 10 + 1;
}
}
use of org.eclipse.zest.layouts.constraints.BasicEntityConstraint in project archi by archimatetool.
the class AbstractLayoutAlgorithm method createInternalNodes.
// public void run() {
//
// if (started == true) {
// throw new RuntimeException("Layout has already run!");
// }
// started = true;
// //layoutStopped = false;
// isLayoutPaused = false;
// applyLayoutInternal(internalNodes, internalRelationships, internalX, internalY, internalWidth, internalHeight);
// stop();
// layoutStopped = true;
// isLayoutPaused = false;
// }
/**
* Creates a list of InternalNode objects from the list of LayoutEntity objects the user
* wants layed out. Sets the internal nodes' positions and sizes from the
* external entities.
*/
private InternalNode[] createInternalNodes(LayoutEntity[] nodes) {
InternalNode[] internalNodes = new InternalNode[nodes.length];
BasicEntityConstraint basicEntityConstraint = new BasicEntityConstraint();
for (int i = 0; i < nodes.length; i++) {
basicEntityConstraint.clear();
LayoutEntity externalNode = nodes[i];
InternalNode internalNode = new InternalNode(externalNode);
externalNode.populateLayoutConstraint(basicEntityConstraint);
internalNode.setInternalLocation(externalNode.getXInLayout(), externalNode.getYInLayout());
internalNodes[i] = internalNode;
}
// end of for
return internalNodes;
}
Aggregations