Package org.gatein.common.i18n

Examples of org.gatein.common.i18n.ResourceBundleManager


      {
         //
         containerPreferences = new ContainerPreferencesInfo(preferencesMD.getPreferenceValidator());

         //
         ResourceBundleManager bundleMgr = context.getBundleManager(portletMD);

         //
         for (PortletPreferenceMetaData portletPreferenceMD : preferencesMD.getPortletPreferences().values())
         {
            List<String> value = portletPreferenceMD.getValue();
            LocalizedString displayName = bundleMgr.getLocalizedValue("javax.portlet.preference.name." + portletPreferenceMD.getName(), portletPreferenceMD.getName());
            LocalizedString description = bundleMgr.getLocalizedValue("javax.portlet.preference.description." + portletPreferenceMD.getName(), portletPreferenceMD.getName());
            containerPreferences.addContainerPreference(portletPreferenceMD.getName(), value, portletPreferenceMD.isReadOnly(), displayName, description);
         }
      }

      //
View Full Code Here


            }
         }
      }

      //
      ResourceBundleManager bundleManager = PortletResourceBundleFactory.createResourceBundleManager(info.getBundleManager(), info);

      // Portlet config object
      PortletConfig config = new PortletConfigImpl(info, application.info, application.portletContext, bundleManager);

      // Finally initialize the porlet instance
View Full Code Here

      // Create factory
      PortletResourceBundleFactory factory = new PortletResourceBundleFactory(bundleMgr, containerInfo);

      // Create manager
      ResourceBundleManager manager = new ResourceBundleManager(EmptyResourceBundle.INSTANCE, factory);

      // Preload declared locales
//      for (Iterator i = metaData.getSupportedLocales().iterator();i.hasNext();)
//      {
//         Locale locale = (Locale)i.next();
View Full Code Here

            }
         }
      }

      //
      ResourceBundleManager bundleManager = PortletResourceBundleFactory.createResourceBundleManager(info.getBundleManager(), info);

      // Portlet config object
      PortletConfig config = new PortletConfigImpl(info, application.info, application.portletContext, bundleManager);

      // Finally initialize the porlet instance
View Full Code Here

   {
      if (applicationBundleMgr == null)
      {
         String baseName = ((PortletApplication20MetaData)metaData).getResourceBundle();
         ResourceBundleFactory rbf = new SimpleResourceBundleFactory(webApp.getClassLoader(), baseName);
         applicationBundleMgr = new ResourceBundleManager(null, rbf);
      }
      return applicationBundleMgr;
   }
View Full Code Here

      return applicationBundleMgr;
   }

   public ResourceBundleManager getBundleManager(PortletMetaData portletMD)
   {
      ResourceBundleManager bundleMgr = portletBundleMgrs.get(portletMD.getPortletName());
      if (bundleMgr == null)
      {
         ResourceBundleFactory rbf = null;
         String rbfName = metaData.getResourceBundleFactoryName();
         if (rbfName != null)
         {
            try
            {
               Class<?> tmpClass = webApp.getClassLoader().loadClass(rbfName);
               if (ResourceBundleFactory.class.isAssignableFrom(tmpClass))
               {
                  Class<? extends ResourceBundleFactory> rbfClass = tmpClass.asSubclass(ResourceBundleFactory.class);
                  Constructor<? extends ResourceBundleFactory> rbfCtor = rbfClass.getConstructor(ClassLoader.class, String.class);
                  rbf = rbfCtor.newInstance(webApp.getClassLoader(), portletMD.getResourceBundle());
               }
            }
            catch (Exception e)
            {
               // Need to log
            }
         }

         //
         if (rbf == null)
         {
            rbf = new SimpleResourceBundleFactory(webApp.getClassLoader(), portletMD.getResourceBundle());
         }

         //
         bundleMgr = new ResourceBundleManager(null, rbf);
         portletBundleMgrs.put(portletMD.getPortletName(), bundleMgr);
      }
      return bundleMgr;
   }
View Full Code Here

               modeInfo = new ContainerModeInfo(mode);
            }
         }
         else
         {
            ResourceBundleManager bundleMgr = context.getBundleManager();

            //
            LocalizedString displayName = bundleMgr.getLocalizedValue(
               "javax.portlet.app.custom-portlet-mode." + mode + ".decoration-name",
               "" + mode);

            //
            if (description != null)
View Full Code Here

   }

   private ContainerParameterInfo build(PublicRenderParameterMetaData parameterMD)
   {
      QName name = getName(parameterMD.getQname(), parameterMD.getName());
      ResourceBundleManager bundleMgr = context.getBundleManager();

      LocalizedString description = bundleMgr.getLocalizedValue(
         "javax.portlet.app.public-render-parameter." + name + ".description",
         getDefaultStringFor(parameterMD.getDescription(), "Description of public render parameter " + name));

      //
      return new ContainerParameterInfo(
View Full Code Here

   }

   private ContainerEventInfo build(EventDefinitionMetaData eventDefinitionMD) throws NoSuchClassException
   {
      QName name = getName(eventDefinitionMD.getQname(), eventDefinitionMD.getName());
      ResourceBundleManager bundleMgr = context.getBundleManager();

      //
      String valueType = eventDefinitionMD.getValueType();
      ContainerTypeInfo type = null;
      if (valueType != null)
      {
         Class clazz = context.getClass(valueType);
         type = new ContainerTypeInfo(clazz);
      }

      //
      LocalizedString displayName = bundleMgr.getLocalizedValue(
         "javax.portlet.app.event-definition." + name + ".display-name",
         "Event " + name);
      LocalizedString description = bundleMgr.getLocalizedValue(
         "javax.portlet.app.event-definition." + name + ".description",
         getDefaultStringFor(eventDefinitionMD.getDescription(), "Description of event " + name));

      //
      return new ContainerEventInfo(name, type, displayName, description, eventDefinitionMD.getAlias());
View Full Code Here

   private ContainerMetaInfo buildContainerMeta(PortletMetaData portletMD)
   {
      ContainerMetaInfo containerMeta = new ContainerMetaInfo();

      //
      ResourceBundleManager bundleMgr = context.getBundleManager(portletMD);

      // Capture inline values
      PortletInfoMetaData portletInfoMD = portletMD.getPortletInfo();
      String[] inlines = null;
      if (portletInfoMD != null)
      {
         // JBoss XB would give null for an empty title, but we know that
         // there must be a title according to the schema
         String title = portletInfoMD.getTitle();
         if (title == null)
         {
            title = "";
         }

         //
         inlines = new String[]{
            title,
            portletInfoMD.getShortTitle(),
            portletInfoMD.getKeywords()
         };
      }

      // Construct info from resource bundle manager
      for (int i = 0; i < KEYS.length; i++)
      {
         String key = KEYS[i];

         //
         Map<Locale, String> tmp = new HashMap<Locale, String>();

         //
         List<Locale> locales = getSupportedLocales(portletMD);

         // Add english locale
         locales.add(Locale.ENGLISH);

         // Feed with the known locales (perhaps should try more locales)
         for (Locale locale : locales)
         {
            ResourceBundle bundle = bundleMgr.getResourceBundle(locale);

            //
            if (bundle != null)
            {
               try
View Full Code Here

TOP

Related Classes of org.gatein.common.i18n.ResourceBundleManager

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.