Search in sources :

Example 91 with Rectangle

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;
}
Also used : TableFigure(com.cubrid.common.ui.er.figures.TableFigure) Iterator(java.util.Iterator) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ERTable(com.cubrid.common.ui.er.model.ERTable) LinkedList(java.util.LinkedList) List(java.util.List)

Example 92 with Rectangle

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;
}
Also used : EntityDiagram(org.jkiss.dbeaver.ext.erd.model.EntityDiagram) EntityFigure(org.jkiss.dbeaver.ext.erd.figures.EntityFigure) Rectangle(org.eclipse.draw2d.geometry.Rectangle)

Example 93 with Rectangle

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);
    }
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) Figure(org.eclipse.draw2d.Figure)

Example 94 with Rectangle

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;
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle)

Example 95 with Rectangle

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;
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle) IFigure(org.eclipse.draw2d.IFigure)

Aggregations

Rectangle (org.eclipse.draw2d.geometry.Rectangle)347 Point (org.eclipse.draw2d.geometry.Point)107 Dimension (org.eclipse.draw2d.geometry.Dimension)80 IFigure (org.eclipse.draw2d.IFigure)43 List (java.util.List)24 AbstractWidgetModel (org.csstudio.opibuilder.model.AbstractWidgetModel)18 DoubleRectangle (edu.cmu.cs.hcii.cogtool.model.DoubleRectangle)17 PointList (org.eclipse.draw2d.geometry.PointList)16 GraphicalEditPart (org.eclipse.gef.GraphicalEditPart)15 CompoundCommand (org.eclipse.gef.commands.CompoundCommand)14 ArrayList (java.util.ArrayList)11 Iterator (java.util.Iterator)11 PrecisionRectangle (org.eclipse.draw2d.geometry.PrecisionRectangle)11 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)11 AbstractContainerModel (org.csstudio.opibuilder.model.AbstractContainerModel)10 AbstractGraphicalEditPart (org.eclipse.gef.editparts.AbstractGraphicalEditPart)10 TableFigure (com.cubrid.common.ui.er.figures.TableFigure)8 Viewport (org.eclipse.draw2d.Viewport)8 Node (org.talend.designer.core.ui.editor.nodes.Node)8 Image (org.eclipse.swt.graphics.Image)7