private void drawTextRightAligned( String txt, int x, int y ) { int off = gc.textExtent( txt ).x; x -= off; gc.drawText( txt, x, y ); }
void drawTimeScaleLine( int height, double pixelsPerMs, long periodInMs ) { int log10 = (int) Math.log10( periodInMs ) + 1; int timeLineDistance = (int) Math.pow( 10, log10 - 1 ) / 2; int incrementUnit = Math.max( timeLineDistance, 1 ); for ( int time = timeLineDistance; time <= periodInMs; time += incrementUnit ) { int x = (int) ( time * pixelsPerMs ); getGc().setForeground( EColor.LIGHTGRAY ); getGc().drawLine( x, 0, x, height ); String marker = Integer.toString( time ); Point point = getGc().textExtent( marker ); getGc().setForeground( EColor.DARKGRAY ); getGc().drawText( marker, x - ( point.x / 2 ), 0, true ); } }
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; } }
gc.drawText( nrInput, point.x + 1, point.y + 1 ); gc.drawText( nrOutput, point.x + 1, point.y + 1 ); gc.drawText( nrInput, point.x + 1, point.y + 1 ); gc.drawText( Const.NVL( partitionSchema.getName(), "<no partition name>" ), point.x, point.y + textExtent.y + 3, true ); gc.drawText( name, namePosition.x, namePosition.y + 2, true ); boolean partitioned = false; gc.setBackground( EColor.BACKGROUND ); gc.setForeground( EColor.BLACK ); gc.drawText( clusterMessage, x - textExtent.x + 1, y - textExtent.y + 1 ); if ( stepMeta.getClusterSchema() != null ) { Point clusterTextExtent = gc.textExtent( clusterMessage ); gc.drawText( copies, x - textExtent.x + 1, y - textExtent.y - clusterTextExtent.y + 1, false ); areaOwners.add( new AreaOwner( AreaType.STEP_COPIES_TEXT, x - textExtent.x + 1, y - textExtent.y - clusterTextExtent.y + 1, textExtent.x, textExtent.y, offset, transMeta, stepMeta ) ); } else { gc.drawText( copies, x - textExtent.x + 1, y - textExtent.y + 1, false ); areaOwners.add( new AreaOwner( AreaType.STEP_COPIES_TEXT, x - textExtent.x + 1, y - textExtent.y + 1, textExtent.x, textExtent.y, offset, transMeta, stepMeta ) ); gc.drawText( trimmedName, areaX + ( totalWidth - nameExtent.x ) / 2 + MINI_ICON_MARGIN, areaY + MINI_ICON_MARGIN, true ); gc.setForeground( EColor.CRYSTAL );
gc.setBackground( EColor.LIGHTGRAY ); gc.drawText( titles[i], rowX, rowY ); rowY += rowHeight;
gc.setForeground( notePadMeta.getFontColorRed(), notePadMeta.getFontColorGreen(), notePadMeta .getFontColorBlue() ); gc.drawText( notePadMeta.getNote(), note.x + margin, note.y + margin, true );