private int[] getLine( StepMeta fs, StepMeta ts ) { Point from = fs.getLocation(); Point to = ts.getLocation(); offset = getOffset(); int x1 = from.x + iconsize / 2; int y1 = from.y + iconsize / 2; int x2 = to.x + iconsize / 2; int y2 = to.y + iconsize / 2; return new int[] { x1, y1, x2, y2 }; }
/** * Get an array of all the selected step locations. * * @return The selected step locations. */ public Point[] getSelectedStepLocations() { List<Point> points = new ArrayList<>(); for ( StepMeta stepMeta : getSelectedSteps() ) { Point p = stepMeta.getLocation(); points.add( new Point( p.x, p.y ) ); // explicit copy of location } return points.toArray( new Point[points.size()] ); }
private static void assertEquals( StepMeta meta, StepMeta another ) { assertTrue( EqualsBuilder.reflectionEquals( meta, another, false, StepMeta.class, new String[] { "location", "targetStepPartitioningMeta" } ) ); boolean manualCheck = new EqualsBuilder() .append( meta.getLocation().x, another.getLocation().x ) .append( meta.getLocation().y, another.getLocation().y ) .isEquals(); assertTrue( manualCheck ); } }
/** * Find the step that is located on a certain point on the canvas, taking into account the icon size. * * @param x * the x-coordinate of the point queried * @param y * the y-coordinate of the point queried * @param iconsize * the iconsize * @return The step information if a step is located at the point. Otherwise, if no step was found: null. */ public StepMeta getStep( int x, int y, int iconsize ) { int i, s; s = steps.size(); for ( i = s - 1; i >= 0; i-- ) { // Back to front because drawing goes from start to end StepMeta stepMeta = steps.get( i ); if ( partOfTransHop( stepMeta ) || stepMeta.isDrawn() ) { // Only consider steps from active or inactive hops! Point p = stepMeta.getLocation(); if ( p != null ) { if ( x >= p.x && x <= p.x + iconsize && y >= p.y && y <= p.y + iconsize + 20 ) { return stepMeta; } } } } return null; }
for ( StepMeta stepMeta : transMeta.getSteps() ) { speeds.put( stepMeta, new StepVelocity( 0, 0 ) ); StepLocation location = new StepLocation( stepMeta.getLocation().x, stepMeta.getLocation().y ); locations.put( stepMeta, location );
/** * Gets the maximum size of the canvas by calculating the maximum location of a step. * * @return Maximum coordinate of a step in the transformation + (100,100) for safety. */ public Point getMaximum() { int maxx = 0, maxy = 0; for ( int i = 0; i < nrSteps(); i++ ) { StepMeta stepMeta = getStep( i ); Point loc = stepMeta.getLocation(); if ( loc.x > maxx ) { maxx = loc.x; } if ( loc.y > maxy ) { maxy = loc.y; } } for ( int i = 0; i < nrNotes(); i++ ) { NotePadMeta notePadMeta = getNote( i ); Point loc = notePadMeta.getLocation(); if ( loc.x + notePadMeta.width > maxx ) { maxx = loc.x + notePadMeta.width; } if ( loc.y + notePadMeta.height > maxy ) { maxy = loc.y + notePadMeta.height; } } return new Point( maxx + 100, maxy + 100 ); }
for ( int i = 0; i < nrSteps(); i++ ) { StepMeta stepMeta = getStep( i ); Point loc = stepMeta.getLocation(); if ( loc.x < minx ) { minx = loc.x;
private void drawStepStatusIndicator( StepMeta stepMeta ) { if ( stepMeta == null ) { return; } // draw status indicator if ( trans != null ) { Point pt = stepMeta.getLocation(); if ( pt == null ) { pt = new Point( 50, 50 ); } Point screen = real2screen( pt.x, pt.y ); int x = screen.x; int y = screen.y; List<StepInterface> steps = trans.findBaseSteps( stepMeta.getName() ); for ( StepInterface step : steps ) { if ( step.getStatus().equals( StepExecutionStatus.STATUS_FINISHED ) ) { gc.drawImage( EImage.TRUE, ( x + iconsize ) - ( MINI_ICON_SIZE / 2 ) + 4, y - ( MINI_ICON_SIZE / 2 ) - 1, magnification ); } } } }
p.x -= 100; } else { p = new Point( lastChained.getLocation().x, lastChained.getLocation().y );
@Test public void testGetMinimum() { final Point minimalCanvasPoint = new Point( 0, 0 ); //for test goal should content coordinate more than NotePadMetaPoint final Point stepPoint = new Point( 500, 500 ); //empty Trans return 0 coordinate point Point point = transMeta.getMinimum(); assertEquals( minimalCanvasPoint.x, point.x ); assertEquals( minimalCanvasPoint.y, point.y ); //when Trans content Step than trans should return minimal coordinate of step StepMeta stepMeta = mock( StepMeta.class ); when( stepMeta.getLocation() ).thenReturn( stepPoint ); transMeta.addStep( stepMeta ); Point actualStepPoint = transMeta.getMinimum(); assertEquals( stepPoint.x - TransMeta.BORDER_INDENT, actualStepPoint.x ); assertEquals( stepPoint.y - TransMeta.BORDER_INDENT, actualStepPoint.y ); }
selectedSteps = new ArrayList<>(); selectedSteps.add( selectedStep ); previous_step_locations = new Point[] { selectedStep.getLocation() }; redraw(); } else if ( selectedNote != null && !selectedNote.isSelected() ) { int dx = icon.x - selectedStep.getLocation().x; int dy = icon.y - selectedStep.getLocation().y; for ( int i = 0; i < selectedSteps.size(); i++ ) { StepMeta stepMeta = selectedSteps.get( i ); PropsUI.setLocation( stepMeta, stepMeta.getLocation().x + dx, stepMeta.getLocation().y + dy ); stopStepMouseOverDelayTimer( stepMeta ); for ( int i = 0; i < selectedSteps.size(); i++ ) { StepMeta stepMeta = selectedSteps.get( i ); PropsUI.setLocation( stepMeta, stepMeta.getLocation().x + dx, stepMeta.getLocation().y + dy );
.isDistributes(), stepMeta.getCopies(), stepMeta.getLocation() == null ? -1 : stepMeta.getLocation().x, stepMeta.getLocation() == null ? -1 : stepMeta.getLocation().y, stepMeta.isDrawn(), stepMeta.getCopiesString() ) );
public void dupeStep( TransMeta transMeta, StepMeta stepMeta ) { spoon.getLog().logDebug( toString(), BaseMessages.getString( PKG, "Spoon.Log.DuplicateStep" ) + stepMeta.getName() ); // Duplicate // step: StepMeta stMeta = (StepMeta) stepMeta.clone(); if ( stMeta != null ) { String newname = transMeta.getAlternativeStepname( stepMeta.getName() ); int nr = 2; while ( transMeta.findStep( newname ) != null ) { newname = stepMeta.getName() + " (copy " + nr + ")"; nr++; } stMeta.setName( newname ); // Don't select this new step! stMeta.setSelected( false ); Point loc = stMeta.getLocation(); stMeta.setLocation( loc.x + 20, loc.y + 20 ); transMeta.addStep( stMeta ); spoon.addUndoNew( transMeta, new StepMeta[] { (StepMeta) stMeta.clone() }, new int[] { transMeta .indexOfStep( stMeta ) } ); spoon.refreshTree(); spoon.refreshGraph(); } }
Point a = stepMeta.getLocation(); if ( rect.contains( a.x, a.y ) ) { stepMeta.setSelected( true );
newStep.setLocation( stepMeta.getLocation().x + 20, stepMeta.getLocation().y + 20 ); newStep.setDraw( true );
Point pt = stepMeta.getLocation(); if ( pt == null ) { pt = new Point( 50, 50 );
Point pt = stepMeta.getLocation(); if ( pt == null ) { pt = new Point( 50, 50 );
Point p = steps[i].getLocation(); Point p = steps[i].getLocation(); String name = steps[i].getName();
} else { if ( startHopStep != null && endHopLocation != null ) { Point fr = startHopStep.getLocation(); Point to = endHopLocation; if ( endHopStep == null ) { } else if ( endHopStep != null && endHopLocation != null ) { Point fr = endHopLocation; Point to = endHopStep.getLocation(); if ( startHopStep == null ) { gc.setForeground( EColor.GRAY ); 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 );
stepNode.setProperty( PROP_STEP_COPIES, step.getCopies() ); stepNode.setProperty( PROP_STEP_COPIES_STRING, step.getCopiesString() ); stepNode.setProperty( PROP_STEP_GUI_LOCATION_X, step.getLocation().x ); stepNode.setProperty( PROP_STEP_GUI_LOCATION_Y, step.getLocation().y ); stepNode.setProperty( PROP_STEP_GUI_DRAW, step.isDrawn() );