Search in sources :

Example 1 with IDrawableLink

use of org.talend.commons.ui.swt.drawing.link.IDrawableLink in project tdi-studio-se by Talend.

the class Link method draw.

public void draw(GC gc, Rectangle boundsOfDrawing) {
    StyleLinkFactory drawableLinkFactory = mapperManager.getUiManager().getStyleLinkFactory();
    IStyleLink styleLink = drawableLinkFactory.getStyleLink(this);
    IDrawableLink drawableLink = styleLink.getDrawableLink();
    if (drawableLink == null) {
        throw new NullPointerException();
    }
    IMapZone zone1 = pointLinkDescriptor1.getZone();
    IMapZone zone2 = pointLinkDescriptor2.getZone();
    int yOffsetPoint1 = uiManager.getVerticalScrolledOffsetBar((Zone) zone1);
    int yOffsetPoint2 = uiManager.getVerticalScrolledOffsetBar((Zone) zone2);
    boolean leftSidePosition = ((zone1 == Zone.INPUTS || zone1 == Zone.OUTPUTS) && zone1 == zone2);
    int point1xForTraceLink = point1.x + (leftSidePosition ? 0 : widthTable1 - 4);
    int point2xForTraceLink = point2.x + (leftSidePosition ? 0 : 0);
    int point1yOffset = point1.y + yOffsetPoint1;
    int point2yOffset = point2.y + yOffsetPoint2;
    drawableLink.setPoint1(new Point(point1xForTraceLink, point1yOffset));
    drawableLink.setPoint2(new Point(point2xForTraceLink, point2yOffset));
    drawableLink.setBoundsOfCalculate(boundsOfDrawing);
    Rectangle boundsOfSolidLine = new Rectangle(boundsOfDrawing.x, boundsOfDrawing.y, boundsOfDrawing.width, boundsOfDrawing.height);
    boundsOfSolidLine.y = boundsOfDrawing.y + MapperUI.OFFSET_VISIBLES_POINTS;
    boundsOfSolidLine.height = boundsOfDrawing.height - 2 * MapperUI.OFFSET_VISIBLES_POINTS;
    drawableLink.getStyle().apply(gc);
    if (!boundsOfSolidLine.contains(new Point(point1xForTraceLink, point1yOffset)) || !boundsOfSolidLine.contains(new Point(point2xForTraceLink, point2yOffset))) {
        // gc.setLineDash(new int[] { 1, spaceBetweenPoints, 1 });
        gc.setLineStyle(SWT.LINE_DOT);
    // gc.setLineStyle(SWT.LINE_CUSTOM);
    // System.out.println("SWT.LINE_DOT");
    } else {
        gc.setLineStyle(SWT.LINE_SOLID);
    // System.out.println("SWT.LINE_SOLID");
    }
    if (this.level != null) {
        drawableLink.setConnectorWidth(this.level * 5);
    }
    drawableLink.draw(gc);
}
Also used : IStyleLink(org.talend.commons.ui.swt.drawing.link.IStyleLink) Rectangle(org.eclipse.swt.graphics.Rectangle) IDrawableLink(org.talend.commons.ui.swt.drawing.link.IDrawableLink) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point) IMapZone(org.talend.designer.abstractmap.ui.visualmap.zone.IMapZone)

Example 2 with IDrawableLink

use of org.talend.commons.ui.swt.drawing.link.IDrawableLink in project tdi-studio-se by Talend.

the class StyleLinkFactory method getSelectedSameInputZoneStyle.

/**
     * DOC amaumont Comment method "getSelectedSameZoneStyle".
     * 
     * @param foregroundColor
     * @return
     */
