Search in sources :

Example 16 with TablePart

use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.

the class TableDirectEditPolicy method showCurrentEditValue.

@Override
protected void showCurrentEditValue(DirectEditRequest request) {
    String value = (String) request.getCellEditor().getValue();
    TablePart tablePart = (TablePart) getHost();
    tablePart.handleNameChange(value);
}
Also used : TablePart(com.cubrid.common.ui.er.part.TablePart)

Example 17 with TablePart

use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.

the class TableLayoutEditPolicy method createAddCommand.

@Override
protected Command createAddCommand(EditPart child, EditPart after) {
    if (!(child instanceof ColumnPart) || !(after instanceof ColumnPart)) {
        return null;
    }
    ERTableColumn toMove = (ERTableColumn) child.getModel();
    ERTableColumn afterModel = (ERTableColumn) after.getModel();
    TablePart originalTablePart = (TablePart) child.getParent();
    ERTable originalTable = (ERTable) originalTablePart.getModel();
    TablePart newTablePart = (TablePart) after.getParent();
    ERTable newTable = newTablePart.getTable();
    int oldIndex = originalTablePart.getChildren().indexOf(child);
    int newIndex = newTablePart.getChildren().indexOf(after);
    return new TransferColumnCommand(toMove, afterModel, originalTable, newTable, oldIndex, newIndex);
}
Also used : ERTableColumn(com.cubrid.common.ui.er.model.ERTableColumn) TablePart(com.cubrid.common.ui.er.part.TablePart) TransferColumnCommand(com.cubrid.common.ui.er.commands.TransferColumnCommand) ColumnPart(com.cubrid.common.ui.er.part.ColumnPart) ERTable(com.cubrid.common.ui.er.model.ERTable)

Example 18 with TablePart

use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.

the class TableNodeEditPolicy method getConnectionCompleteCommand.

/**
	 * @see GraphicalNodeEditPolicy#getConnectionCompleteCommand(CreateConnectionRequest)
	 */
@Override
protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
    CreateRelationshipCommand cmd = (CreateRelationshipCommand) request.getStartCommand();
    TablePart part = (TablePart) request.getTargetEditPart();
    cmd.setPrimaryTable(part.getTable());
    return cmd;
}
Also used : TablePart(com.cubrid.common.ui.er.part.TablePart) CreateRelationshipCommand(com.cubrid.common.ui.er.commands.CreateRelationshipCommand)

Example 19 with TablePart

use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.

the class TableNodeEditPolicy method getReconnectTargetCommand.

/**
	 * @see GraphicalNodeEditPolicy#getReconnectTargetCommand(ReconnectRequest)
	 */
@Override
protected Command getReconnectTargetCommand(ReconnectRequest request) {
    ReconnectPrimaryKeyCommand cmd = new ReconnectPrimaryKeyCommand();
    cmd.setRelationship((Relationship) request.getConnectionEditPart().getModel());
    TablePart tablePart = (TablePart) getHost();
    cmd.setTargetPrimaryKey(tablePart.getTable());
    return cmd;
}
Also used : ReconnectPrimaryKeyCommand(com.cubrid.common.ui.er.commands.ReconnectPrimaryKeyCommand) TablePart(com.cubrid.common.ui.er.part.TablePart)

Example 20 with TablePart

use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.

the class ERSchemaEditor method setLocateTable.

/**
	 * Set the ERD focus location onto the gave table
	 * 
	 * @param tableName
	 */
public void setLocateTable(String tableName) {
    SchemaDiagramPart schemaRootPart = getERSchemaRootPart();
    List allParts = schemaRootPart.getChildren();
    Iterator it = allParts.iterator();
    while (it.hasNext()) {
        Object obj = it.next();
        if (!(obj instanceof TablePart)) {
            continue;
        }
        TablePart tablePart = (TablePart) obj;
        ERTable erTable = tablePart.getTable();
        if (erTable.getName().equals(tableName)) {
            setLocatePoint(erTable.getBounds().x, erTable.getBounds().y);
        }
    }
}
Also used : SchemaDiagramPart(com.cubrid.common.ui.er.part.SchemaDiagramPart) Iterator(java.util.Iterator) TablePart(com.cubrid.common.ui.er.part.TablePart) ERTable(com.cubrid.common.ui.er.model.ERTable) ArrayList(java.util.ArrayList) List(java.util.List) EventObject(java.util.EventObject)

Aggregations

TablePart (com.cubrid.common.ui.er.part.TablePart)21 List (java.util.List)7 ERTable (com.cubrid.common.ui.er.model.ERTable)5 RelationshipPart (com.cubrid.common.ui.er.part.RelationshipPart)4 ColumnPart (com.cubrid.common.ui.er.part.ColumnPart)3 SchemaDiagramPart (com.cubrid.common.ui.er.part.SchemaDiagramPart)3 ArrayList (java.util.ArrayList)3 EventObject (java.util.EventObject)3 Iterator (java.util.Iterator)3 Rectangle (org.eclipse.draw2d.geometry.Rectangle)3 CreateRelationshipCommand (com.cubrid.common.ui.er.commands.CreateRelationshipCommand)2 TableFigure (com.cubrid.common.ui.er.figures.TableFigure)2 ERTableColumn (com.cubrid.common.ui.er.model.ERTableColumn)2 Edge (org.eclipse.draw2d.graph.Edge)2 CreateColumnCommand (com.cubrid.common.ui.er.commands.CreateColumnCommand)1 DeleteTableCommand (com.cubrid.common.ui.er.commands.DeleteTableCommand)1 MoveTableCommand (com.cubrid.common.ui.er.commands.MoveTableCommand)1 ReconnectForeignKeyCommand (com.cubrid.common.ui.er.commands.ReconnectForeignKeyCommand)1 ReconnectPrimaryKeyCommand (com.cubrid.common.ui.er.commands.ReconnectPrimaryKeyCommand)1 TransferColumnCommand (com.cubrid.common.ui.er.commands.TransferColumnCommand)1