ruleset.addRule(new MetaRule() {
public Metadata applyRule(String name, final TagAttribute attribute, MetadataTarget metadataTarget) {
if (CHANGE_EXPAND_LISTENER.equals(name)) {
return new Metadata() {
public void applyMetadata(FaceletContext context, Object object) {
MethodBinding binding = context.getFacesContext().getApplication().createMethodBinding(attribute.getValue(), new Class[] {NodeExpandedEvent.class});
((UIComponent) object).getAttributes().put(CHANGE_EXPAND_LISTENER, binding);
}
};
} else if (NODE_SELECT_LISTENER.equals(name)) {
return new Metadata() {
public void applyMetadata(FaceletContext context, Object object) {
MethodBinding binding = context.getFacesContext().getApplication().createMethodBinding(attribute.getValue(), new Class[] {NodeSelectedEvent.class});
((UIComponent) object).getAttributes().put(NODE_SELECT_LISTENER, binding);
}
};