Search in sources :

Example 1 with MoveTableCommand

use of com.cubrid.common.ui.er.commands.MoveTableCommand in project cubrid-manager by CUBRID.

the class SchemaXYLayoutPolicy method createChangeConstraintCommand.

@Override
protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
    if (!(child instanceof TablePart) || !(constraint instanceof Rectangle)) {
        return null;
    }
    TablePart tablePart = (TablePart) child;
    ERTable erTable = tablePart.getTable();
    TableFigure figure = (TableFigure) tablePart.getFigure();
    Rectangle oldBounds = figure.getBounds();
    Rectangle newBounds = (Rectangle) constraint;
    if (oldBounds.width != newBounds.width && newBounds.width != -1) {
        return null;
    } else if (oldBounds.height != newBounds.height && newBounds.height != -1) {
        return null;
    }
    return new MoveTableCommand(erTable, oldBounds.getCopy(), newBounds.getCopy());
}
Also used : TableFigure(com.cubrid.common.ui.er.figures.TableFigure) TablePart(com.cubrid.common.ui.er.part.TablePart) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ERTable(com.cubrid.common.ui.er.model.ERTable) MoveTableCommand(com.cubrid.common.ui.er.commands.MoveTableCommand)

Aggregations

MoveTableCommand (com.cubrid.common.ui.er.commands.MoveTableCommand)1 TableFigure (com.cubrid.common.ui.er.figures.TableFigure)1 ERTable (com.cubrid.common.ui.er.model.ERTable)1 TablePart (com.cubrid.common.ui.er.part.TablePart)1 Rectangle (org.eclipse.draw2d.geometry.Rectangle)1