Search in sources :

Example 1 with JobPainter

use of org.pentaho.di.job.JobPainter in project pentaho-kettle by pentaho.

the class JobInformation method loadValues.

private JobInformationValues loadValues(ReportSubjectLocation location) throws KettleException {
    // Load the job
    // 
    JobMeta jobMeta = loadJob(location);
    Point min = jobMeta.getMinimum();
    Point area = jobMeta.getMaximum();
    area.x += 30;
    area.y += 30;
    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>();
    JobPainter painter = new JobPainter(gc, jobMeta, area, bar, bar, null, null, null, areaOwners, new ArrayList<JobEntryCopy>(), iconsize, 1, 0, 0, true, "FreeSans", 10);
    painter.setMagnification(0.25f);
    painter.drawJob();
    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);
    JobInformationValues values = new JobInformationValues();
    values.jobMeta = jobMeta;
    values.image = image;
    values.areaOwners = areaOwners;
    return values;
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobPainter(org.pentaho.di.job.JobPainter) ArrayList(java.util.ArrayList) Point(org.pentaho.di.core.gui.Point) SwingGC(org.pentaho.di.core.gui.SwingGC) 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) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) AreaOwner(org.pentaho.di.core.gui.AreaOwner)

Example 2 with JobPainter

use of org.pentaho.di.job.JobPainter in project pentaho-kettle by pentaho.

the class GetJobImageServlet method generateJobImage.

private BufferedImage generateJobImage(JobMeta jobMeta) throws Exception {
    float magnification = 1.0f;
    Point maximum = jobMeta.getMaximum();
    maximum.multiply(magnification);
    SwingGC gc = new SwingGC(null, maximum, 32, 0, 0);
    JobPainter jobPainter = new JobPainter(gc, jobMeta, maximum, null, null, null, null, null, new ArrayList<AreaOwner>(), new ArrayList<JobEntryCopy>(), 32, 1, 0, 0, true, "Arial", 10);
    jobPainter.setMagnification(magnification);
    jobPainter.drawJob();
    BufferedImage image = (BufferedImage) gc.getImage();
    return image;
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobPainter(org.pentaho.di.job.JobPainter) AreaOwner(org.pentaho.di.core.gui.AreaOwner) Point(org.pentaho.di.core.gui.Point) SwingGC(org.pentaho.di.core.gui.SwingGC) BufferedImage(java.awt.image.BufferedImage)

Example 3 with JobPainter

use of org.pentaho.di.job.JobPainter in project pentaho-kettle by pentaho.

the class JobGraph method getJobImage.

public Image getJobImage(Device device, int x, int y, float magnificationFactor) {
    GCInterface gc = new SWTGC(device, new Point(x, y), iconsize);
    int gridSize = PropsUI.getInstance().isShowCanvasGridEnabled() ? PropsUI.getInstance().getCanvasGridSize() : 1;
    JobPainter jobPainter = new JobPainter(gc, jobMeta, new Point(x, y), new SwtScrollBar(hori), new SwtScrollBar(vert), hop_candidate, drop_candidate, selectionRegion, areaOwners, mouseOverEntries, PropsUI.getInstance().getIconSize(), PropsUI.getInstance().getLineWidth(), gridSize, PropsUI.getInstance().getShadowSize(), PropsUI.getInstance().isAntiAliasingEnabled(), PropsUI.getInstance().getNoteFont().getName(), PropsUI.getInstance().getNoteFont().getHeight());
    jobPainter.setMagnification(magnificationFactor);
    jobPainter.setEntryLogMap(entryLogMap);
    jobPainter.setStartHopEntry(startHopEntry);
    jobPainter.setEndHopLocation(endHopLocation);
    jobPainter.setEndHopEntry(endHopEntry);
    jobPainter.setNoInputEntry(noInputEntry);
    if (job != null) {
        jobPainter.setJobEntryResults(job.getJobEntryResults());
    } else {
        jobPainter.setJobEntryResults(new ArrayList<JobEntryResult>());
    }
    List<JobEntryCopy> activeJobEntries = new ArrayList<>();
    if (job != null) {
        if (job.getActiveJobEntryJobs().size() > 0) {
            activeJobEntries.addAll(job.getActiveJobEntryJobs().keySet());
        }
        if (job.getActiveJobEntryTransformations().size() > 0) {
            activeJobEntries.addAll(job.getActiveJobEntryTransformations().keySet());
        }
    }
    jobPainter.setActiveJobEntries(activeJobEntries);
    jobPainter.drawJob();
    return (Image) gc.getImage();
}
Also used : GCInterface(org.pentaho.di.core.gui.GCInterface) SwtScrollBar(org.pentaho.di.ui.spoon.SwtScrollBar) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) JobPainter(org.pentaho.di.job.JobPainter) SWTGC(org.pentaho.di.ui.spoon.SWTGC) ArrayList(java.util.ArrayList) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) Image(org.eclipse.swt.graphics.Image) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) JobEntryResult(org.pentaho.di.job.JobEntryResult)

