Program: 57830
Project: 57830
Buggy source:
@Override public void render(GL2 gl){
  float captionColumnWidth=calcMaxTextWidth(rows);
  float captionRowHeight=calcMaxTextWidth(columns);
  CaleydoTextRenderer textRenderer=view.getTextRenderer();
  PixelGLConverter pixelGLConverter=view.getPixelGLConverter();
  float currentPositionX=(x / 2.0f) - pixelGLConverter.getGLWidthForPixelWidth(getMinWidthPixels() / 2);
  float rowHeight=pixelGLConverter.getGLHeightForPixelHeight(ROW_HEIGHT_PIXELS);
  float currentPositionY=y - captionRowHeight - pixelGLConverter.getGLHeightForPixelHeight(CAPTION_SPACING_PIXELS);
  float textHeight=pixelGLConverter.getGLHeightForPixelHeight(TEXT_HEIGHT_PIXELS);
  for (  CellContainer row : rows) {
    float textPositionY=currentPositionY - rowHeight + (rowHeight - textHeight) / 2.0f + pixelGLConverter.getGLHeightForPixelHeight(2);
    textRenderer.setColor(new float[]{0,0,0});
    textRenderer.renderTextInBounds(gl,row.caption,currentPositionX,textPositionY,0,captionColumnWidth,textHeight);
    gl.glPushAttrib(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_LINE_BIT);
    gl.glColor3f(0,0,0);
    gl.glLineWidth(1);
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0,currentPositionY,0);
    gl.glVertex3f(x,currentPositionY,0);
    gl.glEnd();
    gl.glPopAttrib();
    row.position=currentPositionY;
    currentPositionY-=rowHeight;
  }
  float columnWidth=pixelGLConverter.getGLWidthForPixelWidth(COLUMN_WIDTH_PIXELS);
  currentPositionX+=captionColumnWidth + pixelGLConverter.getGLWidthForPixelWidth(CAPTION_SPACING_PIXELS);
  for (  CellContainer column : columns) {
    if (!column.isVisible) {
      continue;
    }
    float currentColumnWidth=columnWidth * column.numSubdivisions;
    float textPositionX=currentPositionX + (currentColumnWidth - textHeight) / 2.0f + pixelGLConverter.getGLHeightForPixelHeight(2);
    gl.glPushMatrix();
    gl.glTranslatef(textPositionX,y,0);
    gl.glRotatef(-90,0,0,1);
    textRenderer.setColor(new float[]{0,0,0});
    textRenderer.renderTextInBounds(gl,column.caption,0,0,0,captionRowHeight,textHeight);
    gl.glPopMatrix();
    gl.glPushAttrib(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_LINE_BIT);
    gl.glColor3f(0,0,0);
    gl.glLineWidth(1);
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(currentPositionX,0,0);
    gl.glVertex3f(currentPositionX,y,0);
    for (int i=1; i < column.numSubdivisions; i++) {
      gl.glVertex3f(currentPositionX + i * columnWidth,0,0);
      gl.glVertex3f(currentPositionX + i * columnWidth,y - captionRowHeight - pixelGLConverter.getGLHeightForPixelHeight(CAPTION_SPACING_PIXELS),0);
    }
    gl.glEnd();
    float currentDimGroupPositionX=currentPositionX;
    for (    CellContainer row : rows) {
      float cellSpacingX=pixelGLConverter.getGLWidthForPixelWidth(CELL_SPACING_PIXELS);
      float cellSpacingY=pixelGLConverter.getGLHeightForPixelHeight(CELL_SPACING_PIXELS);
      float emptyCellPositionX=currentPositionX + currentColumnWidth - columnWidth;
      ColorRenderer cell=cells.get(row.id + column.id);
      gl.glPushMatrix();
      int pickingID=0;
      if (cell instanceof DimensionGroupRenderer) {
        pickingID=view.getPickingManager().getPickingID(view.getID(),DIMENSION_GROUP_PICKING_TYPE + node.getID(),((DimensionGroupRenderer)cell).getDimensionGroupData().getID());
        gl.glTranslatef(currentDimGroupPositionX + cellSpacingX,row.position - rowHeight + cellSpacingY,0);
        Point2D position1=new Point2D.Float(currentDimGroupPositionX + cellSpacingX,row.position - rowHeight + cellSpacingY);
        Point2D position2=new Point2D.Float((float)position1.getX() + pixelGLConverter.getGLWidthForPixelWidth(CELL_SIZE_PIXELS),(float)position1.getY());
        dimensionGroupPositions.put(((DimensionGroupRenderer)cell).getDimensionGroupData().getID(),new Pair<Point2D,Point2D>(position1,position2));
        currentDimGroupPositionX+=columnWidth;
      }
 else {
        pickingID=view.getPickingManager().getPickingID(view.getID(),EMPTY_CELL_PICKING_TYPE + node.getID(),((EmptyCellRenderer)cell).getID());
        gl.glTranslatef(emptyCellPositionX + cellSpacingX,row.position - rowHeight + cellSpacingY,0);
      }
      cell.setLimits(pixelGLConverter.getGLWidthForPixelWidth(CELL_SIZE_PIXELS),pixelGLConverter.getGLHeightForPixelHeight(CELL_SIZE_PIXELS));
      gl.glPushName(pickingID);
      cell.render(gl);
      gl.glPopName();
      gl.glPopMatrix();
    }
    gl.glPopAttrib();
    column.position=currentPositionX;
    currentPositionX+=currentColumnWidth;
  }
}

