Search in sources :

Example 6 with SwingGC

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;
}
Also used : TransMeta(org.pentaho.di.trans.TransMeta) ArrayList(java.util.ArrayList) Point(org.pentaho.di.core.gui.Point) SwingGC(org.pentaho.di.core.gui.SwingGC) StepMeta(org.pentaho.di.trans.step.StepMeta) Point(org.pentaho.di.core.gui.Point) ScrollBarInterface(org.pentaho.di.core.gui.ScrollBarInterface) BufferedImage(java.awt.image.BufferedImage) GCInterface(org.pentaho.di.core.gui.GCInterface) AreaOwner(org.pentaho.di.core.gui.AreaOwner) TransPainter(org.pentaho.di.trans.TransPainter)

Aggregations

AreaOwner (org.pentaho.di.core.gui.AreaOwner)6 Point (org.pentaho.di.core.gui.Point)6 SwingGC (org.pentaho.di.core.gui.SwingGC)6 BufferedImage (java.awt.image.BufferedImage)4 ScrollBarInterface (org.pentaho.di.core.gui.ScrollBarInterface)4 ArrayList (java.util.ArrayList)3 JobPainter (org.pentaho.di.job.JobPainter)3 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)3 TransPainter (org.pentaho.di.trans.TransPainter)3 StepMeta (org.pentaho.di.trans.step.StepMeta)3 Rectangle (java.awt.Rectangle)2 GCInterface (org.pentaho.di.core.gui.GCInterface)2 JobMeta (org.pentaho.di.job.JobMeta)2 TransMeta (org.pentaho.di.trans.TransMeta)2