use of org.yakindu.base.gmf.runtime.treelayout.TreeLayoutConstraint in project statecharts by Yakindu.
the class TreeLayoutEditPolicy method getConstraintFor.
@Override
protected Object getConstraintFor(ChangeBoundsRequest request, GraphicalEditPart child) {
if (request instanceof AlignmentRequest) {
return super.getConstraintFor(request, child);
}
final Rectangle rect = (Rectangle) super.getConstraintFor(request, child);
final Rectangle cons = getCurrentConstraintFor(child);
final int newTreePosition = TreeLayoutUtil.getNewTreeNodePosition(request.getLocation(), TreeLayoutUtil.getSiblings((IGraphicalEditPart) child));
if (cons instanceof TreeLayoutConstraint) {
final TreeLayoutConstraint treeLayoutConstraint = (TreeLayoutConstraint) cons;
return new TreeLayoutConstraint(rect, treeLayoutConstraint.isRoot(), newTreePosition);
}
return new TreeLayoutConstraint(rect, false, newTreePosition);
}
Aggregations