private String getEventName(ClientBehaviorHolder holder){ String eventName; if (null != owner.getEvent()){ eventName = owner.getEvent().getValue(); } else { eventName = holder.getDefaultEventName(); } if (null == eventName){ throw new TagException(owner.getTag(), "The event name is not defined"); } return eventName; }
/** * @param config */ public BehaviorHandler(BehaviorConfig config) { super(config); behaviorId = config.getBehaviorId(); event = getAttribute ("event"); }
public TagHandler createHandler(TagConfig cfg) throws FacesException, ELException { BehaviorConfig bcfg = new BehaviorConfigWrapper(cfg,this.behaviorId); return new BehaviorHandler(bcfg); } }
protected Behavior createBehavior(FaceletContext ctx) { if (_delegate.getBehaviorId() == null) { throw new TagException( _delegate.getTag(), "No behavior id defined"); } return ctx.getFacesContext().getApplication().createBehavior(_delegate.getBehaviorId()); }
if (_delegate.getBinding() != null) ve = _delegate.getBinding().getValueExpression(faceletContext, Behavior.class); behavior = (Behavior) ve.getValue(faceletContext); throw new TagException(_delegate.getTag(), "No Validator was created"); _delegate.setAttributes(faceletContext, behavior); throw new TagAttributeException(_delegate.getEvent(), "eventName could not be defined for client behavior "+ behavior.toString()); throw new TagAttributeException(_delegate.getEvent(), "eventName "+eventName+" not found on component instance");
public void applyAttachedObject(FacesContext context, UIComponent parent) { FaceletContext ctx = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY); // cast to the ClientBehaviorHolder. ClientBehaviorHolder behaviorHolder = (ClientBehaviorHolder) parent; ValueExpression bindingExpr=null; Behavior behavior=null; if (null != owner.getBinding()){ bindingExpr = owner.getBinding().getValueExpression(ctx, Behavior.class); behavior = (Behavior) bindingExpr.getValue(ctx); } if (null == behavior){ if (null != owner.getBehaviorId()){ behavior = ctx.getFacesContext().getApplication().createBehavior(owner.getBehaviorId()); if (null == behavior){ throw new TagException(owner.getTag(), "No Faces behavior defined for Id "+owner.getBehaviorId()); } if (null != bindingExpr){ bindingExpr.setValue(ctx, behavior); } } else { throw new TagException(owner.getTag(),"No behaviorId defined"); } } owner.setAttributes(ctx, behavior); if (behavior instanceof ClientBehavior) { behaviorHolder.addClientBehavior(getEventName(behaviorHolder), (ClientBehavior)behavior); } }
ComponentSupport.copyPassthroughAttributes(ctx, parent, owner.getTag()); if (null == componentBeanInfo) { throw new TagException( owner.getTag(), "Error: enclosing composite component does not have BeanInfo attribute"); if (null == componentDescriptor) { throw new TagException( owner.getTag(), "Error: enclosing composite component BeanInfo does not have BeanDescriptor"); if (null == targetList) { throw new TagException( owner.getTag(), "Error: enclosing composite component does not support behavior events"); String eventName = owner.getEventName(); boolean supportedEvent = false; for (AttachedObjectTarget target : targetList) { } else { throw new TagException( owner.getTag(), "Error: enclosing composite component does not support event " + eventName); owner.applyAttachedObject(ctx.getFacesContext(), parent); } else {
/** * This tag call _delegate.setAttributes, so the returned MetaRuleset * should ignore attributes that are not supposed to be there like * "binding" and "event" */ @Override public MetaRuleset createMetaRuleset(Class type) { MetaRuleset ruleset = new MetaRulesetImpl(_delegate.getTag(), type); ruleset.ignore("binding"); ruleset.ignore("event"); return ruleset; }
public String getFor() { String result = null; TagAttribute attr = owner.getTagAttribute("for"); if (null != attr) { result = attr.getValue(); } return result; }
public String getEventName() { return _delegate.getEventName(); }
if (_delegate.getBinding() != null) ve = _delegate.getBinding().getValueExpression(faceletContext, Behavior.class); behavior = (Behavior) ve.getValue(faceletContext); throw new TagException(_delegate.getTag(), "No Validator was created"); _delegate.setAttributes(faceletContext, behavior); throw new TagAttributeException(_delegate.getEvent(), "eventName could not be defined for client behavior "+ behavior.toString()); throw new TagAttributeException(_delegate.getEvent(), "eventName "+eventName+" not found on component instance");
@Override public void applyAttachedObject(FacesContext context, UIComponent parent) { FaceletContext ctx = (FaceletContext) context.getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY); // cast to the ClientBehaviorHolder. ClientBehaviorHolder behaviorHolder = (ClientBehaviorHolder) parent; ValueExpression bindingExpr=null; Behavior behavior=null; if (null != owner.getBinding()){ bindingExpr = owner.getBinding().getValueExpression(ctx, Behavior.class); behavior = (Behavior) bindingExpr.getValue(ctx); } if (null == behavior){ if (null != owner.getBehaviorId()){ behavior = ctx.getFacesContext().getApplication().createBehavior(owner.getBehaviorId()); if (null == behavior){ throw new TagException(owner.getTag(), "No Faces behavior defined for Id "+owner.getBehaviorId()); } if (null != bindingExpr){ bindingExpr.setValue(ctx, behavior); } } else { throw new TagException(owner.getTag(),"No behaviorId defined"); } } owner.setAttributes(ctx, behavior); if (behavior instanceof ClientBehavior) { behaviorHolder.addClientBehavior(getEventName(behaviorHolder), (ClientBehavior)behavior); } }
ComponentSupport.copyPassthroughAttributes(ctx, parent, owner.getTag()); if (null == componentBeanInfo) { throw new TagException( owner.getTag(), "Error: enclosing composite component does not have BeanInfo attribute"); if (null == componentDescriptor) { throw new TagException( owner.getTag(), "Error: enclosing composite component BeanInfo does not have BeanDescriptor"); if (null == targetList) { throw new TagException( owner.getTag(), "Error: enclosing composite component does not support behavior events"); String eventName = owner.getEventName(); boolean supportedEvent = false; for (AttachedObjectTarget target : targetList) { } else { throw new TagException( owner.getTag(), "Error: enclosing composite component does not support event " + eventName); owner.applyAttachedObject(ctx.getFacesContext(), parent); } else {
protected Behavior createBehavior(FaceletContext ctx) { if (_delegate.getBehaviorId() == null) { throw new TagException( _delegate.getTag(), "No behavior id defined"); } return ctx.getFacesContext().getApplication().createBehavior(_delegate.getBehaviorId()); }
/** * This tag call _delegate.setAttributes, so the returned MetaRuleset * should ignore attributes that are not supposed to be there like * "binding" and "event" */ @Override public MetaRuleset createMetaRuleset(Class type) { MetaRuleset ruleset = new MetaRulesetImpl(_delegate.getTag(), type); ruleset.ignore("binding"); ruleset.ignore("event"); return ruleset; }
public String getFor() { TagAttribute forAttribute = _delegate.getTagAttribute("for"); if (forAttribute == null) { return null; } else { return forAttribute.getValue(); } }
public String getEventName() { return _delegate.getEventName(); }
if (_delegate.getBinding() != null) ve = _delegate.getBinding().getValueExpression(faceletContext, Behavior.class); behavior = (Behavior) ve.getValue(faceletContext); throw new TagException(_delegate.getTag(), "No Validator was created"); _delegate.setAttributes(faceletContext, behavior); throw new TagAttributeException(_delegate.getEvent(), "eventName could not be defined for client behavior "+ behavior.toString()); throw new TagAttributeException(_delegate.getEvent(), "eventName "+eventName+" not found on component instance");