Infolge der Änderungen aus Revision 1807 funktionierten einige Formulare nicht mehr. An den entsprechenden Stelle Aufrufe

von super.validate(FormSectionEvent) wieder entfernt und Kommentar eingefügt, warum die super-Methoden nicht aufgerufen 
wird.


git-svn-id: https://svn.libreccm.org/ccm/trunk@1812 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2012-08-09 13:54:18 +00:00
parent 8aaac0b933
commit ee818077c1
7 changed files with 54 additions and 42 deletions

View File

@ -160,10 +160,13 @@ public class PublicPersonalProfileCreate extends PageCreate {
} }
} }
/**
* 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 @Override
public void validate(FormSectionEvent fse) throws FormProcessException { public void validate(FormSectionEvent fse) throws FormProcessException {
super.validate(fse);
Folder folder = m_parent.getFolder(fse.getPageState()); Folder folder = m_parent.getFolder(fse.getPageState());
Assert.exists(folder); Assert.exists(folder);
String id = (String) fse.getFormData().get( String id = (String) fse.getFormData().get(

View File

@ -149,7 +149,8 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm
@Override @Override
public void validate(FormSectionEvent e) throws FormProcessException { 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 PageState state = e.getPageState();
final FormData data = e.getFormData(); final FormData data = e.getFormData();

View File

@ -179,7 +179,8 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
@Override @Override
public void validate(FormSectionEvent e) throws FormProcessException { 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 PageState state = e.getPageState();
final FormData data = e.getFormData(); final FormData data = e.getFormData();

View File

@ -124,10 +124,10 @@ public class GenericPersonAliasSetForm
} }
} }
@Override @Override
public void validate(final FormSectionEvent fse) public void validate(final FormSectionEvent fse) throws FormProcessException {
throws FormProcessException { //We don't call super.validate(fse) here because the super method checks for things which are not available
super.validate(fse); //here, causing an exception.
final PageState state = fse.getPageState(); final PageState state = fse.getPageState();
final FormData data = fse.getFormData(); final FormData data = fse.getFormData();

View File

@ -72,11 +72,13 @@ public class GenericPersonCreate extends PageCreate {
} }
} }
// 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 @Override
public void validate(FormSectionEvent e) throws FormProcessException { public void validate(FormSectionEvent e) throws FormProcessException {
super.validate(e);
Folder f = m_parent.getFolder(e.getPageState()); Folder f = m_parent.getFolder(e.getPageState());
Assert.exists(f); Assert.exists(f);
validateNameUniqueness(f, e, GenericPerson.urlSave(getItemName(e))); validateNameUniqueness(f, e, GenericPerson.urlSave(getItemName(e)));

View File

@ -34,7 +34,6 @@ import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import java.util.Date; import java.util.Date;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
@ -47,9 +46,7 @@ import org.apache.log4j.Logger;
*/ */
public class PageCreate extends BasicPageForm public class PageCreate extends BasicPageForm
implements FormSubmissionListener, CreationComponent { implements FormSubmissionListener, CreationComponent {
private static final Logger s_log = Logger.getLogger(PageCreate.class);
protected final CreationSelector m_parent; protected final CreationSelector m_parent;
protected ApplyWorkflowFormSection m_workflowSection; protected ApplyWorkflowFormSection m_workflowSection;
@ -105,13 +102,17 @@ public class PageCreate extends BasicPageForm
return m_workflowSection; return m_workflowSection;
} }
// Init: create a new item id /** create a new item id
*
*/
public void init(FormSectionEvent e) throws FormProcessException { public void init(FormSectionEvent e) throws FormProcessException {
// this is currently a no-op // 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 { public void submitted(FormSectionEvent e) throws FormProcessException {
PageState state = e.getPageState(); PageState state = e.getPageState();
@ -124,14 +125,18 @@ public class PageCreate extends BasicPageForm
} }
} }
// 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 @Override
public void validate(FormSectionEvent e) throws FormProcessException { public void validate(final FormSectionEvent event) throws FormProcessException {
super.validate(e); final Folder folder = m_parent.getFolder(event.getPageState());
Assert.exists(folder);
Folder f = m_parent.getFolder(e.getPageState()); validateNameUniqueness(folder, event);
Assert.exists(f);
validateNameUniqueness(f, e);
} }
// Process: save fields to the database // Process: save fields to the database

