use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.
the class GraphXYLayout method layoutPartitionNodes.
private void layoutPartitionNodes() {
List<TablePart> tables = diagram.getNeedPartitionLayoutTables();
if (tables.isEmpty()) {
return;
}
Rectangle rec = diagram.getRectangle();
layout(tables, 0, rec.y + rec.height);
for (TablePart table : tables) {
// set the bound constraints
table.refreshVisuals();
}
List<TablePart> allTables = diagram.getAllTables();
if (tables.size() == allTables.size()) {
// all new tables, to focus to
// (0,0) location
diagram.moveTopLeftFocus();
} else {
diagram.moveLastTableLocationFocus();
}
diagram.clearNeedPartitionLayoutState();
}
use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.
the class ERGraphLayoutVisitor method initGraph.
private void initGraph(SchemaDiagramPart schemaDiagram) {
for (int i = 0; i < schemaDiagram.getChildren().size(); i++) {
TablePart part = (TablePart) schemaDiagram.getChildren().get(i);
ERTableNode node = buildNode(part);
erGraph.addNode(node);
partNodesMap.put(part, node);
}
}
use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.
the class ERGraphLayoutVisitor method layout.
public void layout(SchemaDiagramPart schemaDiagram) {
initGraph(schemaDiagram);
if (erGraph.getNodeCount() > 0) {
for (int i = 0; i < schemaDiagram.getChildren().size(); i++) {
TablePart tablePart = (TablePart) schemaDiagram.getChildren().get(i);
List conns = tablePart.getSourceConnections();
for (int j = 0; j < conns.size(); j++) {
RelationshipPart relationshipPart = (RelationshipPart) tablePart.getSourceConnections().get(j);
Edge edge = buildEdgeRelation(relationshipPart);
erGraph.addEdge(edge);
partNodesMap.put(relationshipPart, edge);
}
}
ERDirectedGraphLayout gLayout = new ERDirectedGraphLayout(erGraph);
gLayout.layout();
setFiguresBound(schemaDiagram);
}
}
use of com.cubrid.common.ui.er.part.TablePart in project cubrid-manager by CUBRID.
the class SchemaContextMenuProvider method buildContextMenu.
@Override
public void buildContextMenu(IMenuManager menu) {
if (!(menu instanceof SchemaContextMenuProvider)) {
return;
}
SchemaContextMenuProvider menuProvider = (SchemaContextMenuProvider) menu;
EditPartViewer viewer = menuProvider.getViewer();
if (viewer == null) {
return;
}
buildPublicMenuItems(menu);
List selectParts = viewer.getSelectedEditParts();
// blank right-click
if (selectParts == null || selectParts.size() == 0) {
return;
}
// multi-objects right-click
if (selectParts.size() > 1) {
buildMultiFiguresMenuItems(menu);
return;
}
// one object right-click
Object object = selectParts.get(0);
if (object instanceof TablePart) {
buildTableMenuItems(menu);
} else if (object instanceof ColumnPart) {
buildColumnMenuItems(menu);
} else if (object instanceof RelationshipPart) {
buildRelationshipLineMenuItems(menu);
}
}
use of com.cubrid.common.ui.er.part.TablePart 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());
}
Aggregations