use of org.eclipse.draw2d.geometry.Rectangle in project cubrid-manager by CUBRID.
the class SchemaDiagramPart method setTableFigureBounds.
public boolean setTableFigureBounds(boolean updateConstraint) {
List tableParts = getChildren();
for (Iterator iter = tableParts.iterator(); iter.hasNext(); ) {
TablePart tablePart = (TablePart) iter.next();
ERTable erTable = tablePart.getTable();
Rectangle bounds = erTable.getBounds();
if (bounds == null) {
return false;
} else {
TableFigure tableFigure = (TableFigure) tablePart.getFigure();
if (tableFigure == null) {
return false;
} else if (updateConstraint) {
delegatingLayoutManager.setXYLayoutConstraint(tableFigure, new Rectangle(bounds.x, bounds.y, -1, -1));
}
}
}
return true;
}
use of org.eclipse.draw2d.geometry.Rectangle in project dbeaver by serge-rider.
the class EntityPart method createFigure.
//******************* Layout related methods *********************/
/**
* Creates a figure which represents the table
*/
@Override
protected EntityFigure createFigure() {
final EntityFigure figure = new EntityFigure(getTable());
final EntityDiagram diagram = ((DiagramPart) getParent()).getDiagram();
Rectangle bounds = diagram.getInitBounds(getTable());
if (bounds != null) {
figure.setLocation(bounds.getLocation());
}
return figure;
}
use of org.eclipse.draw2d.geometry.Rectangle in project dbeaver by serge-rider.
the class NodePart method modifyBounds.
/**
* If modified, sets bounds and fires off event notification
*
* @param bounds The bounds to set.
*/
public void modifyBounds(Rectangle bounds) {
Rectangle oldBounds = this.bounds;
if (!bounds.equals(oldBounds)) {
this.bounds = bounds;
Figure entityFigure = (Figure) getFigure();
DiagramPart parent = (DiagramPart) getParent();
parent.setLayoutConstraint(this, entityFigure, bounds);
}
}
use of org.eclipse.draw2d.geometry.Rectangle in project dbeaver by serge-rider.
the class DiagramPart method setTableModelBounds.
/**
* Updates the table bounds in the model so that the same bounds can be
* restored after saving
*
* @return whether the procedure execute successfully without any omissions.
* The latter occurs if any EntityFigure has no bounds set for any of
* the Table model objects
*/
public boolean setTableModelBounds() {
List<?> entityParts = getChildren();
for (Iterator<?> iter = entityParts.iterator(); iter.hasNext(); ) {
NodePart entityPart = (NodePart) iter.next();
IFigure entityFigure = entityPart.getFigure();
// continue
if (entityFigure == null) {
continue;
}
Rectangle bounds = entityFigure.getBounds().getCopy();
entityPart.setBounds(bounds);
}
return true;
}
use of org.eclipse.draw2d.geometry.Rectangle in project dbeaver by serge-rider.
the class DiagramXYLayoutPolicy method getCurrentConstraintFor.
/**
* Returns the current bounds as the constraint if none can be found in the
* figures Constraint object
*/
@Override
public Rectangle getCurrentConstraintFor(GraphicalEditPart child) {
IFigure fig = child.getFigure();
Rectangle rectangle = (Rectangle) fig.getParent().getLayoutManager().getConstraint(fig);
if (rectangle == null) {
rectangle = fig.getBounds();
}
return rectangle;
}
Aggregations