Search in sources :

Example 86 with Rectangle

use of org.eclipse.draw2d.geometry.Rectangle in project cubrid-manager by CUBRID.

the class SchemaXYLayoutPolicy method getCurrentConstraintFor.

@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)

Example 87 with Rectangle

use of org.eclipse.draw2d.geometry.Rectangle in project cubrid-manager by CUBRID.

the class TableEditPolicy method createDeleteCommand.

@Override
protected Command createDeleteCommand(GroupRequest request) {
    TablePart tablePart = (TablePart) getHost();
    Rectangle bounds = tablePart.getFigure().getBounds().getCopy();
    ERSchema parent = (ERSchema) (tablePart.getParent().getModel());
    DeleteTableCommand deleteCmd = new DeleteTableCommand();
    deleteCmd.setSchema(parent);
    deleteCmd.setTable((ERTable) (tablePart.getModel()));
    deleteCmd.setOriginalBounds(bounds);
    return deleteCmd;
}
Also used : TablePart(com.cubrid.common.ui.er.part.TablePart) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ERSchema(com.cubrid.common.ui.er.model.ERSchema) DeleteTableCommand(com.cubrid.common.ui.er.commands.DeleteTableCommand)

Example 88 with Rectangle

use of org.eclipse.draw2d.geometry.Rectangle in project cubrid-manager by CUBRID.

the class ERConnectionAnchor method getLocation.

public Point getLocation(Point reference) {
    Rectangle rect = getOwner().getBounds().getCopy();
    this.getOwner().translateToAbsolute(rect);
    if (anchor == UP) {
        return rect.getTopLeft().translate(new Double(rect.width * offsetPercent).intValue(), 0);
    } else if (anchor == RIGHT) {
        return rect.getTopRight().translate(0, new Double(rect.height * offsetPercent).intValue());
    } else if (anchor == DOWN) {
        return rect.getBottomLeft().translate(new Double(rect.width * offsetPercent).intValue(), 0);
    } else if (anchor == LEFT) {
        return rect.getTopLeft().translate(0, new Double(rect.height * offsetPercent).intValue());
    }
    return null;
}
Also used : Rectangle(org.eclipse.draw2d.geometry.Rectangle)

Example 89 with Rectangle

use of org.eclipse.draw2d.geometry.Rectangle in project cubrid-manager by CUBRID.

the class TablePart method createFigure.

protected IFigure createFigure() {
    ERTable erTable = getTable();
    EditableLabel label = new EditableLabel(erTable.getShownName());
    TableFigure tableFigure = new TableFigure(label);
    Rectangle rec = erTable.getBounds();
    if (rec != null) {
        tableFigure.setBounds(rec);
    }
    return tableFigure;
}
Also used : EditableLabel(com.cubrid.common.ui.er.figures.EditableLabel) TableFigure(com.cubrid.common.ui.er.figures.TableFigure) Rectangle(org.eclipse.draw2d.geometry.Rectangle) ERTable(com.cubrid.common.ui.er.model.ERTable)

Example 90 with Rectangle

use of org.eclipse.draw2d.geometry.Rectangle in project cubrid-manager by CUBRID.

the class TablePart method refreshVisuals.

public void refreshVisuals() {
    TableFigure tableFigure = (TableFigure) getFigure();
    Point location = tableFigure.getLocation();
    SchemaDiagramPart parent = (SchemaDiagramPart) getParent();
    Rectangle constraint = new Rectangle(location.x, location.y, -1, -1);
    parent.setLayoutConstraint(this, tableFigure, constraint);
    super.refreshVisuals();
}
Also used : TableFigure(com.cubrid.common.ui.er.figures.TableFigure) Rectangle(org.eclipse.draw2d.geometry.Rectangle) Point(org.eclipse.draw2d.geometry.Point)

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