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
public void validate(FormSectionEvent fse) throws FormProcessException {
super.validate(fse);
public void validate(FormSectionEvent fse) throws FormProcessException {
Folder folder = m_parent.getFolder(fse.getPageState());
Assert.exists(folder);
String id = (String) fse.getFormData().get(

View File

@ -149,7 +149,8 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm
@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();

View File

@ -179,7 +179,8 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
@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();

View File

@ -124,10 +124,10 @@ public class GenericPersonAliasSetForm
}
}
@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();

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
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)));

View File

@ -34,7 +34,6 @@ import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.util.Assert;
import java.util.Date;
import org.apache.log4j.Logger;
/**
@ -47,9 +46,7 @@ import org.apache.log4j.Logger;
*/
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 @@ public class PageCreate extends BasicPageForm
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 @@ 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
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

View File

@ -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 @@ import org.apache.log4j.Logger;
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 @@ public class TemplateEdit extends SimpleEditStep {
//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 @@ public class TemplateEdit extends SimpleEditStep {
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 @@ public class TemplateEdit extends SimpleEditStep {
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;
}
}
}
}