Search in sources :

Example 6 with ERTable

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

the class ColumnEditPolicy method createDeleteCommand.

@Override
protected Command createDeleteCommand(GroupRequest request) {
    ERTable parent = (ERTable) (getHost().getParent().getModel());
    DeleteColumnCommand deleteCmd = new DeleteColumnCommand();
    deleteCmd.setTable(parent);
    deleteCmd.setColumn((ERTableColumn) (getHost().getModel()));
    return deleteCmd;
}
Also used : ERTable(com.cubrid.common.ui.er.model.ERTable) DeleteColumnCommand(com.cubrid.common.ui.er.commands.DeleteColumnCommand)

Example 7 with ERTable

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

the class RelationshipEditPolicy method createDeleteCommand.

protected Command createDeleteCommand(GroupRequest request) {
    Relationship relationship = (Relationship) getHost().getModel();
    ERTable primaryKeyTarget = relationship.getPrimaryKeyTable();
    ERTable foreignKeySource = relationship.getForeignKeyTable();
    DeleteRelationshipCommand deleteCmd = new DeleteRelationshipCommand(foreignKeySource, primaryKeyTarget, relationship);
    return deleteCmd;
}
Also used : DeleteRelationshipCommand(com.cubrid.common.ui.er.commands.DeleteRelationshipCommand) Relationship(com.cubrid.common.ui.er.model.Relationship) ERTable(com.cubrid.common.ui.er.model.ERTable)

Example 8 with ERTable

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

the class SchemaContainerEditPolicy method getCreateCommand.

@Override
protected Command getCreateCommand(CreateRequest request) {
    Object newObject = request.getNewObject();
    if (!(newObject instanceof ERTable)) {
        return null;
    }
    Point location = request.getLocation();
    SchemaDiagramPart schemaPart = (SchemaDiagramPart) getHost();
    ERSchema erSchema = schemaPart.getSchema();
    ERTable erTable = (ERTable) newObject;
    ERSchemaEditor editor = schemaPart.getEditor();
    int offsetX = 0;
    int offsetY = 0;
    if (editor != null) {
        offsetX = editor.getHorizontalScrollWidth();
        offsetY = editor.getVerticalScrollHeight();
    }
    erTable.setBounds(new Rectangle(location.x + offsetX, location.y + offsetY, erTable.getMinWidth(), erTable.getMinHeight()));
    AddTableCommand addTableCommand = new AddTableCommand();
    addTableCommand.setSchema(erSchema);
    SchemaInfo schemaInfo = ERTable.createEmptySchemaInfo(erTable.getName(), erTable.getCubridDatabase().getName());
    addTableCommand.setTable(erTable, schemaInfo);
    return addTableCommand;
}
Also used : SchemaDiagramPart(com.cubrid.common.ui.er.part.SchemaDiagramPart) AddTableCommand(com.cubrid.common.ui.er.commands.AddTableCommand) ERSchemaEditor(com.cubrid.common.ui.er.editor.ERSchemaEditor) ERSchema(com.cubrid.common.ui.er.model.ERSchema) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ERTable(com.cubrid.common.ui.er.model.ERTable) Point(org.eclipse.draw2d.geometry.Point) Point(org.eclipse.draw2d.geometry.Point) SchemaInfo(com.cubrid.common.core.common.model.SchemaInfo)

Example 9 with ERTable

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

the class TableContainerEditPolicy method getCreateCommand.

@Override
protected Command getCreateCommand(CreateRequest request) {
    Object newObject = request.getNewObject();
    if (!(newObject instanceof ERTableColumn)) {
        return null;
    }
    TablePart tablePart = (TablePart) getHost();
    ERTable erTable = tablePart.getTable();
    ERTableColumn column = (ERTableColumn) newObject;
    CreateColumnCommand command = new CreateColumnCommand();
    command.setTable(erTable);
    command.setColumn(column);
    return command;
}
Also used : ERTableColumn(com.cubrid.common.ui.er.model.ERTableColumn) TablePart(com.cubrid.common.ui.er.part.TablePart) ERTable(com.cubrid.common.ui.er.model.ERTable) CreateColumnCommand(com.cubrid.common.ui.er.commands.CreateColumnCommand)

Example 10 with ERTable

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

the class TableLayoutEditPolicy method createMoveChildCommand.

@SuppressWarnings("rawtypes")
@Override
protected Command createMoveChildCommand(EditPart child, EditPart after) {
    if (after == null) {
        return null;
    }
    ERTableColumn childModel = (ERTableColumn) child.getModel();
    ERTable parentTable = (ERTable) getHost().getModel();
    List hostParts = getHost().getChildren();
    int oldIndex = hostParts.indexOf(child);
    int newIndex = hostParts.indexOf(after);
    return new MoveColumnCommand(childModel, parentTable, oldIndex, newIndex);
}
Also used : ERTableColumn(com.cubrid.common.ui.er.model.ERTableColumn) ERTable(com.cubrid.common.ui.er.model.ERTable) List(java.util.List) MoveColumnCommand(com.cubrid.common.ui.er.commands.MoveColumnCommand)

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