ccm-ldn-types-esdservice und ccm-ldn-types-contact wechseln nach dem Anlegen jetzt direkt in den Bearbeitungsmodus und leiten nach Bearbeitung zum nächsten Schritt weiter (Tickets #1773, #1772).
git-svn-id: https://svn.libreccm.org/ccm/trunk@2230 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
c26f5b917d
commit
a30e4b7974
|
|
@ -40,91 +40,93 @@ import com.arsdigita.bebop.PageState;
|
||||||
*/
|
*/
|
||||||
public class ContactPropertiesStep extends SimpleEditStep {
|
public class ContactPropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
/** The name of the editing sheet added to this step */
|
/** The name of the editing sheet added to this step */
|
||||||
public static String EDIT_SHEET_NAME = "edit";
|
public static String EDIT_SHEET_NAME = "edit";
|
||||||
|
|
||||||
public ContactPropertiesStep(ItemSelectionModel itemModel,
|
public ContactPropertiesStep(ItemSelectionModel itemModel,
|
||||||
AuthoringKitWizard parent) {
|
AuthoringKitWizard parent) {
|
||||||
super(itemModel, parent);
|
super(itemModel, parent);
|
||||||
|
|
||||||
BasicPageForm editSheet;
|
BasicPageForm editSheet;
|
||||||
|
|
||||||
editSheet = new ContactPropertyForm(itemModel);
|
editSheet = new ContactPropertyForm(itemModel, this);
|
||||||
add(EDIT_SHEET_NAME,
|
add(EDIT_SHEET_NAME,
|
||||||
GlobalizationUtil.globalize("cms.ui.edit"),
|
GlobalizationUtil.globalize("cms.ui.edit"),
|
||||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||||
editSheet.getSaveCancelSection().getCancelButton());
|
editSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
setDisplayComponent(getContactPropertySheet(itemModel));
|
setDefaultEditKey(EDIT_SHEET_NAME);
|
||||||
}
|
setDisplayComponent(getContactPropertySheet(itemModel));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a component that displays the properties of the Contact specified
|
* Returns a component that displays the properties of the Contact specified
|
||||||
* by the ItemSelectionModel passed in.
|
* by the ItemSelectionModel passed in.
|
||||||
*
|
*
|
||||||
* @param itemModel
|
* @param itemModel
|
||||||
* The ItemSelectionModel to use @pre itemModel != null
|
* The ItemSelectionModel to use @pre itemModel != null
|
||||||
* @return A component to display the state of the basic properties of the
|
* @return A component to display the state of the basic properties of the
|
||||||
*/
|
*/
|
||||||
public static Component getContactPropertySheet(ItemSelectionModel itemModel) {
|
public static Component getContactPropertySheet(ItemSelectionModel itemModel) {
|
||||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||||
|
|
||||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),
|
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),
|
||||||
Contact.TITLE);
|
Contact.TITLE);
|
||||||
|
|
||||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
|
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
|
||||||
Contact.NAME);
|
Contact.NAME);
|
||||||
|
|
||||||
sheet.add(ContactGlobalizationUtil.globalize(
|
sheet.add(ContactGlobalizationUtil.globalize(
|
||||||
"london.contenttypes.ui.contact.givenname"),
|
"london.contenttypes.ui.contact.givenname"),
|
||||||
Contact.GIVEN_NAME);
|
Contact.GIVEN_NAME);
|
||||||
|
|
||||||
sheet.add(ContactGlobalizationUtil.globalize(
|
sheet.add(ContactGlobalizationUtil.globalize(
|
||||||
"london.contenttypes.ui.contact.familyname"),
|
"london.contenttypes.ui.contact.familyname"),
|
||||||
Contact.FAMILY_NAME);
|
Contact.FAMILY_NAME);
|
||||||
|
|
||||||
sheet.add(ContactGlobalizationUtil.globalize(
|
sheet.add(ContactGlobalizationUtil.globalize(
|
||||||
"london.contenttypes.ui.contact.suffix"),
|
"london.contenttypes.ui.contact.suffix"),
|
||||||
Contact.SUFFIX);
|
Contact.SUFFIX);
|
||||||
|
|
||||||
sheet.add(ContactGlobalizationUtil.globalize(
|
sheet.add(ContactGlobalizationUtil.globalize(
|
||||||
"london.contenttypes.ui.contact.type"),
|
"london.contenttypes.ui.contact.type"),
|
||||||
Contact.CONTACT_TYPE,
|
Contact.CONTACT_TYPE,
|
||||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||||
public String format(DomainObject item,
|
public String format(DomainObject item,
|
||||||
String attribute,
|
String attribute,
|
||||||
PageState state) {
|
PageState state) {
|
||||||
Contact contact = (Contact) item;
|
Contact contact = (Contact) item;
|
||||||
if (contact.getContactType() != null) {
|
if (contact.getContactType() != null) {
|
||||||
return contact.getContactTypeName();
|
return contact.getContactTypeName();
|
||||||
} else {
|
} else {
|
||||||
return (String) GlobalizationUtil
|
return (String) GlobalizationUtil
|
||||||
.globalize("cms.ui.unknown")
|
.globalize("cms.ui.unknown")
|
||||||
.localize();
|
.localize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.description"),
|
});
|
||||||
Contact.DESCRIPTION);
|
|
||||||
|
|
||||||
sheet.add(ContactGlobalizationUtil.globalize(
|
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.description"),
|
||||||
"london.contenttypes.ui.contact.emails"),
|
Contact.DESCRIPTION);
|
||||||
Contact.EMAILS);
|
|
||||||
|
|
||||||
sheet.add(ContactGlobalizationUtil.globalize(
|
sheet.add(ContactGlobalizationUtil.globalize(
|
||||||
"london.contenttypes.ui.contact.orgname"),
|
"london.contenttypes.ui.contact.emails"),
|
||||||
Contact.ORG_NAME);
|
Contact.EMAILS);
|
||||||
|
|
||||||
sheet.add(ContactGlobalizationUtil.globalize(
|
sheet.add(ContactGlobalizationUtil.globalize(
|
||||||
"london.contenttypes.ui.contact.deptname"),
|
"london.contenttypes.ui.contact.orgname"),
|
||||||
Contact.DEPT_NAME);
|
Contact.ORG_NAME);
|
||||||
|
|
||||||
sheet.add(ContactGlobalizationUtil.globalize(
|
sheet.add(ContactGlobalizationUtil.globalize(
|
||||||
"london.contenttypes.ui.contact.role"),
|
"london.contenttypes.ui.contact.deptname"),
|
||||||
Contact.ROLE);
|
Contact.DEPT_NAME);
|
||||||
|
|
||||||
return sheet;
|
sheet.add(ContactGlobalizationUtil.globalize(
|
||||||
}
|
"london.contenttypes.ui.contact.role"),
|
||||||
|
Contact.ROLE);
|
||||||
|
|
||||||
|
return sheet;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,8 @@ public class ContactPropertyForm extends BasicPageForm {
|
||||||
*/
|
*/
|
||||||
public static final String ID = "Contact_edit";
|
public static final String ID = "Contact_edit";
|
||||||
|
|
||||||
|
private final ContactPropertiesStep step;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new form to edit the Contact object specified by the item
|
* Creates a new form to edit the Contact object specified by the item
|
||||||
* selection model passed in.
|
* selection model passed in.
|
||||||
|
|
@ -60,8 +62,9 @@ public class ContactPropertyForm extends BasicPageForm {
|
||||||
* @param itemModel The ItemSelectionModel to use to obtain the Contact to
|
* @param itemModel The ItemSelectionModel to use to obtain the Contact to
|
||||||
* work on
|
* work on
|
||||||
*/
|
*/
|
||||||
public ContactPropertyForm(ItemSelectionModel itemModel) {
|
public ContactPropertyForm(ItemSelectionModel itemModel, ContactPropertiesStep step) {
|
||||||
super(ID, itemModel);
|
super(ID, itemModel);
|
||||||
|
this.step = step;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -215,6 +218,8 @@ public class ContactPropertyForm extends BasicPageForm {
|
||||||
contact.setDeptName((String) data.get(Contact.DEPT_NAME));
|
contact.setDeptName((String) data.get(Contact.DEPT_NAME));
|
||||||
contact.setRole((String) data.get(Contact.ROLE));
|
contact.setRole((String) data.get(Contact.ROLE));
|
||||||
contact.save();
|
contact.save();
|
||||||
|
|
||||||
|
step.maybeForwardToNextStep(fse.getPageState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,53 +38,58 @@ import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
*/
|
*/
|
||||||
public class ESDServicePropertiesForm extends BasicPageForm {
|
public class ESDServicePropertiesForm extends BasicPageForm {
|
||||||
|
|
||||||
/** Name of this form */
|
/** Name of this form */
|
||||||
private static final String ID = "ESDService_edit";
|
private static final String ID = "ESDService_edit";
|
||||||
|
|
||||||
|
private final ESDServicePropertiesStep step;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param itemModel
|
* @param itemModel
|
||||||
*/
|
*/
|
||||||
public ESDServicePropertiesForm(ItemSelectionModel itemModel) {
|
public ESDServicePropertiesForm(ItemSelectionModel itemModel, ESDServicePropertiesStep step) {
|
||||||
super(ID, itemModel);
|
super(ID, itemModel);
|
||||||
}
|
this.step = step;
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds widgets to the form.
|
|
||||||
**/
|
|
||||||
protected void addWidgets() {
|
|
||||||
|
|
||||||
/* Add standard widgets Title & name/url */
|
|
||||||
super.addWidgets();
|
|
||||||
|
|
||||||
add(new Label(ESDServiceGlobalizationUtil.globalize(
|
|
||||||
"london.contenttypes.ui.esdservice.servicetimes")));
|
|
||||||
ParameterModel serviceTimesParam = new StringParameter(ESDService.SERVICE_TIMES);
|
|
||||||
TextField serviceTimes = new TextField(serviceTimesParam);
|
|
||||||
add(serviceTimes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize Form with values if already set.
|
|
||||||
*/
|
|
||||||
public void init(FormSectionEvent fse) {
|
|
||||||
FormData data = fse.getFormData();
|
|
||||||
ESDService esdService = (ESDService) super.initBasicWidgets(fse);
|
|
||||||
data.put(ESDService.SERVICE_TIMES, esdService.getServiceTimes());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Process this form and set the values from form.
|
|
||||||
*/
|
|
||||||
public void process(FormSectionEvent fse) {
|
|
||||||
FormData data = fse.getFormData();
|
|
||||||
ESDService esdService = (ESDService) super.processBasicWidgets(fse);
|
|
||||||
|
|
||||||
// save only if save button was pressed
|
|
||||||
if (esdService != null
|
|
||||||
&& getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
|
||||||
|
|
||||||
esdService.setServiceTimes((String) data.get(ESDService.SERVICE_TIMES));
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Adds widgets to the form.
|
||||||
|
**/
|
||||||
|
protected void addWidgets() {
|
||||||
|
|
||||||
|
/* Add standard widgets Title & name/url */
|
||||||
|
super.addWidgets();
|
||||||
|
|
||||||
|
add(new Label(ESDServiceGlobalizationUtil.globalize(
|
||||||
|
"london.contenttypes.ui.esdservice.servicetimes")));
|
||||||
|
ParameterModel serviceTimesParam = new StringParameter(ESDService.SERVICE_TIMES);
|
||||||
|
TextField serviceTimes = new TextField(serviceTimesParam);
|
||||||
|
add(serviceTimes);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize Form with values if already set.
|
||||||
|
*/
|
||||||
|
public void init(FormSectionEvent fse) {
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
ESDService esdService = (ESDService) super.initBasicWidgets(fse);
|
||||||
|
data.put(ESDService.SERVICE_TIMES, esdService.getServiceTimes());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process this form and set the values from form.
|
||||||
|
*/
|
||||||
|
public void process(FormSectionEvent fse) {
|
||||||
|
FormData data = fse.getFormData();
|
||||||
|
ESDService esdService = (ESDService) super.processBasicWidgets(fse);
|
||||||
|
|
||||||
|
// save only if save button was pressed
|
||||||
|
if (esdService != null
|
||||||
|
&& getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
||||||
|
|
||||||
|
esdService.setServiceTimes((String) data.get(ESDService.SERVICE_TIMES));
|
||||||
|
|
||||||
|
step.maybeForwardToNextStep(fse.getPageState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,13 @@ public class ESDServicePropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
ESDServicePropertiesForm editSheet;
|
ESDServicePropertiesForm editSheet;
|
||||||
|
|
||||||
editSheet = new ESDServicePropertiesForm(itemModel);
|
editSheet = new ESDServicePropertiesForm(itemModel, this);
|
||||||
add(EDIT_SHEET_NAME,
|
add(EDIT_SHEET_NAME,
|
||||||
GlobalizationUtil.globalize("cms.ui.edit"),
|
GlobalizationUtil.globalize("cms.ui.edit"),
|
||||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||||
editSheet.getSaveCancelSection().getCancelButton());
|
editSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
|
setDefaultEditKey(EDIT_SHEET_NAME);
|
||||||
setDisplayComponent(getESDServicePropertySheet(itemModel));
|
setDisplayComponent(getESDServicePropertySheet(itemModel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue