public AreaOwner( Object extensionAreaType, int x, int y, int width, int heigth, Point offset, Object parent, Object owner ) { super(); this.extensionAreaType = extensionAreaType; this.area = new Rectangle( x - offset.x, y - offset.y, width, heigth ); this.parent = parent; this.owner = owner; }
/** * Validate if a certain coordinate is contained in the area * * @param x * x-coordinate * @param y * y-coordinate * @return true if the specified coordinate is contained in the area */ public boolean contains( int x, int y ) { return area.contains( x, y ); }
if ( rect.height < 0 || rect.width < 0 ) { org.pentaho.di.core.gui.Rectangle rectified = new org.pentaho.di.core.gui.Rectangle( rect.x, rect.y, rect.width, rect.height ); StepMeta stepMeta = transMeta.getStep( i ); Point a = stepMeta.getLocation(); if ( rect.contains( a.x, a.y ) ) { stepMeta.setSelected( true ); Point a = ni.getLocation(); Point b = new Point( a.x + ni.width, a.y + ni.height ); if ( rect.contains( a.x, a.y ) && rect.contains( b.x, b.y ) ) { ni.setSelected( true );
/** * @param x * @param y * @param width * @param heigth * @param owner */ public AreaOwner( AreaType areaType, int x, int y, int width, int heigth, Point offset, Object parent, Object owner ) { super(); this.areaType = areaType; this.area = new Rectangle( x - offset.x, y - offset.y, width, heigth ); this.parent = parent; this.owner = owner; }
@Override public void mouseDown( MouseEvent event ) { if ( drawAreas == null ) { return; } for ( int i = drawAreas.size() - 1; i >= 0; i-- ) { MetricsDrawArea drawArea = drawAreas.get( i ); if ( drawArea.getArea().contains( event.x, event.y ) ) { MetricsDuration duration = drawArea.getDuration(); if ( duration == null ) { continue; } System.out.println( duration.toString() ); LoggingObjectInterface loggingObject = LoggingRegistry.getInstance().getLoggingObject( duration.getLogChannelId() ); if ( loggingObject == null ) { return; } System.out.println( loggingObject.getObjectType() + " : " + loggingObject.getObjectName() ); } } } } );
private void drawDurations( List<MetricsDuration> durations, List<MetricsDrawArea> areas, double pixelsPerMs ) { // set top indent int y = 20; for ( MetricsDuration duration : durations ) { Long realDuration = duration.getEndDate().getTime() - duration.getDate().getTime(); // How many pixels does it take to drawn this duration? // int durationWidth = (int) ( realDuration * pixelsPerMs ); int x = 2 + (int) ( ( duration.getDate().getTime() - periodStart ) * pixelsPerMs ); getGc().setBackground( EColor.BACKGROUND ); getGc().setForeground( EColor.LIGHTBLUE ); getGc().fillGradientRectangle( x, y, durationWidth, barHeight, false ); getGc().setForeground( EColor.BLACK ); getGc().drawRectangle( x, y, durationWidth, barHeight ); areas.add( new MetricsDrawArea( new Rectangle( x, y, durationWidth, barHeight ), duration ) ); LoggingObjectInterface loggingObject = LoggingRegistry.getInstance().getLoggingObject( duration.getLogChannelId() ); String message = duration.getDescription() + " - " + loggingObject.getObjectName() + " : " + duration.getDuration() + "ms"; if ( duration.getCount() > 1 ) { message += " " + duration.getCount() + " calls, avg=" + ( duration.getDuration() / duration.getCount() ); } getGc().setFont( EFont.GRAPH ); getGc().textExtent( message ); getGc().drawText( message, x + 3, y + 4, true ); y += barHeight + 5; } }
@Override public void mouseDown( MouseEvent event ) { if ( drawAreas == null ) { return; } for ( int i = drawAreas.size() - 1; i >= 0; i-- ) { MetricsDrawArea drawArea = drawAreas.get( i ); if ( drawArea.getArea().contains( event.x, event.y ) ) { MetricsDuration duration = drawArea.getDuration(); if ( duration == null ) { continue; } System.out.println( duration.toString() ); LoggingObjectInterface loggingObject = LoggingRegistry.getInstance().getLoggingObject( duration.getLogChannelId() ); if ( loggingObject == null ) { continue; } System.out.println( loggingObject.getObjectType() + " : " + loggingObject.getObjectName() ); } } } } );
selectionRegion = new org.pentaho.di.core.gui.Rectangle( real.x, real.y, 0, 0 );
public void selectInRect( JobMeta jobMeta, org.pentaho.di.core.gui.Rectangle rect ) { int i; for ( i = 0; i < jobMeta.nrJobEntries(); i++ ) { JobEntryCopy je = jobMeta.getJobEntry( i ); Point p = je.getLocation(); if ( ( ( p.x >= rect.x && p.x <= rect.x + rect.width ) || ( p.x >= rect.x + rect.width && p.x <= rect.x ) ) && ( ( p.y >= rect.y && p.y <= rect.y + rect.height ) || ( p.y >= rect.y + rect.height && p.y <= rect.y ) ) ) { je.setSelected( true ); } } for ( i = 0; i < jobMeta.nrNotes(); i++ ) { NotePadMeta ni = jobMeta.getNote( i ); Point a = ni.getLocation(); Point b = new Point( a.x + ni.width, a.y + ni.height ); if ( rect.contains( a.x, a.y ) && rect.contains( b.x, b.y ) ) { ni.setSelected( true ); } } }
selectionRegion = new org.pentaho.di.core.gui.Rectangle( real.x, real.y, 0, 0 );