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 {
|
||||
|
||||
/** The name of the editing sheet added to this step */
|
||||
public static String EDIT_SHEET_NAME = "edit";
|
||||
/** The name of the editing sheet added to this step */
|
||||
public static String EDIT_SHEET_NAME = "edit";
|
||||
|
||||
public ContactPropertiesStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
super(itemModel, parent);
|
||||
public ContactPropertiesStep(ItemSelectionModel itemModel,
|
||||
AuthoringKitWizard parent) {
|
||||
super(itemModel, parent);
|
||||
|
||||
BasicPageForm editSheet;
|
||||
BasicPageForm editSheet;
|
||||
|
||||
editSheet = new ContactPropertyForm(itemModel);
|
||||
add(EDIT_SHEET_NAME,
|
||||
GlobalizationUtil.globalize("cms.ui.edit"),
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton());
|
||||
editSheet = new ContactPropertyForm(itemModel, this);
|
||||
add(EDIT_SHEET_NAME,
|
||||
GlobalizationUtil.globalize("cms.ui.edit"),
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDisplayComponent(getContactPropertySheet(itemModel));
|
||||
}
|
||||
setDefaultEditKey(EDIT_SHEET_NAME);
|
||||
setDisplayComponent(getContactPropertySheet(itemModel));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a component that displays the properties of the Contact specified
|
||||
* by the ItemSelectionModel passed in.
|
||||
*
|
||||
* @param itemModel
|
||||
* The ItemSelectionModel to use @pre itemModel != null
|
||||
* @return A component to display the state of the basic properties of the
|
||||
*/
|
||||
public static Component getContactPropertySheet(ItemSelectionModel itemModel) {
|
||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||
/**
|
||||
* Returns a component that displays the properties of the Contact specified
|
||||
* by the ItemSelectionModel passed in.
|
||||
*
|
||||
* @param itemModel
|
||||
* The ItemSelectionModel to use @pre itemModel != null
|
||||
* @return A component to display the state of the basic properties of the
|
||||
*/
|
||||
public static Component getContactPropertySheet(ItemSelectionModel itemModel) {
|
||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),
|
||||
Contact.TITLE);
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),
|
||||
Contact.TITLE);
|
||||
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
|
||||
Contact.NAME);
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
|
||||
Contact.NAME);
|
||||
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.givenname"),
|
||||
Contact.GIVEN_NAME);
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.givenname"),
|
||||
Contact.GIVEN_NAME);
|
||||
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.familyname"),
|
||||
Contact.FAMILY_NAME);
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.familyname"),
|
||||
Contact.FAMILY_NAME);
|
||||
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.suffix"),
|
||||
Contact.SUFFIX);
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.suffix"),
|
||||
Contact.SUFFIX);
|
||||
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.type"),
|
||||
Contact.CONTACT_TYPE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
public String format(DomainObject item,
|
||||
String attribute,
|
||||
PageState state) {
|
||||
Contact contact = (Contact) item;
|
||||
if (contact.getContactType() != null) {
|
||||
return contact.getContactTypeName();
|
||||
} else {
|
||||
return (String) GlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.type"),
|
||||
Contact.CONTACT_TYPE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
public String format(DomainObject item,
|
||||
String attribute,
|
||||
PageState state) {
|
||||
Contact contact = (Contact) item;
|
||||
if (contact.getContactType() != null) {
|
||||
return contact.getContactTypeName();
|
||||
} else {
|
||||
return (String) GlobalizationUtil
|
||||
.globalize("cms.ui.unknown")
|
||||
.localize();
|
||||
}
|
||||
}
|
||||
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.description"),
|
||||
Contact.DESCRIPTION);
|
||||
});
|
||||
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.emails"),
|
||||
Contact.EMAILS);
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.description"),
|
||||
Contact.DESCRIPTION);
|
||||
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.orgname"),
|
||||
Contact.ORG_NAME);
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.emails"),
|
||||
Contact.EMAILS);
|
||||
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.deptname"),
|
||||
Contact.DEPT_NAME);
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.orgname"),
|
||||
Contact.ORG_NAME);
|
||||
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.role"),
|
||||
Contact.ROLE);
|
||||
sheet.add(ContactGlobalizationUtil.globalize(
|
||||
"london.contenttypes.ui.contact.deptname"),
|
||||
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";
|
||||
|
||||
private final ContactPropertiesStep step;
|
||||
|
||||
/**
|
||||
* Creates a new form to edit the Contact object specified by the item
|
||||
* selection model passed in.
|
||||
|
|
@ -60,8 +62,9 @@ public class ContactPropertyForm extends BasicPageForm {
|
|||
* @param itemModel The ItemSelectionModel to use to obtain the Contact to
|
||||
* work on
|
||||
*/
|
||||
public ContactPropertyForm(ItemSelectionModel itemModel) {
|
||||
public ContactPropertyForm(ItemSelectionModel itemModel, ContactPropertiesStep step) {
|
||||
super(ID, itemModel);
|
||||
this.step = step;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -215,6 +218,8 @@ public class ContactPropertyForm extends BasicPageForm {
|
|||
contact.setDeptName((String) data.get(Contact.DEPT_NAME));
|
||||
contact.setRole((String) data.get(Contact.ROLE));
|
||||
contact.save();
|
||||
|
||||
step.maybeForwardToNextStep(fse.getPageState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,53 +38,58 @@ import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
|||
*/
|
||||
public class ESDServicePropertiesForm extends BasicPageForm {
|
||||
|
||||
/** Name of this form */
|
||||
private static final String ID = "ESDService_edit";
|
||||
/** Name of this form */
|
||||
private static final String ID = "ESDService_edit";
|
||||
|
||||
private final ESDServicePropertiesStep step;
|
||||
|
||||
/**
|
||||
* @param itemModel
|
||||
*/
|
||||
public ESDServicePropertiesForm(ItemSelectionModel itemModel) {
|
||||
super(ID, itemModel);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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));
|
||||
/**
|
||||
* @param itemModel
|
||||
*/
|
||||
public ESDServicePropertiesForm(ItemSelectionModel itemModel, ESDServicePropertiesStep step) {
|
||||
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));
|
||||
|
||||
step.maybeForwardToNextStep(fse.getPageState());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,12 +55,13 @@ public class ESDServicePropertiesStep extends SimpleEditStep {
|
|||
|
||||
ESDServicePropertiesForm editSheet;
|
||||
|
||||
editSheet = new ESDServicePropertiesForm(itemModel);
|
||||
editSheet = new ESDServicePropertiesForm(itemModel, this);
|
||||
add(EDIT_SHEET_NAME,
|
||||
GlobalizationUtil.globalize("cms.ui.edit"),
|
||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||
editSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
setDefaultEditKey(EDIT_SHEET_NAME);
|
||||
setDisplayComponent(getESDServicePropertySheet(itemModel));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue