Search in sources :

Example 1 with ChangeNodeConstraintCommand

use of com.cubrid.cubridmanager.ui.replication.editor.commands.ChangeNodeConstraintCommand in project cubrid-manager by CUBRID.

the class DiagramLayoutEditPolicy method createChangeConstraintCommand.

/**
	 * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createChangeConstraintCommand(org.eclipse.gef.EditPart,
	 *      java.lang.Object)
	 * @param child the EditPart of the child being changed
	 * @param constraint the new constraint, after being
	 *        {@link #translateToModelConstraint(Object) translated}
	 * @return Command
	 */
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
    if (!(child instanceof NodePart)) {
        return null;
    }
    if (!(constraint instanceof Rectangle)) {
        return null;
    }
    ChangeNodeConstraintCommand cmd = new ChangeNodeConstraintCommand();
    cmd.setNode((Node) child.getModel());
    cmd.setLocation(((Rectangle) constraint).getLocation());
    cmd.setDimension(((Rectangle) constraint).getSize());
    return cmd;
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) NodePart(com.cubrid.cubridmanager.ui.replication.editor.parts.NodePart) ChangeNodeConstraintCommand(com.cubrid.cubridmanager.ui.replication.editor.commands.ChangeNodeConstraintCommand)

Example 2 with ChangeNodeConstraintCommand

use of com.cubrid.cubridmanager.ui.replication.editor.commands.ChangeNodeConstraintCommand in project cubrid-manager by CUBRID.

the class ContainerNodeLayoutEditPolicy method createChangeConstraintCommand.

/**
	 * @see org.eclipse.gef.editpolicies.ConstrainedLayoutEditPolicy#createChangeConstraintCommand(org.eclipse.gef.EditPart,
	 *      java.lang.Object)
	 * @param child the EditPart of the child being changed
	 * @param constraint the new constraint, after being
	 *        {@link #translateToModelConstraint(Object) translated}
	 * @return Command
	 */
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
    if (!(child instanceof NodePart)) {
        return null;
    }
    if (!(constraint instanceof Rectangle)) {
        return null;
    }
    ChangeNodeConstraintCommand cmd = new ChangeNodeConstraintCommand();
    cmd.setNode((Node) child.getModel());
    cmd.setLocation(((Rectangle) constraint).getLocation());
    cmd.setDimension(((Rectangle) constraint).getSize());
    return cmd;
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) NodePart(com.cubrid.cubridmanager.ui.replication.editor.parts.NodePart) ChangeNodeConstraintCommand(com.cubrid.cubridmanager.ui.replication.editor.commands.ChangeNodeConstraintCommand)

Aggregations

ChangeNodeConstraintCommand (com.cubrid.cubridmanager.ui.replication.editor.commands.ChangeNodeConstraintCommand)2 NodePart (com.cubrid.cubridmanager.ui.replication.editor.parts.NodePart)2 Rectangle (org.eclipse.draw2d.geometry.Rectangle)2