From 1a45df3f7fcc3d7552a0244c29cb4939df45a5fb Mon Sep 17 00:00:00 2001 From: jensp Date: Sat, 9 Apr 2011 09:58:19 +0000 Subject: [PATCH] =?UTF-8?q?Weitere=20Korrekturen=20und=20Erg=C3=A4nzungen?= =?UTF-8?q?=20an=20der=20GUI=20f=C3=BCr=20verschiedene=20Contenttypen=20(D?= =?UTF-8?q?ateFormatter,=20etc.)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@845 8810af33-2d31-482b-a856-94f89814c4df --- .../ui/GenericPersonPropertiesStep.java | 35 +++++++++-------- .../ui/ArticleInJournalPropertiesStep.java | 28 ++++++++++++-- .../ui/ExpertiseOrdererSheet.java | 2 +- .../ui/ProceedingsPropertiesStep.java | 38 ++++++++++++++++++- .../contenttypes/ui/SeriesEditshipTable.java | 37 +++++++++++++----- .../ui/SciProjectPropertiesStep.java | 38 ++++++++++++++++++- 6 files changed, 142 insertions(+), 36 deletions(-) diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertiesStep.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertiesStep.java index 5d3f29d5a..eba17aaf4 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertiesStep.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonPropertiesStep.java @@ -85,27 +85,26 @@ public class GenericPersonPropertiesStep extends SimpleEditStep { DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( itemModel); - sheet.add((String) ContenttypesGlobalizationUtil.globalize( - "cms.contenttypes.ui.person.surname").localize(), + sheet.add(ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.person.surname"), GenericPerson.SURNAME); - sheet.add((String) ContenttypesGlobalizationUtil.globalize( - "cms.contenttypes.ui.person.givenname").localize(), + sheet.add(ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.person.givenname"), GenericPerson.GIVENNAME); - sheet.add((String) ContenttypesGlobalizationUtil.globalize( - "cms.contenttypes.ui.person.titlepre").localize(), + sheet.add(ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.person.titlepre"), GenericPerson.TITLEPRE); - sheet.add((String) ContenttypesGlobalizationUtil.globalize( - "cms.contenttypes.ui.person.titlepost").localize(), + sheet.add(ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.person.titlepost"), GenericPerson.TITLEPOST); - sheet.add((String) ContenttypesGlobalizationUtil.globalize( - "cms.contenttypes.ui.person.birthdate").localize(), + sheet.add(ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.person.birthdate"), GenericPerson.BIRTHDATE, new DomainObjectPropertySheet.AttributeFormatter() { public String format(DomainObject item, String attribute, - PageState state) { - //ContentPage page = (ContentPage) item; + PageState state) { GenericPerson person = (GenericPerson) item; if (person.getBirthdate() != null) { return DateFormat.getDateInstance(DateFormat.LONG).format(person. @@ -117,8 +116,8 @@ public class GenericPersonPropertiesStep extends SimpleEditStep { } }); - sheet.add((String) ContenttypesGlobalizationUtil.globalize( - "cms.contenttypes.ui.person.gender").localize(), + sheet.add(ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.person.gender"), GenericPerson.GENDER, new DomainObjectPropertySheet.AttributeFormatter() { @@ -138,8 +137,8 @@ public class GenericPersonPropertiesStep extends SimpleEditStep { }); if (!ContentSection.getConfig().getHideLaunchDate()) { - sheet.add((String) ContenttypesGlobalizationUtil.globalize( - "cms.ui.authoring.page_launch_date").localize(), + sheet.add(ContenttypesGlobalizationUtil.globalize( + "cms.ui.authoring.page_launch_date"), ContentPage.LAUNCH_DATE, new DomainObjectPropertySheet.AttributeFormatter() { @@ -158,8 +157,8 @@ public class GenericPersonPropertiesStep extends SimpleEditStep { }); } - sheet.add((String) ContenttypesGlobalizationUtil.globalize( - "cms.contenttypes.ui.person.description").localize(), + sheet.add(ContenttypesGlobalizationUtil.globalize( + "cms.contenttypes.ui.person.description"), GenericPerson.DESCRIPTION); return sheet; } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ArticleInJournalPropertiesStep.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ArticleInJournalPropertiesStep.java index ee295239a..82700a881 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ArticleInJournalPropertiesStep.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ArticleInJournalPropertiesStep.java @@ -24,6 +24,7 @@ import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PageState; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contenttypes.ArticleInJournal; +import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.SimpleEditStep; @@ -31,6 +32,7 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainService; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; +import java.text.DateFormat; /** * @@ -66,9 +68,26 @@ public class ArticleInJournalPropertiesStep extends PublicationPropertiesStep { sheet.add(PublicationGlobalizationUtil.globalize( "publications.ui.articleinjournal.publication_date"), - ArticleInJournal.PUBLICATION_DATE); + ArticleInJournal.PUBLICATION_DATE, + new DomainObjectPropertySheet.AttributeFormatter() { - sheet.add(PublicationGlobalizationUtil.globalize( + public String format(DomainObject obj, + String attribute, + PageState state) { + + ArticleInJournal article = (ArticleInJournal) obj; + + if (article.getPublicationDate() != null) { + return DateFormat.getDateInstance(DateFormat.LONG).format( + article.getPublicationDate()); + } else { + return (String) ContenttypesGlobalizationUtil.globalize( + "cms.ui.unknown").localize(); + } + } + }); + + sheet.add(PublicationGlobalizationUtil.globalize( "publications.ui.articleinjournal.reviewed"), ArticleInJournal.REVIEWED, new ReviewedFormatter()); @@ -114,7 +133,7 @@ public class ArticleInJournalPropertiesStep extends PublicationPropertiesStep { } - private static class ReviewedFormatter + private static class ReviewedFormatter extends DomainService implements DomainObjectPropertySheet.AttributeFormatter { @@ -127,7 +146,8 @@ public class ArticleInJournalPropertiesStep extends PublicationPropertiesStep { && (get(obj, attribute) instanceof Boolean) && ((Boolean) get(obj, attribute) == true)) { return (String) PublicationGlobalizationUtil.globalize( - "publications.ui.articleinjournal.reviewed.yes").localize(); + "publications.ui.articleinjournal.reviewed.yes"). + localize(); } else { return (String) PublicationGlobalizationUtil.globalize( "publications.ui.articleinjournal.reviewed.no").localize(); diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererSheet.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererSheet.java index f3cd321d9..6fbda5263 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererSheet.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ExpertiseOrdererSheet.java @@ -45,7 +45,7 @@ public class ExpertiseOrdererSheet "publications.ui.expertise.orderer").localize(), TABLE_COL_EDIT)); columnModel.add(new TableColumn( - 0, + 1, PublicationGlobalizationUtil.globalize( "publications.ui.expertise.orderer.remove").localize(), TABLE_COL_DEL)); diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertiesStep.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertiesStep.java index 650e2de81..689ab4ce9 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertiesStep.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/ProceedingsPropertiesStep.java @@ -21,13 +21,17 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.PageState; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contenttypes.Proceedings; +import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; 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.domain.DomainObject; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; +import java.text.DateFormat; /** * @@ -57,11 +61,41 @@ public class ProceedingsPropertiesStep sheet.add(PublicationGlobalizationUtil.globalize( "publications.ui.proceedings.date_from_of_conference"), - Proceedings.DATE_FROM_OF_CONFERENCE); + Proceedings.DATE_FROM_OF_CONFERENCE, + new DomainObjectPropertySheet.AttributeFormatter() { + + public String format(DomainObject item, + String attribute, + PageState state) { + Proceedings proceedings = (Proceedings) item; + if (proceedings.getDateFromOfConference() != null) { + return DateFormat.getDateInstance(DateFormat.LONG).format(proceedings. + getDateFromOfConference()); + } else { + return (String) ContenttypesGlobalizationUtil.globalize( + "cms.ui.unknown").localize(); + } + } + }); sheet.add(PublicationGlobalizationUtil.globalize( "publications.ui.proceedings.date_to_of_conference"), - Proceedings.DATE_TO_OF_CONFERENCE); + Proceedings.DATE_TO_OF_CONFERENCE, + new DomainObjectPropertySheet.AttributeFormatter() { + + public String format(DomainObject item, + String attribute, + PageState state) { + Proceedings proceedings = (Proceedings) item; + if (proceedings.getDateToOfConference() != null) { + return DateFormat.getDateInstance(DateFormat.LONG).format(proceedings. + getDateToOfConference()); + } else { + return (String) ContenttypesGlobalizationUtil.globalize( + "cms.ui.unknown").localize(); + } + } + }); return sheet; } diff --git a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/SeriesEditshipTable.java b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/SeriesEditshipTable.java index 836e8a507..cb34f449b 100644 --- a/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/SeriesEditshipTable.java +++ b/ccm-sci-publications/src/com/arsdigita/cms/contenttypes/ui/SeriesEditshipTable.java @@ -36,10 +36,14 @@ import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.contenttypes.EditshipCollection; import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.Series; +import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.ui.authoring.SimpleEditStep; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; +import java.text.DateFormat; import org.apache.log4j.Logger; /** @@ -62,7 +66,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener { SimpleEditStep editStep) { super(); m_itemModel = itemModel; - this.editStep = (SeriesEditshipStep)editStep; + this.editStep = (SeriesEditshipStep) editStep; setEmptyView( new Label(PublicationGlobalizationUtil.globalize( @@ -174,9 +178,23 @@ public class SeriesEditshipTable extends Table implements TableActionListener { case 0: return m_editor.getFullName(); case 1: - return m_editshipCollection.getFrom(); + if (m_editshipCollection.getFrom() == null) { + return ContenttypesGlobalizationUtil.globalize( + "cms.ui.unknown").localize(); + } else { + return DateFormat.getDateInstance(DateFormat.LONG). + format( + m_editshipCollection.getFrom()); + } case 2: - return m_editshipCollection.getTo(); + if (m_editshipCollection.getTo() == null) { + return ContenttypesGlobalizationUtil.globalize( + "cms.ui.unknown").localize(); + } else { + return DateFormat.getDateInstance(DateFormat.LONG). + format( + m_editshipCollection.getTo()); + } case 3: return PublicationGlobalizationUtil.globalize( "publications.ui.series.editship.edit").localize(); @@ -240,8 +258,7 @@ public class SeriesEditshipTable extends Table implements TableActionListener { int col) { SecurityManager securityManager = Utilities.getSecurityManager(state); - Series series = (Series) m_itemModel. - getSelectedObject(state); + Series series = (Series) m_itemModel.getSelectedObject(state); boolean canEdit = securityManager.canAccess( state.getRequest(), @@ -365,9 +382,10 @@ public class SeriesEditshipTable extends Table implements TableActionListener { TableColumn column = getColumnModel().get(event.getColumn().intValue()); if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) { - } else if(TABLE_COL_EDIT_EDITSHIP.equals(column.getHeaderKey().toString())) { - while(editors.next()) { - if(editors.getEditor().equals(editor)) { + } else if (TABLE_COL_EDIT_EDITSHIP.equals(column.getHeaderKey(). + toString())) { + while (editors.next()) { + if (editors.getEditor().equals(editor)) { break; } } @@ -378,7 +396,8 @@ public class SeriesEditshipTable extends Table implements TableActionListener { editors.close(); - editStep.showComponent(state, SeriesEditshipStep.ADD_EDITOR_SHEET_NAME); + editStep.showComponent(state, + SeriesEditshipStep.ADD_EDITOR_SHEET_NAME); } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) { series.removeEditor(editor); } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java index dfac5b1ea..d17a09a04 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java @@ -21,16 +21,20 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Label; +import com.arsdigita.bebop.PageState; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentTypeCollection; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contenttypes.SciOrganizationConfig; import com.arsdigita.cms.contenttypes.SciProject; +import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; 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.domain.DomainObject; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; +import java.text.DateFormat; /** * Step for editing the basic properties of a {@link SciProject}. @@ -53,10 +57,40 @@ public class SciProjectPropertiesStep sheet.add(SciOrganizationGlobalizationUtil.globalize( "sciorganization.ui.project.begin"), - SciProject.BEGIN); + SciProject.BEGIN, + new DomainObjectPropertySheet.AttributeFormatter() { + + public String format(DomainObject obj, + String attribute, + PageState state) { + SciProject project = (SciProject) obj; + if (project.getBegin() == null) { + return (String) ContenttypesGlobalizationUtil.globalize( + "cms.ui.unknown").localize(); + } else { + return DateFormat.getDateInstance(DateFormat.LONG).format( + project.getBegin()); + } + } + }); sheet.add(SciOrganizationGlobalizationUtil.globalize( "sciorganization.ui.project.end"), - SciProject.END); + SciProject.END, + new DomainObjectPropertySheet.AttributeFormatter() { + + public String format(DomainObject obj, + String attribute, + PageState state) { + SciProject project = (SciProject) obj; + if (project.getEnd() == null) { + return (String) ContenttypesGlobalizationUtil.globalize( + "cms.ui.unknown").localize(); + } else { + return DateFormat.getDateInstance(DateFormat.LONG).format( + project.getEnd()); + } + } + }); sheet.add(SciOrganizationGlobalizationUtil.globalize( "sciorganization.ui.project.shortdesc"), SciProject.PROJECT_SHORT_DESCRIPTION);