public Map<String, Object> getFactoryOptions(Object nodeObject) {
if (nodeObject == null) {
return null;
}
LayoutComponent desc = getLayoutComponent();
Map<String, Object> props = new HashMap<String, Object>();
if ((nodeObject instanceof Integer) && nodeObject.equals(TOP_ID)) {
// This case deals with the top node.
// NOTE: All supported options must be handled here,
// otherwise they'll be ignored.
// NOTE: Options will be evaluated later, do not eval here.
setProperty(props, "text", desc.getOption("text"));
setProperty(props, "url", desc.getOption("url"));
setProperty(props, "imageURL", desc.getOption("imageURL"));
setProperty(props, "target", desc.getOption("target"));
setProperty(props, "action", desc.getOption("action"));
// NOTE: Although actionListener is supported, LH currently
// implements this to be the ActionListener of the "turner"
// which is inconsistent with "action". We should make use
// of the "Handler" feature which provides a "toggle"
// CommandEvent.
setProperty(props, "actionListener", desc.getOption("actionListener"));
setProperty(props, "expanded", desc.getOption("expanded"));
setProperty(props, "rendered", desc.getOption("rendered"));
} else {
// This case deals with the children
if (nodeObject instanceof Map) {
String key = (String) desc.getOption("childNameKey");
if (key == null) {
key = "name";
}
setProperty(props, "text", ((Map) nodeObject).get(key));
} else {
// Use the object itself...
setProperty(props, "text", nodeObject);
}
// Finish setting the child properties
setProperty(props, "url", desc.getOption("childURL"));
setProperty(props, "imageURL", desc.getOption("childImageURL"));
setProperty(props, "action", desc.getOption("childAction"));
String tt = (String) desc.getOption("targetConfigName");
if (!GuiUtil.isEmpty(tt)){
setProperty(props, "targetConfigName", tt);
}
/*
String check = (String) desc.getOption("checkAdminServer");
if (!GuiUtil.isEmpty(check)) {
String serverName = (String) props.get("text");
if (serverName.equals("server")) {
setProperty(props, "text", "server (Admin Server)");
setProperty(props, "serverName", "server");
} else {
setProperty(props, "serverName", serverName);
}
}
*/
setProperty(props, "encodedText",
GuiUtil.encode((String) props.get("text"), null, null));
// We are using "childActionListener" for the hyperlink, not the TreeNode
// setProperty(props, "actionListener", desc.getOption("childActionListener"));
setProperty(props, "expanded", desc.getOption("childExpanded"));
}
// Return the options
return props;
}