use of org.eclipse.draw2d.geometry.Dimension in project cubrid-manager by CUBRID.
the class ERTableNode method setStartPointByCenter.
public void setStartPointByCenter(int centerX, int centerY) {
Dimension d = getDefaultPreferredSize();
this.x = centerX - d.width / 2;
this.y = centerY - d.height / 2;
}
use of org.eclipse.draw2d.geometry.Dimension in project cubrid-manager by CUBRID.
the class ERMinJoinDirectedGraphLayout method buildLayoutSumLenth.
public int buildLayoutSumLenth(List<ERTableNode> allNode, boolean horizon) {
if (allNode == null || allNode.isEmpty()) {
return 0;
}
int sum = 0;
int count = allNode.size();
ERTableNode firstNode = allNode.get(0);
ERTableNode endNode = allNode.get(count - 1);
if (horizon) {
sum += firstNode.width / 2;
sum += endNode.width / 2;
for (int i = 0; i < count - 1; i++) {
Dimension tmpD = buildDefaultCenterOffset(allNode.get(i), allNode.get(i + 1), Ray.RIGHT);
sum += Math.abs(tmpD.width);
}
} else {
sum += firstNode.height / 2;
sum += endNode.height / 2;
for (int i = 0; i < count - 1; i++) {
Dimension tmpD = buildDefaultCenterOffset(allNode.get(i), allNode.get(i + 1), Ray.DOWN);
sum += Math.abs(tmpD.height);
}
}
return sum;
}
use of org.eclipse.draw2d.geometry.Dimension in project cubrid-manager by CUBRID.
the class ERMinJoinDirectedGraphLayout method getHighestNode.
private ERTableNode getHighestNode(List<ERTableNode> nodes) {
ERTableNode result = null;
int highest = 0;
if (nodes.size() == 1) {
return nodes.get(0);
}
for (ERTableNode node : nodes) {
Dimension d = node.getDefaultPreferredSize();
if (d.height > highest) {
highest = d.height;
result = node;
}
}
return result;
}
use of org.eclipse.draw2d.geometry.Dimension in project cubrid-manager by CUBRID.
the class ERMinJoinDirectedGraphLayout method buildRelationNodeXY.
private void buildRelationNodeXY(ERTableNode basicNode, ERTableNode otherNode, Ray ray) {
Dimension offsetD = buildDefaultCenterOffset(basicNode, otherNode, ray);
buildRelationNodeXY(basicNode, otherNode, ray, offsetD);
}
use of org.eclipse.draw2d.geometry.Dimension in project dbeaver by serge-rider.
the class EntityAddCommand method execute.
@Override
public void execute() {
Point curLocation = location == null ? null : new Point(location);
for (ERDEntity entity : entities) {
diagramPart.getDiagram().addTable(entity, true);
if (curLocation != null) {
// Put new entities in specified location
for (Object diagramChild : diagramPart.getChildren()) {
if (diagramChild instanceof EntityPart) {
EntityPart entityPart = (EntityPart) diagramChild;
if (entityPart.getTable() == entity) {
final Rectangle newBounds = new Rectangle();
final Dimension size = entityPart.getFigure().getPreferredSize();
newBounds.x = curLocation.x;
newBounds.y = curLocation.y;
newBounds.width = size.width;
newBounds.height = size.height;
entityPart.modifyBounds(newBounds);
curLocation.x += size.width + 20;
break;
}
}
}
}
}
}
Aggregations