From c9ed92fd1c71c71ae77e0370af90d3b7c885e060 Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Tue, 19 Nov 2019 13:10:43 +0100 Subject: [PATCH] Forms for Review publication type --- .../cms/contenttypes/ui/ReviewController.java | 14 +++ .../contenttypes/ui/ReviewPropertiesStep.java | 90 +++++++++++++++++++ .../contenttypes/ui/ReviewPropertyForm.java | 70 +++++++++++++++ 3 files changed, 174 insertions(+) create mode 100644 sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ReviewController.java create mode 100644 sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ReviewPropertiesStep.java create mode 100644 sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ReviewPropertyForm.java diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ReviewController.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ReviewController.java new file mode 100644 index 0000000..e612ced --- /dev/null +++ b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ReviewController.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.arsdigita.cms.contenttypes.ui; + +/** + * + * @author Jens Pelzetter + */ +public class ReviewController { + +} diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ReviewPropertiesStep.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ReviewPropertiesStep.java new file mode 100644 index 0000000..6cd2216 --- /dev/null +++ b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ReviewPropertiesStep.java @@ -0,0 +1,90 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.Component; +import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; +import com.arsdigita.cms.ui.authoring.BasicPageForm; +import com.arsdigita.cms.ui.authoring.SimpleEditStep; +import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; +import com.arsdigita.globalization.GlobalizedMessage; +import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; + +import org.scientificcms.publications.SciPublicationsConstants; + + +/** + * + * @author Jens Pelzetter + */ +public class ReviewPropertiesStep extends ArticleInJournalPropertiesStep { + + private final StringParameter selectedLangParam; + + public ReviewPropertiesStep( + final ItemSelectionModel itemModel, + final AuthoringKitWizard parent, + final StringParameter selectedLangParam + ) { + super(itemModel, parent, selectedLangParam); + this.selectedLangParam = selectedLangParam; + } + + public static Component getReviewPropertySheet( + final ItemSelectionModel itemModel, + final StringParameter selectedLangParam + ) { + final DomainObjectPropertySheet sheet + = (DomainObjectPropertySheet) ArticleInJournalPropertiesStep + .getArticleInJournalPropertySheet(itemModel, selectedLangParam); + + return sheet; + } + + @Override + protected void addBasicProperties( + final ItemSelectionModel itemModel, + final AuthoringKitWizard parent + ) { + final SimpleEditStep basicProperties = new SimpleEditStep( + itemModel, + parent, + selectedLangParam, + EDIT_SHEET_NAME + ); + + BasicPageForm editBasicSheet = new ReviewPropertyForm( + itemModel, this, selectedLangParam + ); + + basicProperties.add( + EDIT_SHEET_NAME, + new GlobalizedMessage( + "publications.ui.review.edit_basic_sheet", + SciPublicationsConstants.BUNDLE + ), + new WorkflowLockedComponentAccess(editBasicSheet, itemModel), + editBasicSheet.getSaveCancelSection().getCancelButton()); + + basicProperties.setDisplayComponent( + getReviewPropertySheet(itemModel, selectedLangParam) + ); + + getSegmentedPanel().addSegment( + new Label( + new GlobalizedMessage( + "publications.ui.publication.basic_properties", + SciPublicationsConstants.BUNDLE + ) + ), + basicProperties + ); + } + +} diff --git a/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ReviewPropertyForm.java b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ReviewPropertyForm.java new file mode 100644 index 0000000..09ec983 --- /dev/null +++ b/sci-publications/src/main/java/com/arsdigita/cms/contenttypes/ui/ReviewPropertyForm.java @@ -0,0 +1,70 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.FormProcessException; +import com.arsdigita.bebop.PageState; +import com.arsdigita.bebop.event.FormInitListener; +import com.arsdigita.bebop.event.FormProcessListener; +import com.arsdigita.bebop.event.FormSectionEvent; +import com.arsdigita.bebop.event.FormSubmissionListener; +import com.arsdigita.bebop.parameters.StringParameter; +import com.arsdigita.cms.ItemSelectionModel; + +/** + * + * @author Jens Pelzetter + */ +public class ReviewPropertyForm extends ArticleInJournalPropertyForm + implements FormProcessListener, FormInitListener, FormSubmissionListener { + + public static final String ID = "ReviewEdit"; + + private ReviewPropertiesStep step; + + public ReviewPropertyForm( + final ItemSelectionModel itemModel, + final StringParameter selectedLangParam + ) { + this(itemModel, null, selectedLangParam); + } + + public ReviewPropertyForm( + final ItemSelectionModel itemModel, + final ReviewPropertiesStep step, + final StringParameter selectedLangParam + ) { + super(itemModel, step, selectedLangParam); + this.step = step; + addSubmissionListener(this); + } + + @Override + protected void addWidgets() { + super.addWidgets(); + } + + @Override + public void init(final FormSectionEvent event) throws FormProcessException { + super.init(event); + + final PageState state = event.getPageState(); + getReviewed().setVisible(state, false); + +// FormData data = fse.getFormData(); +// Review review = (Review) initBasicWidgets(fse); + } + + @Override + public void process(final FormSectionEvent event) + throws FormProcessException { + super.process(event); + +// FormData data = fse.getFormData(); +// Review review = (Review) processBasicWidgets(fse); + } + +}