JGoPalette item alignment

I’m trying to use JGoPalette in my application along side my JGoView as a tool palette. Essentially, drag an icon from the palette onto the JGoView and a new object of that type is added to the diagram.

<I wanted to post a screen capture, but the Insert Image function is not working >
I'm using JGoIconicNodes in the palette to have a 32x32 icon with a label underneath it (default positioning).
My problem is that I can't figure out how to center my JGoIconicNodes in the vertical palette so they line up neatly. The label text is a slightly different length for each and they are left aligning to the palette grid. I've played with a number of settings and can't figure out how to center them.
Clues? I'm sure this must be a common need.
Here's my code if it helps.
private void createPallete(Composite parent) {

//Create the pallete
palette = new JGoPalette(parent, SWT.VERTICAL | SWT.V_SCROLL);

//Place in the grid
GridData gridData = new GridData();
gridData.widthHint = 70;
gridData.horizontalAlignment = SWT.FILL;
gridData.verticalAlignment = SWT.FILL;

//Create icons for the palette
createPaletteNode("Content", "icons/Content_32.gif");
createPaletteNode("Question", "icons/Question_32.gif");
createPaletteNode("Jump", "icons/Jump_32.gif");
createPaletteNode("Browser App", "icons/BrowserApp_32.gif");
createPaletteNode("Desktop App", "icons/DesktopApp_32.gif");

private void createPaletteNode(String text, String iconFile) {
JGoIconicNode node = new JGoIconicNode(text);
ImageDescriptor imageDescriptor =
AbstractUIPlugin.imageDescriptorFromPlugin(Application.PLUGIN_ID, iconFile);
ImageData imageData = imageDescriptor.getImageData();
JGoImage img = new JGoImage();
img.setSize(img.getImage().width, img.getImage().height);
What you want to do is set JGoPalette.setGridSpot(JGoObject.Center), or JGoObject.TopCenter or JGoObject.BottomCenter.
But there's a bug in JGoPalette.layoutItems that has it ignoring that property. Here's a corrected implementation that you can use, either by modifying JGoPalette.java or by overriding the method:
public void layoutItems() {
boolean vert = (getOrientation() == OrientationVertical);
// don't care about undo/redo
getDocument().setSuspendUpdates(true); // position all objects vertically so they don't overlap
int wView = getExtentSize().width;
int hView = getExtentSize().height;
int wCell = getGridWidth();
int hCell = getGridHeight();
int xOrig = getGridOrigin().x;
int yOrig = getGridOrigin().y;
int xPnt = xOrig;
int yPnt = yOrig;
boolean single = getSingleRowCol();
int spot = getGridSpot(); // just modify top-level objects, not parts of areas
JGoListPosition pos = getDocument().getFirstObjectPos();
while (pos != null) {
JGoObject obj = getDocument().getObjectAtPos(pos);
pos = getDocument().getNextObjectPosAtTop(pos); obj.setSpotLocation(spot, xPnt, yPnt);
if (vert) {
xPnt += Math.max(wCell, (int)(Math.ceil((double)obj.getWidth()/wCell))*wCell);
if (single || (xPnt + obj.getWidth() > wView)) {
xPnt = xOrig;
yPnt += Math.max(hCell, (int)(Math.ceil((double)obj.getHeight()/hCell))*hCell);
} else {
yPnt += Math.max(hCell, (int)(Math.ceil((double)obj.getHeight()/hCell))*hCell);
if (single || (yPnt + obj.getHeight() > hView)) {
yPnt = yOrig;
xPnt += Math.max(wCell, (int)(Math.ceil((double)obj.getWidth()/wCell))*wCell);
} // minimize the size of the document
Dimension docsize = getPrintDocumentSize();
Point doctopleft = getPrintDocumentTopLeft();
getDocument().setDocumentTopLeft(doctopleft); getDocument().setSuspendUpdates(false);
This will be in the release of 5.2, which should be coming out soon.

Works like a charm. Thanks, Walter.