Search in sources :

Example 1 with SwingUniversalImage

use of org.pentaho.di.core.SwingUniversalImage in project pentaho-kettle by pentaho.

the class SwingDirectGC method drawImage.

public void drawImage(EImage image, int x, int y, int width, int height, float magnification) {
    SwingUniversalImage img = getNativeImage(image);
    drawImage(img, x, y, width, height);
}
Also used : SwingUniversalImage(org.pentaho.di.core.SwingUniversalImage)

Example 2 with SwingUniversalImage

use of org.pentaho.di.core.SwingUniversalImage in project pentaho-kettle by pentaho.

the class SwingDirectGC method getImageIcon.

private SwingUniversalImage getImageIcon(String fileName) throws KettleException {
    SwingUniversalImage image = null;
    InputStream inputStream = null;
    if (fileName == null) {
        throw new KettleException("Image icon file name can not be null");
    }
    if (SvgSupport.isSvgEnabled() && SvgSupport.isSvgName(fileName)) {
        try {
            inputStream = new FileInputStream(fileName);
        } catch (FileNotFoundException ex) {
        // no need to fail
        }
        if (inputStream == null) {
            try {
                inputStream = new FileInputStream("/" + fileName);
            } catch (FileNotFoundException ex) {
            // no need to fail
            }
        }
        if (inputStream == null) {
            inputStream = getClass().getResourceAsStream(fileName);
        }
        if (inputStream == null) {
            inputStream = getClass().getResourceAsStream("/" + fileName);
        }
        if (inputStream != null) {
            try {
                SvgImage svg = SvgSupport.loadSvgImage(inputStream);
                image = new SwingUniversalImageSvg(svg);
            } catch (Exception ex) {
                throw new KettleException("Unable to load image from classpath : '" + fileName + "'", ex);
            } finally {
                IOUtils.closeQuietly(inputStream);
            }
        }
    }
    if (image == null) {
        fileName = SvgSupport.toPngName(fileName);
        try {
            inputStream = new FileInputStream(fileName);
        } catch (FileNotFoundException ex) {
        // no need to fail
        }
        if (inputStream == null) {
            try {
                inputStream = new FileInputStream("/" + fileName);
            } catch (FileNotFoundException ex) {
            // no need to fail
            }
        }
        if (inputStream == null) {
            inputStream = getClass().getResourceAsStream(fileName);
        }
        if (inputStream == null) {
            inputStream = getClass().getResourceAsStream("/" + fileName);
        }
        if (inputStream != null) {
            try {
                BufferedImage bitmap = ImageIO.read(inputStream);
                WaitingImageObserver wia = new WaitingImageObserver(bitmap);
                wia.waitImageLoaded();
                image = new SwingUniversalImageBitmap(bitmap);
            } catch (Exception ex) {
                throw new KettleException("Unable to load image from classpath : '" + fileName + "'", ex);
            } finally {
                IOUtils.closeQuietly(inputStream);
            }
        }
    }
    if (image == null) {
        throw new KettleException("Unable to load image from classpath : '" + fileName + "'");
    }
    return image;
}
Also used : SwingUniversalImageSvg(org.pentaho.di.core.SwingUniversalImageSvg) KettleException(org.pentaho.di.core.exception.KettleException) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) FileNotFoundException(java.io.FileNotFoundException) SvgImage(org.pentaho.di.core.svg.SvgImage) SwingUniversalImageBitmap(org.pentaho.di.core.SwingUniversalImageBitmap) SwingUniversalImage(org.pentaho.di.core.SwingUniversalImage) FileInputStream(java.io.FileInputStream) KettleException(org.pentaho.di.core.exception.KettleException) FileNotFoundException(java.io.FileNotFoundException) BufferedImage(java.awt.image.BufferedImage) WaitingImageObserver(org.pentaho.reporting.libraries.base.util.WaitingImageObserver)

Example 3 with SwingUniversalImage

use of org.pentaho.di.core.SwingUniversalImage in project pentaho-kettle by pentaho.

the class SwingDirectGC method drawImage.

public void drawImage(EImage image, int locationX, int locationY, float magnification, double angle) {
    SwingUniversalImage img = getNativeImage(image);
    drawImage(img, locationX, locationY, angle, small_icon_size);
}
Also used : SwingUniversalImage(org.pentaho.di.core.SwingUniversalImage)

Example 4 with SwingUniversalImage

use of org.pentaho.di.core.SwingUniversalImage in project pentaho-kettle by pentaho.

the class SwingGC method drawJobEntryIcon.

