Examples of MessageFormat


Examples of java.text.MessageFormat

  /**
   *
   */
  private MessageFormat getMessageFormat(String pattern)
  {
    MessageFormat messageFormat = new MessageFormat("");
    messageFormat.setLocale((Locale)locale.getValue());
    messageFormat.applyPattern(pattern);
    return messageFormat;
  }
View Full Code Here

Examples of java.text.MessageFormat

        getChart().getPropertiesMap().getProperty(DefaultChartTheme.PROPERTY_DIAL_LABEL) : null;
   
    if(label != null)
    {
      if(dialUnitScale < 0)
        label = new MessageFormat(label).format(new Object[]{String.valueOf(Math.pow(10, dialUnitScale))});
      else if(dialUnitScale < 3)
        label = new MessageFormat(label).format(new Object[]{"1"});
      else
        label = new MessageFormat(label).format(new Object[]{String.valueOf((int)Math.pow(10, dialUnitScale-2))});
   
    }
   
    // Set the units - this is just a string that will be shown next to the
    // value
View Full Code Here

Examples of java.text.MessageFormat

    if(label != null)
    {
      JRFont displayFont = jrPlot.getValueDisplay().getFont();
      Font themeDisplayFont = getFont((JRFont)getDefaultValue(defaultPlotPropertiesMap, ChartThemesConstants.PLOT_DISPLAY_FONT), displayFont, defaultBaseFontSize);
      if(dialUnitScale < 0)
        label = new MessageFormat(label).format(new Object[]{String.valueOf(Math.pow(10, dialUnitScale))});
      else if(dialUnitScale < 3)
        label = new MessageFormat(label).format(new Object[]{"1"});
      else
        label = new MessageFormat(label).format(new Object[]{String.valueOf((int)Math.pow(10, dialUnitScale-2))});
   
      String[] textLines = label.split("\\n");
      for(int i = 0; i < textLines.length; i++)
      {
        DialTextAnnotation dialAnnotation = new DialTextAnnotation(textLines[i]);
View Full Code Here

Examples of java.text.MessageFormat

        {
            if(formats == null)
                formats = new Hashtable();
        }

        MessageFormat format = null;
        // Check to see if we already have a requested MessageFormat cached
        // and construct it if we don't
        // NOTE: this block statement should be synchronized. However
        // concurrent creation of two formats will have no harmful
        // consequences, and we avoid a performance hit.
        /* synchronized(formats) */
        {
            format = (MessageFormat)formats.get(key);
            if(format == null)
            {
                format = new MessageFormat(((ResourceBundle)object).getString(key));
                format.setLocale(getBundle().getLocale());
                formats.put(key, format);
            }
        }

        // Perform the formatting. We synchronize on it in case it
        // contains date formatting, which is not thread-safe.
        synchronized(format)
        {
            return format.format(params);
        }
    }
View Full Code Here

Examples of java.text.MessageFormat

            if (code == null)
            {
                return null;
            }

            final MessageFormat msg = findMessage(code);
            return msg.format(params);
        }
        catch (final MissingResourceException mre)
        {
            return "Unknown message with code \"" + code + "\".";
        }
View Full Code Here

Examples of java.text.MessageFormat

     */
    private static synchronized MessageFormat findMessage(final String code)
        throws MissingResourceException
    {
        // Check if the message is cached
        MessageFormat msg = (MessageFormat) messages.get(code);
        if (msg != null)
        {
            return msg;
        }

        // Locate the message
        if (resources == null)
        {
            resources = ResourceBundle.getBundle("org.apache.commons.vfs.Resources");
        }
        final String msgText = resources.getString(code);
        msg = new MessageFormat(msgText);
        messages.put(code, msg);
        return msg;
    }
View Full Code Here

Examples of java.text.MessageFormat

         rfc850DateFmt.setTimeZone(tz);
         asciiDateFmt.setTimeZone(tz);
         if (serve.isAccessLogged())
         {
            // not format string must be not tull
            accessFmt = new MessageFormat((String) serve.arguments.get(ARG_ACCESS_LOG_FMT));
            logPlaceholders = new Object[12];
         }
         serve.threadPool.executeThread(this);
         synchronized(serve.connections)
         {
View Full Code Here

Examples of java.text.MessageFormat

                }
            }

            if (msgArgs != null)
            {
                MessageFormat formatter=(MessageFormat) msgFormats.get(stringForKey);
                if (formatter == null)
                {
                    formatter = new MessageFormat(stringForKey);
                    msgFormats.put(stringForKey,formatter);
                }
                return formatter.format(msgArgs);
            }
            else
            {
                return stringForKey;
            }
View Full Code Here

Examples of java.text.MessageFormat

  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++) {
    retval += ' ';
    retval += parameters [i];
      }
      return retval;
  }
  format.setLocale (locale);

  // return the formatted message
  StringBuffer  result = new StringBuffer ();

  result = format.format (parameters, result, new FieldPosition (0));
  return result.toString ();
    }
View Full Code Here

Examples of java.text.MessageFormat

    }
    else {
      pattern = getDefaultBundle().getString(key);
    }
    if (objects != null) {
      MessageFormat formatter = new MessageFormat("");
      formatter.setLocale(ctx.getLocale());
      formatter.applyPattern(pattern);
      pattern = formatter.format(objects);
    }
    return pattern;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.