From a97ec7426bca66963ece66f0ae72c818d36882ac Mon Sep 17 00:00:00 2001 From: jensp Date: Mon, 10 Jun 2013 09:37:27 +0000 Subject: [PATCH] =?UTF-8?q?-=20Inlinesite=20springt=20jetzt=20nach=20dem?= =?UTF-8?q?=20Anlegen=20des=20Items=20direkt=20zum=20bearbeiten=20der=20Ba?= =?UTF-8?q?sicProperties=20-=20Insitesite=20leitet=20jetzt=20zum=20n=C3=A4?= =?UTF-8?q?chsten=20Schritt=20weiter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@2201 8810af33-2d31-482b-a856-94f89814c4df --- .../arsdigita/cms/contenttypes/InlineSite.xml | 32 +++--- .../ui/InlineSitePropertiesStep.java | 99 ++++++++-------- .../ui/InlineSitePropertyForm.java | 106 ++++++++++-------- 3 files changed, 122 insertions(+), 115 deletions(-) diff --git a/ccm-cms-types-inlinesite/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/InlineSite.xml b/ccm-cms-types-inlinesite/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/InlineSite.xml index b44807ed5..a07931e0c 100755 --- a/ccm-cms-types-inlinesite/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/InlineSite.xml +++ b/ccm-cms-types-inlinesite/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/InlineSite.xml @@ -1,24 +1,26 @@ - + - + - + - + - - + + diff --git a/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/ui/InlineSitePropertiesStep.java b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/ui/InlineSitePropertiesStep.java index c274270fa..2fc3d618d 100755 --- a/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/ui/InlineSitePropertiesStep.java +++ b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/ui/InlineSitePropertiesStep.java @@ -35,78 +35,73 @@ import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.domain.DomainObject; import java.text.DateFormat; - /** - * Authoring step to edit the simple attributes of the InlineSite content - * type (and its subclasses). + * Authoring step to edit the simple attributes of the InlineSite content type (and its subclasses). */ -public class InlineSitePropertiesStep - extends SimpleEditStep { +public class InlineSitePropertiesStep extends SimpleEditStep { - /** The name of the editing sheet added to this step */ + /** + * The name of the editing sheet added to this step + */ public static final String EDIT_SHEET_NAME = "edit"; - public InlineSitePropertiesStep( ItemSelectionModel itemModel, - AuthoringKitWizard parent ) { - super( itemModel, parent ); + public InlineSitePropertiesStep(final ItemSelectionModel itemModel, + final AuthoringKitWizard parent) { + super(itemModel, parent); - BasicPageForm editSheet; + final BasicPageForm editSheet = new InlineSitePropertyForm(itemModel, this); + add(EDIT_SHEET_NAME, "Edit", + new WorkflowLockedComponentAccess(editSheet, itemModel), + editSheet.getSaveCancelSection().getCancelButton()); + setDefaultEditKey(EDIT_SHEET_NAME); - editSheet = new InlineSitePropertyForm( itemModel ); - add( EDIT_SHEET_NAME, "Edit", - new WorkflowLockedComponentAccess(editSheet, itemModel), - editSheet.getSaveCancelSection().getCancelButton() ); - - setDisplayComponent( getInlineSitePropertySheet( itemModel ) ); + setDisplayComponent(getInlineSitePropertySheet(itemModel)); } /** - * Returns a component that displays the properties of the - * InlineSite specified by the ItemSelectionModel passed in. + * Returns a component that displays the properties of the InlineSite specified by the ItemSelectionModel passed in. + * * @param itemModel The ItemSelectionModel to use * @pre itemModel != null - * @return A component to display the state of the basic properties - * of the release + * @return A component to display the state of the basic properties of the release */ - public static Component getInlineSitePropertySheet( ItemSelectionModel - itemModel ) { - DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( itemModel ); + public static Component getInlineSitePropertySheet(final ItemSelectionModel itemModel) { + DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); - sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), + sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), InlineSite.TITLE); - sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"), - InlineSite.NAME ); + sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"), + InlineSite.NAME); if (!ContentSection.getConfig().getHideLaunchDate()) { sheet.add(GlobalizationUtil - .globalize("cms.contenttypes.ui.launch_date"), - ContentPage.LAUNCH_DATE, - new DomainObjectPropertySheet.AttributeFormatter() { - - @Override - public String format(DomainObject item, - String attribute, - PageState state) { - ContentPage page = (ContentPage) item; - if (page.getLaunchDate() != null) { - return DateFormat - .getDateInstance(DateFormat.LONG) - .format(page.getLaunchDate()); - } else { - return (String) GlobalizationUtil - .globalize("cms.ui.unknown") - .localize(); - } - } - }); + .globalize("cms.contenttypes.ui.launch_date"), + ContentPage.LAUNCH_DATE, + new DomainObjectPropertySheet.AttributeFormatter() { + @Override + public String format(final DomainObject item, + final String attribute, + final PageState state) { + ContentPage page = (ContentPage) item; + if (page.getLaunchDate() != null) { + return DateFormat + .getDateInstance(DateFormat.LONG) + .format(page.getLaunchDate()); + } else { + return (String) GlobalizationUtil + .globalize("cms.ui.unknown") + .localize(); + } + } + }); } - sheet.add( GlobalizationUtil.globalize("cms.contenttypes.ui.summary"), - InlineSite.DESCRIPTION); - sheet.add( InlineSiteGlobalizationUtil - .globalize("cms.contenttypes.ui.inlinesite.url"), - InlineSite.URL ); + + sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.summary"), + InlineSite.DESCRIPTION); + sheet.add(InlineSiteGlobalizationUtil + .globalize("cms.contenttypes.ui.inlinesite.url"), + InlineSite.URL); return sheet; } } - diff --git a/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/ui/InlineSitePropertyForm.java b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/ui/InlineSitePropertyForm.java index 9b6da565e..8b36d2028 100755 --- a/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/ui/InlineSitePropertyForm.java +++ b/ccm-cms-types-inlinesite/src/com/arsdigita/cms/contenttypes/ui/InlineSitePropertyForm.java @@ -19,44 +19,48 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.cms.contenttypes.InlineSite; -import com.arsdigita.bebop.FormData; +import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.Label; import com.arsdigita.bebop.event.FormInitListener; import com.arsdigita.bebop.event.FormProcessListener; import com.arsdigita.bebop.event.FormSectionEvent; -import com.arsdigita.bebop.form.TextArea; +import com.arsdigita.bebop.form.TextArea; import com.arsdigita.bebop.form.TextField; -import com.arsdigita.bebop.parameters.NotEmptyValidationListener; +import com.arsdigita.bebop.parameters.NotEmptyValidationListener; import com.arsdigita.bebop.parameters.ParameterModel; import com.arsdigita.bebop.parameters.ParameterModel; -import com.arsdigita.bebop.parameters.StringInRangeValidationListener; +import com.arsdigita.bebop.parameters.StringInRangeValidationListener; import com.arsdigita.bebop.parameters.StringParameter; -import com.arsdigita.cms.CMS; -import com.arsdigita.cms.ContentPage; -import com.arsdigita.cms.ContentSection; +import com.arsdigita.cms.CMS; +import com.arsdigita.cms.ContentPage; +import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ui.authoring.BasicPageForm; -import com.arsdigita.cms.util.GlobalizationUtil; - +import com.arsdigita.cms.util.GlobalizationUtil; /** - * Form to edit the basic properties of an InlineSite. This form can be - * extended to create forms for InlineSite subclasses. + * Form to edit the basic properties of an InlineSite. This form can be extended to create forms for InlineSite + * subclasses. */ public class InlineSitePropertyForm extends BasicPageForm - implements FormProcessListener, FormInitListener { + implements FormProcessListener, FormInitListener { private TextField m_url; - private TextArea m_description; + private TextArea m_description; + private InlineSitePropertiesStep m_step; /** - * Creates a new form to edit the InlineSite object specified - * by the item selection model passed in. - * @param itemModel The ItemSelectionModel to use to obtain the - * InlineSite to work on + * Creates a new form to edit the InlineSite object specified by the item selection model passed in. + * + * @param itemModel The ItemSelectionModel to use to obtain the InlineSite to work on */ - public InlineSitePropertyForm(ItemSelectionModel itemModel) { + public InlineSitePropertyForm(final ItemSelectionModel itemModel) { + this(itemModel, null); + } + + public InlineSitePropertyForm(final ItemSelectionModel itemModel, final InlineSitePropertiesStep step) { super("inlineSiteEdit", itemModel); + m_step = step; } /** @@ -64,50 +68,56 @@ public class InlineSitePropertyForm extends BasicPageForm */ protected void addWidgets() { super.addWidgets(); - add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.description"))); - m_description = new TextArea(ContentPage.DESCRIPTION); - m_description.setCols(30); - m_description.setRows(5); - if (ContentSection.getConfig().mandatoryDescriptions()) { - m_description.addValidationListener( - new NotEmptyValidationListener(GlobalizationUtil.globalize("cms.contenttypes.ui.description_missing"))); - } - m_description.addValidationListener( - new StringInRangeValidationListener( - 0, - 4000)); - add(m_description); - + add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.description"))); + m_description = new TextArea(ContentPage.DESCRIPTION); + m_description.setCols(30); + m_description.setRows(5); + if (ContentSection.getConfig().mandatoryDescriptions()) { + m_description.addValidationListener( + new NotEmptyValidationListener(GlobalizationUtil. + globalize("cms.contenttypes.ui.description_missing"))); + } + m_description.addValidationListener( + new StringInRangeValidationListener( + 0, + 4000)); + add(m_description); + add(new Label("URL:")); - ParameterModel urlParam - = new StringParameter("url"); + ParameterModel urlParam = new StringParameter("url"); m_url = new TextField(urlParam); m_url.setSize(40); add(m_url); } - /** Form initialisation hook. Fills widgets with data. */ + /** + * Form initialisation hook. Fills widgets with data. + */ public void init(FormSectionEvent fse) { - InlineSite site - = (InlineSite) super.initBasicWidgets(fse); - - m_url.setValue(fse.getPageState(), + InlineSite site = (InlineSite) super.initBasicWidgets(fse); + + m_url.setValue(fse.getPageState(), site.getURL()); - m_description.setValue(fse.getPageState(), site.getDescription()); + m_description.setValue(fse.getPageState(), site.getDescription()); } - - /** Form processing hook. Saves InlineSite object. */ + + /** + * Form processing hook. Saves InlineSite object. + */ public void process(FormSectionEvent fse) { - InlineSite site - = (InlineSite) super.processBasicWidgets(fse); + InlineSite site = (InlineSite) super.processBasicWidgets(fse); // save only if save button was pressed if (site != null - && getSaveCancelSection().getSaveButton() - .isSelected(fse.getPageState())) { - site.setURL((String)m_url.getValue(fse.getPageState())); - site.setDescription((String)m_description.getValue(fse.getPageState())); + && getSaveCancelSection().getSaveButton() + .isSelected(fse.getPageState())) { + site.setURL((String) m_url.getValue(fse.getPageState())); + site.setDescription((String) m_description.getValue(fse.getPageState())); site.save(); } + + if (m_step != null) { + m_step.maybeForwardToNextStep(fse.getPageState()); + } } }