* @since 1.2
*/
public class ZkConfigDefinitionParser implements BeanDefinitionParser {
public BeanDefinition parse(Element element, ParserContext pc) {
final BeanDefinitionRegistry reg = pc.getRegistry();
//register ZK scopes
final BeanDefinitionBuilder builder =
BeanDefinitionBuilder.rootBeanDefinition(CustomScopeConfigurer.class);
final Map scopes = new HashMap();
scopes.put("application", new ApplicationScope());
scopes.put("desktop", new DesktopScope());
scopes.put("page", new PageScope());
scopes.put("idspace", new IdSpaceScope());
scopes.put("execution", new ExecutionScope());
builder.addPropertyValue("scopes", scopes);
reg.registerBeanDefinition(ZkBeanIds.ZK_SCOPE_CONFIG, builder.getBeanDefinition());
//register ZK implicit object factory bean
registerImplicitObjects(reg);
//register singleton ZkSpringBeanBindingComposer (used to bind ZK component as Spring bean),
//see ZkDesktopReuseUiFactory#applyZkSpringBeanBindingComposer(PageDefinition pd)
final BeanDefinitionBuilder bbuilder =
BeanDefinitionBuilder.rootBeanDefinition(ZkSpringBeanBindingComposer.class);
reg.registerBeanDefinition(ZkBeanIds.ZK_BINDING_COMPOSER, bbuilder.getBeanDefinition());
//register PropertyEditor for ZkComponentProxyFactoryBean#type
final BeanDefinitionBuilder xbuilder =
BeanDefinitionBuilder.rootBeanDefinition(CustomEditorConfigurer.class);
final Map editors = new HashMap();
editors.put("org.zkoss.spring.bean.TypePropertyEditor", "org.zkoss.spring.bean.TypePropertyEditor");
xbuilder.addPropertyValue("customEditors", editors);
reg.registerBeanDefinition(ZkBeanIds.ZK_TYPE_PROPERTY_EDITOR, xbuilder.getBeanDefinition());
return null;
}