use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class TransPainter method drawTrans.
private void drawTrans(Point thumb) {
if (!shadow && gridSize > 1) {
drawGrid();
}
if (hori != null && vert != null) {
hori.setThumb(thumb.x);
vert.setThumb(thumb.y);
}
try {
ExtensionPointHandler.callExtensionPoint(LogChannel.GENERAL, KettleExtensionPoint.TransPainterStart.id, this);
} catch (KettleException e) {
LogChannel.GENERAL.logError("Error in TransPainterStart extension point", e);
}
gc.setFont(EFont.NOTE);
// First the notes
for (int i = 0; i < transMeta.nrNotes(); i++) {
NotePadMeta ni = transMeta.getNote(i);
drawNote(ni);
}
gc.setFont(EFont.GRAPH);
gc.setBackground(EColor.BACKGROUND);
for (int i = 0; i < transMeta.nrTransHops(); i++) {
TransHopMeta hi = transMeta.getTransHop(i);
drawHop(hi);
}
EImage arrow;
if (candidate != null) {
drawHop(candidate, true);
} else {
if (startHopStep != null && endHopLocation != null) {
Point fr = startHopStep.getLocation();
Point to = endHopLocation;
if (endHopStep == null) {
gc.setForeground(EColor.GRAY);
arrow = EImage.ARROW_DISABLED;
} else {
gc.setForeground(EColor.BLUE);
arrow = EImage.ARROW_DEFAULT;
}
Point start = real2screen(fr.x + iconsize / 2, fr.y + iconsize / 2);
Point end = real2screen(to.x, to.y);
drawArrow(arrow, start.x, start.y, end.x, end.y, theta, calcArrowLength(), 1.2, null, startHopStep, endHopStep == null ? endHopLocation : endHopStep);
} else if (endHopStep != null && endHopLocation != null) {
Point fr = endHopLocation;
Point to = endHopStep.getLocation();
if (startHopStep == null) {
gc.setForeground(EColor.GRAY);
arrow = EImage.ARROW_DISABLED;
} else {
gc.setForeground(EColor.BLUE);
arrow = EImage.ARROW_DEFAULT;
}
Point start = real2screen(fr.x, fr.y);
Point end = real2screen(to.x + iconsize / 2, to.y + iconsize / 2);
drawArrow(arrow, start.x, start.y, end.x, end.y, theta, calcArrowLength(), 1.2, null, startHopStep == null ? endHopLocation : startHopStep, endHopStep);
}
}
// Draw regular step appearance
for (int i = 0; i < transMeta.nrSteps(); i++) {
StepMeta stepMeta = transMeta.getStep(i);
if (stepMeta.isDrawn()) {
drawStep(stepMeta);
}
}
if (slowStepIndicatorEnabled) {
// Highlight possible bottlenecks
for (int i = 0; i < transMeta.nrSteps(); i++) {
StepMeta stepMeta = transMeta.getStep(i);
if (stepMeta.isDrawn()) {
checkDrawSlowStepIndicator(stepMeta);
}
}
}
// Draw step status indicators (running vs. done)
for (int i = 0; i < transMeta.nrSteps(); i++) {
StepMeta stepMeta = transMeta.getStep(i);
if (stepMeta.isDrawn()) {
drawStepStatusIndicator(stepMeta);
}
}
// Draw performance table for selected step(s)
for (int i = 0; i < transMeta.nrSteps(); i++) {
StepMeta stepMeta = transMeta.getStep(i);
if (stepMeta.isDrawn()) {
drawStepPerformanceTable(stepMeta);
}
}
int selectedStepsCount = 0;
for (int i = transMeta.nrSteps() - 1; i >= 0; i--) {
StepMeta stepMeta = transMeta.getStep(i);
if (stepMeta.isSelected()) {
selectedStepsCount++;
}
}
TransPainterFlyoutExtension extension = null;
for (int i = transMeta.nrSteps() - 1; i >= 0; i--) {
StepMeta stepMeta = transMeta.getStep(i);
if (stepMeta.isSelected() && stepMeta.isDrawn() && selectedStepsCount == 1) {
extension = new TransPainterFlyoutExtension(gc, areaOwners, transMeta, stepMeta, translationX, translationY, magnification, area, offset);
break;
}
}
if (extension == null) {
// pass null to notify extension that nothing is selected
extension = new TransPainterFlyoutExtension(gc, areaOwners, transMeta, null, translationX, translationY, magnification, area, offset);
}
try {
ExtensionPointHandler.callExtensionPoint(LogChannel.GENERAL, KettleExtensionPoint.TransPainterFlyout.id, extension);
} catch (Exception e) {
LogChannel.GENERAL.logError("Error calling extension point(s) for the transformation painter step", e);
}
//
if (noInputStep != null) {
gc.setLineWidth(2);
gc.setForeground(EColor.RED);
Point n = noInputStep.getLocation();
gc.drawLine(n.x - 5, n.y - 5, n.x + iconsize + 10, n.y + iconsize + 10);
gc.drawLine(n.x - 5, n.y + iconsize + 5, n.x + iconsize + 5, n.y - 5);
}
if (drop_candidate != null) {
gc.setLineStyle(ELineStyle.SOLID);
gc.setForeground(EColor.BLACK);
Point screen = real2screen(drop_candidate.x, drop_candidate.y);
gc.drawRectangle(screen.x, screen.y, iconsize, iconsize);
}
try {
ExtensionPointHandler.callExtensionPoint(LogChannel.GENERAL, KettleExtensionPoint.TransPainterEnd.id, this);
} catch (KettleException e) {
LogChannel.GENERAL.logError("Error in TransPainterEnd extension point", e);
}
if (!shadow) {
drawRect(selrect);
}
}
use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class TransPainter method buildTransformationImage.
public void buildTransformationImage() {
Point max = transMeta.getMaximum();
Point thumb = getThumb(area, max);
offset = getOffset(thumb, area);
// First clear the image in the background color
gc.setBackground(EColor.BACKGROUND);
gc.fillRectangle(0, 0, area.x, area.y);
//
if (shadowSize > 0) {
shadow = true;
gc.setTransform(translationX, translationY, shadowSize, magnification);
gc.setAlpha(20);
drawTrans(thumb);
}
// Draw the transformation onto the image
//
shadow = false;
gc.setTransform(translationX, translationY, 0, magnification);
gc.setAlpha(255);
drawTrans(thumb);
gc.dispose();
}
use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class TransPainter method getNamePosition.
public Point getNamePosition(String string, Point screen, int iconsize) {
Point textsize = gc.textExtent(string);
int xpos = screen.x + (iconsize / 2) - (textsize.x / 2);
int ypos = screen.y + iconsize + 5;
return new Point(xpos, ypos);
}
use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class StepMeta method setLocation.
@Override
public void setLocation(int x, int y) {
int nx = (x >= 0 ? x : 0);
int ny = (y >= 0 ? y : 0);
Point loc = new Point(nx, ny);
if (!loc.equals(location)) {
setChanged();
}
location = loc;
}
use of org.pentaho.di.core.gui.Point in project pentaho-kettle by pentaho.
the class StepMeta method replaceMeta.
public void replaceMeta(StepMeta stepMeta) {
// --> StepPlugin.id
this.stepid = stepMeta.stepid;
this.name = stepMeta.name;
if (stepMeta.stepMetaInterface != null) {
setStepMetaInterface((StepMetaInterface) stepMeta.stepMetaInterface.clone());
} else {
this.stepMetaInterface = null;
}
this.selected = stepMeta.selected;
this.distributes = stepMeta.distributes;
this.setRowDistribution(stepMeta.getRowDistribution());
this.copiesString = stepMeta.copiesString;
// force re-calculation
this.copiesCache = null;
if (stepMeta.location != null) {
this.location = new Point(stepMeta.location.x, stepMeta.location.y);
} else {
this.location = null;
}
this.drawstep = stepMeta.drawstep;
this.description = stepMeta.description;
this.terminator = stepMeta.terminator;
if (stepMeta.stepPartitioningMeta != null) {
this.stepPartitioningMeta = stepMeta.stepPartitioningMeta.clone();
} else {
this.stepPartitioningMeta = null;
}
if (stepMeta.clusterSchema != null) {
this.clusterSchema = stepMeta.clusterSchema.clone();
} else {
this.clusterSchema = null;
}
// temporary to resolve later.
this.clusterSchemaName = stepMeta.clusterSchemaName;
// Also replace the remote steps with cloned versions...
//
this.remoteInputSteps = new ArrayList<RemoteStep>();
for (RemoteStep remoteStep : stepMeta.remoteInputSteps) {
this.remoteInputSteps.add((RemoteStep) remoteStep.clone());
}
this.remoteOutputSteps = new ArrayList<RemoteStep>();
for (RemoteStep remoteStep : stepMeta.remoteOutputSteps) {
this.remoteOutputSteps.add((RemoteStep) remoteStep.clone());
}
//
if (stepMeta.stepErrorMeta != null) {
this.stepErrorMeta = stepMeta.stepErrorMeta.clone();
}
this.attributesMap = copyStringMap(stepMeta.attributesMap);
// this.setShared(stepMeta.isShared());
this.id = stepMeta.getObjectId();
this.setChanged(true);
}
Aggregations