BaseContact
Weitere Teile der UI fertig. git-svn-id: https://svn.libreccm.org/ccm/trunk@211 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
861a3e1d27
commit
6009b2e14e
|
|
@ -44,10 +44,13 @@ public class BaseContactAddressPropertiesStep extends SimpleEditStep {
|
||||||
public BaseContactAddressPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent, String prefix) {
|
public BaseContactAddressPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent, String prefix) {
|
||||||
super(itemModel, parent, prefix);
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
|
// BaseContact baseContact = (BaseContact)itemModel.getSelectedObject(state);
|
||||||
|
|
||||||
//XXX
|
//XXX
|
||||||
if(false/*EMPTY*/) {
|
if(/*baseContact.getAddress() == null*/ true) {
|
||||||
// BasicPageForm editAddressSheet = new BaseContactAddAddressPropertyForm(itemModel, this);
|
// BasicPageForm addAddressSheet = new BaseContactAddAddressPropertyForm(itemModel, this);
|
||||||
// add(ADD_ADDRESS_SHEET_NAME, "Add Address", new WorkflowLockedComponentAccess(addAddressSheet, itemModel), addAddressSheet.getSaveCancelSection().getCancelButton());
|
BasicPageForm addAddressSheet = new BaseContactEditAddressPropertyForm(itemModel, this);
|
||||||
|
add(ADD_ADDRESS_SHEET_NAME, "Add Address", new WorkflowLockedComponentAccess(addAddressSheet, itemModel), addAddressSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
/* Set the displayComponent for this step */
|
/* Set the displayComponent for this step */
|
||||||
setDisplayComponent(getEmptyBaseAddressPropertySheet(itemModel));
|
setDisplayComponent(getEmptyBaseAddressPropertySheet(itemModel));
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ package com.arsdigita.cms.contenttypes.ui;
|
||||||
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;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
|
|
@ -32,6 +33,7 @@ import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import com.arsdigita.cms.contenttypes.BaseAddress;
|
import com.arsdigita.cms.contenttypes.BaseAddress;
|
||||||
|
import com.arsdigita.cms.contenttypes.BaseContact;
|
||||||
import com.arsdigita.cms.contenttypes.util.BaseAddressGlobalizationUtil;
|
import com.arsdigita.cms.contenttypes.util.BaseAddressGlobalizationUtil;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
@ -80,8 +82,6 @@ public class BaseContactEditAddressPropertyForm extends BasicPageForm implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWidgets() {
|
public void addWidgets() {
|
||||||
// super.addWidgets();
|
|
||||||
|
|
||||||
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.address").localize()));
|
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.address").localize()));
|
||||||
ParameterModel addressParam = new StringParameter(ADDRESS);
|
ParameterModel addressParam = new StringParameter(ADDRESS);
|
||||||
addressParam.addParameterListener( new NotNullValidationListener( ) );
|
addressParam.addParameterListener( new NotNullValidationListener( ) );
|
||||||
|
|
@ -141,15 +141,18 @@ public class BaseContactEditAddressPropertyForm extends BasicPageForm implements
|
||||||
|
|
||||||
public void init(FormSectionEvent fse) {
|
public void init(FormSectionEvent fse) {
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
// BaseAddress baseAddress = (BaseAddress)super.initBasicWidgets(fse);
|
PageState state = fse.getPageState();
|
||||||
|
BaseContact baseContact = (BaseContact)getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
// data.put(ADDRESS, baseAddress.getAddress());
|
if(baseContact.getAddress() != null) {
|
||||||
// data.put(POSTAL_CODE, baseAddress.getPostalCode());
|
data.put(ADDRESS, baseContact.getAddress().getAddress());
|
||||||
// data.put(CITY, baseAddress.getCity());
|
data.put(POSTAL_CODE, baseContact.getAddress().getPostalCode());
|
||||||
// data.put(STATE, baseAddress.getState());
|
data.put(CITY, baseContact.getAddress().getCity());
|
||||||
// if(!BaseAddress.getConfig().getHideCountryCodeSelection()) {
|
data.put(STATE, baseContact.getAddress().getState());
|
||||||
// data.put(ISO_COUNTRY_CODE, baseAddress.getIsoCountryCode());
|
if(!BaseAddress.getConfig().getHideCountryCodeSelection()) {
|
||||||
// }
|
data.put(ISO_COUNTRY_CODE, baseContact.getAddress().getIsoCountryCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void submitted(FormSectionEvent fse) {
|
public void submitted(FormSectionEvent fse) {
|
||||||
|
|
@ -161,18 +164,18 @@ public class BaseContactEditAddressPropertyForm extends BasicPageForm implements
|
||||||
|
|
||||||
public void process(FormSectionEvent fse) {
|
public void process(FormSectionEvent fse) {
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
BaseContact baseContact = (BaseContact)getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
BaseAddress baseAddress = (BaseAddress)super.processBasicWidgets(fse);
|
if (baseContact.getAddress() != null &&
|
||||||
|
|
||||||
if (baseAddress != null &&
|
|
||||||
getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
||||||
baseAddress.setAddress((String)data.get(ADDRESS));
|
baseContact.getAddress().setAddress((String)data.get(ADDRESS));
|
||||||
baseAddress.setPostalCode((String)data.get(POSTAL_CODE));
|
baseContact.getAddress().setPostalCode((String)data.get(POSTAL_CODE));
|
||||||
baseAddress.setCity((String)data.get(CITY));
|
baseContact.getAddress().setCity((String)data.get(CITY));
|
||||||
baseAddress.setState((String)data.get(STATE));
|
baseContact.getAddress().setState((String)data.get(STATE));
|
||||||
baseAddress.setIsoCountryCode((String)data.get(ISO_COUNTRY_CODE));
|
baseContact.getAddress().setIsoCountryCode((String)data.get(ISO_COUNTRY_CODE));
|
||||||
|
|
||||||
baseAddress.save();
|
baseContact.getAddress().save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_step != null) {
|
if (m_step != null) {
|
||||||
|
|
|
||||||
|
|
@ -9,15 +9,23 @@
|
||||||
|
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormData;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
import com.arsdigita.bebop.Label;
|
||||||
|
import com.arsdigita.bebop.PageState;
|
||||||
import com.arsdigita.bebop.event.FormInitListener;
|
import com.arsdigita.bebop.event.FormInitListener;
|
||||||
import com.arsdigita.bebop.event.FormProcessListener;
|
import com.arsdigita.bebop.event.FormProcessListener;
|
||||||
import com.arsdigita.bebop.event.FormSectionEvent;
|
import com.arsdigita.bebop.event.FormSectionEvent;
|
||||||
import com.arsdigita.bebop.event.FormSubmissionListener;
|
import com.arsdigita.bebop.event.FormSubmissionListener;
|
||||||
|
import com.arsdigita.bebop.form.TextField;
|
||||||
|
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||||
|
import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
|
||||||
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
import com.arsdigita.cms.contenttypes.BaseContact;
|
import com.arsdigita.cms.contenttypes.BaseContact;
|
||||||
|
import com.arsdigita.cms.contenttypes.Person;
|
||||||
|
import com.arsdigita.cms.contenttypes.util.BaseAddressGlobalizationUtil;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
@ -31,9 +39,10 @@ public class BaseContactEditPersonPropertyForm extends BasicPageForm implements
|
||||||
|
|
||||||
private BaseContactPersonPropertiesStep m_step;
|
private BaseContactPersonPropertiesStep m_step;
|
||||||
|
|
||||||
// public static final String
|
public static final String SURNAME = Person.SURNAME;
|
||||||
// public static final String
|
public static final String GIVENNAME = Person.GIVENNAME;
|
||||||
// public static final String
|
public static final String TITLEPRE = Person.TITLEPRE;
|
||||||
|
public static final String TITLEPOST = Person.TITLEPOST;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the form
|
* ID of the form
|
||||||
|
|
@ -63,55 +72,70 @@ public class BaseContactEditPersonPropertyForm extends BasicPageForm implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWidgets() {
|
public void addWidgets() {
|
||||||
super.addWidgets();
|
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize()));
|
||||||
|
ParameterModel surnameParam = new StringParameter(SURNAME);
|
||||||
|
surnameParam.addParameterListener( new NotNullValidationListener( ) );
|
||||||
|
surnameParam.addParameterListener( new StringInRangeValidationListener(0, 1000) );
|
||||||
|
TextField surname = new TextField(surnameParam);
|
||||||
|
add(surname);
|
||||||
|
|
||||||
/*
|
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname").localize()));
|
||||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.genericorganization.ui.organizationname")));
|
ParameterModel givennameParam = new StringParameter(GIVENNAME);
|
||||||
ParameterModel organizationNameParam = new StringParameter(ORGANIZATIONAME);
|
givennameParam.addParameterListener( new NotNullValidationListener( ) );
|
||||||
TextField organizationName = new TextField(organizationNameParam);
|
givennameParam.addParameterListener( new StringInRangeValidationListener(0, 1000) );
|
||||||
organizationName.addValidationListener(new NotNullValidationListener());
|
TextField givenname = new TextField(givennameParam);
|
||||||
add(organizationName);
|
add(givenname);
|
||||||
|
|
||||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.genericorganization.ui.organizationnameaddendum")));
|
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize()));
|
||||||
TextField organizationNameAddendum = new TextField(ORGANIZATIONNAMEADDENDUM);
|
ParameterModel titlepreParam = new StringParameter(TITLEPRE);
|
||||||
add(organizationNameAddendum);
|
titlepreParam.addParameterListener( new StringInRangeValidationListener(0, 1000) );
|
||||||
|
TextField titlepre = new TextField(titlepreParam);
|
||||||
|
add(titlepre);
|
||||||
|
|
||||||
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.genericorganzation.ui.description")));
|
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize()));
|
||||||
TextArea description = new TextArea(DESCRIPTION);
|
ParameterModel titlepostParam = new StringParameter(TITLEPOST);
|
||||||
description.setRows(5);
|
titlepostParam.addParameterListener( new StringInRangeValidationListener(0, 1000) );
|
||||||
description.setCols(30);
|
TextField titlepost = new TextField(titlepostParam);
|
||||||
add(description);
|
add(titlepost);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void init(FormSectionEvent fse) {
|
||||||
public void init(FormSectionEvent e) throws FormProcessException {
|
FormData data = fse.getFormData();
|
||||||
FormData data = e.getFormData();
|
PageState state = fse.getPageState();
|
||||||
// BaseContact baseContact = (BaseContact)super.initBasicWidgets(e);
|
BaseContact baseContact = (BaseContact)getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
// data.put(DESCRIPTION, baseContact.getDescription());
|
if(baseContact.getPerson() != null) {
|
||||||
}
|
data.put(SURNAME, baseContact.getPerson().getSurname());
|
||||||
|
data.put(GIVENNAME, baseContact.getPerson().getGivenName());
|
||||||
@Override
|
data.put(TITLEPRE, baseContact.getPerson().getTitlePre());
|
||||||
public void process(FormSectionEvent e) throws FormProcessException {
|
data.put(TITLEPOST, baseContact.getPerson().getTitlePost());
|
||||||
FormData data = e.getFormData();
|
|
||||||
|
|
||||||
// BaseContact baseContact = (BaseContact)super.processBasicWidgets(e);
|
|
||||||
|
|
||||||
// if((baseContact != null) && (getSaveCancelSection().getSaveButton().isSelected(e.getPageState()))) {
|
|
||||||
// baseContact.setDescription((String)data.get(DESCRIPTION));
|
|
||||||
|
|
||||||
// baseContact.save();
|
|
||||||
// }
|
|
||||||
|
|
||||||
if(m_step != null) {
|
|
||||||
m_step.maybeForwardToNextStep(e.getPageState());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void submitted(FormSectionEvent e) throws FormProcessException {
|
public void submitted(FormSectionEvent fse) {
|
||||||
if((m_step != null) && (getSaveCancelSection().getCancelButton().isSelected(e.getPageState()))) {
|
if (m_step != null &&
|
||||||
m_step.cancelStreamlinedCreation(e.getPageState());
|
getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) {
|
||||||
|
m_step.cancelStreamlinedCreation(fse.getPageState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void process(FormSectionEvent fse) {
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
PageState state = fse.getPageState();
|
||||||
|
BaseContact baseContact = (BaseContact)getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
|
if (baseContact.getPerson() != null &&
|
||||||
|
getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
||||||
|
baseContact.getPerson().setSurname((String)data.get(SURNAME));
|
||||||
|
baseContact.getPerson().setGivenName((String)data.get(GIVENNAME));
|
||||||
|
baseContact.getPerson().setTitlePre((String)data.get(TITLEPRE));
|
||||||
|
baseContact.getPerson().setTitlePost((String)data.get(TITLEPOST));
|
||||||
|
|
||||||
|
baseContact.getPerson().save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_step != null) {
|
||||||
|
m_step.maybeForwardToNextStep(fse.getPageState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -43,11 +43,11 @@ public class BaseContactPersonPropertiesStep extends SimpleEditStep {
|
||||||
super(itemModel, parent, prefix);
|
super(itemModel, parent, prefix);
|
||||||
|
|
||||||
//XXX
|
//XXX
|
||||||
//Alternativ addPerson
|
|
||||||
if(false/*EMPTY*/) {
|
if(false/*EMPTY*/) {
|
||||||
|
|
||||||
// BasicPageForm editPersonSheet = new BaseContactAddPersonPropertyForm(itemModel, this);
|
BasicPageForm addPersonSheet = new BaseContactEditPersonPropertyForm(itemModel, this);
|
||||||
// add(EDIT_PERSON_SHEET_NAME, "Edit Person", new WorkflowLockedComponentAccess(editPersonSheet, itemModel), editPersonSheet.getSaveCancelSection().getCancelButton());
|
// BasicPageForm addPersonSheet = new BaseContactAddPersonPropertyForm(itemModel, this);
|
||||||
|
add(EDIT_PERSON_SHEET_NAME, "Add Person", new WorkflowLockedComponentAccess(addPersonSheet, itemModel), addPersonSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
/* Set the displayComponent for this step */
|
/* Set the displayComponent for this step */
|
||||||
setDisplayComponent(getEmptyPersonPropertySheet(itemModel));
|
setDisplayComponent(getEmptyPersonPropertySheet(itemModel));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue