Package java.text

Examples of java.text.MessageFormat


      headerdateformat.setTimeZone(tz);
      rfc850DateFmt.setTimeZone(tz);
      asciiDateFmt.setTimeZone(tz);
      if (serve.isAccessLogged()) {
        // note format string must be not null
        accessFmt = new MessageFormat(
            (String) serve.arguments.get(ARG_ACCESS_LOG_FMT));
        logPlaceholders = new Object[12];
      }
      initSSLAttrs();
      try {
View Full Code Here


    while(keys.hasNext()){
      String header = (String)keys.next();
      String value = getHeader(req,header);
      if(value!=null){
        String pattern = (String)header_map.get(header);
        MessageFormat mf = new MessageFormat(pattern);
        try{
          Object[] vs = mf.parse(value);
          mobile = (String)vs[0];
          if(mobile.startsWith("86"))
            mobile = mobile.substring(2);
          break;
        }catch(Exception e){
View Full Code Here

public class MessageFormatTest extends TestCase
{
  public static void testMessageFormt()
  {
    MessageFormat format = new MessageFormat("{1} {0,number,integer}"); //$NON-NLS-1$
    System.out.println(format.format(new Object[]{new Integer (1), new Integer (1)}));

    Format[] fmt = format.getFormatsByArgumentIndex();

    for (int i = 0; i < fmt.length; i++)
    {
      Format format1 = fmt[i];
      System.out.println(format1);

    }

    format.setFormat(1, null);
    System.out.println(format.format(new Object[]{"-", "a"}));//$NON-NLS-1$ //$NON-NLS-2$
    assertTrue(true);
  }
View Full Code Here

  {
    try
    {
      final String parameter = computeParameter(formulaContext, entries);
      final String pattern = computePattern(configIndicator);
      final MessageFormat messageFormat = new MessageFormat(pattern, formulaContext.getLocalizationContext().getLocale());
      return messageFormat.format(new Object[]{reportPath, parameter});
    }
    catch (UnsupportedEncodingException e)
    {
      throw EvaluationException.getInstance(LibFormulaErrorValue.ERROR_UNEXPECTED_VALUE);
    }
View Full Code Here

  {
    final JPanel contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new GridBagLayout());

    pageMessageFormatter = new MessageFormat(messages.getString("progress-dialog.page-label")); //$NON-NLS-1$
    rowsMessageFormatter = new MessageFormat(messages.getString("progress-dialog.rows-label")); //$NON-NLS-1$
    passMessageFormatter = new MessageFormat(messages.getString("progress-dialog.pass-label-0")); //$NON-NLS-1$

    messageCarrier = new JLabel(" "); //$NON-NLS-1$
    passCountMessage = new JLabel(" "); //$NON-NLS-1$
    rowCountMessage = new JLabel(" "); //$NON-NLS-1$
    pageCountMessage = new JLabel(" "); //$NON-NLS-1$
View Full Code Here

  /**
   * Creates a new ConfigEditorPanel.
   */
  public ConfigEditorPanel()
  {
    moduleNameFormat = new MessageFormat("{0} - Version {1}.{2}-{3}"); //$NON-NLS-1$

    moduleNameField = new JTextArea();
    moduleNameField.setName("ModuleNameField"); //$NON-NLS-1$
    moduleNameField.setMinimumSize(new Dimension(100, 10));
    moduleNameField.setEditable(false);
View Full Code Here

     * @param pattern the message pattern
     * @param arguments the message arguments
     * @return the formatted string
     */
    public String message(String pattern, Object[] arguments) {
        MessageFormat format = new MessageFormat(pattern, getLocale());
        return format.format(arguments, new StringBuffer(), null).toString();
    }
View Full Code Here

    //             so the "{0}" in "AB '{0}' CD" will not be replaced.
    //             In order to avoid this we quote every ' with '', so
    //             everthing will be replaced as expected.
    msg = RegainToolkit.replace(msg, "'", "''");
   
    MessageFormat format = new MessageFormat(msg, mBundle.getLocale());
    return format.format(args);   
  }
View Full Code Here

      }
      else {
         args[0] = dat;
         StringBuffer text = new StringBuffer();
         if (formatter == null) {
            formatter = new MessageFormat(format);
         }
         formatter.format(args, text, null);
         sb.append(text);
      }
      sb.append(" ");
View Full Code Here

                    BUNDLE_NAME,
                    context.getViewRoot().getLocale());
            resourceString = bundle.getString(key);
            if (arguments != null)
            {
                final MessageFormat format = new MessageFormat(resourceString,
                        context.getViewRoot().getLocale());
                resourceString = format.format(arguments);
            }
        }
        catch (final MissingResourceException exception)
        {
            resourceString = key;
View Full Code Here

TOP

Related Classes of java.text.MessageFormat

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.