String evt = (String) component.getAttributes().get("event");
if(evt == null || evt.trim().length() == 0){
evt = "onmouseover";
}
function.addParameter(evt);
ScriptOptions Optionssub = new ScriptOptions(component);
Optionssub.addOption("onopen", component.getAttributes().get("onopen"));
Optionssub.addOption("onclose", component.getAttributes().get("onclose"));
Optionssub.addOption("direction", component.getAttributes().get("direction"));
function.addParameter(Optionssub);
function.appendScript(buffer);
} else {
buffer.append(".");
function = new JSFunction("asDropDown");
function.addParameter(component.getClientId(context));
String evt = (String) component.getAttributes().get("event");
if(evt == null || evt.trim().length() == 0){
evt = "onmouseover";
}
function.addParameter(evt);
function.addParameter("onmouseout");
ScriptOptions Options = new ScriptOptions(component);
Options.addOption("direction", component.getAttributes().get("direction"));
Options.addOption("jointPoint", component.getAttributes().get("jointPoint"));
Options.addOption("verticalOffset", component.getAttributes().get("verticalOffset"));
Options.addOption("horizontalOffset", component.getAttributes().get("horizontalOffset"));
Options.addOption("oncollapse", component.getAttributes().get("oncollapse"));
Options.addOption("onexpand", component.getAttributes().get("onexpand"));
Options.addOption("onitemselect", component.getAttributes().get("onitemselect"));
Options.addOption("ongroupactivate", component.getAttributes().get("ongroupactivate"));
function.addParameter(Options);
function.appendScript(buffer);
}
List children = component.getChildren();
for(Iterator it = children.iterator();it.hasNext();) {
UIComponent kid = (UIComponent)it.next();
String itemId = null;
int flcloseonclick=1;
int flagGroup = 0;
if (kid instanceof UIMenuItem) {
UIMenuItem MenuItem=(UIMenuItem)kid;
itemId = kid.getClientId(context);
if (MenuItem.isDisabled()){
flcloseonclick=0;
}
} else if (kid instanceof UIMenuGroup) {
UIMenuGroup menuGroup=(UIMenuGroup)kid;
itemId = "ref" + kid.getClientId(context);
flcloseonclick=0;
if (menuGroup.isDisabled()) flagGroup = 2; else flagGroup = 1;
}
if(itemId != null){
function = new JSFunction("addItem");
function.addParameter(itemId);
function.addParameter(new Integer(flcloseonclick));
ScriptOptions options = new ScriptOptions(kid);
options.addOption("onmouseout", kid.getAttributes().get("onmouseout"));
options.addOption("onmouseover", kid.getAttributes().get("onmouseover"));
options.addOption("flagGroup", new Integer(flagGroup));
String tmp = (String)kid.getAttributes().get("selectClass");
if (tmp != null && tmp.length() > 0) options.addOption("selectClass", tmp);
function.addParameter(options);
buffer.append('.');
function.appendScript(buffer);
}
}