protected EventSet newCreatedEventSet(EventSetDescriptor esd) { Object pdO = esd.getValue(Constants.EventSetDescriptor.BINDING_PROPERTY); if (pdO instanceof PropertyDescriptor) { //!CQ check for attr descriptor too? return new MethodBindEventSet(this, esd, (PropertyDescriptor)pdO); } return super.newCreatedEventSet(esd); }
/** * Perform markup-based event wiring here on a per-bean basis. */ protected void bindEventSets() { for (Iterator pi = properties.iterator(); pi.hasNext(); ) { Property p = (Property)pi.next(); if (p instanceof MarkupProperty && MethodBindEventSet.isMethodBindProperty(p)) { MarkupProperty mp = (MarkupProperty)p; PropertyDescriptor pd = p.getDescriptor(); EventSetDescriptor[] esds = beanInfo.getEventSetDescriptors(); for (int i = 0; i < esds.length; i++) { Object epdO = esds[i].getValue(Constants.EventSetDescriptor.BINDING_PROPERTY); if (pd.equals(epdO)) eventSets.add(new MethodBindEventSet(this, esds[i], mp)); } } } }
protected void initEvent(String handlerName) { super.initEvent(handlerName); if (reference != null) { // This looks HACKed, but I am just not sure // I cloned this code from BeansDesignBean.newDesignEvent since when I was created // the property may not have existed, IE not set, on the actual bean Object possiblePropertyDescriptor = descriptor.getEventSetDescriptor().getValue(Constants.EventSetDescriptor.BINDING_PROPERTY); if (possiblePropertyDescriptor instanceof PropertyDescriptor) { PropertyDescriptor propertyDescriptor = (PropertyDescriptor) possiblePropertyDescriptor; if (MethodBindDesignProperty.isMethodBindingProperty(propertyDescriptor)) { reference.property = ((BeansDesignBean) liveBean).bean.getProperty(propertyDescriptor.getName()); } } } }
protected SourceDesignEvent newDesignEvent(EventDescriptor ed) { if (bean instanceof FacesBean) { Object pdO = ed.getEventSetDescriptor().getValue(Constants.EventSetDescriptor.BINDING_PROPERTY); if (pdO instanceof PropertyDescriptor && MethodBindDesignProperty.isMethodBindingProperty((PropertyDescriptor)pdO)) { DesignProperty prop = getProperty(((PropertyDescriptor)pdO).getName()); if (prop instanceof MethodBindDesignProperty) return new MethodBindDesignEvent(ed, this, (MethodBindDesignProperty)prop); } } return new BeansDesignEvent(ed, this); }
/** * */ public Event setEvent(EventDescriptor ed, MethodDescriptor md, String value) { Event e = getEvent(md.getName()); if (e != null) { Object defaultBody = ed.getEventSetDescriptor().getValue(Constants.EventDescriptor.DEFAULT_EVENT_BODY); if (defaultBody instanceof String) { e.setDefaultBody((String)defaultBody); } Object parameterNames = ed.getEventSetDescriptor().getValue(Constants.EventDescriptor.PARAMETER_NAMES); if (parameterNames instanceof String[]) { e.setParameterNames((String[])parameterNames); } Object requiredImports = ed.getEventSetDescriptor().getValue(Constants.EventDescriptor.REQUIRED_IMPORTS); if (requiredImports instanceof String[]) { e.setRequiredImports((String[])requiredImports); } e.setHandler(value); } else { e = newCreatedEvent(md, value); if (e != null) events.add(e); } return e; }