Fixed version (ground truth):
@Override public void render(GL2 gl){
  float captionColumnWidth=calcMaxTextWidth(rows);
  float captionRowHeight=calcMaxTextWidth(columns);
  CaleydoTextRenderer textRenderer=view.getTextRenderer();
  PixelGLConverter pixelGLConverter=view.getPixelGLConverter();
  float currentPositionX=(x / 2.0f) - pixelGLConverter.getGLWidthForPixelWidth(getMinWidthPixels() / 2);
  float rowHeight=pixelGLConverter.getGLHeightForPixelHeight(ROW_HEIGHT_PIXELS);
  float captionSpacingY=pixelGLConverter.getGLHeightForPixelHeight(CAPTION_SPACING_PIXELS);
  float captionSpacingX=pixelGLConverter.getGLWidthForPixelWidth(CAPTION_SPACING_PIXELS);
  float currentPositionY=y - captionRowHeight - captionSpacingY;
  float textHeight=pixelGLConverter.getGLHeightForPixelHeight(TEXT_HEIGHT_PIXELS);
  for (  CellContainer row : rows) {
    float textPositionY=currentPositionY - rowHeight + (rowHeight - textHeight) / 2.0f + pixelGLConverter.getGLHeightForPixelHeight(2);
    if (row.parentContainer == null) {
      gl.glColor3f(0.7f,0.7f,0.7f);
      gl.glBegin(GL2.GL_QUADS);
      gl.glVertex3f(currentPositionX,currentPositionY - rowHeight,0);
      gl.glVertex3f(currentPositionX + captionColumnWidth + pixelGLConverter.getGLWidthForPixelWidth(CAPTION_SPACING_PIXELS),currentPositionY - rowHeight,0);
      gl.glVertex3f(currentPositionX + captionColumnWidth + pixelGLConverter.getGLWidthForPixelWidth(CAPTION_SPACING_PIXELS),currentPositionY,0);
      gl.glVertex3f(currentPositionX,currentPositionY,0);
      gl.glEnd();
    }
    textRenderer.setColor(new float[]{0,0,0});
    textRenderer.renderTextInBounds(gl,row.caption,currentPositionX + captionSpacingX,textPositionY,0,captionColumnWidth - 2 * captionSpacingX,textHeight);
    gl.glPushAttrib(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_LINE_BIT);
    gl.glColor3f(0,0,0);
    gl.glLineWidth(1);
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(0,currentPositionY,0.1f);
    gl.glVertex3f(x,currentPositionY,0.1f);
    gl.glEnd();
    gl.glPopAttrib();
    row.position=currentPositionY;
    currentPositionY-=rowHeight;
  }
  float columnWidth=pixelGLConverter.getGLWidthForPixelWidth(COLUMN_WIDTH_PIXELS);
  currentPositionX+=captionColumnWidth + pixelGLConverter.getGLWidthForPixelWidth(CAPTION_SPACING_PIXELS);
  for (  CellContainer column : columns) {
    if (!column.isVisible) {
      continue;
    }
    float currentColumnWidth=columnWidth * column.numSubdivisions;
    gl.glPushAttrib(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_LINE_BIT);
    float childIndent=0;
    gl.glColor3f(0.7f,0.7f,0.7f);
    if (column.parentContainer == null) {
      gl.glBegin(GL2.GL_QUADS);
      gl.glVertex3f(currentPositionX,y - captionRowHeight - captionSpacingY,0);
      gl.glVertex3f(currentPositionX + currentColumnWidth,y - captionRowHeight - captionSpacingY,0);
      gl.glVertex3f(currentPositionX + currentColumnWidth,y,0);
      gl.glVertex3f(currentPositionX,y,0);
      gl.glEnd();
    }
 else {
      childIndent=captionSpacingY * 2;
      gl.glColor3f(0.8f,0.8f,0.8f);
      gl.glBegin(GL2.GL_QUADS);
      gl.glVertex3f(currentPositionX,y - captionRowHeight - captionSpacingY,0);
      gl.glVertex3f(currentPositionX + currentColumnWidth,y - captionRowHeight - captionSpacingY,0);
      gl.glVertex3f(currentPositionX + currentColumnWidth,y,0);
      gl.glVertex3f(currentPositionX,y,0);
      gl.glColor3f(0.7f,0.7f,0.7f);
      gl.glVertex3f(currentPositionX,y - childIndent,0);
      gl.glVertex3f(currentPositionX + currentColumnWidth,y - childIndent,0);
      gl.glVertex3f(currentPositionX + currentColumnWidth,y,0);
      gl.glVertex3f(currentPositionX,y,0);
      gl.glEnd();
    }
    float textPositionX=currentPositionX + (currentColumnWidth - textHeight) / 2.0f + pixelGLConverter.getGLHeightForPixelHeight(2);
    gl.glPushMatrix();
    gl.glTranslatef(textPositionX,y - childIndent - captionSpacingY,0);
    gl.glRotatef(-90,0,0,1);
    textRenderer.setColor(new float[]{0,0,0});
    textRenderer.renderTextInBounds(gl,column.caption,0,0,0,captionRowHeight - childIndent - 2 * captionSpacingY,textHeight);
    gl.glPopMatrix();
    gl.glColor3f(0,0,0);
    gl.glLineWidth(1);
    gl.glBegin(GL2.GL_LINES);
    gl.glVertex3f(currentPositionX,0,0);
    gl.glVertex3f(currentPositionX,y - childIndent,0);
    for (int i=1; i < column.numSubdivisions; i++) {
      gl.glVertex3f(currentPositionX + i * columnWidth,0,0);
      gl.glVertex3f(currentPositionX + i * columnWidth,y - captionRowHeight - captionSpacingY,0);
    }
    gl.glEnd();
    float currentDimGroupPositionX=currentPositionX;
    for (    CellContainer row : rows) {
      float cellSpacingX=pixelGLConverter.getGLWidthForPixelWidth(CELL_SPACING_PIXELS);
      float cellSpacingY=pixelGLConverter.getGLHeightForPixelHeight(CELL_SPACING_PIXELS);
      float emptyCellPositionX=currentPositionX + currentColumnWidth - columnWidth;
      ColorRenderer cell=cells.get(row.id + column.id);
      gl.glPushMatrix();
      int pickingID=0;
      if (cell instanceof DimensionGroupRenderer) {
        pickingID=view.getPickingManager().getPickingID(view.getID(),DIMENSION_GROUP_PICKING_TYPE + node.getID(),((DimensionGroupRenderer)cell).getDimensionGroupData().getID());
        gl.glTranslatef(currentDimGroupPositionX + cellSpacingX,row.position - rowHeight + cellSpacingY,0);
        Point2D position1=new Point2D.Float(currentDimGroupPositionX + cellSpacingX,row.position - rowHeight + cellSpacingY);
        Point2D position2=new Point2D.Float((float)position1.getX() + pixelGLConverter.getGLWidthForPixelWidth(CELL_SIZE_PIXELS),(float)position1.getY());
        dimensionGroupPositions.put(((DimensionGroupRenderer)cell).getDimensionGroupData().getID(),new Pair<Point2D,Point2D>(position1,position2));
        currentDimGroupPositionX+=columnWidth;
      }
 else {
        pickingID=view.getPickingManager().getPickingID(view.getID(),EMPTY_CELL_PICKING_TYPE + node.getID(),((EmptyCellRenderer)cell).getID());
        gl.glTranslatef(emptyCellPositionX + cellSpacingX,row.position - rowHeight + cellSpacingY,0);
      }
      cell.setLimits(pixelGLConverter.getGLWidthForPixelWidth(CELL_SIZE_PIXELS),pixelGLConverter.getGLHeightForPixelHeight(CELL_SIZE_PIXELS));
      gl.glPushName(pickingID);
      cell.render(gl);
      gl.glPopName();
      gl.glPopMatrix();
    }
    gl.glPopAttrib();
    column.position=currentPositionX;
    currentPositionX+=currentColumnWidth;
  }
}