Search in sources :

Example 16 with ERTable

use of com.cubrid.common.ui.er.model.ERTable in project cubrid-manager by CUBRID.

the class TablePart method revertNameChange.

public void revertNameChange() {
    TableFigure tableFigure = (TableFigure) getFigure();
    EditableLabel label = tableFigure.getNameLabel();
    ERTable erTable = getTable();
    label.setText(erTable.getShownName());
    label.setVisible(true);
    refreshVisuals();
}
Also used : TableFigure(com.cubrid.common.ui.er.figures.TableFigure) EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel) ERTable(com.cubrid.common.ui.er.model.ERTable)

Example 17 with ERTable

use of com.cubrid.common.ui.er.model.ERTable 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 18 with ERTable

use of com.cubrid.common.ui.er.model.ERTable 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 19 with ERTable

use of com.cubrid.common.ui.er.model.ERTable in project cubrid-manager by CUBRID.

the class SchemaDiagramPart method clearNeedPartitionLayoutState.

public void clearNeedPartitionLayoutState() {
    List tableParts = getChildren();
    for (Iterator iter = tableParts.iterator(); iter.hasNext(); ) {
        TablePart tablePart = (TablePart) iter.next();
        ERTable erTable = tablePart.getTable();
        if (erTable.isNeedPartitionLayout()) {
            erTable.setNeedPartitionLayout(false);
        }
    }
}
Also used : Iterator(java.util.Iterator) ERTable(com.cubrid.common.ui.er.model.ERTable) LinkedList(java.util.LinkedList) List(java.util.List)

Example 20 with ERTable

use of com.cubrid.common.ui.er.model.ERTable in project cubrid-manager by CUBRID.

the class SchemaDiagramPart method getNeedPartitionLayoutTables.

public List<TablePart> getNeedPartitionLayoutTables() {
    List<TablePart> result = new LinkedList<TablePart>();
    List tableParts = getChildren();
    for (Iterator iter = tableParts.iterator(); iter.hasNext(); ) {
        Object obj = iter.next();
        if (!(obj instanceof TablePart)) {
            continue;
        }
        TablePart tablePart = (TablePart) obj;
        ERTable erTable = tablePart.getTable();
        if (erTable.isNeedPartitionLayout()) {
            result.add(tablePart);
        }
    }
    return result;
}
Also used : Iterator(java.util.Iterator) ERTable(com.cubrid.common.ui.er.model.ERTable) LinkedList(java.util.LinkedList) List(java.util.List) EventObject(java.util.EventObject) LinkedList(java.util.LinkedList)

Aggregations

ERTable (com.cubrid.common.ui.er.model.ERTable)30 List (java.util.List)14 ERTableColumn (com.cubrid.common.ui.er.model.ERTableColumn)11 TableFigure (com.cubrid.common.ui.er.figures.TableFigure)6 Iterator (java.util.Iterator)6 SchemaInfo (com.cubrid.common.core.common.model.SchemaInfo)5 ERSchema (com.cubrid.common.ui.er.model.ERSchema)5 TablePart (com.cubrid.common.ui.er.part.TablePart)5 LinkedList (java.util.LinkedList)5 Rectangle (org.eclipse.draw2d.geometry.Rectangle)5 CubridTableParser (com.cubrid.common.ui.er.model.CubridTableParser)4 Relationship (com.cubrid.common.ui.er.model.Relationship)4 ArrayList (java.util.ArrayList)4 EventObject (java.util.EventObject)4 SchemaDiagramPart (com.cubrid.common.ui.er.part.SchemaDiagramPart)3 Constraint (com.cubrid.common.core.common.model.Constraint)2 DBAttribute (com.cubrid.common.core.common.model.DBAttribute)2 EditableLabel (com.cubrid.common.ui.er.figures.EditableLabel)2 PropertyChangeProvider (com.cubrid.common.ui.er.model.PropertyChangeProvider)2 Point (org.eclipse.draw2d.geometry.Point)2