Search in sources :

Example 1 with ELineStyle

use of org.pentaho.di.core.gui.PrimitiveGCInterface.ELineStyle in project pentaho-kettle by pentaho.

the class TransPainter method drawLine.

private void drawLine(StepMeta fs, StepMeta ts, TransHopMeta hi, boolean is_candidate) {
    int[] line = getLine(fs, ts);
    EColor col;
    ELineStyle linestyle = ELineStyle.SOLID;
    int activeLinewidth = linewidth;
    EImage arrow;
    if (is_candidate) {
        col = EColor.BLUE;
        arrow = EImage.ARROW_CANDIDATE;
    } else {
        if (hi.isEnabled()) {
            if (fs.isSendingErrorRowsToStep(ts)) {
                col = EColor.RED;
                linestyle = ELineStyle.DASH;
                activeLinewidth = linewidth + 1;
                arrow = EImage.ARROW_ERROR;
            } else {
                col = EColor.HOP_DEFAULT;
                arrow = EImage.ARROW_DEFAULT;
            }
        } else {
            col = EColor.GRAY;
            arrow = EImage.ARROW_DISABLED;
        }
    }
    if (hi.split) {
        activeLinewidth = linewidth + 2;
    }
    // Check to see if the source step is an info step for the target step.
    // 
    StepIOMetaInterface ioMeta = ts.getStepMetaInterface().getStepIOMeta();
    List<StreamInterface> infoStreams = ioMeta.getInfoStreams();
    if (!infoStreams.isEmpty()) {
        // 
        for (StreamInterface stream : infoStreams) {
            if (fs.getName().equalsIgnoreCase(stream.getStepname())) {
                // 
                if (fs.getCopies() > 1) {
                    // This is not a desirable situation, it will always end in error.
                    // As such, it's better not to give feedback on it.
                    // We do this by drawing an error icon over the hop...
                    // 
                    col = EColor.RED;
                    arrow = EImage.ARROW_ERROR;
                }
            }
        }
    }
    gc.setForeground(col);
    gc.setLineStyle(linestyle);
    gc.setLineWidth(activeLinewidth);
    drawArrow(arrow, line, hi, fs, ts);
    if (hi.split) {
        gc.setLineWidth(linewidth);
    }
    gc.setForeground(EColor.BLACK);
    gc.setBackground(EColor.BACKGROUND);
    gc.setLineStyle(ELineStyle.SOLID);
}
Also used : EImage(org.pentaho.di.core.gui.PrimitiveGCInterface.EImage) StepIOMetaInterface(org.pentaho.di.trans.step.StepIOMetaInterface) EColor(org.pentaho.di.core.gui.PrimitiveGCInterface.EColor) ELineStyle(org.pentaho.di.core.gui.PrimitiveGCInterface.ELineStyle) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) StreamInterface(org.pentaho.di.trans.step.errorhandling.StreamInterface)

Aggregations

KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)1 Point (org.pentaho.di.core.gui.Point)1 EColor (org.pentaho.di.core.gui.PrimitiveGCInterface.EColor)1 EImage (org.pentaho.di.core.gui.PrimitiveGCInterface.EImage)1 ELineStyle (org.pentaho.di.core.gui.PrimitiveGCInterface.ELineStyle)1 StepIOMetaInterface (org.pentaho.di.trans.step.StepIOMetaInterface)1 StreamInterface (org.pentaho.di.trans.step.errorhandling.StreamInterface)1