label.suffix_template = Suffix template (use %n to represent the backup/version index)
label.suffix_template_tooltip = %n in the template will be replaced by the index number. The suffix will appear before the filename extension.
label.index_digits = Number of digits to use for the index
-default.suffix_index_digits_min = 1
-default.suffix_index_digits_max = 6
label.example_filenames = Example filenames
label.suffix_example_filenames = Some example filenames using these settings:
label.increment_index = Increment suffix indexes (like version files) - newest file has largest index.
label.suffix_template = Plantilla de sufijo (usa %n para representar el índice)
label.suffix_template_tooltip = Esto será reemplazado por el número de índice. El sufijo aparecerá antes de la extensión.
label.index_digits = Número de dígitos a utilizar para el índice.
-default.suffix_index_digits_min = 1
-default.suffix_index_digits_max = 6
label.example_filenames = Ejemplos de nombres de archivos
label.suffix_example_filenames = Algunos nombres de archivos de ejemplo usando estas configuraciones:
label.increment_index = El archivo más nuevo tiene el índice más grande
enableBackupFiles
.setSelected(Cache.getDefault(BackupFiles.ENABLED, true));
suffixTemplate.setText(Cache.getDefault(BackupFiles.SUFFIX,
- "-v" + BackupFiles.getNumPlaceHolder()));
+ "-v" + BackupFiles.NUM_PLACEHOLDER));
suffixDigitsSpinner
.setValue(Cache.getDefault(BackupFiles.SUFFIX_DIGITS, 3));
suffixReverse.setSelected(
}
-class BackupFilenameParts
-{
- String base;
-
- String templateStart;
-
- int num;
-
- int digits;
-
- String templateEnd;
-
- String extension;
-
- boolean isBackupFile;
-
- public BackupFilenameParts(File file, String base, String template, int digits,
- String extension)
- {
- this(file.getName(), base, template, digits, extension);
- }
-
- public BackupFilenameParts(String filename, String base, String template,
- int digits, String extension)
- {
- this.isBackupFile = false;
-
- // calculate minimum length of a backup filename
- int minlength = base.length() + template.length()
- - BackupFiles.NUM_PLACEHOLDER.length() + digits
- + extension.length();
-
- if (!(filename.startsWith(base) && filename.endsWith(extension)
- && filename.length() >= minlength))
- {
- // non-starter
- return;
- }
-
- int numcharstart = template.indexOf(BackupFiles.NUM_PLACEHOLDER);
- String templateStart = template;
- String templateEnd = "";
- if (numcharstart > -1)
- {
- templateStart = template.substring(0, numcharstart);
- templateEnd = template.substring(
- numcharstart + BackupFiles.NUM_PLACEHOLDER.length());
- }
-
- int startLength = base.length() + templateStart.length();
- int endLength = templateEnd.length() + extension.length();
- String numString = filename.substring(startLength,
- filename.length() - endLength);
-
- if (filename.length() >= startLength + digits + endLength
- && filename.startsWith(base + templateStart)
- && filename.endsWith(templateEnd + extension)
- && numString.matches("[0-9]+"))
- {
- this.base = base;
- this.templateStart = templateStart;
- this.num = Integer.parseInt(numString);
- this.digits = digits;
- this.templateStart = templateStart;
- this.templateEnd = templateEnd;
- this.isBackupFile = true;
- }
-
- }
-
- public boolean isBackupFile()
- {
- return this.isBackupFile;
- }
-
- public int indexNum()
- {
- return this.num;
- }
-}
\ No newline at end of file
public static String SUFFIX_DIGITS = NS + "_SUFFIX_DIGITS";
- protected static String NUM_PLACEHOLDER = "%n";
+ public static final String NUM_PLACEHOLDER = "%n";
public static String REVERSE_ORDER = NS + "_REVERSE_ORDER";
return path;
}
- public static String getNumPlaceHolder()
- {
- return NUM_PLACEHOLDER;
- }
-
public boolean setWriteSuccess(boolean flag)
{
boolean old = this.tempFileWriteSuccess;
suffixDigitsLabel.setHorizontalAlignment(SwingConstants.LEFT);
suffixDigitsLabel.setFont(LABEL_FONT);
int defaultmin = 1;
- try
- {
- defaultmin = Integer.parseInt(
- MessageManager.getString("default.suffix_index_digits_min"));
- } catch (Exception e)
- {
- defaultmin = 1;
- System.out.println(
- "Exception setting suffix digits min from default.suffix_index_digits_min label, setting to "
- + defaultmin);
- }
int defaultmax = 6;
- try {
- defaultmax = Integer.parseInt(
- MessageManager.getString("default.suffix_index_digits_max"));
- } catch (Exception e) {
- defaultmax = 6;
- System.out.println(
- "Exception setting suffix digits max from default.suffix_index_digits_max label, setting to "
- + defaultmax);
- }
ChangeListener c = new ChangeListener()
{
@Override
import java.util.List;
import java.util.TreeMap;
-import org.junit.Assert;
+import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;