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);
}
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;
}
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);
}
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);
}
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;
}
Aggregations