Example 4 with JobPainter

use of org.pentaho.di.job.JobPainter in project pentaho-kettle by pentaho.

the class JobInformation method drawImage.

public void drawImage(final Graphics2D g2d, final Rectangle2D rectangle2d, ReportSubjectLocation location, boolean pixelateImages) throws KettleException {
    // Load the job
    // 
    JobMeta jobMeta = loadJob(location);
    Point min = jobMeta.getMinimum();
    Point area = jobMeta.getMaximum();
    area.x -= min.x;
    area.y -= min.y;
    int iconsize = 32;
    ScrollBarInterface bar = new ScrollBarInterface() {

        public void setThumb(int thumb) {
        }

        public int getSelection() {
            return 0;
        }
    };
    // Paint the transformation...
    // 
    Rectangle rect = new java.awt.Rectangle(0, 0, area.x, area.y);
    double magnificationX = rectangle2d.getWidth() / rect.getWidth();
    double magnificationY = rectangle2d.getHeight() / rect.getHeight();
    float magnification = (float) Math.min(1, Math.min(magnificationX, magnificationY));
    SwingGC gc = new SwingGC(g2d, rect, iconsize, 0, 0);
    gc.setDrawingPixelatedImages(pixelateImages);
    List<AreaOwner> areaOwners = new ArrayList<AreaOwner>();
    JobPainter painter = new JobPainter(gc, jobMeta, area, bar, bar, null, null, null, areaOwners, new ArrayList<JobEntryCopy>(), iconsize, 1, 0, 0, true, "FreeSans", 10);
    painter.setMagnification(magnification);
    painter.setTranslationX((-min.x) * magnification);
    painter.setTranslationY((-min.y) * magnification);
    painter.drawJob();
}
Also used : JobMeta(org.pentaho.di.job.JobMeta) JobPainter(org.pentaho.di.job.JobPainter) Rectangle(java.awt.Rectangle) ArrayList(java.util.ArrayList) Point(org.pentaho.di.core.gui.Point) SwingGC(org.pentaho.di.core.gui.SwingGC) Point(org.pentaho.di.core.gui.Point) ScrollBarInterface(org.pentaho.di.core.gui.ScrollBarInterface) JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) AreaOwner(org.pentaho.di.core.gui.AreaOwner)

Aggregations

Point (org.pentaho.di.core.gui.Point)4 JobPainter (org.pentaho.di.job.JobPainter)4 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)4 ArrayList (java.util.ArrayList)3 AreaOwner (org.pentaho.di.core.gui.AreaOwner)3 SwingGC (org.pentaho.di.core.gui.SwingGC)3 BufferedImage (java.awt.image.BufferedImage)2 GCInterface (org.pentaho.di.core.gui.GCInterface)2 ScrollBarInterface (org.pentaho.di.core.gui.ScrollBarInterface)2 JobMeta (org.pentaho.di.job.JobMeta)2 Rectangle (java.awt.Rectangle)1 Image (org.eclipse.swt.graphics.Image)1 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)1 JobEntryResult (org.pentaho.di.job.JobEntryResult)1 SWTGC (org.pentaho.di.ui.spoon.SWTGC)1 SwtScrollBar (org.pentaho.di.ui.spoon.SwtScrollBar)1