if (content.length != 7 && content.length != 8)
throw new Exception ("Bad number of parameters");
String name = (String)content[NAME];
String description = (String)content[DESCRIPTION];
String iconUrl = (String)content[ICON_URL];
String defaultUrl = (String)content[DEFAULT_URL];
TreeAction action = new HttpLinkTreeAction (defaultUrl);
// menu entries
//
TreeNodeMenuEntry[] menuEntries = createTreeMenus ((Object[])content[MENU_ENTRIES]);
// sub nodes
//
TreeNode[] subNodes = null;
Object[] genericSubNodes = (Object[])content[SUB_NODES];
if (genericSubNodes != null && genericSubNodes.length > 0)
{
subNodes = new TreeNode[genericSubNodes.length];
for (int i=0; i< genericSubNodes.length; i++)
{
subNodes[i] = createTreeNode ( (Object[])genericSubNodes[i] );
}
}
else
{
subNodes = new TreeNode[0];
}
// sub resources nodes
//
ResourceTreeNode[] subResNodes = null;
Object[] genericSubResNodes = (Object[])content[SUB_RESOURCES];
if (genericSubResNodes != null && genericSubResNodes.length > 0)
{
subResNodes = new ResourceTreeNode[genericSubResNodes.length];
for (int i=0; i< genericSubResNodes.length; i++)
{
subResNodes[i] = (ResourceTreeNode)createTreeNode ( (Object[])genericSubResNodes[i] );
}
}
else
{
subResNodes = new ResourceTreeNode[0];
}
if ((content.length-1) == MANAGEABLE_RESOURCES)
{
// we are a resource tree node
//
ManageableResource res = createManageableResource (content[MANAGEABLE_RESOURCES]);
return new SimpleResourceTreeNode (name, description, iconUrl, action, menuEntries, subNodes, subResNodes, res);
}
else
{
// we are not a resource tree node, but simply a tree node!
//
return new SimpleTreeNode (name, description, iconUrl, action, menuEntries, subNodes, subResNodes);
}