Package java.text

Examples of java.text.MessageFormat.format()


        // If a MessageFormat exists, we use it to format the property
        if (StringUtils.isNotBlank(format) && propertyValue != null) {

          MessageFormat messageFormat = new MessageFormat(format);
          return messageFormat.format(new Object[] { propertyValue });
        } else if (StringUtils.isBlank(format) && propertyValue != null) {
          return propertyValue.toString();
        } else {
          if (StringUtils.isNotBlank(defaultValue)) {
            return defaultValue.trim();
View Full Code Here


                  Object tmpObject = PropertyUtils.getNestedProperty(o, columnElement
                      .getPropertyName().trim());

                  if (StringUtils.isNotBlank(columnElement.getPattern())) {
                    MessageFormat messageFormat = new MessageFormat(columnElement.getPattern());
                    content += messageFormat.format(new Object[] { tmpObject });
                  } else {
                    content += String.valueOf(tmpObject);
                  }
                } catch (Exception e) {
                  logger.warn("Something went wrong with the property {}. Check that an accessor method for this property exists in the bean.");
View Full Code Here

    public static String formatMsg(String key, Object[] args) {
        MessageFormat mf = new MessageFormat(getString(key));
        mf.setLocale(Locale.getDefault());

        return mf.format(args);
    }
}
View Full Code Here

        TIFFField field = dir.getField(tagID);
        if (field == null) {
            MessageFormat mf =
                new MessageFormat(JaiI18N.getString("TIFFImage5"));
            mf.setLocale(Locale.getDefault());
            throw new RuntimeException(mf.format(new Object[] {tagName}));
        } else {
      return field;
        }
    }
View Full Code Here

            public final MessageFormat NOT_ROTATE = new MessageFormat("Storage size for index <{0}> is {1} bytes, below the maximum of {2} bytes. Not doing anything.");

            @Override
            public String getDescription() {
                MessageFormat format = shouldRotate() ? ROTATE : NOT_ROTATE;
                return format.format(new Object[] {
                        index,
                        sizeInBytes,
                        maxSize
                });
            }
View Full Code Here

        }

        @Override
        public String getDescription() {
            final MessageFormat format = (shouldRotate ? ROTATE_FORMAT : NOT_ROTATE_FORMAT);
            return format.format(new Object[]{index, actualCount, maxDocs});
        }

        @Override
        public boolean shouldRotate() {
            return shouldRotate;
View Full Code Here

        final IContext context = arguments.getContext();
        final Locale locale = context.getLocale();
        final ResourceBundle resourceBundle = resourceBundleProvider.getResourceBundle(locale);
        final String string = resourceBundle.getString(key);
        final MessageFormat messageFormat = new MessageFormat(string, locale);
        final String message = messageFormat.format((messageParameters != null ? messageParameters : EMPTY_MESSAGE_PARAMETERS));
        return new MessageResolution(message);
    }

    @Override
    public void initialize() {
View Full Code Here

     
        MessageFormat formatter = new MessageFormat("");     
        formatter.setLocale(Utilities.currentLocale);

        formatter.applyPattern(str);
        return formatter.format(messageArguments);
    }
   
    public static String retourLigne()
    {
        return "\r\n";
View Full Code Here

        for (int i = 0; i < len; i++) {
            final Localizable pat = msgPatterns.get(i);
            final Object[] args = msgArguments.get(i);
            final MessageFormat fmt = new MessageFormat(pat.getLocalizedString(locale),
                                                        locale);
            sb.append(fmt.format(args));
            if (++count < len) {
                // Add a separator if there are other messages.
                sb.append(separator);
            }
        }
View Full Code Here

      public void actionPerformed( ActionEvent e )
      {
        final float    value    = docFrame.getMaxMeterHold();
        final boolean  valueClip  = value > -0.2f;
        peakArgs[0] = new Float( value );
        lbPeak.setText( frmtPeak.format( peakArgs ));
        if( valueClip && !clipped ) {
          clipped = valueClip;
          lbPeak.setForeground( Color.red );
        }
      }
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.