Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ private void prepareSelectPaginationModeItems() {
"paginierung_spalte.svg"));
selectPaginationModeItems.add(new IllustratedSelectItem(PaginatorMode.FOLIATION, "sheetCounting",
"paginierung_blatt.svg"));
selectPaginationModeItems.add(new IllustratedSelectItem(PaginatorMode.FOLIATION_WITH_EMPTY_PAGE, "sheetCountingWithEmptyPage",
"paginierung_blatt_leerseite.svg"));
selectPaginationModeItems.add(new IllustratedSelectItem(PaginatorMode.RECTOVERSO_FOLIATION, "sheetCountingRectoVerso",
"paginierung_blatt_rectoverso.svg"));
selectPaginationModeItems.add(new IllustratedSelectItem(PaginatorMode.VERSORECTO_FOLIATION, "sheetCountingVersoRecto",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,17 @@ public class AlphabeticNumeral implements Fragment {
*/
private HalfInteger increment;

AlphabeticNumeral(String value) {
/**
* Indicates the pagination context for the numeral.
* A value of {@code true} represents an odd (left) page.
* A value of {@code false} represents an even (right) page.
* A value of {@code null} indicates that the numeral can appear on any page.
*/
private final Boolean page;

AlphabeticNumeral(String value, Boolean page) {
this.value = parseInt(value);
this.page = page;
}

/**
Expand Down Expand Up @@ -65,7 +74,7 @@ public void setIncrement(HalfInteger increment) {

@Override
public String toString() {
return format(value) + (Objects.nonNull(increment) ? " (" + increment + ")" : " (default)");
return format(new HalfInteger(value, false)) + (Objects.nonNull(increment) ? " (" + increment + ")" : " (default)");
}

/**
Expand All @@ -76,16 +85,20 @@ public String toString() {
*/
@Override
public String format(HalfInteger value) {
return format(value.intValue());
return format(value, page);
}

/**
* Returns the value formatted as alphabetic characters.
*
* @param number numeric value to format
* @param value
* numeric value to format
* @param page
* Indicates on which type of page this AlphabeticNumeral should be shown (true = odd pages, false = even pages, null = all pages)
* @return the formatted value
*/
public static String format(int number) {
public static String format(HalfInteger value, Boolean page) {
int number = value.intValue();
StringBuilder result = new StringBuilder();

while (number > 0) {
Expand All @@ -95,8 +108,11 @@ public static String format(int number) {
result.insert(0, letter);
number = number / ALPHABET_SIZE;
}

return result.toString();
if (page == null || page == value.isHalf()) {
return result.toString();
} else {
return "";
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,23 @@ public class DecimalNumeral implements Fragment {
*/
private HalfInteger increment;

/**
* Indicates the pagination context for the numeral.
* A value of {@code true} represents an odd (left) page.
* A value of {@code false} represents an even (right) page.
* A value of {@code null} indicates that the numeral can appear on any page.
*/
private final Boolean page;

/**
* The initial value of this numeral.
*/
private int value;

DecimalNumeral(String value) {
DecimalNumeral(String value, Boolean page) {
this.value = Integer.parseInt(value);
this.digits = "%0" + value.length() + "d";
this.page = page;
}

/**
Expand All @@ -47,7 +56,11 @@ public class DecimalNumeral implements Fragment {
*/
@Override
public String format(HalfInteger value) {
return String.format(digits, value.intValue());
if (page == null || page == value.isHalf()) {
return String.format(digits, value.intValue());
} else {
return "";
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,13 @@ private void parse(String initializer) {
* page information
*/
private void createFragment(StringBuilder stringBuilder, PaginatorState fragmentType, Boolean pageType) {
if (pageType == null && fragmentType.equals(PaginatorState.DECIMAL)) {
fragments.addLast(new DecimalNumeral(stringBuilder.toString()));
} else if (pageType == null && (fragmentType.equals(PaginatorState.UPPERCASE_ROMAN)
|| fragmentType.equals(PaginatorState.LOWERCASE_ROMAN))) {
if (fragmentType.equals(PaginatorState.DECIMAL)) {
fragments.addLast(new DecimalNumeral(stringBuilder.toString(), pageType));
} else if (fragmentType.equals(PaginatorState.UPPERCASE_ROMAN) || fragmentType.equals(PaginatorState.LOWERCASE_ROMAN)) {
fragments.addLast(
new RomanNumeral(stringBuilder.toString(), fragmentType.equals(PaginatorState.UPPERCASE_ROMAN)));
} else if (pageType == null && fragmentType.equals(PaginatorState.ALPHABETIC)) {
fragments.addLast(new AlphabeticNumeral(stringBuilder.toString()));
new RomanNumeral(stringBuilder.toString(), fragmentType.equals(PaginatorState.UPPERCASE_ROMAN), pageType));
} else if (fragmentType.equals(PaginatorState.ALPHABETIC)) {
fragments.addLast(new AlphabeticNumeral(stringBuilder.toString(), pageType));
} else if (fragmentType.equals(PaginatorState.INCREMENT)) {
if (fragments.isEmpty() || Objects.isNull(fragments.peekLast())) {
fragments.addLast(new StaticText("", pageType));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@ String format(String value, String next, boolean fictitious, String separator) {
}
},

/**
* The counter is increased on every second page. The pages are numbered alternating counter and "UNCOUNTED".
* (1, UNCOUNTED, 2, UNCOUNTED, … / [1], [UNCOUNTED], [2], [UNCOUNTED], …)
*/
FOLIATION_WITH_EMPTY_PAGE(8) {
@Override
String format(String value, String next, boolean fictitious, String separator) {
if (fictitious) {
return "[¿UNCOUNTED¡" + value + "½]";
} else {
return "¿UNCOUNTED¡" + value + "½";
}
}
},


/**
* Normal pagination (1, 2, 3, 4, … / [1], [2], [3], [4], …).
*/
Expand Down Expand Up @@ -99,9 +115,9 @@ String format(String value, String next, boolean fictitious, String separator) {
@Override
String format(String value, String next, boolean fictitious, String separator) {
if (fictitious) {
return '[' + value + "°]¡r¿v½";
return '[' + value + "°]¡r¿`v`½";
} else {
return value.concat("°¡r¿v½");
return value.concat("°¡r¿`v`½");
}
}
},
Expand All @@ -114,9 +130,9 @@ String format(String value, String next, boolean fictitious, String separator) {
@Override
String format(String value, String next, boolean fictitious, String separator) {
if (fictitious) {
return "½[" + value + "°]¡r¿v½";
return "½[" + value + "°]¡r¿`v`½";
} else {
return '½' + value + "°¡r¿v½";
return '½' + value + "°¡r¿`v`½";
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,12 @@ public String format(PaginatorMode mode, String valueString, boolean fictitious,
throw b;
}
}
return mode.format('´' + AlphabeticNumeral.format(value) + '´', '´' + AlphabeticNumeral.format(value + 1) + '´', fictitious,
separator);
return mode.format(
'´' + AlphabeticNumeral.format(new HalfInteger(value, false), null) + '´',
'´' + AlphabeticNumeral.format(new HalfInteger(value + 1, false), null) + '´',
fictitious,
separator
);
}
},

Expand Down Expand Up @@ -92,8 +96,12 @@ public String format(PaginatorMode mode, String valueString, boolean fictitious,
throw b;
}
}
return mode.format(RomanNumeral.format(value, true), RomanNumeral.format(value + 1, true), fictitious,
separator);
return mode.format(
RomanNumeral.format(new HalfInteger(value, false), true, null),
RomanNumeral.format(new HalfInteger(value + 1, false), true, null),
fictitious,
separator
);
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ public class RomanNumeral implements Fragment {
* @param inputValue
* value to format
* @param uppercase
* if true, the Roman numeral is upper case, otherwise lower case
* If true, produces upper case roman numerals, else lower case
* @param page
* Indicates on which type of page this RomanNumeral should be shown (true = odd pages, false = even pages, null = all pages)
* @return Roman numeral for the value
*/
public static String format(int inputValue, boolean uppercase) {
int value = inputValue;
public static String format(HalfInteger inputValue, boolean uppercase, Boolean page) {
int value = inputValue.intValue();
StringBuilder result = new StringBuilder();
while (value >= 1000) {
result.append(uppercase ? 'M' : 'm');
Expand All @@ -64,12 +66,22 @@ public static String format(int inputValue, boolean uppercase) {
value %= 100;
result.append(TENS[value / 10]);
result.append(ONES[value % 10]);
return uppercase ? result.toString().toUpperCase() : result.toString();
if (page == null || page == inputValue.isHalf()) {
return uppercase ? result.toString().toUpperCase() : result.toString();
} else {
return "";
}
}

/**
* Returns the Roman numeral for the value as string.
* @param value
* value to format
* @return Roman numeral for the value
*/
@Override
public String format(HalfInteger value) {
return format(value.intValue(), uppercase);
return format(value, uppercase, page);
}

/**
Expand Down Expand Up @@ -127,6 +139,14 @@ private static int updateResult(int result, int threshold, int difference) {
*/
private HalfInteger increment;

/**
* Indicates the pagination context for the numeral.
* A value of {@code true} represents an odd (left) page.
* A value of {@code false} represents an even (right) page.
* A value of {@code null} indicates that the numeral can appear on any page.
*/
private final Boolean page;

/**
* If true, produces upper case roman numerals, else lower case.
*/
Expand All @@ -137,9 +157,10 @@ private static int updateResult(int result, int threshold, int difference) {
*/
private final int value;

RomanNumeral(String value, boolean uppercase) {
RomanNumeral(String value, boolean uppercase, Boolean page) {
this.value = parseInt(value);
this.uppercase = uppercase;
this.page = page;
}

@Override
Expand All @@ -164,6 +185,6 @@ public void setIncrement(HalfInteger increment) {
*/
@Override
public String toString() {
return format(value, uppercase) + (Objects.nonNull(increment) ? " (" + increment + ")" : " (default)");
return format(new HalfInteger(value, false)) + (Objects.nonNull(increment) ? " (" + increment + ")" : " (default)");
}
}
1 change: 1 addition & 0 deletions Kitodo/src/main/resources/messages/messages_de.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ setImportConfigurationForSelectedProcessesText=Bitte wählen Sie die Importkonfi
setRepresentative=Repräsentant setzen\:
settings=Einstellungen
sheetCounting=Blattzählung
sheetCountingWithEmptyPage=Blattzählung mit Leerseite
sheetCountingRectoVerso=Blattzählung recto-verso
sheetCountingVersoRecto=Blattzählung verso-recto
shortcuts=Tastaturkürzel
Expand Down
1 change: 1 addition & 0 deletions Kitodo/src/main/resources/messages/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,7 @@ setImportConfigurationForSelectedProcessesText=Please select the import configur
setRepresentative=Set representative\:
settings=Settings
sheetCounting=Sheet counting
sheetCountingWithEmptyPage=Sheet counting with empty page
sheetCountingRectoVerso=RectoVerso Pagination
sheetCountingVersoRecto=VersoRecto Pagination
shortcuts=Keyboard shortcuts
Expand Down
2 changes: 2 additions & 0 deletions Kitodo/src/main/resources/messages/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,8 @@ setImportConfigurationForSelectedProcessesText=Por favor seleccione la configura
setRepresentative=Establecer representante\:
settings=Ajustes
sheetCounting=Recuento de hojas
# please check google translation below
sheetCountingWithEmptyPage=Recuento de hojas con página en blanco
sheetCountingRectoVerso=Recuento de hojas recto-verso
sheetCountingVersoRecto=Recuento de hojas verso-recto
shortcuts=Atajos de teclado
Expand Down
Loading
Loading