if (node.getUserObject() == null) { throw new AssertException(
"GenericTreeNode to append/prepend needs to have a UserObject set! Please use setUserObject()."); }
}
private TreeModel buildTreeModel() {
GenericTreeNode gtnChild, rootTreeNode;
Translator translator = getTranslator();
GenericTreeModel gtm = new GenericTreeModel();
rootTreeNode = new GenericTreeNode();
//there should be i18n key for main.menu.title for the rootNode in package of implementing type
rootTreeNode.setTitle(translator.translate("main.menu.title"));
rootTreeNode.setAltText(translator.translate("main.menu.title.alt"));
gtm.setRootNode(rootTreeNode);
// Prepend
boolean rootNodeSet = false;
if (nodesToPrepend.size() != 0) {
for (GenericTreeNode node : nodesToPrepend) {
rootTreeNode.addChild(node);
if (!rootNodeSet) {
rootTreeNode.setDelegate(node);
rootTreeNode.setUserObject(node.getUserObject());
rootNodeSet = true;
}
}
}
// add extension menues
ExtManager extm = ExtManager.getInstance();
int cnt = extm.getExtensionCnt();
int j = 0;
for (int i = 0; i < cnt; i++) {
Extension anExt = extm.getExtension(i);
// check for sites
GenericActionExtension ae = (GenericActionExtension) anExt.getExtensionFor(className);
if (ae != null) {
gtnChild = new GenericTreeNode();
String menuText = ae.getActionText(getLocale());
gtnChild.setTitle(menuText);
gtnChild.setAltText(ae.getDescription(getLocale()));
gtnChild.setUserObject(ae);
// load first child on root node
if (j == 0 && !rootNodeSet) {
rootTreeNode.setDelegate(gtnChild);
rootTreeNode.setUserObject(ae);
} else {