Package java.util

Examples of java.util.ResourceBundle$CacheKeyReference


  // similarly, cope with unsupported locale...
  if (locale == null)
      locale = Locale.getDefault ();

  // get the appropriately localized MessageFormat object
  ResourceBundle  bundle;
  MessageFormat  format;

  try {
      bundle = ResourceBundle.getBundle (bundleName, locale);
      format = new MessageFormat (bundle.getString (messageId));
  } catch (MissingResourceException e) {
      String retval;

      retval = packagePrefix (messageId);
      for (int i = 0; i < parameters.length; i++) {
View Full Code Here


           @Override
           protected void renderResponse() throws Exception
           {
               assert "foo".equals(getValue("#{themeSelector.theme}"));
               Map<String, String> theme = Theme.instance();
               ResourceBundle themeResources = ThemeSelector.instance().getThemeResourceBundle();
               assert !themeResources.getKeys().hasMoreElements();
               assert theme.entrySet().size() == 0;
               boolean exception = false;
               try
               {
                   themeResources.getObject("bar");
               }
               catch (MissingResourceException e)
               {
                  exception = true;
               }
View Full Code Here

    this.controller = controller;
    this.defaultFont = defaultFont;
    this.headerFooterFont = defaultFont.deriveFont(11f);
   
    try {
      ResourceBundle resource = ResourceBundle.getBundle(HomePrintableComponent.class.getName());
      this.fixedHeaderLabel = getFixedHeaderOrFooterLabel(resource, "fixedHeader");
      this.fixedFooterLabel = getFixedHeaderOrFooterLabel(resource, "fixedFooter");
    } catch (MissingResourceException ex) {
      // No resource bundle
    }
View Full Code Here

  public static String getMessageResourceString(String bundleName, String key, Object params[], Locale locale)
  {

    String text = null;

    ResourceBundle bundle = ResourceBundle.getBundle(bundleName, locale, getCurrentClassLoader(params));

    try
    {
      text = bundle.getString(key);
    }
    catch (MissingResourceException e)
    {
      text = "?? key " + key + " not found ??";
    }
View Full Code Here

  private void initSystemProperties() {
    if (OperatingSystem.isMacOSX()) {
      // Change Mac OS X application menu name
      String classPackage = SweetHome3D.class.getName();
      classPackage = classPackage.substring(0, classPackage.lastIndexOf("."));
      ResourceBundle resource = ResourceBundle.getBundle(classPackage + "." + "package");
      String applicationName = resource.getString("SweetHome3D.applicationName");
      System.setProperty("com.apple.mrj.application.apple.menu.about.name", applicationName);
      // Use Mac OS X screen menu bar for frames menu bar
      System.setProperty("apple.laf.useScreenMenuBar", "true");
      // Force the use of Quartz under Mac OS X for better Java 2D rendering
      // performance
View Full Code Here

  /**
   * Updates a Swing resource bundle in use from the current Locale.
   */
  private static void updateSwingResourceBundle(String swingResource) {
    ResourceBundle resource;
    try {
      resource = ResourceBundle.getBundle(swingResource);
    } catch (MissingResourceException ex) {
      resource = ResourceBundle.getBundle(swingResource, Locale.ENGLISH);
    }
    // Update UIManager properties
    for (Enumeration<?> it = resource.getKeys(); it.hasMoreElements(); ) {
      String property = (String)it.nextElement();
      UIManager.put(property, resource.getString(property));
    }
  }
View Full Code Here

   * @exception IllegalArgumentException if no string for the given key can be found
   */
  public String getLocalizedString(Class<?> resourceClass,
                                   String   resourceKey,
                                   Object ... resourceParameters) {
    ResourceBundle classResourceBundle = this.classResourceBundles.get(resourceClass);
    if (classResourceBundle == null) {
      try {     
        classResourceBundle = getResourceBundle(resourceClass.getName());
        this.classResourceBundles.put(resourceClass, classResourceBundle);
      } catch (IOException ex) {
View Full Code Here

   */
  public String getLocalizedString(String resourceFamily,
                                   String resourceKey,
                                   Object ... resourceParameters) {
    try {     
      ResourceBundle resourceBundle = getResourceBundle(resourceFamily);
      return getLocalizedString(resourceBundle, resourceKey, resourceParameters);
    } catch (IOException ex) {
      throw new IllegalArgumentException(
          "Can't find resource bundle for " + resourceFamily, ex);
    }
View Full Code Here

   * only among .properties files.
   * @throws IOException if no .properties file was found
   */
  private ResourceBundle getResourceBundle(String resourceFamily) throws IOException {
    resourceFamily = resourceFamily.replace('.', '/');
    ResourceBundle resourceBundle = this.resourceBundles.get(resourceFamily);
    if (resourceBundle != null) {
      return resourceBundle;
    }
    Locale defaultLocale = Locale.getDefault();
    String language = defaultLocale.getLanguage();
    String country = defaultLocale.getCountry();
    String [] suffixes = {".properties",
                          "_" + language + ".properties",
                          "_" + language + "_" + country + ".properties"};
    for (String suffix : suffixes) {
      for (ClassLoader classLoader : getResourceClassLoaders()) {
        InputStream in = classLoader.getResourceAsStream(resourceFamily + suffix);
        if (in != null) {
          final ResourceBundle parentResourceBundle = resourceBundle;
          try {
            resourceBundle = new PropertyResourceBundle(in) {
              {
                setParent(parentResourceBundle);
              }
View Full Code Here

        if (colorChooser == null
            || !Locale.getDefault().equals(colorChooserLocale)) {
          try {
            // Read Swing localized properties because Swing doesn't update its internal strings automatically
            // when default Locale is updated (see bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4884480)
            ResourceBundle resource =
                ResourceBundle.getBundle("com.sun.swing.internal.plaf.basic.resources.basic");
            // Update UIManager properties
            for (Enumeration iter = resource.getKeys(); iter.hasMoreElements(); ) {
              String property = (String)iter.nextElement();
              UIManager.put(property, resource.getString(property));
            }     
          } catch (MissingResourceException ex) {
            // Let labels unchanged
          }
         
View Full Code Here

TOP

Related Classes of java.util.ResourceBundle$CacheKeyReference

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.