/** * Create the number based on the number of digits set.<p> * * @see org.apache.commons.collections.Factory#create() */ public Object create() { // formats the number with the amount of digits selected return m_numberFormat.sprintf(m_number); }
/** * @see java.util.Iterator#next() */ public String next() { String result = m_baseName; if (m_counter > 0) { String numberSuffix = "-" + I_CmsFileNameGenerator.NUMBER_FORMAT.sprintf(m_counter); if (m_prefix == null) { result = m_baseName + numberSuffix; } else { result = m_prefix + numberSuffix + m_suffix; } } m_counter += 1; return result; }
/** * Applies white space padding to the right of the given String.<p> * * @param input the input to pad right * @param size the size of the padding * * @return the input padded to the right */ public static String padRight(String input, int size) { return (new PrintfFormat("%-" + size + "s")).sprintf(input); }
@Override public Object create() { if (explorerMode) { if (m_number == 1) { return ""; } else { return "_" + m_numberFormat.sprintf(m_number - 1); } } else { return super.create(); } }
/** * Applies white space padding to the left of the given String.<p> * * @param input the input to pad left * @param size the size of the padding * * @return the input padded to the left */ public static String padLeft(String input, int size) { return (new PrintfFormat("%" + size + "s")).sprintf(input); }
/** * Applies white space padding to the left of the given String.<p> * * @param input the input to pad left * @param size the size of the padding * * @return the input padded to the left */ public static String padLeft(String input, int size) { return (new PrintfFormat("%" + size + "s")).sprintf(input); }
/** * Applies white space padding to the right of the given String.<p> * * @param input the input to pad right * @param size the size of the padding * * @return the input padded to the right */ public static String padRight(String input, int size) { return (new PrintfFormat("%-" + size + "s")).sprintf(input); }
/** * Adds a numeric suffix to the end of a string, unless the number passed as a parameter is 0.<p> * * @param name the base name * @param number the number from which to form the suffix * * @return the concatenation of the base name and possibly the numeric suffix */ protected String getNumberedName(String name, int number) { if (number == 0) { return name; } PrintfFormat fmt = new PrintfFormat("%0.6d"); return name + "_" + fmt.sprintf(number); }
number = NUMBER_FORMAT.sprintf(++j); resolver.addMacro(MACRO_NUMBER, number);
String imageNumber = numberFormat.sprintf(count); newName += imageNumber + suffix;
String imageNumber = numberFormat.sprintf(count); newName += imageNumber + suffix;