Search in sources :

Example 11 with ERTable

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

the class PartFactory method createEditPart.

public EditPart createEditPart(EditPart context, Object model) {
    EditPart part = null;
    if (model instanceof ERSchema) {
        part = new SchemaDiagramPart();
    } else if (model instanceof ERTable) {
        part = new TablePart();
    } else if (model instanceof Relationship) {
        part = new RelationshipPart();
    } else if (model instanceof ERTableColumn) {
        part = new ColumnPart();
    }
    if (null == part) {
        LOGGER.error("Part is null :" + context + "," + model);
    }
    part.setModel(model);
    return part;
}
Also used : Relationship(com.cubrid.common.ui.er.model.Relationship) ERTableColumn(com.cubrid.common.ui.er.model.ERTableColumn) EditPart(org.eclipse.gef.EditPart) ERSchema(com.cubrid.common.ui.er.model.ERSchema) ERTable(com.cubrid.common.ui.er.model.ERTable)

Example 12 with ERTable

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

the class TablePart method handleViewModelChange.

@Override
protected void handleViewModelChange(PropertyChangeEvent evt) {
    Object newValue = evt.getNewValue();
    Object oldValue = evt.getOldValue();
    if (oldValue == null || newValue == null) {
        throw new IllegalStateException(Messages.errOldNewValueBothNull);
    }
    if (newValue.equals(oldValue)) {
        return;
    }
    ERTable table = getTable();
    if (newValue.equals(PropertyChangeProvider.LOGIC_MODEL)) {
        setName(table.getLogicName());
    } else if (newValue.equals(PropertyChangeProvider.PHYSICAL_MODEL)) {
        setName(table.getName());
    }
    List<EditPart> children = getChildren();
    for (EditPart part : children) {
        if (part instanceof ColumnPart) {
            ColumnPart columnPart = (ColumnPart) part;
            columnPart.handleViewModelChange(evt);
        }
    }
    refreshVisuals();
}
Also used : ConnectionEditPart(org.eclipse.gef.ConnectionEditPart) NodeEditPart(org.eclipse.gef.NodeEditPart) EditPart(org.eclipse.gef.EditPart) ERTable(com.cubrid.common.ui.er.model.ERTable)

Example 13 with ERTable

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

the class TablePart method createFigure.

protected IFigure createFigure() {
    ERTable erTable = getTable();
    EditableLabel label = new EditableLabel(erTable.getShownName());
    TableFigure tableFigure = new TableFigure(label);
    Rectangle rec = erTable.getBounds();
    if (rec != null) {
        tableFigure.setBounds(rec);
    }
    return tableFigure;
}
Also used : EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel) TableFigure(com.cubrid.common.ui.er.figures.TableFigure) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ERTable(com.cubrid.common.ui.er.model.ERTable)

Example 14 with ERTable

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

the class SchemaDiagramPart method setTableFigureBounds.

public boolean setTableFigureBounds(boolean updateConstraint) {
    List tableParts = getChildren();
    for (Iterator iter = tableParts.iterator(); iter.hasNext(); ) {
        TablePart tablePart = (TablePart) iter.next();
        ERTable erTable = tablePart.getTable();
        Rectangle bounds = erTable.getBounds();
        if (bounds == null) {
            return false;
        } else {
            TableFigure tableFigure = (TableFigure) tablePart.getFigure();
            if (tableFigure == null) {
                return false;
            } else if (updateConstraint) {
                delegatingLayoutManager.setXYLayoutConstraint(tableFigure, new Rectangle(bounds.x, bounds.y, -1, -1));
            }
        }
    }
    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)

Example 15 with ERTable

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

the class AbstractSelectionAction method getERTable.

protected ERTable getERTable() {
    ERTable table = null;
    PropertyChangeProvider node = getSelectedNode();
    if (node instanceof ERTable) {
        table = (ERTable) node;
    } else if (node instanceof ERTableColumn) {
        ERTableColumn col = (ERTableColumn) node;
        table = col.getTable();
    }
    return table;
}
Also used : PropertyChangeProvider(com.cubrid.common.ui.er.model.PropertyChangeProvider) ERTableColumn(com.cubrid.common.ui.er.model.ERTableColumn) ERTable(com.cubrid.common.ui.er.model.ERTable)

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