}
// --------------------------
// Table with the menu titles
// --------------------------
Table menuTable = new Table().setBorder(0).setCellSpacing(0).setCellPadding(0);
menuTable.addAttribute("BACKGROUND", bgImage);
if(widthVector.size() > 0) {
// We'll count the total width of the table as we go
int tableWidth = ((Integer) widthVector.get(0)).intValue();
TR menuRow = new TR().setVAlign(AlignType.TOP)
// An empty cell for padding
.addElement(
new TD().setWidth(tableWidth).addElement(Entities.NBSP).addElement(
new IMG().setSrc(spacerImage).setWidth(tableWidth).setHeight(18)));
// This is the width of the last cell...
widthVector.addElement(new Integer(200));
// Add the title cells
for(int i = 0; i < textVector.size(); i++) {
TD menuCell = new TD();
int width = ((Integer) widthVector.get(i + 1)).intValue();
int tab = ((Integer) tabVector.get(i)).intValue();
String text = (String) textVector.get(i);
tableWidth += width;
menuCell.setWidth(width);
Font menuTitle = new Font().setSize(2).setFace("Arial, Helvetica, sans-serif");
if(tab != 0) {
A linkElement = new A("EmptyPage" /*
* + "?" + EmptyPage.MODULE + "=" + module +
* "&" + EmptyPage.MENU + "=" + tab + "&" +
* EmptyPage.TITLE + "=" +
* URLEncoder.encode(text,
* environment.getCharsetWWW())
*/)
.setTarget("main")
.addElement(text);
String menuScriptName = MENU_NAME_BASE + tab;
linkElement.setOnClick("return openMenu(" + menuScriptName + ")");
menuCell.addElement(menuTitle.addElement(linkElement));
} else
menuCell.addElement(menuTitle.addElement(text).setColor(DISABLED_COLOR));
menuRow.addElement(menuCell);
}
menuTable.addElement(menuRow).setWidth(tableWidth + 2); // Don't ask me where the '+2'
// comes from, but the last
// menus don't work in netscape
// without it...
} else
menuTable.addElement(new TR().addElement(new TD().addElement(Entities.NBSP)));
return menuTable;
}