From de10f87f75aa9097ab5689781a3c551b38780711 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pontus=20=C3=96sterdahl?= <85453963+pontus-osterdahl@users.noreply.github.com> Date: Tue, 12 Dec 2023 10:21:29 +0100 Subject: [PATCH 1/7] Pontus osterdahl patch 14 (#22) * Let defaultpaginationscopeSelectedItem depend on User settings * Add paginateFromFirstPageByDefault to User bean * Create V2_127__Add_default_pagination_scope.sql * Update messages_de.properties * Update messages_en.properties --- .../org/kitodo/data/database/beans/User.java | 23 ++++++- .../V2_127__Add_default_pagination_scope.sql | 13 ++++ .../forms/dataeditor/PaginationPanel.java | 67 +++++++++++-------- .../resources/messages/messages_de.properties | 1 + .../resources/messages/messages_en.properties | 1 + .../userEdit/metadataEditorSettings.xhtml | 9 +++ 6 files changed, 86 insertions(+), 28 deletions(-) create mode 100644 Kitodo-DataManagement/src/main/resources/db/migration/V2_127__Add_default_pagination_scope.sql diff --git a/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/User.java b/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/User.java index 175464b6e90..b9ab4ab7452 100644 --- a/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/User.java +++ b/Kitodo-DataManagement/src/main/java/org/kitodo/data/database/beans/User.java @@ -111,6 +111,9 @@ public class User extends BaseBean { @Column(name = "show_pagination_by_default") private boolean showPaginationByDefault; + @Column(name = "paginate_from_first_page_by_default") + private boolean paginateFromFirstPageByDefault; + /** * Constructor for User Entity. */ @@ -146,6 +149,7 @@ public User(User user) { this.shortcuts = user.shortcuts; this.showCommentsByDefault = user.showCommentsByDefault; this.showPaginationByDefault = user.showPaginationByDefault; + this.paginateFromFirstPageByDefault = user.paginateFromFirstPageByDefault; this.defaultGalleryViewMode = user.defaultGalleryViewMode; if (user.roles != null) { @@ -172,7 +176,6 @@ public User(User user) { this.filters = user.filters; } - // default values if (Objects.nonNull(user.tableSize)) { this.tableSize = user.tableSize; } @@ -493,6 +496,24 @@ public void setShowPaginationByDefault(boolean showPaginationByDefault) { this.showPaginationByDefault = showPaginationByDefault; } + /** + * Get paginateFromFirstPageByDefault. + * + * @return value of paginateFromFirstPageByDefault + */ + public boolean isPaginateFromFirstPageByDefault() { + return paginateFromFirstPageByDefault; + } + + /** + * Set paginateFromFirstPageByDefault. + * + * @param paginateFromFirstPageByDefault as boolean + */ + public void setPaginateFromFirstPageByDefault(boolean paginateFromFirstPageByDefault) { + this.paginateFromFirstPageByDefault = paginateFromFirstPageByDefault; + } + /** * Removes a user from the environment. Since the * user ID may still be referenced somewhere, the user is not hard deleted from diff --git a/Kitodo-DataManagement/src/main/resources/db/migration/V2_127__Add_default_pagination_scope.sql b/Kitodo-DataManagement/src/main/resources/db/migration/V2_127__Add_default_pagination_scope.sql new file mode 100644 index 00000000000..2f71191a3d2 --- /dev/null +++ b/Kitodo-DataManagement/src/main/resources/db/migration/V2_127__Add_default_pagination_scope.sql @@ -0,0 +1,13 @@ +-- +-- (c) Kitodo. Key to digital objects e. V. +-- +-- This file is part of the Kitodo project. +-- +-- It is licensed under GNU General Public License version 3 or later. +-- +-- For the full copyright and license information, please read the +-- GPL3-License.txt file that was distributed with this source code. +-- + +-- Add column "paginate_from_first_page_by_default" to "user" table +ALTER TABLE user ADD paginate_from_first_page_by_default TINYINT(1) DEFAULT 0; diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/PaginationPanel.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/PaginationPanel.java index 12756c817b9..7be1e2bed45 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/PaginationPanel.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/PaginationPanel.java @@ -29,6 +29,7 @@ import org.kitodo.api.dataformat.View; import org.kitodo.config.ConfigCore; import org.kitodo.config.enums.ParameterCore; +import org.kitodo.data.database.beans.User; import org.kitodo.exceptions.InvalidImagesException; import org.kitodo.exceptions.InvalidMetadataValueException; import org.kitodo.exceptions.MediaNotFoundException; @@ -56,12 +57,13 @@ public class PaginationPanel { private List selectPaginationModeItems; private IllustratedSelectItem selectPaginationModeSelectedItem; private Map selectPaginationScopeItems; - private Boolean selectPaginationScopeSelectedItem = Boolean.TRUE; + private Boolean selectPaginationScopeSelectedItem; /** * Constructor. * - * @param dataEditor DataEditorForm instance + * @param dataEditor + * DataEditorForm instance */ PaginationPanel(DataEditorForm dataEditor) { this.dataEditor = dataEditor; @@ -71,20 +73,22 @@ 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 physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); + List physicalDivisions = dataEditor.getWorkpiece() + .getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); for (int i = 1; i < physicalDivisions.size(); i++) { PhysicalDivision physicalDivision = physicalDivisions.get(i - 1); physicalDivision.setOrder(i); @@ -112,15 +116,16 @@ public List getPaginationSelectionSelectedItems() { * selected items to set */ public void setPaginationSelectionSelectedItems(List selectedItems) { - List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); + List 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(); } } @@ -218,7 +223,6 @@ public List getPaginationSelectionItems() { return paginationSelectionItems; } - /** * Returns the items for the paginationTypeSelect select menu. * @@ -265,8 +269,14 @@ public void setFictitiousCheckboxChecked(boolean fictitiousCheckboxChecked) { this.fictitiousCheckboxChecked = fictitiousCheckboxChecked; } + private void prepareSelectPaginationScopeSelectedItem() { + selectPaginationScopeSelectedItem = ServiceManager.getUserService().getCurrentUser() + .isPaginateFromFirstPageByDefault(); + } + private void preparePaginationSelectionItems() { - List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); + List physicalDivisions = dataEditor.getWorkpiece() + .getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); paginationSelectionItems = new ArrayList<>(physicalDivisions.size()); for (int i = 0; i < physicalDivisions.size(); i++) { View view = View.of(physicalDivisions.get(i)); @@ -280,7 +290,8 @@ private void preparePaginationSelectionItems() { */ public void preparePaginationSelectionSelectedItems() { paginationSelectionSelectedItems = new ArrayList<>(); - List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); + List physicalDivisions = dataEditor.getWorkpiece() + .getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); for (Pair selectedElement : dataEditor.getSelectedMedia()) { for (int i = 0; i < physicalDivisions.size(); i++) { PhysicalDivision physicalDivision = physicalDivisions.get(i); @@ -303,18 +314,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() { @@ -353,7 +364,7 @@ public void startPaginationClick() { } } } catch (NumberFormatException e) { - Helper.setErrorMessage("paginationFormatError", new Object[] { paginationStartValue }); + Helper.setErrorMessage("paginationFormatError", new Object[] {paginationStartValue }); } paginationSelectionSelectedItems = new ArrayList<>(); preparePaginationSelectionItems(); @@ -370,8 +381,9 @@ 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()); } } @@ -388,5 +400,6 @@ public void show() { selectPaginationScopeSelectedItem = Boolean.TRUE; preparePaginationSelectionItems(); preparePaginationSelectionSelectedItems(); + prepareSelectPaginationScopeSelectedItem(); } } diff --git a/Kitodo/src/main/resources/messages/messages_de.properties b/Kitodo/src/main/resources/messages/messages_de.properties index da55bd6ded2..f1b3600d252 100644 --- a/Kitodo/src/main/resources/messages/messages_de.properties +++ b/Kitodo/src/main/resources/messages/messages_de.properties @@ -1161,6 +1161,7 @@ userDN=User DN userDocumentationLink=Anwenderdokumentation Kitodo.Production 3.X userEdit.metadataEditorSettings = Metadateneditor userEdit.metadataEditorSettings.defaultGalleryView = Standardansicht Galerie +userEdit.metadataEditorSettings.paginationScopeByDefault = Standardm\u00E4ssig ab erster markierten Seite paginieren userEdit.metadataEditorSettings.showCommentsByDefault = Kommentare standardm\u00E4ssig einblenden userEdit.metadataEditorSettings.showPaginationByDefault = Paginierung standardm\u00E4ssig einblenden userInstruction=Bedienungshinweise diff --git a/Kitodo/src/main/resources/messages/messages_en.properties b/Kitodo/src/main/resources/messages/messages_en.properties index e7db7ed8e38..9c8db4f1280 100644 --- a/Kitodo/src/main/resources/messages/messages_en.properties +++ b/Kitodo/src/main/resources/messages/messages_en.properties @@ -1162,6 +1162,7 @@ userDN=User DN userDocumentationLink=Kitodo.Production 3.X user documentation userEdit.metadataEditorSettings = Metadata editor userEdit.metadataEditorSettings.defaultGalleryView = Default gallery view +userEdit.metadataEditorSettings.paginationScopeByDefault = By default paginate from first selected page userEdit.metadataEditorSettings.showCommentsByDefault = Show comments by default userEdit.metadataEditorSettings.showPaginationByDefault = Show pagination by default userInstruction=User instructions diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/userEdit/metadataEditorSettings.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/userEdit/metadataEditorSettings.xhtml index b1c59701504..530e42c8353 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/userEdit/metadataEditorSettings.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/userEdit/metadataEditorSettings.xhtml @@ -77,6 +77,15 @@ value="#{UserForm.userObject.showPaginationByDefault}" onchange="toggleSave()"/> +
+ + +
From 2173fc9093530d48a830452434e15b4cf5b0fb14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pontus=20=C3=96sterdahl?= <85453963+pontus-osterdahl@users.noreply.github.com> Date: Tue, 12 Dec 2023 10:51:03 +0100 Subject: [PATCH 2/7] Pontus osterdahl patch 15 (#23) * Update metadataEditorSettings.xhtml * Update messages_de.properties * Update messages_en.properties --- Kitodo/src/main/resources/messages/messages_de.properties | 2 +- Kitodo/src/main/resources/messages/messages_en.properties | 2 +- .../includes/userEdit/metadataEditorSettings.xhtml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Kitodo/src/main/resources/messages/messages_de.properties b/Kitodo/src/main/resources/messages/messages_de.properties index f1b3600d252..2d6c34977e6 100644 --- a/Kitodo/src/main/resources/messages/messages_de.properties +++ b/Kitodo/src/main/resources/messages/messages_de.properties @@ -1161,7 +1161,7 @@ userDN=User DN userDocumentationLink=Anwenderdokumentation Kitodo.Production 3.X userEdit.metadataEditorSettings = Metadateneditor userEdit.metadataEditorSettings.defaultGalleryView = Standardansicht Galerie -userEdit.metadataEditorSettings.paginationScopeByDefault = Standardm\u00E4ssig ab erster markierten Seite paginieren +userEdit.metadataEditorSettings.paginateFromFistPageByDefault = Standardm\u00E4ssig ab erster markierten Seite paginieren userEdit.metadataEditorSettings.showCommentsByDefault = Kommentare standardm\u00E4ssig einblenden userEdit.metadataEditorSettings.showPaginationByDefault = Paginierung standardm\u00E4ssig einblenden userInstruction=Bedienungshinweise diff --git a/Kitodo/src/main/resources/messages/messages_en.properties b/Kitodo/src/main/resources/messages/messages_en.properties index 9c8db4f1280..8300a928f4f 100644 --- a/Kitodo/src/main/resources/messages/messages_en.properties +++ b/Kitodo/src/main/resources/messages/messages_en.properties @@ -1162,7 +1162,7 @@ userDN=User DN userDocumentationLink=Kitodo.Production 3.X user documentation userEdit.metadataEditorSettings = Metadata editor userEdit.metadataEditorSettings.defaultGalleryView = Default gallery view -userEdit.metadataEditorSettings.paginationScopeByDefault = By default paginate from first selected page +userEdit.metadataEditorSettings.paginateFromFistPageByDefault = By default paginate from first selected page userEdit.metadataEditorSettings.showCommentsByDefault = Show comments by default userEdit.metadataEditorSettings.showPaginationByDefault = Show pagination by default userInstruction=User instructions diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/userEdit/metadataEditorSettings.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/userEdit/metadataEditorSettings.xhtml index 530e42c8353..853ca725197 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/userEdit/metadataEditorSettings.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/userEdit/metadataEditorSettings.xhtml @@ -78,12 +78,12 @@ onchange="toggleSave()"/>
- +
From 585914ab61ab9ce1374d05b0a612cf9d11d9b8cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pontus=20=C3=96sterdahl?= <85453963+pontus-osterdahl@users.noreply.github.com> Date: Tue, 12 Dec 2023 15:30:20 +0100 Subject: [PATCH 3/7] Update messages_de.properties --- Kitodo/src/main/resources/messages/messages_de.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kitodo/src/main/resources/messages/messages_de.properties b/Kitodo/src/main/resources/messages/messages_de.properties index 2d6c34977e6..b80346b5908 100644 --- a/Kitodo/src/main/resources/messages/messages_de.properties +++ b/Kitodo/src/main/resources/messages/messages_de.properties @@ -1161,7 +1161,7 @@ userDN=User DN userDocumentationLink=Anwenderdokumentation Kitodo.Production 3.X userEdit.metadataEditorSettings = Metadateneditor userEdit.metadataEditorSettings.defaultGalleryView = Standardansicht Galerie -userEdit.metadataEditorSettings.paginateFromFistPageByDefault = Standardm\u00E4ssig ab erster markierten Seite paginieren +userEdit.metadataEditorSettings.paginateFromFirstPageByDefault = Standardm\u00E4ssig ab erster markierten Seite paginieren userEdit.metadataEditorSettings.showCommentsByDefault = Kommentare standardm\u00E4ssig einblenden userEdit.metadataEditorSettings.showPaginationByDefault = Paginierung standardm\u00E4ssig einblenden userInstruction=Bedienungshinweise From 0566e58ca99e9131f216302e9d12e262672ac0cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pontus=20=C3=96sterdahl?= <85453963+pontus-osterdahl@users.noreply.github.com> Date: Tue, 12 Dec 2023 15:30:47 +0100 Subject: [PATCH 4/7] Update messages_en.properties --- Kitodo/src/main/resources/messages/messages_en.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kitodo/src/main/resources/messages/messages_en.properties b/Kitodo/src/main/resources/messages/messages_en.properties index 8300a928f4f..8e23cc36106 100644 --- a/Kitodo/src/main/resources/messages/messages_en.properties +++ b/Kitodo/src/main/resources/messages/messages_en.properties @@ -1162,7 +1162,7 @@ userDN=User DN userDocumentationLink=Kitodo.Production 3.X user documentation userEdit.metadataEditorSettings = Metadata editor userEdit.metadataEditorSettings.defaultGalleryView = Default gallery view -userEdit.metadataEditorSettings.paginateFromFistPageByDefault = By default paginate from first selected page +userEdit.metadataEditorSettings.paginateFromFirstPageByDefault = By default paginate from first selected page userEdit.metadataEditorSettings.showCommentsByDefault = Show comments by default userEdit.metadataEditorSettings.showPaginationByDefault = Show pagination by default userInstruction=User instructions From 0d9521ed9ee01d125e7ad6d91c481d2d8f9af2bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pontus=20=C3=96sterdahl?= <85453963+pontus-osterdahl@users.noreply.github.com> Date: Tue, 12 Dec 2023 15:31:28 +0100 Subject: [PATCH 5/7] Update metadataEditorSettings.xhtml --- .../templates/includes/userEdit/metadataEditorSettings.xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/userEdit/metadataEditorSettings.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/userEdit/metadataEditorSettings.xhtml index 853ca725197..ae34840089a 100644 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/userEdit/metadataEditorSettings.xhtml +++ b/Kitodo/src/main/webapp/WEB-INF/templates/includes/userEdit/metadataEditorSettings.xhtml @@ -80,7 +80,7 @@
- Date: Tue, 20 Feb 2024 22:28:04 +0100 Subject: [PATCH 6/7] revert strange formatting --- .../forms/dataeditor/PaginationPanel.java | 58 +++++++++---------- 1 file changed, 26 insertions(+), 32 deletions(-) diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/PaginationPanel.java b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/PaginationPanel.java index 7be1e2bed45..dac9751538d 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/PaginationPanel.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/dataeditor/PaginationPanel.java @@ -62,8 +62,7 @@ public class PaginationPanel { /** * Constructor. * - * @param dataEditor - * DataEditorForm instance + * @param dataEditor DataEditorForm instance */ PaginationPanel(DataEditorForm dataEditor) { this.dataEditor = dataEditor; @@ -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 physicalDivisions = dataEditor.getWorkpiece() - .getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); + List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); for (int i = 1; i < physicalDivisions.size(); i++) { PhysicalDivision physicalDivision = physicalDivisions.get(i - 1); physicalDivision.setOrder(i); @@ -116,16 +113,15 @@ public List getPaginationSelectionSelectedItems() { * selected items to set */ public void setPaginationSelectionSelectedItems(List selectedItems) { - List physicalDivisions = dataEditor.getWorkpiece() - .getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); + List 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(); } } @@ -223,6 +219,7 @@ public List getPaginationSelectionItems() { return paginationSelectionItems; } + /** * Returns the items for the paginationTypeSelect select menu. * @@ -275,8 +272,7 @@ private void prepareSelectPaginationScopeSelectedItem() { } private void preparePaginationSelectionItems() { - List physicalDivisions = dataEditor.getWorkpiece() - .getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); + List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); paginationSelectionItems = new ArrayList<>(physicalDivisions.size()); for (int i = 0; i < physicalDivisions.size(); i++) { View view = View.of(physicalDivisions.get(i)); @@ -290,8 +286,7 @@ private void preparePaginationSelectionItems() { */ public void preparePaginationSelectionSelectedItems() { paginationSelectionSelectedItems = new ArrayList<>(); - List physicalDivisions = dataEditor.getWorkpiece() - .getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); + List physicalDivisions = dataEditor.getWorkpiece().getAllPhysicalDivisionChildrenSortedFilteredByPageAndTrack(); for (Pair selectedElement : dataEditor.getSelectedMedia()) { for (int i = 0; i < physicalDivisions.size(); i++) { PhysicalDivision physicalDivision = physicalDivisions.get(i); @@ -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() { @@ -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(); @@ -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()); } } From 99af79fd737bff4cd974bc2d7bc9d0ce514fdb99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pontus=20=C3=96sterdahl?= Date: Tue, 20 Feb 2024 22:32:56 +0100 Subject: [PATCH 7/7] rename file --- ...ination_scope.sql => V2_128__Add_default_pagination_scope.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Kitodo-DataManagement/src/main/resources/db/migration/{V2_127__Add_default_pagination_scope.sql => V2_128__Add_default_pagination_scope.sql} (100%) diff --git a/Kitodo-DataManagement/src/main/resources/db/migration/V2_127__Add_default_pagination_scope.sql b/Kitodo-DataManagement/src/main/resources/db/migration/V2_128__Add_default_pagination_scope.sql similarity index 100% rename from Kitodo-DataManagement/src/main/resources/db/migration/V2_127__Add_default_pagination_scope.sql rename to Kitodo-DataManagement/src/main/resources/db/migration/V2_128__Add_default_pagination_scope.sql