use of org.pentaho.di.core.gui.SwingGC in project pentaho-kettle by pentaho.
the class TransformationInformation method loadValues.
private TransformationInformationValues loadValues(ReportSubjectLocation location) throws KettleException {
// Load the transformation
//
TransMeta transMeta = loadTransformation(location);
Point min = transMeta.getMinimum();
Point area = transMeta.getMaximum();
area.x += 100;
area.y += 100;
int iconsize = 32;
ScrollBarInterface bar = new ScrollBarInterface() {
public void setThumb(int thumb) {
}
public int getSelection() {
return 0;
}
};
// Paint the transformation...
//
GCInterface gc = new SwingGC(null, area, iconsize, 50, 20);
List<AreaOwner> areaOwners = new ArrayList<AreaOwner>();
TransPainter painter = new TransPainter(gc, transMeta, area, bar, bar, null, null, null, areaOwners, new ArrayList<StepMeta>(), iconsize, 1, 0, 0, true, "FreeSans", 10);
painter.setMagnification(0.5f);
painter.setTranslationX(min.x);
painter.setTranslationY(min.y);
painter.buildTransformationImage();
BufferedImage bufferedImage = (BufferedImage) gc.getImage();
int newWidth = bufferedImage.getWidth() - min.x;
int newHeigth = bufferedImage.getHeight() - min.y;
BufferedImage image = new BufferedImage(newWidth, newHeigth, bufferedImage.getType());
image.getGraphics().drawImage(bufferedImage, 0, 0, newWidth, newHeigth, min.x, min.y, min.x + newWidth, min.y + newHeigth, null);
TransformationInformationValues values = new TransformationInformationValues();
values.transMeta = transMeta;
values.image = image;
values.areaOwners = areaOwners;
return values;
}
Aggregations