public void drawJobEntryIcon(int x, int y, JobEntryCopy jobEntryCopy, float magnification) {
    if (jobEntryCopy == null) {
        // Don't draw anything
        return;
    }
    SwingUniversalImage image = null;
    if (jobEntryCopy.isSpecial()) {
        if (jobEntryCopy.isStart()) {
            image = imageStart;
        }
        if (jobEntryCopy.isDummy()) {
            image = imageDummy;
        }
    } else {
        String configId = jobEntryCopy.getEntry().getPluginId();
        if (configId != null) {
            image = entryImages.get(configId);
        }
    }
    if (image == null) {
        return;
    }
    drawImage(image, x + xOffset, y + xOffset, iconsize);
// gc.drawImage(image, x+xOffset, y+yOffset, observer);
}
Also used : SwingUniversalImage(org.pentaho.di.core.SwingUniversalImage)

Example 5 with SwingUniversalImage

use of org.pentaho.di.core.SwingUniversalImage in project pentaho-kettle by pentaho.

the class SwingGC method getImageIcon.

private SwingUniversalImage getImageIcon(String fileName) throws KettleException {
    SwingUniversalImage image = null;
    InputStream inputStream = null;
    if (fileName == null) {
        throw new KettleException("Image icon file name can not be null");
    }
    if (SvgSupport.isSvgEnabled() && SvgSupport.isSvgName(fileName)) {
        try {
            inputStream = new FileInputStream(fileName);
        } catch (FileNotFoundException ex) {
        // no need to fail
        }
        if (inputStream == null) {
            try {
                inputStream = new FileInputStream("/" + fileName);
            } catch (FileNotFoundException ex) {
            // no need to fail
            }
        }
        if (inputStream == null) {
            inputStream = getClass().getResourceAsStream(fileName);
        }
        if (inputStream == null) {
            inputStream = getClass().getResourceAsStream("/" + fileName);
        }
        if (inputStream != null) {
            try {
                SvgImage svg = SvgSupport.loadSvgImage(inputStream);
                image = new SwingUniversalImageSvg(svg);
            } catch (Exception ex) {
                throw new KettleException("Unable to load image from classpath : '" + fileName + "'", ex);
            } finally {
                IOUtils.closeQuietly(inputStream);
            }
        }
    }
    if (image == null) {
        fileName = SvgSupport.toPngName(fileName);
        try {
            inputStream = new FileInputStream(fileName);
        } catch (FileNotFoundException ex) {
        // no need to fail
        }
        if (inputStream == null) {
            try {
                inputStream = new FileInputStream("/" + fileName);
            } catch (FileNotFoundException ex) {
            // no need to fail
            }
        }
        if (inputStream == null) {
            inputStream = getClass().getResourceAsStream(fileName);
        }
        if (inputStream == null) {
            inputStream = getClass().getResourceAsStream("/" + fileName);
        }
        if (inputStream != null) {
            try {
                BufferedImage bitmap = ImageIO.read(inputStream);
                WaitingImageObserver wia = new WaitingImageObserver(bitmap);
                wia.waitImageLoaded();
                image = new SwingUniversalImageBitmap(bitmap);
            } catch (Exception ex) {
                throw new KettleException("Unable to load image from classpath : '" + fileName + "'", ex);
            } finally {
                IOUtils.closeQuietly(inputStream);
            }
        }
    }
    if (image == null) {
        throw new KettleException("Unable to load image from classpath : '" + fileName + "'");
    }
    return image;
}
Also used : SwingUniversalImageSvg(org.pentaho.di.core.SwingUniversalImageSvg) KettleException(org.pentaho.di.core.exception.KettleException) FileInputStream(java.io.FileInputStream) InputStream(java.io.InputStream) FileNotFoundException(java.io.FileNotFoundException) SvgImage(org.pentaho.di.core.svg.SvgImage) SwingUniversalImageBitmap(org.pentaho.di.core.SwingUniversalImageBitmap) SwingUniversalImage(org.pentaho.di.core.SwingUniversalImage) FileInputStream(java.io.FileInputStream) KettleException(org.pentaho.di.core.exception.KettleException) FileNotFoundException(java.io.FileNotFoundException) BufferedImage(java.awt.image.BufferedImage) WaitingImageObserver(org.pentaho.reporting.libraries.base.util.WaitingImageObserver)

Aggregations

SwingUniversalImage (org.pentaho.di.core.SwingUniversalImage)14 FileNotFoundException (java.io.FileNotFoundException)4 KettleException (org.pentaho.di.core.exception.KettleException)4 BufferedImage (java.awt.image.BufferedImage)3 FileInputStream (java.io.FileInputStream)3 InputStream (java.io.InputStream)3 SwingUniversalImageBitmap (org.pentaho.di.core.SwingUniversalImageBitmap)3 SwingUniversalImageSvg (org.pentaho.di.core.SwingUniversalImageSvg)3 SvgImage (org.pentaho.di.core.svg.SvgImage)3 WaitingImageObserver (org.pentaho.reporting.libraries.base.util.WaitingImageObserver)3 HashMap (java.util.HashMap)1 PluginInterface (org.pentaho.di.core.plugins.PluginInterface)1 PluginRegistry (org.pentaho.di.core.plugins.PluginRegistry)1