Search in sources :

Example 16 with TableFigure

use of com.cubrid.common.ui.er.figures.TableFigure 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)

Example 17 with TableFigure

use of com.cubrid.common.ui.er.figures.TableFigure in project cubrid-manager by CUBRID.

the class SchemaDiagramPart method setTableModelBounds.

public boolean setTableModelBounds() {
    List tableParts = getChildren();
    for (Iterator iter = tableParts.iterator(); iter.hasNext(); ) {
        Object obj = iter.next();
        if (!(obj instanceof TablePart)) {
            continue;
        }
        TablePart tablePart = (TablePart) obj;
        TableFigure tableFigure = (TableFigure) tablePart.getFigure();
        if (tableFigure == null) {
            continue;
        }
        Rectangle bounds = tableFigure.getBounds().getCopy();
        ERTable erTable = tablePart.getTable();
        erTable.setBounds(bounds);
    }
    return true;
}
Also used : TableFigure(com.cubrid.common.ui.er.figures.TableFigure) Iterator(java.util.Iterator) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ERTable(com.cubrid.common.ui.er.model.ERTable) LinkedList(java.util.LinkedList) List(java.util.List) EventObject(java.util.EventObject)

Example 18 with TableFigure

use of com.cubrid.common.ui.er.figures.TableFigure in project cubrid-manager by CUBRID.

the class SchemaDiagramPart method getRectangle.

public Rectangle getRectangle() {
    Rectangle rec = new Rectangle(0, 0, 0, 0);
    List tableParts = getChildren();
    for (Iterator iter = tableParts.iterator(); iter.hasNext(); ) {
        Object obj = iter.next();
        if (!(obj instanceof TablePart)) {
            continue;
        }
        TablePart tablePart = (TablePart) obj;
        TableFigure tableFigure = (TableFigure) tablePart.getFigure();
        if (tableFigure == null) {
            continue;
        }
        LayoutUtil.unionAndExpand(rec, tableFigure.getBounds());
    }
    return rec;
}
Also used : TableFigure(com.cubrid.common.ui.er.figures.TableFigure) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Iterator(java.util.Iterator) LinkedList(java.util.LinkedList) List(java.util.List) EventObject(java.util.EventObject)

Aggregations

TableFigure (com.cubrid.common.ui.er.figures.TableFigure)18 Rectangle (org.eclipse.draw2d.geometry.Rectangle)8 EditableLabel (com.cubrid.common.ui.er.figures.EditableLabel)6 ERTable (com.cubrid.common.ui.er.model.ERTable)6 Iterator (java.util.Iterator)4 List (java.util.List)4 EventObject (java.util.EventObject)3 LinkedList (java.util.LinkedList)3 TablePart (com.cubrid.common.ui.er.part.TablePart)2 Point (org.eclipse.draw2d.geometry.Point)2 ValidationGraphicalViewer (com.cubrid.common.ui.er.ValidationGraphicalViewer)1 ValidationMessageHandler (com.cubrid.common.ui.er.ValidationMessageHandler)1 MoveTableCommand (com.cubrid.common.ui.er.commands.MoveTableCommand)1 ERDirectEditManager (com.cubrid.common.ui.er.directedit.ERDirectEditManager)1 LabelCellEditorLocator (com.cubrid.common.ui.er.directedit.LabelCellEditorLocator)1 TableNameCellEditorValidator (com.cubrid.common.ui.er.directedit.TableNameCellEditorValidator)1 TableNameCellEditor (com.cubrid.common.ui.er.editor.TableNameCellEditor)1 ConnectionFigure (com.cubrid.common.ui.er.figures.ConnectionFigure)1 RelationshipPart (com.cubrid.common.ui.er.part.RelationshipPart)1 SchemaDiagramPart (com.cubrid.common.ui.er.part.SchemaDiagramPart)1