Package java.util

Examples of java.util.ResourceBundle$LoaderReference


  public void initialize(final SubSystem subSystem) throws ModuleInitializeException
  {
    if (subSystem.getExtendedConfig().getBoolProperty(
        "org.pentaho.reporting.engine.classic.core.modules.gui.base.SwingDialogTranslation")) //$NON-NLS-1$
    {
      final ResourceBundle resources = ResourceBundle.getBundle(SwingCommonModule.BUNDLE_NAME);
      final UIDefaults defaults = UIManager.getDefaults();
      final Enumeration en = resources.getKeys();
      while (en.hasMoreElements())
      {
        try
        {
          final String keyName = (String) en.nextElement();
          defaults.put(keyName, resources.getObject(keyName));
        }
        catch (Exception e)
        {
          // Ignored; if it happens, we would not care that much ..
        }
View Full Code Here


  public void propertyChange(final PropertyChangeEvent evt)
  {
    try
    {
      final Locale locale = target.getLocale();
      final ResourceBundle bundle =
          ResourceBundle.getBundle(resourceBundleName, locale);
      final String string = bundle.getString(resourceKey);
      target.setText(string);
    }
    catch (IllegalComponentStateException ice)
    {
      target.setText(messages.getString("USER_NO_PARENT_ERROR", resourceKey)); //$NON-NLS-1$
View Full Code Here

        return null;
      }

      final ResourceBundleFactory resourceBundleFactory =
          runtime.getResourceBundleFactory();
      final ResourceBundle bundle =
          resourceBundleFactory.getResourceBundle(resourceId);
      if (bundle != null)
      {
        return bundle.getObject(svalue);
      }
    }
    catch (Exception e)
    {
      // on errors return null.
View Full Code Here

    try
    {
      final ResourceBundleFactory resourceBundleFactory =
          runtime.getResourceBundleFactory();
      final ResourceBundle bundle =
          resourceBundleFactory.getResourceBundle(resourceId);

      // update the format string, if neccessary ...
      if (ObjectUtilities.equal(formatKey, appliedFormatKey) == false)
      {
        final String newFormatString = bundle.getString(formatKey);
        messageFormatSupport.setFormatString(newFormatString);
        appliedFormatKey = formatKey;
      }

      messageFormatSupport.setLocale(resourceBundleFactory.getLocale());
View Full Code Here

   * @return the formatted message.
   */
  public Object getValue()
  {
    final ResourceBundleFactory resourceBundleFactory = getResourceBundleFactory();
    final ResourceBundle bundle;
    if (resourceIdentifier == null)
    {
      bundle = ExpressionUtilities.getDefaultResourceBundle(this);
    }
    else
    {
      bundle = resourceBundleFactory.getResourceBundle(resourceIdentifier);
    }

    final String newFormatString = bundle.getString(formatKey);
    messageFormatSupport.setFormatString(newFormatString);
    messageFormatSupport.setLocale(resourceBundleFactory.getLocale());
    return messageFormatSupport.performFormat(getDataRow());
  }
View Full Code Here

    }

    try
    {
      final ResourceBundleFactory resourceBundleFactory = runtime.getResourceBundleFactory();
      final ResourceBundle bundle = resourceBundleFactory.getResourceBundle(resourceId);
      if (bundle != null)
      {
        return bundle.getString(resourceKey);
      }
    }
    catch (Exception e)
    {
      // on errors return null.
View Full Code Here

    {
      return null;
    }

    final ResourceBundleFactory resourceBundleFactory = getResourceBundleFactory();
    final ResourceBundle bundle;
    if (resourceIdentifier == null)
    {
      bundle = ExpressionUtilities.getDefaultResourceBundle(this);
    }
    else
    {
      bundle = resourceBundleFactory.getResourceBundle(resourceIdentifier);
    }
    return bundle.getObject(String.valueOf(key));
  }
View Full Code Here

    }

    try
    {
      final ResourceBundleFactory resourceBundleFactory = runtime.getResourceBundleFactory();
      final ResourceBundle bundle = resourceBundleFactory.getResourceBundle(resourceId);
      if (bundle != null)
      {
        return bundle.getString(resourceKey);
      }
    }
    catch (Exception e)
    {
      // on errors return null.
View Full Code Here

     *
     * @return null if the data can't be found -- defaulting happens
     *         above here.
     */
    protected String getInternal(Class requestor, String field, int type) {
        ResourceBundle bundle = null;
        Package pckg = requestor.getPackage();

        String bString = (pckg == null ? ""
                : (requestor.getPackage().getName() + "."))
                + ResourceFileNamePrefix;

        try {
            bundle = ResourceBundle.getBundle(bString, loc);
        } catch (MissingResourceException e) {
            Debug.message(DEBUG, "Could not locate resource: "
                    + bString.replace('.', '/') + ".properties");
            return null;
        }

        String key = shortClassName(requestor) + "." + field;
        switch (type) {
        case TEXT:
            // Do nothing.
            break;
        case TITLE:
            key += ".title";
            break;
        case TOOLTIP:
            key += ".tooltip";
            break;
        case MNEMONIC:
            key += ".mnemonic";
            break;
        }

        try {

            return bundle.getString(key);

        } catch (MissingResourceException e) {

            Debug.message(DEBUG, "Could not locate string in resource: "
                    + (pckg == null ? "" : (requestor.getPackage().getName().replace('.', '/') + "."))
View Full Code Here

     * @return null if the data can't be found -- defaulting happens
     *         above here.
     */
    protected void setForBundleCreation(Class requestor, String field,
                                        int type, String defaultString) {
        ResourceBundle bundle = null;

        Package pckg = requestor.getPackage();

        String bString = (pckg == null ? ""
                : (requestor.getPackage().getName() + "."))
                + ResourceFileNamePrefix;
       
        String propertyFileNameKey = null;
        Properties propertyFileProperties = null;

        // OK, first see what the property file should be.
        StringBuffer sbuf = new StringBuffer(bString.replace('.', '/'));
        // Scope the desired resource bundle property file if the
        // default isn't wanted.
        if (!Debug.debugging(DEBUG_CREATE_DEFAULT)) {
            sbuf.append("_" + loc.toString());
        }
        sbuf.append(".properties");
        propertyFileNameKey = sbuf.toString().intern();

        // See if we already have a properties file with the key-value
        // pairs for this particular resource bundle.
        propertyFileProperties = (Properties) getCreateHash().get(propertyFileNameKey);

        // If not, create it.
        if (propertyFileProperties == null) {
            propertyFileProperties = new Properties();
            getCreateHash().put(propertyFileNameKey, propertyFileProperties);
        }

        try {
            bundle = ResourceBundle.getBundle(bString, loc);
        } catch (MissingResourceException e) {
        }

        String resourceKey = shortClassName(requestor) + "." + field;
        switch (type) {
        case TEXT:
            // Do nothing.
            break;
        case TITLE:
            resourceKey += ".title";
            break;
        case TOOLTIP:
            resourceKey += ".tooltip";
            break;
        case MNEMONIC:
            resourceKey += ".mnemonic";
            break;
        }

        try {
            if (bundle != null) {
                String resourceValue = bundle.getString(resourceKey);
                propertyFileProperties.put(resourceKey, resourceValue);
            } else {
                propertyFileProperties.put(resourceKey, defaultString);
            }
        } catch (MissingResourceException e) {
View Full Code Here

TOP

Related Classes of java.util.ResourceBundle$LoaderReference

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.