Package org.apache.jetspeed.om.portlet

Examples of org.apache.jetspeed.om.portlet.Language


        Preferences prefs = portlet.getPortletPreferences();
        Preference pref = prefs.addPreference("preference 1");
        pref.addValue("value 1");
        pref.addValue("value 2");
       
        Language language = portlet.addLanguage(Locale.getDefault());
        language.setTitle("Portlet 1");
        language.setShortTitle("Portlet 1");
       
        Supports supports = portlet.addSupports("html/text");
        supports.addPortletMode("EDIT");
        supports.addPortletMode("VIEW");
        supports.addPortletMode("HELP");
View Full Code Here


        return descriptorPreferences.addPreference(name);
    }      
   
    public Language getLanguage(Locale locale)
    {
        Language lang = null;
        Language fallback = null;
        Language defaultLanguage = null;
        boolean defaultLocale = locale.equals(JetspeedLocale.getDefaultLocale());
       
        for (Language l : getLanguages())
        {
            if (locale.equals(l.getLocale()))
View Full Code Here

            }
        }
       
        for (Language language : source.getLanguages())
        {
            Language copyLanguage = copy.addLanguage(language.getLocale());
            copyLanguage.setTitle(language.getTitle());
            copyLanguage.setShortTitle(language.getShortTitle());
            copyLanguage.setKeywords(language.getKeywords());
            copyLanguage.setSupportedLocale(language.isSupportedLocale());
        }
       
        for (ContainerRuntimeOption runtimeOption : source.getContainerRuntimeOptions())
        {
            ContainerRuntimeOption copyRuntimeOption = copy.addContainerRuntimeOption(runtimeOption.getName());
View Full Code Here

        Preferences prefs = portlet.getPortletPreferences();
        Preference pref = prefs.addPreference("preference 1");
        pref.addValue("value 1");
        pref.addValue("value 2");
       
        Language language = portlet.addLanguage(Locale.getDefault());
        language.setTitle("Portlet 1");
        language.setShortTitle("Portlet 1");
       
        Supports supports = portlet.addSupports("html/text");
        supports.addPortletMode(MODE_EDIT);
        supports.addPortletMode(MODE_VIEW);
        supports.addPortletMode(MODE_HELP);
View Full Code Here

            SecurityRoleRef jsrr = jpd.addSecurityRoleRef(srr.getRoleName());
            jsrr.setRoleLink(srr.getRoleLink());
        }
       
        // First load the required default PortletInfo Language using the English Locale
        Language defaultLanguage = addLanguage(jpd, pd.getPortletInfo(), JetspeedLocale.getDefaultLocale(), false);
        for (String localeString : pd.getSupportedLocales())
        {
            Locale locale = JetspeedLocale.convertStringToLocale(localeString);
            if (locale.equals(JetspeedLocale.getDefaultLocale()))
            {
                defaultLanguage.setSupportedLocale(true);
            }
            else
            {
                addLanguage(jpd, pd.getPortletInfo(), locale, true);
            }
View Full Code Here

        }
    }
   
    protected Language addLanguage(PortletDefinition jpd, PortletInfo info, Locale locale, boolean supportedLocale)
    {               
        Language l = jpd.addLanguage(locale);
        l.setSupportedLocale(supportedLocale);
        l.setTitle(info.getTitle());
        l.setShortTitle(info.getShortTitle());
        l.setKeywords(info.getKeywords());
        if (locale != null && jpd.getResourceBundle() != null)
        {
            try
            {
                ResourceBundle bundle = ResourceBundle.getBundle(jpd.getResourceBundle(), locale, Thread.currentThread().getContextClassLoader());
                String value = bundle.getString(Language.JAVAX_PORTLET_TITLE);
                if (value != null && !value.equals(""))
                {
                    // use the value provided by the resource bundle
                    l.setTitle(value);
                }
                value = bundle.getString(Language.JAVAX_PORTLET_SHORT_TITLE);
                if (value != null && !value.equals(""))
                {
                    // use the value provided by the resource bundle
                    l.setShortTitle(value);
                }
                value = bundle.getString(Language.JAVAX_PORTLET_KEYWORDS);
                if (value != null && !value.equals(""))
                {
                    // user the value provided by the resource bundle
                    l.setKeywords(value);
                }
            }
            catch (MissingResourceException e)
            {
                // ignore
View Full Code Here

                bundleCache = Collections.synchronizedMap(new HashMap<Locale, ResourceBundle>());
            }
            bundle = bundleCache.get(locale);
            if (bundle == null)
            {
                Language l = pd.getLanguage(locale);
                if (pd.getResourceBundle() == null)
                {
                    bundle = new InlinePortletResourceBundle(l.getTitle(), l.getShortTitle(), l.getKeywords());
                }
                else
                {
                    ClassLoader paCl = classLoaderMap.get(paName);
                   
                    if (paCl == null)
                    {
                        throw new UnavailableException("Portlet Application " + paName + " not available");
                    }
                    ResourceBundle loadedBundle = loadResourceBundle(l.getLocale(), pd.getResourceBundle(), paCl);
                    if (loadedBundle != null)
                    {
                        bundle = new InlinePortletResourceBundle(l.getTitle(), l.getShortTitle(), l.getKeywords(), loadedBundle);
                    }
                    else
                    {
                        bundle = new InlinePortletResourceBundle(l.getTitle(), l.getShortTitle(), l.getKeywords());
                    }
                }
                bundleCache.put(locale, bundle);
            }
        }
View Full Code Here

        return descriptorPreferences.addPreference(name);
    }      
   
    public Language getLanguage(Locale locale)
    {
        Language lang = null;
        Language fallback = null;
        Language defaultLanguage = null;
        boolean defaultLocale = locale.equals(JetspeedLocale.getDefaultLocale());
       
        for (Language l : getLanguages())
        {
            if (locale.equals(l.getLocale()))
View Full Code Here

        // if(language != null)
        // {
        //     return language;
        // }
       
        Language language = portlet.getLanguage(locale);
       
        if (language == null)
        {
            Enumeration locales = request.getLocales();
            while (language == null && locales.hasMoreElements())
View Full Code Here

            }
        }

        for (Language language : source.getLanguages())
        {
            Language copyLanguage = copy.addLanguage(language.getLocale());
            copyLanguage.setTitle(language.getTitle());
            copyLanguage.setShortTitle(language.getShortTitle());
            copyLanguage.setKeywords(language.getKeywords());
            copyLanguage.setSupportedLocale(language.isSupportedLocale());
        }

        for (ContainerRuntimeOption runtimeOption : source.getContainerRuntimeOptions())
        {
            ContainerRuntimeOption copyRuntimeOption = copy.addContainerRuntimeOption(runtimeOption.getName());
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.portlet.Language

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.