From ba43a81c54351cc0d75487b5ffa877b953c6bfc2 Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Sat, 6 Aug 2022 14:35:29 +0200 Subject: [PATCH] Some bugfixes for editing the properties of a collected volume and an article in a collected volume. --- ...rticleInCollectedVolumePropertiesStep.java | 9 ++-- .../ArticleInCollectedVolumeRow.java | 28 +++++++++-- .../CollectedVolumePropertiesStep.java | 2 + .../edit-articleincollectedvolume.xhtml | 48 ++++++++++++------- .../edit-collectedvolume.xhtml | 15 ++++-- .../ui/SciPublicationsBundle.properties | 5 ++ .../ui/SciPublicationsBundle_de.properties | 5 ++ 7 files changed, 84 insertions(+), 28 deletions(-) diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumePropertiesStep.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumePropertiesStep.java index 07862f6..b9022bd 100644 --- a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumePropertiesStep.java +++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumePropertiesStep.java @@ -71,7 +71,7 @@ public class ArticleInCollectedVolumePropertiesStep @Inject private Models models; - + @Inject private ArticleInCollectedVolumePropertiesStepModel propertiesStepModel; @@ -110,8 +110,11 @@ public class ArticleInCollectedVolumePropertiesStep propertiesStepModel.setChapter(getPublication().getChapter()); propertiesStepModel.setCollectedVolumeTitle( - globalizationHelper.getValueFromLocalizedString( - getPublication().getTitle()) + Optional + .ofNullable(getPublication().getCollectedVolume()) + .map(CollectedVolume::getTitle) + .map(globalizationHelper::getValueFromLocalizedString) + .orElse(null) ); propertiesStepModel.setEndPage(getPublication().getEndPage()); diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumeRow.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumeRow.java index d56ed97..505819e 100644 --- a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumeRow.java +++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/ArticleInCollectedVolumeRow.java @@ -8,21 +8,25 @@ import java.util.Comparator; */ public class ArticleInCollectedVolumeRow implements Comparable { - + private String articleUuid; private String title; private String chapter; + private Integer startPage; + + private Integer endPage; + public String getArticleUuid() { return articleUuid; } - + public void setArticleUuid(final String articleUuid) { this.articleUuid = articleUuid; } - + public String getTitle() { return title; } @@ -39,11 +43,29 @@ public class ArticleInCollectedVolumeRow this.chapter = chapter; } + public Integer getStartPage() { + return startPage; + } + + public void setStartPage(final Integer startPage) { + this.startPage = startPage; + } + + public Integer getEndPage() { + return endPage; + } + + public void setEndPage(final Integer endPage) { + this.endPage = endPage; + } + @Override public int compareTo(final ArticleInCollectedVolumeRow other) { return Comparator .nullsFirst( Comparator.comparing(ArticleInCollectedVolumeRow::getChapter) + .thenComparing(ArticleInCollectedVolumeRow::getStartPage) + .thenComparing(ArticleInCollectedVolumeRow::getEndPage) ) .compare(this, other); } diff --git a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/CollectedVolumePropertiesStep.java b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/CollectedVolumePropertiesStep.java index 30d5297..bfaad8b 100644 --- a/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/CollectedVolumePropertiesStep.java +++ b/sci-publications/src/main/java/org/scientificcms/publications/ui/contenttypes/CollectedVolumePropertiesStep.java @@ -518,6 +518,8 @@ public class CollectedVolumePropertiesStep ) ); row.setChapter(article.getChapter()); + row.setStartPage(article.getStartPage()); + row.setEndPage(article.getEndPage()); return row; } diff --git a/sci-publications/src/main/resources/WEB-INF/views/org/scientificcms/contenttypes/ui/articleincollectedvolume/edit-articleincollectedvolume.xhtml b/sci-publications/src/main/resources/WEB-INF/views/org/scientificcms/contenttypes/ui/articleincollectedvolume/edit-articleincollectedvolume.xhtml index 23cadbc..fe03604 100644 --- a/sci-publications/src/main/resources/WEB-INF/views/org/scientificcms/contenttypes/ui/articleincollectedvolume/edit-articleincollectedvolume.xhtml +++ b/sci-publications/src/main/resources/WEB-INF/views/org/scientificcms/contenttypes/ui/articleincollectedvolume/edit-articleincollectedvolume.xhtml @@ -21,6 +21,7 @@ inputId="start-page" label="#{SciPublicationsUiMessageBundle['articleincollectedvolume.basicproperties.startpage.label']}" name="startPage" + value="#{SciCmsArticleInCollectedVolumePropertiesStepModel.startPage}" /> - + + + + + +
+
#{SciPublicationsUiMessageBundle['articleincollectedvolume.basicproperties.startpage.label']}
+
#{SciCmsArticleInCollectedVolumePropertiesStepModel.startPage}
+
+
+
#{SciPublicationsUiMessageBundle['articleincollectedvolume.basicproperties.endpage.label']}
+
#{SciCmsArticleInCollectedVolumePropertiesStepModel.endPage}
+
+
+
#{SciPublicationsUiMessageBundle['articleincollectedvolume.basicproperties.chapter.label']}
+
#{SciCmsArticleInCollectedVolumePropertiesStepModel.chapter}
+
+ +
+ + +

#{SciPublicationsUiMessageBundle['articleincollectedvolume.basicproperties.collectedvolume']}

- +
@@ -58,10 +82,10 @@ publicationType="#{SciCmsArticleInCollectedVolumePropertiesStepModel.collectedVolumeType}" /> - + -

#{'articleincollectedvolume.basicproperties.collectedvolume.none'}

+

#{SciPublicationsUiMessageBundle['articleincollectedvolume.basicproperties.collectedvolume.none']}

@@ -83,20 +107,8 @@ - -

-
#{SciPublicationsUiMessageBundle['articleincollectedvolume.basicproperties.startpage.label']}
-
#{SciCmsArticleInCollectedVolumePropertiesStepModel.startPage}
-
-
-
#{SciPublicationsUiMessageBundle['articleincollectedvolume.basicproperties.endpage.label']}
-
#{SciCmsArticleInCollectedVolumePropertiesStepModel.endPage}
-
-
-
#{SciPublicationsUiMessageBundle['articleincollectedvolume.basicproperties.chapter.label']}
-
#{SciCmsArticleInCollectedVolumePropertiesStepModel.chapter}
-
- + +