protected boolean shouldWriteId(UIComponent component) { String id = component.getId(); return (null != id) && (!id.startsWith(UIViewRoot.UNIQUE_ID_PREFIX) || ((component instanceof ClientBehaviorHolder) && !((ClientBehaviorHolder) component).getClientBehaviors().isEmpty())); }
protected void renderDomEvents(FacesContext context, UIComponent component, String[] eventAttrs) throws IOException { if (component instanceof ClientBehaviorHolder) { renderDomEvents(context, component, eventAttrs, ((ClientBehaviorHolder) component).getClientBehaviors()); } else { renderPassThruAttributes(context, component, eventAttrs); } }
protected void setConfirmationScript(FacesContext context, MenuItem item) { if (item instanceof ClientBehaviorHolder) { Map<String, List<ClientBehavior>> behaviors = ((ClientBehaviorHolder) item).getClientBehaviors(); List<ClientBehavior> clickBehaviors = (behaviors == null) ? null : behaviors.get("click"); if (clickBehaviors != null && !clickBehaviors.isEmpty()) { for (int i = 0; i < clickBehaviors.size(); i++) { ClientBehavior clientBehavior = clickBehaviors.get(i); if (clientBehavior instanceof ConfirmBehavior) { ClientBehaviorContext cbc = ClientBehaviorContext.createClientBehaviorContext( context, (UIComponent) item, "click", item.getClientId(), Collections.EMPTY_LIST); clientBehavior.getScript(cbc); break; } } } } }
protected void setConfirmationScript(FacesContext context, MenuItem item) { if (item instanceof ClientBehaviorHolder) { Map<String, List<ClientBehavior>> behaviors = ((ClientBehaviorHolder) item).getClientBehaviors(); List<ClientBehavior> clickBehaviors = (behaviors == null) ? null : behaviors.get("click"); if (clickBehaviors != null && !clickBehaviors.isEmpty()) { for (int i = 0; i < clickBehaviors.size(); i++) { ClientBehavior clientBehavior = clickBehaviors.get(i); if (clientBehavior instanceof ConfirmBehavior) { ClientBehaviorContext cbc = ClientBehaviorContext.createClientBehaviorContext( context, (UIComponent) item, "click", item.getClientId(), Collections.EMPTY_LIST); clientBehavior.getScript(cbc); break; } } } } }
protected void decodeBehaviors(FacesContext context, UIComponent component) { if (!(component instanceof ClientBehaviorHolder)) { return; } Map<String, List<ClientBehavior>> behaviors = ((ClientBehaviorHolder) component).getClientBehaviors(); if (behaviors.isEmpty()) { return; } Map<String, String> params = context.getExternalContext().getRequestParameterMap(); String behaviorEvent = params.get("javax.faces.behavior.event"); if (null != behaviorEvent) { List<ClientBehavior> behaviorsForEvent = behaviors.get(behaviorEvent); if (behaviorsForEvent != null && !behaviorsForEvent.isEmpty()) { String behaviorSource = params.get("javax.faces.source"); String clientId = component.getClientId(context); if (behaviorSource != null && clientId.equals(behaviorSource)) { for (ClientBehavior behavior : behaviorsForEvent) { behavior.decode(context, component); } } } } }
protected String getEventBehaviors(FacesContext context, ClientBehaviorHolder cbh, String event, List<ClientBehaviorContext.Parameter> parameters) { List<ClientBehavior> behaviors = cbh.getClientBehaviors().get(event); StringBuilder sb = SharedStringBuilder.get(context, SB_GET_EVENT_BEHAVIORS); if (behaviors != null && !behaviors.isEmpty()) { UIComponent component = (UIComponent) cbh; String clientId = component.getClientId(context); List<ClientBehaviorContext.Parameter> params; if (parameters != null && !parameters.isEmpty()) { params = parameters; } else { params = Collections.emptyList(); } for (int i = 0; i < behaviors.size(); i++) { ClientBehavior behavior = behaviors.get(i); ClientBehaviorContext cbc = ClientBehaviorContext.createClientBehaviorContext( context, component, event, clientId, params); String script = behavior.getScript(cbc); if (script != null) { sb.append(script).append(";"); } } } return sb.length() == 0 ? null : sb.toString(); }
allBehaviors = ((ClientBehaviorHolder) component).getClientBehaviors();
protected void encodeClientBehaviors(FacesContext context, ClientBehaviorHolder component) throws IOException { ResponseWriter writer = context.getResponseWriter(); Map<String, List<ClientBehavior>> clientBehaviors = component.getClientBehaviors();
private static Map<String, List<ClientBehavior>> getClientBehaviorsMap(UIComponent component) { Map<String, List<ClientBehavior>> result; if (component instanceof ClientBehaviorHolder) { ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component; result = clientBehaviorHolder.getClientBehaviors(); } else { result = Collections.emptyMap(); } return result; }
private static List<ClientBehavior> getClientBehaviors(UIComponent component, String behaviorEventName) { if (component instanceof ClientBehaviorHolder) { ClientBehaviorHolder bHolder = (ClientBehaviorHolder)component; Map <String, List <ClientBehavior>> behaviors = bHolder.getClientBehaviors(); if (null != behaviors) { return behaviors.get(behaviorEventName); } } return null; }
private static Map<String, List<ClientBehavior>> getClientBehaviorsMap(UIComponent component) { Map<String, List<ClientBehavior>> result; if (component instanceof ClientBehaviorHolder) { ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) component; result = clientBehaviorHolder.getClientBehaviors(); } else { result = Collections.emptyMap(); } return result; }
private static List<ClientBehavior> getClientBehaviors(UIComponent component, String behaviorEventName) { if (component instanceof ClientBehaviorHolder) { ClientBehaviorHolder bHolder = (ClientBehaviorHolder)component; Map <String, List <ClientBehavior>> behaviors = bHolder.getClientBehaviors(); if (null != behaviors) { return behaviors.get(behaviorEventName); } } return null; }
private static List<ClientBehavior> getClientBehaviors(UIComponent component, String behaviorEventName) { if (component instanceof ClientBehaviorHolder) { ClientBehaviorHolder bHolder = (ClientBehaviorHolder)component; Map <String, List <ClientBehavior>> behaviors = bHolder.getClientBehaviors(); if (null != behaviors) { return behaviors.get(behaviorEventName); } } return null; }
public Map<String, List<ClientBehavior>> getClientBehaviors() { Map<String, List<ClientBehavior>> clientBehaviors = new HashMap<String, List<ClientBehavior>>(1); clientBehaviors.put(_sourceEvent, ((ClientBehaviorHolder)_delegate).getClientBehaviors().get(_targetEvent)); return Collections.unmodifiableMap(clientBehaviors); }
protected boolean shouldWriteId(UIComponent component) { String id = component.getId(); return (null != id) && (!id.startsWith(UIViewRoot.UNIQUE_ID_PREFIX) || ((component instanceof ClientBehaviorHolder) && !((ClientBehaviorHolder) component).getClientBehaviors().isEmpty())); }
protected void validateClientBehaviors(final ValidationContext context, final ClientBehaviorHolder component) { Map<String, List<ClientBehavior>> clientBehaviors = component.getClientBehaviors(); if (!clientBehaviors.isEmpty()) { for (String event : clientBehaviors.keySet()) { List<ClientBehavior> behaviors = clientBehaviors.get(event); for (ClientBehavior behavior : behaviors) { validateClientBehavior(context, component, event, behavior); } } } }
static boolean shouldWriteIdAttribute(Component component, String id) { String componentTag = getComponentTag((UIComponent) component); return (id != null && (isComponentWrapper((UIComponent) component) || componentTag != null) && !"option".equals(componentTag) && (!id.startsWith(UIViewRoot.UNIQUE_ID_PREFIX) || ((component instanceof ClientBehaviorHolder) && !((ClientBehaviorHolder) component).getClientBehaviors().isEmpty()))); }
static boolean shouldWriteIdAttribute(Component component, String id) { String componentTag = getComponentTag((UIComponent) component); return (id != null && (isComponentWrapper((UIComponent) component) || componentTag != null) && !"option".equals(componentTag) && (!id.startsWith(UIViewRoot.UNIQUE_ID_PREFIX) || ((component instanceof ClientBehaviorHolder) && !((ClientBehaviorHolder) component).getClientBehaviors().isEmpty()))); }
public static boolean iterateEffects(AnimationBehavior.Iterator iterator) { if (!(iterator.getUIComponent() instanceof ClientBehaviorHolder)) return false; for (String effect : ((ClientBehaviorHolder)iterator.getUIComponent()).getClientBehaviors().keySet()) { for (ClientBehavior behavior: ((ClientBehaviorHolder)iterator.getUIComponent()).getClientBehaviors().get(effect)) { if (behavior instanceof AnimationBehavior) { iterator.next(effect, (AnimationBehavior)behavior); } } } return true; }
protected void renderDomEvents(FacesContext context, UIComponent component, String[] eventAttrs) throws IOException { if (component instanceof ClientBehaviorHolder) { renderDomEvents(context, component, eventAttrs, ((ClientBehaviorHolder) component).getClientBehaviors()); } else { renderPassThruAttributes(context, component, eventAttrs); } }