Java Code Examples for org.pentaho.di.job.JobMeta#getMaximum()

The following examples show how to use org.pentaho.di.job.JobMeta#getMaximum() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GetJobImageServlet.java    From pentaho-kettle with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
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;
}
 
Example 2
Source File: JobInformation.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
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;
  }
 
Example 3
Source File: JobInformation.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
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();
}