Search in sources :

Example 1 with VarTablePart

use of org.talend.designer.gefabstractmap.part.VarTablePart in project tdi-studio-se by Talend.

the class VarColumnAnchor method getReferencePoint.

@Override
public Point getReferencePoint() {
    Point ref = null;
    final VarTablePart varTablePart = (VarTablePart) MapperUtils.getMapperTablePart(entityManager.getEditPart());
    if (entityManager.isTableMinimized()) {
        if (isSource) {
            ref = varTablePart.getFigure().getBounds().getRight();
        } else {
            ref = varTablePart.getFigure().getBounds().getLeft();
        }
    } else if (getOwner() instanceof TableTreeEntityFigure) {
        TableTreeEntityFigure nodeFigure = (TableTreeEntityFigure) getOwner();
        // normal column
        if (nodeFigure.getTreeBranch() == null) {
            if (isSource) {
                ref = getOwner().getBounds().getRight();
            } else {
                if (nodeFigure.getElement() != null) {
                    ref = nodeFigure.getElement().getBounds().getLeft();
                } else {
                    ref = getOwner().getBounds().getLeft();
                }
            }
            getOwner().translateToAbsolute(ref);
        }
    } else if (getOwner() instanceof VarEntityFigure) {
        VarEntityFigure varNodeFigure = (VarEntityFigure) getOwner();
        if (isSource) {
            ref = getOwner().getBounds().getRight();
            ref.x = varTablePart.getFigure().getBounds().getRight().x;
        } else {
            if (varNodeFigure.getExpression() != null) {
                ref = varNodeFigure.getExpression().getBounds().getLeft();
            } else {
                ref = getOwner().getBounds().getLeft();
            }
        }
        getOwner().translateToAbsolute(ref);
    } else {
        ref = getOwner().getBounds().getCenter();
        getOwner().translateToAbsolute(ref);
    }
    return ref;
}
Also used : VarEntityFigure(org.talend.designer.gefabstractmap.figures.var.VarEntityFigure) TableTreeEntityFigure(org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure) VarTablePart(org.talend.designer.gefabstractmap.part.VarTablePart) Point(org.eclipse.draw2d.geometry.Point)

Aggregations

Point (org.eclipse.draw2d.geometry.Point)1 TableTreeEntityFigure (org.talend.designer.gefabstractmap.figures.table.entity.TableTreeEntityFigure)1 VarEntityFigure (org.talend.designer.gefabstractmap.figures.var.VarEntityFigure)1 VarTablePart (org.talend.designer.gefabstractmap.part.VarTablePart)1