From: <pb...@fe...> - 2012-12-17 07:47:46
|
Author: pboy Date: 2012-12-17 07:47:37 +0000 (Mon, 17 Dec 2012) New Revision: 2393 Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonCreate.java trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageCreate.java trunk/ccm-cms/src/com/arsdigita/cms/ui/templates/TemplateEdit.java Log: Reverted r1812 for some forms, which dont work anymore. (on behalf of JensP) Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java 2012-12-16 20:27:20 UTC (rev 2392) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachAddressPropertyForm.java 2012-12-17 07:47:37 UTC (rev 2393) @@ -149,7 +149,8 @@ @Override public void validate(FormSectionEvent e) throws FormProcessException { - super.validate(e); + //Calling super.validate(e) here causes an exception because the super method checks things which not available + //here. final PageState state = e.getPageState(); final FormData data = e.getFormData(); Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java 2012-12-16 20:27:20 UTC (rev 2392) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericContactAttachPersonPropertyForm.java 2012-12-17 07:47:37 UTC (rev 2393) @@ -179,7 +179,8 @@ @Override public void validate(FormSectionEvent e) throws FormProcessException { - super.validate(e); + //Calling super.validate(e) here causes an exception because the super method checks things which not available + //here. final PageState state = e.getPageState(); final FormData data = e.getFormData(); Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java 2012-12-16 20:27:20 UTC (rev 2392) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonAliasSetForm.java 2012-12-17 07:47:37 UTC (rev 2393) @@ -124,10 +124,10 @@ } } - @Override - public void validate(final FormSectionEvent fse) - throws FormProcessException { - super.validate(fse); + @Override + public void validate(final FormSectionEvent fse) throws FormProcessException { + //We don't call super.validate(fse) here because the super method checks for things which are not available + //here, causing an exception. final PageState state = fse.getPageState(); final FormData data = fse.getFormData(); Modified: trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonCreate.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonCreate.java 2012-12-16 20:27:20 UTC (rev 2392) +++ trunk/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericPersonCreate.java 2012-12-17 07:47:37 UTC (rev 2393) @@ -72,11 +72,13 @@ } } - // Validate: ensure name uniqueness + /** + * Ensure name uniqueness. Note: We can't call {@code super.validate(FormSectionEvent)} here + * because the super method {@link BasicPageForm#validate(com.arsdigita.bebop.event.FormSectionEvent)} tries + * to access things which on existing yet. + */ @Override - public void validate(FormSectionEvent e) throws FormProcessException { - super.validate(e); - + public void validate(FormSectionEvent e) throws FormProcessException { Folder f = m_parent.getFolder(e.getPageState()); Assert.exists(f); validateNameUniqueness(f, e, GenericPerson.urlSave(getItemName(e))); Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageCreate.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageCreate.java 2012-12-16 20:27:20 UTC (rev 2392) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/authoring/PageCreate.java 2012-12-17 07:47:37 UTC (rev 2393) @@ -34,7 +34,6 @@ import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.util.Assert; import java.util.Date; - import org.apache.log4j.Logger; /** @@ -47,9 +46,7 @@ */ public class PageCreate extends BasicPageForm implements FormSubmissionListener, CreationComponent { - - private static final Logger s_log = Logger.getLogger(PageCreate.class); - + protected final CreationSelector m_parent; protected ApplyWorkflowFormSection m_workflowSection; @@ -105,13 +102,17 @@ return m_workflowSection; } - // Init: create a new item id + /** create a new item id + * + */ public void init(FormSectionEvent e) throws FormProcessException { // this is currently a no-op } - // Submission: If the Cancel button was pressed, hide self and - // show the display component + /** + * If the Cancel button was pressed, hide self and + * show the display component + */ public void submitted(FormSectionEvent e) throws FormProcessException { PageState state = e.getPageState(); @@ -124,14 +125,18 @@ } } - // Validate: ensure name uniqueness + /** + * Validate inputs to ensure name uniqueness. Note: We can't call {@code super.validate(FormSectionEvent)} here + * because the super method {@link BasicPageForm#validate(com.arsdigita.bebop.event.FormSectionEvent)} tries + * to access things which on existing yet. + * + * @param event + */ @Override - public void validate(FormSectionEvent e) throws FormProcessException { - super.validate(e); - - Folder f = m_parent.getFolder(e.getPageState()); - Assert.exists(f); - validateNameUniqueness(f, e); + public void validate(final FormSectionEvent event) throws FormProcessException { + final Folder folder = m_parent.getFolder(event.getPageState()); + Assert.exists(folder); + validateNameUniqueness(folder, event); } // Process: save fields to the database Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/templates/TemplateEdit.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/templates/TemplateEdit.java 2012-12-16 20:27:20 UTC (rev 2392) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/templates/TemplateEdit.java 2012-12-17 07:47:37 UTC (rev 2393) @@ -18,7 +18,6 @@ */ package com.arsdigita.cms.ui.templates; - import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.Label; @@ -52,7 +51,7 @@ public class TemplateEdit extends SimpleEditStep { private static Logger s_log = - Logger.getLogger(TemplateEdit.class); + Logger.getLogger(TemplateEdit.class); /** * Construct a new TemplateEdit component @@ -73,8 +72,8 @@ //DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel, false); - sheet.add((String) GlobalizationUtil.globalize("cms.ui.templates.name").localize(), ContentItem.NAME); - sheet.add((String) GlobalizationUtil.globalize("cms.ui.templates.label").localize(), Template.LABEL); + sheet.add((String) GlobalizationUtil.globalize("cms.ui.templates.name").localize(), ContentItem.NAME); + sheet.add((String) GlobalizationUtil.globalize("cms.ui.templates.label").localize(), Template.LABEL); setDisplayComponent(sheet); } @@ -101,13 +100,13 @@ protected void addWidgets() { add(new Label(GlobalizationUtil.globalize("cms.ui.templates.name"))); TextField nameWidget = - new TextField(new TrimmedStringParameter(NAME)); + new TextField(new TrimmedStringParameter(NAME)); nameWidget.addValidationListener(new NameValidationListener()); add(nameWidget); add(new Label(GlobalizationUtil.globalize("cms.ui.templates.label"))); TextField labelWidget = - new TextField(new TrimmedStringParameter(Template.LABEL)); + new TextField(new TrimmedStringParameter(Template.LABEL)); labelWidget.addValidationListener(new NotNullValidationListener()); add(labelWidget); } @@ -127,34 +126,35 @@ FormData data = e.getFormData(); PageState state = e.getPageState(); Template t = getTemplate(state); - t.setName((String)data.get(NAME)); - t.setLabel((String)data.get(Template.LABEL)); + t.setName((String) data.get(NAME)); + t.setLabel((String) data.get(Template.LABEL)); t.save(); } public void validate(FormSectionEvent event) throws FormProcessException { - super.validate(event); - + //Calling super.validate(e) here causes an exception because the super method checks things which not available + //here. + PageState state = event.getPageState(); FormData data = event.getFormData(); Template t = getTemplate(state); - String newName = (String)data.get(NAME); + String newName = (String) data.get(NAME); String oldName = t.getName(); // Validation passes if the item name is the same. - if ( !newName.equalsIgnoreCase(oldName) ) { - validateNameUniqueness((Folder)t.getParent(), event); + if (!newName.equalsIgnoreCase(oldName)) { + validateNameUniqueness((Folder) t.getParent(), event); } } // Get the current template public Template getTemplate(PageState state) { Template t = - (Template) getItemSelectionModel().getSelectedObject(state); + (Template) getItemSelectionModel().getSelectedObject(state); Assert.exists(t); return t; } + } - } |