use of org.jkiss.dbeaver.ext.erd.command.NodeMoveCommand in project dbeaver by serge-rider.
the class DiagramXYLayoutPolicy method createChangeConstraintCommand.
/**
* Creates command to move table. Does not allow table to be resized
*/
@Override
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
if (!(child instanceof NodePart))
return null;
if (!(constraint instanceof Rectangle))
return null;
NodePart nodePart = (NodePart) child;
Figure figure = (Figure) nodePart.getFigure();
Rectangle oldBounds = figure.getBounds();
Rectangle newBounds = (Rectangle) constraint;
// Restrict resize for entities
if (nodePart instanceof EntityPart) {
if (oldBounds.width != newBounds.width && newBounds.width != -1)
return null;
if (oldBounds.height != newBounds.height && newBounds.height != -1)
return null;
}
return new NodeMoveCommand(nodePart, oldBounds.getCopy(), newBounds.getCopy());
}
Aggregations