Skip to content

Commit

Permalink
revert strange formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Pontus Österdahl committed Feb 20, 2024
1 parent 0d9521e commit 7669cba
Showing 1 changed file with 26 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ public class PaginationPanel {
/**
* Constructor.
*
* @param dataEditor
* DataEditorForm instance
* @param dataEditor DataEditorForm instance
*/
PaginationPanel(DataEditorForm dataEditor) {
this.dataEditor = dataEditor;
Expand All @@ -73,22 +72,20 @@ public class PaginationPanel {
}

/**
* Checks and updates media references in workpiece depending on changes in
* file system.
* Checks and updates media references in workpiece depending on changes in file system.
*/
public void updateMediaReferences() {
boolean mediaReferencesChanged = false;
try {
mediaReferencesChanged = ServiceManager.getFileService().searchForMedia(dataEditor.getProcess(),
dataEditor.getWorkpiece());
dataEditor.getWorkpiece());
} catch (InvalidImagesException e) {
Helper.setErrorMessage(e.getLocalizedMessage());
} catch (MediaNotFoundException e) {
Helper.setWarnMessage(e.getMessage());
}
dataEditor.setMediaUpdated(mediaReferencesChanged);
List<PhysicalDivision> physicalDivisions = dataEditor.getWorkpiece()
.getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack();
List<PhysicalDivision> physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack();
for (int i = 1; i < physicalDivisions.size(); i++) {
PhysicalDivision physicalDivision = physicalDivisions.get(i - 1);
physicalDivision.setOrder(i);
Expand Down Expand Up @@ -116,16 +113,15 @@ public List<Integer> getPaginationSelectionSelectedItems() {
* selected items to set
*/
public void setPaginationSelectionSelectedItems(List<Integer> selectedItems) {
List<PhysicalDivision> physicalDivisions = dataEditor.getWorkpiece()
.getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack();
List<PhysicalDivision> physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack();
if (!selectedItems.isEmpty()) {
int lastItemIndex = selectedItems.get(selectedItems.size() - 1);
if (this.paginationSelectionSelectedItems.isEmpty() || !Objects.equals(
this.paginationSelectionSelectedItems.get(this.paginationSelectionSelectedItems.size() - 1),
lastItemIndex)) {
if (this.paginationSelectionSelectedItems.isEmpty()
|| !Objects.equals(this.paginationSelectionSelectedItems.get(
this.paginationSelectionSelectedItems.size() - 1), lastItemIndex)) {
dataEditor.getStructurePanel().updateNodeSelection(
dataEditor.getGalleryPanel().getGalleryMediaContent(physicalDivisions.get(lastItemIndex)),
physicalDivisions.get(lastItemIndex).getLogicalDivisions().get(0));
dataEditor.getGalleryPanel().getGalleryMediaContent(physicalDivisions.get(lastItemIndex)),
physicalDivisions.get(lastItemIndex).getLogicalDivisions().get(0));
updateMetadataPanel();
}
}
Expand Down Expand Up @@ -223,6 +219,7 @@ public List<SelectItem> getPaginationSelectionItems() {
return paginationSelectionItems;
}


/**
* Returns the items for the paginationTypeSelect select menu.
*
Expand Down Expand Up @@ -275,8 +272,7 @@ private void prepareSelectPaginationScopeSelectedItem() {
}

private void preparePaginationSelectionItems() {
List<PhysicalDivision> physicalDivisions = dataEditor.getWorkpiece()
.getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack();
List<PhysicalDivision> physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack();
paginationSelectionItems = new ArrayList<>(physicalDivisions.size());
for (int i = 0; i < physicalDivisions.size(); i++) {
View view = View.of(physicalDivisions.get(i));
Expand All @@ -290,8 +286,7 @@ private void preparePaginationSelectionItems() {
*/
public void preparePaginationSelectionSelectedItems() {
paginationSelectionSelectedItems = new ArrayList<>();
List<PhysicalDivision> physicalDivisions = dataEditor.getWorkpiece()
.getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack();
List<PhysicalDivision> physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack();
for (Pair<PhysicalDivision, LogicalDivision> selectedElement : dataEditor.getSelectedMedia()) {
for (int i = 0; i < physicalDivisions.size(); i++) {
PhysicalDivision physicalDivision = physicalDivisions.get(i);
Expand All @@ -314,18 +309,18 @@ private void preparePaginationTypeSelectItems() {

private void prepareSelectPaginationModeItems() {
selectPaginationModeItems = new ArrayList<>(6);
selectPaginationModeItems
.add(new IllustratedSelectItem(PaginatorMode.PAGES, "pageCount", "paginierung_seite.svg"));
selectPaginationModeItems
.add(new IllustratedSelectItem(PaginatorMode.DOUBLE_PAGES, "columnCount", "paginierung_spalte.svg"));
selectPaginationModeItems
.add(new IllustratedSelectItem(PaginatorMode.FOLIATION, "sheetCounting", "paginierung_blatt.svg"));
selectPaginationModeItems.add(new IllustratedSelectItem(PaginatorMode.RECTOVERSO_FOLIATION,
"sheetCountingRectoVerso", "paginierung_blatt_rectoverso.svg"));
selectPaginationModeItems.add(new IllustratedSelectItem(PaginatorMode.PAGES, "pageCount",
"paginierung_seite.svg"));
selectPaginationModeItems.add(new IllustratedSelectItem(PaginatorMode.DOUBLE_PAGES, "columnCount",
"paginierung_spalte.svg"));
selectPaginationModeItems.add(new IllustratedSelectItem(PaginatorMode.FOLIATION, "sheetCounting",
"paginierung_blatt.svg"));
selectPaginationModeItems.add(new IllustratedSelectItem(PaginatorMode.RECTOVERSO_FOLIATION, "sheetCountingRectoVerso",
"paginierung_blatt_rectoverso.svg"));
selectPaginationModeItems.add(new IllustratedSelectItem(PaginatorMode.RECTOVERSO, "pageCountRectoVerso",
"paginierung_seite_rectoverso.svg"));
selectPaginationModeItems.add(
new IllustratedSelectItem(PaginatorMode.DOUBLE_PAGES, "pageCountDouble", "paginierung_doppelseite.svg"));
selectPaginationModeItems.add(new IllustratedSelectItem(PaginatorMode.DOUBLE_PAGES, "pageCountDouble",
"paginierung_doppelseite.svg"));
}

private void prepareSelectPaginationScopeItems() {
Expand Down Expand Up @@ -364,7 +359,7 @@ public void startPaginationClick() {
}
}
} catch (NumberFormatException e) {
Helper.setErrorMessage("paginationFormatError", new Object[] {paginationStartValue });
Helper.setErrorMessage("paginationFormatError", new Object[] { paginationStartValue });
}
paginationSelectionSelectedItems = new ArrayList<>();
preparePaginationSelectionItems();
Expand All @@ -381,9 +376,8 @@ private void updateMetadataPanel() {
&& dataEditor.getStructurePanel().getSelectedLogicalNode().getData() instanceof StructureTreeNode
&& Objects.nonNull(dataEditor.getStructurePanel().getSelectedLogicalNode().getData())
&& ((StructureTreeNode) dataEditor.getStructurePanel().getSelectedLogicalNode().getData())
.getDataObject() instanceof View) {
View view = (View) ((StructureTreeNode) dataEditor.getStructurePanel().getSelectedLogicalNode().getData())
.getDataObject();
.getDataObject() instanceof View) {
View view = (View) ((StructureTreeNode) dataEditor.getStructurePanel().getSelectedLogicalNode().getData()).getDataObject();
dataEditor.getMetadataPanel().showPageInLogical(view.getPhysicalDivision());
}
}
Expand Down

0 comments on commit 7669cba

Please sign in to comment.