Search in sources :

Example 16 with Point

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

the class JobEntryCopy method replaceMeta.

public void replaceMeta(JobEntryCopy jobEntryCopy) {
    entry = (JobEntryInterface) jobEntryCopy.entry.clone();
    // Copy nr. 0 is the base copy...
    nr = jobEntryCopy.nr;
    selected = jobEntryCopy.selected;
    if (jobEntryCopy.location != null) {
        location = new Point(jobEntryCopy.location.x, jobEntryCopy.location.y);
    }
    launchingInParallel = jobEntryCopy.launchingInParallel;
    draw = jobEntryCopy.draw;
    id = jobEntryCopy.id;
    setChanged();
}
Also used : Point(org.pentaho.di.core.gui.Point)

Example 17 with Point

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

the class JobMeta method getMaximum.

/**
 * Gets the maximum.
 *
 * @return the maximum
 */
public Point getMaximum() {
    int maxx = 0, maxy = 0;
    for (int i = 0; i < nrJobEntries(); i++) {
        JobEntryCopy entry = getJobEntry(i);
        Point loc = entry.getLocation();
        if (loc.x > maxx) {
            maxx = loc.x;
        }
        if (loc.y > maxy) {
            maxy = loc.y;
        }
    }
    for (int i = 0; i < nrNotes(); i++) {
        NotePadMeta ni = getNote(i);
        Point loc = ni.getLocation();
        if (loc.x + ni.width > maxx) {
            maxx = loc.x + ni.width;
        }
        if (loc.y + ni.height > maxy) {
            maxy = loc.y + ni.height;
        }
    }
    return new Point(maxx + 100, maxy + 100);
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) NotePadMeta(org.pentaho.di.core.NotePadMeta) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 18 with Point

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

the class JobMeta method getMinimum.

/**
 * Get the minimum point on the canvas of a job
 *
 * @return Minimum coordinate of a step in the job
 */
public Point getMinimum() {
    int minx = Integer.MAX_VALUE;
    int miny = Integer.MAX_VALUE;
    for (int i = 0; i < nrJobEntries(); i++) {
        JobEntryCopy jobEntryCopy = getJobEntry(i);
        Point loc = jobEntryCopy.getLocation();
        if (loc.x < minx) {
            minx = loc.x;
        }
        if (loc.y < miny) {
            miny = loc.y;
        }
    }
    for (int i = 0; i < nrNotes(); i++) {
        NotePadMeta notePadMeta = getNote(i);
        Point loc = notePadMeta.getLocation();
        if (loc.x < minx) {
            minx = loc.x;
        }
        if (loc.y < miny) {
            miny = loc.y;
        }
    }
    if (minx > BORDER_INDENT && minx != Integer.MAX_VALUE) {
        minx -= BORDER_INDENT;
    } else {
        minx = 0;
    }
    if (miny > BORDER_INDENT && miny != Integer.MAX_VALUE) {
        miny -= BORDER_INDENT;
    } else {
        miny = 0;
    }
    return new Point(minx, miny);
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) NotePadMeta(org.pentaho.di.core.NotePadMeta) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 19 with Point

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

the class JobMeta method getSelectedLocations.

/**
 * Gets the selected locations.
 *
 * @return the selected locations
 */
public Point[] getSelectedLocations() {
    List<JobEntryCopy> selectedEntries = getSelectedEntries();
    Point[] retval = new Point[selectedEntries.size()];
    for (int i = 0; i < retval.length; i++) {
        JobEntryCopy si = selectedEntries.get(i);
        Point p = si.getLocation();
        // explicit copy of location
        retval[i] = new Point(p.x, p.y);
    }
    return retval;
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Example 20 with Point

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

the class JobMeta method getJobEntryCopy.

/**
 * Gets the job entry copy.
 *
 * @param x        the x
 * @param y        the y
 * @param iconsize the iconsize
 * @return the job entry copy
 */
public JobEntryCopy getJobEntryCopy(int x, int y, int iconsize) {
    int i, s;
    s = nrJobEntries();
    for (i = s - 1; i >= 0; i--) {
        // Back to front because drawing goes from start to end
        JobEntryCopy je = getJobEntry(i);
        Point p = je.getLocation();
        if (p != null) {
            if (x >= p.x && x <= p.x + iconsize && y >= p.y && y <= p.y + iconsize) {
                return je;
            }
        }
    }
    return null;
}
Also used : JobEntryCopy(org.pentaho.di.job.entry.JobEntryCopy) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint) Point(org.pentaho.di.core.gui.Point) KettleExtensionPoint(org.pentaho.di.core.extension.KettleExtensionPoint)

Aggregations

Point (org.pentaho.di.core.gui.Point)141 KettleExtensionPoint (org.pentaho.di.core.extension.KettleExtensionPoint)72 Test (org.junit.Test)37 StepMeta (org.pentaho.di.trans.step.StepMeta)34 NotePadMeta (org.pentaho.di.core.NotePadMeta)29 KettleException (org.pentaho.di.core.exception.KettleException)28 JobEntryCopy (org.pentaho.di.job.entry.JobEntryCopy)28 PrintWriter (java.io.PrintWriter)26 HttpServletRequest (javax.servlet.http.HttpServletRequest)26 HttpServletResponse (javax.servlet.http.HttpServletResponse)26 LogChannelInterface (org.pentaho.di.core.logging.LogChannelInterface)26 TransMeta (org.pentaho.di.trans.TransMeta)25 StringWriter (java.io.StringWriter)24 AreaOwner (org.pentaho.di.core.gui.AreaOwner)22 Trans (org.pentaho.di.trans.Trans)18 JobMeta (org.pentaho.di.job.JobMeta)17 ArrayList (java.util.ArrayList)16 TransHopMeta (org.pentaho.di.trans.TransHopMeta)14 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)14 KettleRepositoryLostException (org.pentaho.di.repository.KettleRepositoryLostException)12