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;
}
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;
}
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;
}
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;
}
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);
}
Aggregations