public IStyleLink getSelectedSameInputZoneStyle() {
    StyleLink style = new StyleLink();
    setCommonsStyleProperties(style);
    IDrawableLink sameZoneLink = getSameZoneLink(style);
    style.setDrawableLink(sameZoneLink);
    ExtremityWestArrow westArrow = new ExtremityWestArrow(style);
    style.setExtremity1(westArrow);
    ExtremityEastArrow eastArrowTarget = new ExtremityEastArrow(style);
    eastArrowTarget.setXOffset(-eastArrowTarget.getSize().x);
    style.setExtremity2(eastArrowTarget);
    style.setForegroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_SELECTED_LOOKUP_LINKS));
    return style;
}
Also used : IStyleLink(org.talend.commons.ui.swt.drawing.link.IStyleLink) StyleLink(org.talend.commons.ui.swt.drawing.link.StyleLink) IDrawableLink(org.talend.commons.ui.swt.drawing.link.IDrawableLink) ExtremityWestArrow(org.talend.commons.ui.swt.drawing.link.ExtremityWestArrow) ExtremityEastArrow(org.talend.commons.ui.swt.drawing.link.ExtremityEastArrow)

Example 3 with IDrawableLink

use of org.talend.commons.ui.swt.drawing.link.IDrawableLink in project tdi-studio-se by Talend.

the class Link method draw.

public void draw(GC gc, Rectangle boundsOfDrawing) {
    StyleLinkFactory drawableLinkFactory = mapperManager.getUiManager().getStyleLinkFactory();
    IStyleLink styleLink = drawableLinkFactory.getStyleLink(this);
    IDrawableLink drawableLink = styleLink.getDrawableLink();
    if (drawableLink == null) {
        throw new NullPointerException();
    }
    IMapZone zone1 = pointLinkDescriptor1.getZone();
    IMapZone zone2 = pointLinkDescriptor2.getZone();
    int yOffsetPoint1 = uiManager.getVerticalScrolledOffsetBar((Zone) zone1);
    int yOffsetPoint2 = uiManager.getVerticalScrolledOffsetBar((Zone) zone2);
    boolean leftSidePosition = ((zone1 == Zone.INPUTS || zone1 == Zone.VARS) && zone1 == zone2);
    int point1xForTraceLink = point1.x + (leftSidePosition ? 0 : widthTable1 - 4);
    int point2xForTraceLink = point2.x + (leftSidePosition ? 0 : 0);
    int point1yOffset = point1.y + yOffsetPoint1;
    int point2yOffset = point2.y + yOffsetPoint2;
    // feature 11742
    final int yOffsetConstant = 5;
    if (point1yOffset < -yOffsetConstant) {
        point1yOffset = -yOffsetConstant;
    }
    if (point2yOffset < -yOffsetConstant) {
        point2yOffset = -yOffsetConstant;
    }
    drawableLink.setPoint1(new Point(point1xForTraceLink, point1yOffset));
    drawableLink.setPoint2(new Point(point2xForTraceLink, point2yOffset));
    drawableLink.setBoundsOfCalculate(boundsOfDrawing);
    Rectangle boundsOfSolidLine = new Rectangle(boundsOfDrawing.x, boundsOfDrawing.y, boundsOfDrawing.width, boundsOfDrawing.height);
    boundsOfSolidLine.y = boundsOfDrawing.y + MapperUI.OFFSET_VISIBLES_POINTS;
    boundsOfSolidLine.height = boundsOfDrawing.height - 2 * MapperUI.OFFSET_VISIBLES_POINTS;
    drawableLink.getStyle().apply(gc);
    if (!boundsOfSolidLine.contains(new Point(point1xForTraceLink, point1yOffset)) || !boundsOfSolidLine.contains(new Point(point2xForTraceLink, point2yOffset))) {
        // gc.setLineDash(new int[] { 1, spaceBetweenPoints, 1 });
        gc.setLineStyle(SWT.LINE_DOT);
    // gc.setLineStyle(SWT.LINE_CUSTOM);
    // System.out.println("SWT.LINE_DOT");
    } else {
        gc.setLineStyle(SWT.LINE_SOLID);
    // System.out.println("SWT.LINE_SOLID");
    }
    if (this.level != null) {
        drawableLink.setConnectorWidth(this.level * 5);
    }
    drawableLink.draw(gc);
}
Also used : IStyleLink(org.talend.commons.ui.swt.drawing.link.IStyleLink) Rectangle(org.eclipse.swt.graphics.Rectangle) IDrawableLink(org.talend.commons.ui.swt.drawing.link.IDrawableLink) Point(org.eclipse.swt.graphics.Point) Point(org.eclipse.swt.graphics.Point) IMapZone(org.talend.designer.abstractmap.ui.visualmap.zone.IMapZone)

