diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertiesStep.java b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertiesStep.java index 0d663565a..170ffb122 100755 --- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertiesStep.java +++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertiesStep.java @@ -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.suffix"), - Contact.SUFFIX); + sheet.add(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.familyname"), + Contact.FAMILY_NAME); - 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.suffix"), + Contact.SUFFIX); - sheet.add(ContactGlobalizationUtil.globalize( - "london.contenttypes.ui.contact.emails"), - Contact.EMAILS); - - sheet.add(ContactGlobalizationUtil.globalize( - "london.contenttypes.ui.contact.orgname"), - Contact.ORG_NAME); - - sheet.add(ContactGlobalizationUtil.globalize( - "london.contenttypes.ui.contact.deptname"), - Contact.DEPT_NAME); - - sheet.add(ContactGlobalizationUtil.globalize( - "london.contenttypes.ui.contact.role"), - Contact.ROLE); + 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(); + } + } - return sheet; - } + }); + + sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.description"), + Contact.DESCRIPTION); + + sheet.add(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.emails"), + Contact.EMAILS); + + sheet.add(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.orgname"), + Contact.ORG_NAME); + + sheet.add(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.deptname"), + Contact.DEPT_NAME); + + sheet.add(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.role"), + Contact.ROLE); + + return sheet; + } } diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertyForm.java b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertyForm.java index 9979a8a02..e2c99e83b 100755 --- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertyForm.java +++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertyForm.java @@ -52,6 +52,8 @@ public class ContactPropertyForm extends BasicPageForm { * Name of this form */ public static final String ID = "Contact_edit"; + + private final ContactPropertiesStep step; /** * Creates a new form to edit the Contact object specified by the item @@ -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()); } } } diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesForm.java b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesForm.java index 5c6c790d6..726efc300 100755 --- a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesForm.java +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesForm.java @@ -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"; - - - /** - * @param itemModel - */ - public ESDServicePropertiesForm(ItemSelectionModel itemModel) { - super(ID, itemModel); - } + /** Name of this form */ + private static final String ID = "ESDService_edit"; + + private final ESDServicePropertiesStep 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)); + /** + * @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()); + } + } + } diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesStep.java b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesStep.java index 46e465356..f412b0e80 100755 --- a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesStep.java +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesStep.java @@ -55,13 +55,14 @@ 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()); - setDisplayComponent(getESDServicePropertySheet(itemModel)); + setDefaultEditKey(EDIT_SHEET_NAME); + setDisplayComponent(getESDServicePropertySheet(itemModel)); } /**