Package com.sun.faces.config.beans

Examples of com.sun.faces.config.beans.ResourceBundleBean


                                       digester.getMatch() +
                                       "} Push " + CLASS_NAME);
        }
        Class clazz =
            digester.getClassLoader().loadClass(CLASS_NAME);
        ResourceBundleBean cb = (ResourceBundleBean) clazz.newInstance();
        digester.push(cb);

    }


     * @exception IllegalStateException if the popped object is not
     *  of the correct type
     */
    public void end(String namespace, String name) throws Exception {

        ResourceBundleBean top = null;
        try {
            top = (ResourceBundleBean) digester.pop();
        } catch (Exception e) {
            throw new IllegalStateException("Popped object is not a " +
                                            CLASS_NAME + " instance");
        }
        ApplicationBean fcb = (ApplicationBean) digester.peek();
        if (null != fcb.getResourceBundle(top.getVar())) {
            throw new IllegalStateException("Multiple ResourceBundle definitions " +
                    "with the same name: " + top.getVar() + ".");
        }
        fcb.addResourceBundle(top);

    }

        }
        // iterate over the list of managed beans
        for (Iterator<Map.Entry<String,ResourceBundleBean>> i = rbMap.entrySet().iterator(); i.hasNext(); ) {
            Map.Entry<String,ResourceBundleBean> entry = i.next();
            String var = entry.getKey();
            ResourceBundleBean resourceBundleBean = entry.getValue();
            if ( resourceBundleBean != null) {
                Locale curLocale = Util.getLocaleFromContextOrSystem(facesContext);
                String locale = curLocale.toString();
                DescriptionBean descBean =
                    resourceBundleBean.getDescription(locale);
                DisplayNameBean displayNameBean =
                        resourceBundleBean.getDisplayName(locale);
                String desc = "",
                        displayName = "";
                descBean = (null != descBean) ? descBean :
                    resourceBundleBean.getDescription("");
                if (null != descBean) {
                    // handle the case where the lang or xml:lang attributes
                    // are not specified on the description
                    desc = descBean.getDescription();
                }
                displayNameBean = (null != displayNameBean) ? displayNameBean :
                    resourceBundleBean.getDisplayName("");
                if (null != displayNameBean) {
                    displayName = displayNameBean.getDisplayName();
                }
                list.add(Util.getFeatureDescriptor(var,
                    displayName, desc, false, false, true,

                // If the ViewRoot has no Locale, fall back to the default.
                locale = defaultLocale;
            }
        }
        assert(null != locale);
        ResourceBundleBean bean = resourceBundles.get(var);
        ResourceBundle result = null;

        if (null != bean) {
            String baseName = bean.getBasename();
            if (null != baseName) {
                result =
                    ResourceBundle.getBundle(baseName,
                                             locale,
                                             Thread.currentThread().

                                       digester.getMatch() +
                                       "} Push " + CLASS_NAME);
        }
        Class clazz =
            digester.getClassLoader().loadClass(CLASS_NAME);
        ResourceBundleBean cb = (ResourceBundleBean) clazz.newInstance();
        digester.push(cb);

    }

     * @exception IllegalStateException if the popped object is not
     *  of the correct type
     */
    public void end(String namespace, String name) throws Exception {

        ResourceBundleBean top = null;
        try {
            top = (ResourceBundleBean) digester.pop();
        } catch (Exception e) {
            throw new IllegalStateException("Popped object is not a " +
                                            CLASS_NAME + " instance");
        }
        ApplicationBean fcb = (ApplicationBean) digester.peek();
        if (null != fcb.getResourceBundle(top.getVar())) {
            throw new IllegalStateException("Multiple ResourceBundle definitions " +
                    "with the same name: " + top.getVar() + ".");
        }
        fcb.addResourceBundle(top);

    }

TOP

Related Classes of com.sun.faces.config.beans.ResourceBundleBean

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.