private void renderOperatorBackground(final Operator operator,final Graphics2D g2){
  Rectangle2D frame=model.getOperatorRect(operator);
  if (frame == null) {
    return;
  }
  RoundRectangle2D background=new RoundRectangle2D.Double(frame.getX() - 7,frame.getY() - 3,frame.getWidth() + 14,frame.getHeight() + 11,OPERATOR_BG_CORNER,OPERATOR_BG_CORNER);
  g2.setColor(Color.WHITE);
  g2.fill(background);
  Rectangle2D nameBounds=OPERATOR_FONT.getStringBounds(operator.getName(),g2.getFontRenderContext());
  if (nameBounds.getWidth() > frame.getWidth()) {
    double relevantWidth=Math.min(nameBounds.getWidth(),frame.getWidth() * MAX_HEADER_RATIO);
    double offset=(frame.getWidth() - relevantWidth) / 2;
    int x=(int)(frame.getX() + offset);
    int padding=5;
    RoundRectangle2D nameBackground=new RoundRectangle2D.Double((int)Math.min(frame.getX() - padding,x - padding),frame.getY() - 3,relevantWidth + 2 * padding,ProcessRendererModel.HEADER_HEIGHT + 3,OPERATOR_BG_CORNER,OPERATOR_BG_CORNER);
    g2.fill(nameBackground);
  }
  renderPortsBackground(operator.getInputPorts(),g2);
  renderPortsBackground(operator.getOutputPorts(),g2);
}

private void renderOperatorBackground ( final Operator operator , final Graphics2D g2 ) { Rectangle2D frame = model . getOperatorRect ( operator ) ; if ( frame == null ) { return ; } RoundRectangle2D background = new RoundRectangle2D . Double ( frame . getX ( ) - 7 , frame . getY ( ) - 3 , frame . getWidth ( ) + 14 , frame . getHeight ( ) + 11 , OPERATOR_BG_CORNER , OPERATOR_BG_CORNER ) ; g2 . setColor ( Color . WHITE ) ; g2 . fill ( background ) ; Rectangle2D nameBounds = OPERATOR_FONT . getStringBounds ( operator . getName ( ) , g2 . getFontRenderContext ( ) ) ; if ( nameBounds . getWidth ( ) > frame . getWidth ( ) ) { double relevantWidth = Math . min ( nameBounds . getWidth ( ) , frame . getWidth ( ) * MAX_HEADER_RATIO ) ; double offset = ( frame . getWidth ( ) - relevantWidth ) / 2 ; int x = ( int ) ( frame . getX ( ) + offset ) ; int padding = 5 ; RoundRectangle2D nameBackground = new RoundRectangle2D . Double ( ( int ) Math . min ( frame . getX ( ) - padding , x - padding ) , frame . getY ( ) - 3 , relevantWidth + 2 * padding , ProcessRendererModel . HEADER_HEIGHT + 3 , OPERATOR_BG_CORNER , OPERATOR_BG_CORNER ) ; g2 . fill ( nameBackground ) ; } renderPortsBackground ( operator . getInputPorts ( ) , g2 ) ; renderPortsBackground ( operator . getOutputPorts ( ) , g2 ) ; }
draws the operator background ( white round rectangle ) .
