Examples of ClientBehavior


Examples of javax.faces.component.behavior.ClientBehavior

        RenderKitUtils.renderPassThroughAttributes(facesContext, component, knownAttributes);
    }

    private ClientBehavior createClientBehavior(String handlerData, Set<ClientBehaviorHint> hints) {
        ClientBehavior behavior = facesEnvironment.createMock(ClientBehavior.class);
        expect(behavior.getScript(EasyMock.<ClientBehaviorContext>notNull())).andStubReturn(
                MessageFormat.format("prompt({0})", handlerData));

        expect(behavior.getHints()).andStubReturn(hints);
        return behavior;
    }
View Full Code Here

Examples of javax.faces.component.behavior.ClientBehavior

        componentAttributes.put("onclick", "alert(click)");

        Set<ClientBehaviorHint> emptyHintsSet = EnumSet.noneOf(ClientBehaviorHint.class);
        Set<ClientBehaviorHint> submittingHintsSet = EnumSet.of(ClientBehaviorHint.SUBMITTING);

        ClientBehavior keypressBehavior = createClientBehavior("keypress", emptyHintsSet);
        ClientBehavior actionBehavior1 = createClientBehavior("action1", emptyHintsSet);
        ClientBehavior actionBehavior2 = createClientBehavior("action2", submittingHintsSet);
        ClientBehavior actionBehavior3 = createClientBehavior("action3", emptyHintsSet);
        ClientBehavior contextmenuBehavior = createClientBehavior("contextmenu", emptyHintsSet);

        behaviorsMap.put("keypress", Arrays.asList(keypressBehavior));
        behaviorsMap.put("action", Arrays.asList(actionBehavior1, actionBehavior2, actionBehavior3));
        behaviorsMap.put("contextmenu", Arrays.asList(contextmenuBehavior));
View Full Code Here

Examples of javax.faces.component.behavior.ClientBehavior

        componentAttributes.put("onclick", "alert(click)");
        componentAttributes.put("style", "color:green");

        Set<ClientBehaviorHint> emptyHintsSet = EnumSet.noneOf(ClientBehaviorHint.class);

        ClientBehavior actionBehavior1 = createClientBehavior("action1", emptyHintsSet);
        behaviorsMap.put("action", Arrays.asList(actionBehavior1));

        ClientBehaviorHolder behaviorHolder = createMockClientBehaviorHolder();
        UIComponent component = (UIComponent) behaviorHolder;
        return component;
View Full Code Here

Examples of javax.faces.component.behavior.ClientBehavior

        Map<String, String> requestParameterMap = new HashMap<String, String>();
        requestParameterMap.put(RenderKitUtils.BEHAVIOR_SOURCE_ID, behaviorSourceId);
        requestParameterMap.put(RenderKitUtils.BEHAVIOR_EVENT_NAME, behaviorEventName);
        expect(externalContext.getRequestParameterMap()).andStubReturn(requestParameterMap);

        ClientBehavior actionBehavior = createClientBehavior("action1", EnumSet.of(ClientBehaviorHint.SUBMITTING));
        ClientBehavior actionBehavior1 = createClientBehavior("action2", EnumSet.of(ClientBehaviorHint.SUBMITTING));
        behaviorsMap.put("action", Arrays.asList(actionBehavior, actionBehavior1));

        ClientBehavior blurBehavior = createClientBehavior("blur1", EnumSet.of(ClientBehaviorHint.SUBMITTING));
        behaviorsMap.put("blur", Arrays.asList(blurBehavior));

        return component;
    }
View Full Code Here

Examples of javax.faces.component.behavior.ClientBehavior

                    return;
                }
            }

            if (shouldAddBehavior(behaviorHolder, eventName)) {
                ClientBehavior behavior = createBehavior(context);

                behaviorHolder.addClientBehavior(eventName, behavior);
            }
        }
View Full Code Here

Examples of javax.faces.component.behavior.ClientBehavior

            return true;
        }

        private ClientBehavior createBehavior(FacesContext context) {
            Application application = context.getApplication();
            ClientBehavior behavior = (ClientBehavior) application.createBehavior(this.behaviorId);

            ((StateHolder) behavior).restoreState(context, behaviorState);

            if (behaviors == null) {
                behaviors = new ArrayList<ClientBehavior>();
View Full Code Here

Examples of javax.faces.component.behavior.ClientBehavior

        boolean submitting = false;
        Iterator<ClientBehavior> clientIterator = attachedEventBehaviors
                .iterator();
        while (clientIterator.hasNext())
        {
            ClientBehavior clientBehavior = clientIterator.next();
            String script = clientBehavior.getScript (context);
           
            // The script _can_ be null, and in fact is for <f:ajax disabled="true" />
           
            if (script != null)
            {
                //either strings or functions, but I assume string is more appropriate since it allows access to the
                //origin as this!
                target.append("'" + escapeJavaScriptForChain(script) + "'");
                if (clientIterator.hasNext())
                {
                    target.append(", ");
                }
            }
            if (!submitting) {
                submitting = clientBehavior.getHints().contains(ClientBehaviorHint.SUBMITTING);
            }
        }
        return submitting;
    }
View Full Code Here

Examples of javax.faces.component.behavior.ClientBehavior

        boolean submitting = false;
        Iterator<ClientBehavior> clientIterator = attachedEventBehaviors
                .iterator();
        while (clientIterator.hasNext())
        {
            ClientBehavior clientBehavior = clientIterator.next();
            String script = clientBehavior.getScript(context);
            // The script _can_ be null, and in fact is for <f:ajax disabled="true" />
            if (script != null)
            {
                //either strings or functions, but I assume string is more appropriate
                //since it allows access to the
                //origin as this!
                target.append("'" + escapeJavaScriptForChain(script) + "'");
                if (clientIterator.hasNext())
                {
                    target.append(", ");
                }
            }
            if (!submitting)
            {
                submitting = clientBehavior.getHints().contains(
                        ClientBehaviorHint.SUBMITTING);
            }
        }
        return submitting;
    }
View Full Code Here

Examples of javax.faces.component.behavior.ClientBehavior

                        {
                            if (clientBehaviorList instanceof RandomAccess)
                            {
                                for (int i = 0, size = clientBehaviorList.size(); i < size; i++)
                                {
                                    ClientBehavior clientBehavior = clientBehaviorList.get(i);
                                    clientBehavior.decode(facesContext, component);
                                }
                            }
                            else
                            {
                                for (ClientBehavior clientBehavior : clientBehaviorList)
                                {
                                    clientBehavior.decode(facesContext, component);
                                }
                            }
                        }
                    }
                }
View Full Code Here

Examples of javax.faces.component.behavior.ClientBehavior

        // javax.faces.component.UIComponentBase.addClientBehavior
        if (attachedEventBehaviors instanceof RandomAccess)
        {
            for (int i = 0, size = attachedEventBehaviors.size(); i < size; i++)
            {
                ClientBehavior clientBehavior = attachedEventBehaviors.get(i);
                submitting =  _appendClientBehaviourScript(target, context,
                        submitting, i < (size -1), clientBehavior);  
            }
        }
        else
        {
            Iterator<ClientBehavior> clientIterator = attachedEventBehaviors.iterator();
            while (clientIterator.hasNext())
            {
                ClientBehavior clientBehavior = clientIterator.next();
                submitting = _appendClientBehaviourScript(target, context, submitting,
                        clientIterator.hasNext(), clientBehavior);
            }
        }
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.