subG.setBackground(g.getBackground());
subG.setForeground(g.getForeground());
subG.setAntialias(g.getAntialias());
subG.fillRectangle(0, 0, dummyRectangle.width, dummyRectangle.height);
nodePainter.paintNode(graphPane, subG, dummyNode, ShapeNodePainter.SMALL, theSubGraphHighlighter, new JPowerGraphPoint(dummyRectangle.width/2, dummyRectangle.height/2), scale);
JPowerGraphColor nodeColor = nodePainter.getBackgroundColor(dummyNode, graphPane, theSubGraphHighlighter);
for (int i = 0; i < rowSizes.length; i++) {
int rowIndex = (((numRows - 1) / 2) - i) * -1;
int normalisedRowIndex = rowIndex;
if (normalisedRowIndex < 0){
normalisedRowIndex *= -1;
}
int rowdx = 0;
int numFullNodes = 0;
int numHalfNodes = 0;
int numGaps = 0;
if (i % 2 != 0) {
numFullNodes = (rowSizes[i] - 2);
numHalfNodes = 1;
numGaps = (rowSizes[i] - 1);
}
else{
numFullNodes = (rowSizes[i] - 1);
numHalfNodes = 0;
numGaps = (rowSizes[i] - 1);
}
rowdx = (numFullNodes * dummyRectangle.width) + (numHalfNodes * dummyRectangle.width) + (numGaps * hPadBetweenInstances) ;
rowdx = rowdx / 2;
JPowerGraphGraphics rowG = rowImageMap.retrieve(scale, rowSizes[i], g.getBackground(), nodeColor);
if (rowG == null){
int rowWidth = (dummyRectangle.width + hPadBetweenInstances) * rowSizes[i] + 1;
rowG = g.getSubJPowerGraphGraphics(new JPowerGraphDimension(rowWidth, dummyRectangle.height));
rowG.setBackground(g.getBackground());
rowG.setForeground(g.getForeground());
rowG.setAntialias(g.getAntialias());
rowG.fillRectangle(0, 0, rowWidth, dummyRectangle.height);
for (int j = 0; j < rowSizes[i]; j++) {
int thisDx = (dummyRectangle.width + hPadBetweenInstances) * j;
JPowerGraphPoint thisPoint = new JPowerGraphPoint(thisDx + dummyRectangle.width/2, dummyRectangle.height/2);
rowG.drawSubJPowerGraph(subG, thisPoint.x - dummyRectangle.width/2, thisPoint.y - dummyRectangle.height/2);
}
rowImageMap.register(scale, rowSizes[i], rowG, g.getBackground(), nodeColor);
}
int rowdy = rowIndex * (dummyRectangle.height + vPadBetweenInstances);
JPowerGraphPoint thisPoint = new JPowerGraphPoint(thePoint.x - rowdx, thePoint.y + rowdy);
g.drawSubJPowerGraph(rowG, thisPoint.x - dummyRectangle.width/2, thisPoint.y - dummyRectangle.height/2);
}
subG.dispose();
}
else{