Package org.apache.myfaces.custom.radio

Examples of org.apache.myfaces.custom.radio.HtmlRadio


    public void decode(FacesContext facesContext, UIComponent uiComponent)
    {
        if (uiComponent instanceof HtmlRadio)
        {
            HtmlRadio radio = (HtmlRadio) uiComponent;
            String forAttr = radio.getFor();
            if (forAttr == null)
            {
                throw new IllegalStateException("mandatory attribute 'for'");
            }
            int index = radio.getIndex();
            if (index < 0)
            {
                throw new IllegalStateException("positive index must be given");
            }

            UIComponent uiSelectOne = radio.findComponent(forAttr);
            if (uiSelectOne == null)
            {
                throw new IllegalStateException("Could not find component '" + forAttr + "' (calling findComponent on component '" + radio.getClientId(facesContext) + "')");
            }
            if (!(uiSelectOne instanceof UISelectOne))
            {
                throw new IllegalStateException("UISelectOne expected");
            }

            if (uiSelectOne instanceof ClientBehaviorHolder) {
                ClientBehaviorHolder clientBehaviorHolder = (ClientBehaviorHolder) uiSelectOne;

                Map<String, List<ClientBehavior>> clientBehaviors =
                        clientBehaviorHolder.getClientBehaviors();

                if (clientBehaviors != null && !clientBehaviors.isEmpty()) {
                    Map<String, String> paramMap = facesContext.getExternalContext().
                            getRequestParameterMap();

                    String behaviorEventName = paramMap.get("javax.faces.behavior.event");

                    if (behaviorEventName != null) {
                        List<ClientBehavior> clientBehaviorList = clientBehaviors.get(behaviorEventName);

                        if (clientBehaviorList != null && !clientBehaviorList.isEmpty()) {
                            String clientId = paramMap.get("javax.faces.source");

                            if (radio.getClientId().equals(clientId)) {
                                for (ClientBehavior clientBehavior : clientBehaviorList) {
                                    clientBehavior.decode(facesContext, radio);
                                }
                            }
                        }
View Full Code Here

TOP

Related Classes of org.apache.myfaces.custom.radio.HtmlRadio

Copyright © 2018 www.massapicom. 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.