Search in sources :

Example 1 with GCInterface

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

the class StarModelDialog method drawLogicalModel.

protected void drawLogicalModel(LogicalModel logicalModel, Canvas canvas, PaintEvent paintEvent) {
    getRelationshipsFromFact();
    Rectangle rect = canvas.getBounds();
    GCInterface gc = new SWTDirectGC(paintEvent.gc, new org.pentaho.di.core.gui.Point(rect.width, rect.height), 32);
    StarModelPainter painter = new StarModelPainter(gc, logicalModel, logicalRelationships, locale);
    painter.draw();
}
Also used : GCInterface(org.pentaho.di.core.gui.GCInterface) SWTDirectGC(org.pentaho.di.ui.spoon.SWTDirectGC) Rectangle(org.eclipse.swt.graphics.Rectangle)

Example 2 with GCInterface

use of org.pentaho.di.core.gui.GCInterface 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 3 with GCInterface

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

the class TransGraph method getTransformationImage.

public Image getTransformationImage(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;
    TransPainter transPainter = new TransPainter(gc, transMeta, new Point(x, y), new SwtScrollBar(hori), new SwtScrollBar(vert), candidate, drop_candidate, selectionRegion, areaOwners, mouseOverSteps, PropsUI.getInstance().getIconSize(), PropsUI.getInstance().getLineWidth(), gridSize, PropsUI.getInstance().getShadowSize(), PropsUI.getInstance().isAntiAliasingEnabled(), PropsUI.getInstance().getNoteFont().getName(), PropsUI.getInstance().getNoteFont().getHeight(), trans, PropsUI.getInstance().isIndicateSlowTransStepsEnabled());
    transPainter.setMagnification(magnificationFactor);
    transPainter.setStepLogMap(stepLogMap);
    transPainter.setStartHopStep(startHopStep);
    transPainter.setEndHopLocation(endHopLocation);
    transPainter.setNoInputStep(noInputStep);
    transPainter.setEndHopStep(endHopStep);
    transPainter.setCandidateHopType(candidateHopType);
    transPainter.setStartErrorHopStep(startErrorHopStep);
    transPainter.setShowTargetStreamsStep(showTargetStreamsStep);
    transPainter.buildTransformationImage();
    Image img = (Image) gc.getImage();
    gc.dispose();
    return img;
}
Also used : GCInterface(org.pentaho.di.core.gui.GCInterface) SwtScrollBar(org.pentaho.di.ui.spoon.SwtScrollBar) SWTGC(org.pentaho.di.ui.spoon.SWTGC) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) TransPainter(org.pentaho.di.trans.TransPainter) SwtUniversalImage(org.pentaho.di.core.SwtUniversalImage) Image(org.eclipse.swt.graphics.Image) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 4 with GCInterface

use of org.pentaho.di.core.gui.GCInterface 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 5 with GCInterface

use of org.pentaho.di.core.gui.GCInterface 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

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