View File

@ -18,7 +18,6 @@
*/ */
package com.arsdigita.cms.ui.templates; package com.arsdigita.cms.ui.templates;
import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormData;
import com.arsdigita.bebop.FormProcessException; import com.arsdigita.bebop.FormProcessException;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
@ -52,7 +51,7 @@ import org.apache.log4j.Logger;
public class TemplateEdit extends SimpleEditStep { public class TemplateEdit extends SimpleEditStep {
private static Logger s_log = private static Logger s_log =
Logger.getLogger(TemplateEdit.class); Logger.getLogger(TemplateEdit.class);
/** /**
* Construct a new TemplateEdit component * Construct a new TemplateEdit component
@ -73,8 +72,8 @@ public class TemplateEdit extends SimpleEditStep {
//DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); //DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel, false); 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.name").localize(), ContentItem.NAME);
sheet.add((String) GlobalizationUtil.globalize("cms.ui.templates.label").localize(), Template.LABEL); sheet.add((String) GlobalizationUtil.globalize("cms.ui.templates.label").localize(), Template.LABEL);
setDisplayComponent(sheet); setDisplayComponent(sheet);
} }
@ -101,13 +100,13 @@ public class TemplateEdit extends SimpleEditStep {
protected void addWidgets() { protected void addWidgets() {
add(new Label(GlobalizationUtil.globalize("cms.ui.templates.name"))); add(new Label(GlobalizationUtil.globalize("cms.ui.templates.name")));
TextField nameWidget = TextField nameWidget =
new TextField(new TrimmedStringParameter(NAME)); new TextField(new TrimmedStringParameter(NAME));
nameWidget.addValidationListener(new NameValidationListener()); nameWidget.addValidationListener(new NameValidationListener());
add(nameWidget); add(nameWidget);
add(new Label(GlobalizationUtil.globalize("cms.ui.templates.label"))); add(new Label(GlobalizationUtil.globalize("cms.ui.templates.label")));
TextField labelWidget = TextField labelWidget =
new TextField(new TrimmedStringParameter(Template.LABEL)); new TextField(new TrimmedStringParameter(Template.LABEL));
labelWidget.addValidationListener(new NotNullValidationListener()); labelWidget.addValidationListener(new NotNullValidationListener());
add(labelWidget); add(labelWidget);
} }
@ -127,34 +126,35 @@ public class TemplateEdit extends SimpleEditStep {
FormData data = e.getFormData(); FormData data = e.getFormData();
PageState state = e.getPageState(); PageState state = e.getPageState();
Template t = getTemplate(state); Template t = getTemplate(state);
t.setName((String)data.get(NAME)); t.setName((String) data.get(NAME));
t.setLabel((String)data.get(Template.LABEL)); t.setLabel((String) data.get(Template.LABEL));
t.save(); t.save();
} }
public void validate(FormSectionEvent event) throws FormProcessException { 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(); PageState state = event.getPageState();
FormData data = event.getFormData(); FormData data = event.getFormData();
Template t = getTemplate(state); Template t = getTemplate(state);
String newName = (String)data.get(NAME); String newName = (String) data.get(NAME);
String oldName = t.getName(); String oldName = t.getName();
// Validation passes if the item name is the same. // Validation passes if the item name is the same.
if ( !newName.equalsIgnoreCase(oldName) ) { if (!newName.equalsIgnoreCase(oldName)) {
validateNameUniqueness((Folder)t.getParent(), event); validateNameUniqueness((Folder) t.getParent(), event);
} }
} }
// Get the current template // Get the current template
public Template getTemplate(PageState state) { public Template getTemplate(PageState state) {
Template t = Template t =
(Template) getItemSelectionModel().getSelectedObject(state); (Template) getItemSelectionModel().getSelectedObject(state);
Assert.exists(t); Assert.exists(t);
return t; return t;
} }
}
}
} }