Example 4 with IDrawableLink

use of org.talend.commons.ui.swt.drawing.link.IDrawableLink in project tdi-studio-se by Talend.

the class StyleLinkFactory method getSelectedSameInputZoneStyle.

/**
     * DOC amaumont Comment method "getSelectedSameZoneStyle".
     * 
     * @param foregroundColor
     * @return
     */
public IStyleLink getSelectedSameInputZoneStyle() {
    StyleLink style = new StyleLink();
    setCommonsStyleProperties(style);
    IDrawableLink sameZoneLink = getSameZoneLink(style);
    style.setDrawableLink(sameZoneLink);
    ExtremityWestArrow westArrow = new ExtremityWestArrow(style);
    style.setExtremity1(westArrow);
    ExtremityEastArrow eastArrowTarget = new ExtremityEastArrow(style);
    eastArrowTarget.setXOffset(-eastArrowTarget.getSize().x);
    style.setExtremity2(eastArrowTarget);
    style.setForegroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_SELECTED_LOOKUP_LINKS));
    return style;
}
Also used : IStyleLink(org.talend.commons.ui.swt.drawing.link.IStyleLink) StyleLink(org.talend.commons.ui.swt.drawing.link.StyleLink) IDrawableLink(org.talend.commons.ui.swt.drawing.link.IDrawableLink) ExtremityWestArrow(org.talend.commons.ui.swt.drawing.link.ExtremityWestArrow) ExtremityEastArrow(org.talend.commons.ui.swt.drawing.link.ExtremityEastArrow)

Example 5 with IDrawableLink

use of org.talend.commons.ui.swt.drawing.link.IDrawableLink in project tdi-studio-se by Talend.

the class StyleLinkFactory method getSelectedSameVarsZoneStyle.

/**
     * DOC amaumont Comment method "getSelectedSameZoneStyle".
     * 
     * @param foregroundColor
     * @return
     */
public IStyleLink getSelectedSameVarsZoneStyle() {
    StyleLink style = new StyleLink();
    setCommonsStyleProperties(style);
    IDrawableLink sameZoneLink = getSameZoneLink(style);
    style.setDrawableLink(sameZoneLink);
    ExtremityWestArrow westArrow = new ExtremityWestArrow(style);
    style.setExtremity1(westArrow);
    ExtremityEastArrow eastArrowTarget = new ExtremityEastArrow(style);
    eastArrowTarget.setXOffset(-eastArrowTarget.getSize().x);
    style.setExtremity2(eastArrowTarget);
    style.setForegroundColor(ColorProviderMapper.getColor(ColorInfo.COLOR_SELECTED_LOOKUP_LINKS));
    return style;
}
Also used : IStyleLink(org.talend.commons.ui.swt.drawing.link.IStyleLink) StyleLink(org.talend.commons.ui.swt.drawing.link.StyleLink) IDrawableLink(org.talend.commons.ui.swt.drawing.link.IDrawableLink) ExtremityWestArrow(org.talend.commons.ui.swt.drawing.link.ExtremityWestArrow) ExtremityEastArrow(org.talend.commons.ui.swt.drawing.link.ExtremityEastArrow)

Aggregations

IDrawableLink (org.talend.commons.ui.swt.drawing.link.IDrawableLink)6 IStyleLink (org.talend.commons.ui.swt.drawing.link.IStyleLink)5 Point (org.eclipse.swt.graphics.Point)3 Rectangle (org.eclipse.swt.graphics.Rectangle)3 ExtremityEastArrow (org.talend.commons.ui.swt.drawing.link.ExtremityEastArrow)3 ExtremityWestArrow (org.talend.commons.ui.swt.drawing.link.ExtremityWestArrow)3 StyleLink (org.talend.commons.ui.swt.drawing.link.StyleLink)3 IMapZone (org.talend.designer.abstractmap.ui.visualmap.zone.IMapZone)2 Table (org.eclipse.swt.widgets.Table)1 TableItem (org.eclipse.swt.widgets.TableItem)1 LinkDescriptor (org.talend.commons.ui.swt.drawing.link.LinkDescriptor)1