CT HealthCareFacility
angepaßt auf die Verwendung von basetypes.Address und basetypes.Contact git-svn-id: https://svn.libreccm.org/ccm/trunk@447 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
eea7541ae5
commit
6eb01bf684
|
|
@ -9,8 +9,6 @@
|
|||
<ccm:requires name="ccm-core" version="6.6.0" relation="ge"/>
|
||||
<ccm:requires name="ccm-cms" version="6.6.0" relation="ge"/>
|
||||
<ccm:requires name="ccm-cms-types-genericorganization" version="6.6.0" relation="ge"/>
|
||||
<ccm:requires name="ccm-cms-types-baseAddress" version="6.6.0" relation="ge"/>
|
||||
<ccm:requires name="ccm-cms-types-baseContact" version="6.6.0" relation="ge"/>
|
||||
</ccm:dependencies>
|
||||
<ccm:directories>
|
||||
<ccm:directory name="pdl"/>
|
||||
|
|
|
|||
|
|
@ -1,36 +1,36 @@
|
|||
model com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.GenricOrganization;
|
||||
import com.arsdigita.cms.contenttypes.BaseAddress;
|
||||
import com.arsdigita.cms.contenttypes.BaseContact;
|
||||
//import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
||||
import com.arsdigita.cms.basetypes.Address;
|
||||
import com.arsdigita.cms.basetypes.Contact;
|
||||
|
||||
import com.arsdigita.kernel.ACSObject;
|
||||
import com.arsdigita.cms.*;
|
||||
|
||||
// HealthCareFacility Object
|
||||
object type HealthCareFacility extends GenericOrganization {
|
||||
|
||||
BaseAddress[0..1] address = join ct_healthCareFacilities.address_id
|
||||
to ct_baseAddresses.address_id;
|
||||
com.arsdigita.cms.basetypes.Address[0..1] address = join ct_healthCareFacilities.address_id
|
||||
to cms_addresses.address_id;
|
||||
|
||||
reference key ( ct_healthCareFacilities.hcf_id );
|
||||
}
|
||||
|
||||
association {
|
||||
|
||||
BaseContact[0..n] contacts = join ct_healthCareFacilities.hcf_id
|
||||
to ct_healthCareFacility_baseContact_map.hcf_id,
|
||||
join ct_healthCareFacility_baseContact_map.contact_id
|
||||
to ct_baseContacts.contact_id;
|
||||
com.arsdigita.cms.basetypes.Contact[0..n] contacts = join ct_healthCareFacilities.hcf_id
|
||||
to ct_healthCareFacility_contact_map.hcf_id,
|
||||
join ct_healthCareFacility_contact_map.contact_id
|
||||
to cms_contacts.contact_id;
|
||||
|
||||
HealthCareFacility[0..n] healthCareFacilities = join ct_baseContacts.contact_id
|
||||
to ct_healthCareFacility_baseContact_map.contact_id,
|
||||
join ct_healthCareFacility_baseContact_map.hcf_id
|
||||
to ct_healthCareFacilities.hcf_id;
|
||||
HealthCareFacility[0..n] healthCareFacilities = join cms_contacts.contact_id
|
||||
to ct_healthCareFacility_contact_map.contact_id,
|
||||
join ct_healthCareFacility_contact_map.hcf_id
|
||||
to ct_healthCareFacilities.hcf_id;
|
||||
|
||||
// Link Attribute
|
||||
String contact_type = ct_healthCareFacility_baseContact_map.contact_type VARCHAR(100);
|
||||
BigDecimal contact_order = ct_healthCareFacility_baseContact_map.contact_order INTEGER;
|
||||
String contact_type = ct_healthCareFacility_contact_map.contact_type VARCHAR(100);
|
||||
BigDecimal contact_order = ct_healthCareFacility_contact_map.contact_order INTEGER;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,13 +4,10 @@
|
|||
<table name="acs_objects"/>
|
||||
<table name="cms_items"/>
|
||||
<table name="ct_genericorganizations"/>
|
||||
<table name="ct_baseAddresses"/>
|
||||
<table name="ct_baseContacts"/>
|
||||
<initializer class="com.arsdigita.cms.Initializer"/>
|
||||
</requires>
|
||||
<provides>
|
||||
<table name="ct_healtCareFacilities"/>
|
||||
<!-- <table name="ct_healtCareFacility_baseContact_map"/> -->
|
||||
<table name="ct_healthCareFacilities"/>
|
||||
<initializer class="com.arsdigita.cms.contenttypes.HealthCareFacilityInitializer"/>
|
||||
</provides>
|
||||
<scripts>
|
||||
|
|
|
|||
|
|
@ -123,12 +123,12 @@ public class HealthCareFacility extends GenericOrganization {
|
|||
/* accessors *************************************************/
|
||||
|
||||
// Get the address for this contact
|
||||
public BaseAddress getAddress() {
|
||||
return (BaseAddress)DomainObjectFactory.newInstance((DataObject)get(ADDRESS));
|
||||
public com.arsdigita.cms.basetypes.Address getAddress() {
|
||||
return (com.arsdigita.cms.basetypes.Address)DomainObjectFactory.newInstance((DataObject)get(ADDRESS));
|
||||
}
|
||||
|
||||
// Set the address for this contact
|
||||
public void setAddress(BaseAddress address) {
|
||||
public void setAddress(com.arsdigita.cms.basetypes.Address address) {
|
||||
set(ADDRESS, address);
|
||||
}
|
||||
|
||||
|
|
@ -138,13 +138,13 @@ public class HealthCareFacility extends GenericOrganization {
|
|||
}
|
||||
|
||||
// Get all contacts for this health care facility
|
||||
public BaseContactCollection getContacts() {
|
||||
return new BaseContactCollection((DataCollection) get(CONTACTS));
|
||||
public HealthCareFacilityContactCollection getContacts() {
|
||||
return new HealthCareFacilityContactCollection((DataCollection) get(CONTACTS));
|
||||
}
|
||||
|
||||
// Add a contact for this health care facility
|
||||
public void addContact(BaseContact contact, String contactType) {
|
||||
Assert.exists(contact, BaseContact.class);
|
||||
public void addContact(com.arsdigita.cms.basetypes.Contact contact, String contactType) {
|
||||
Assert.exists(contact, com.arsdigita.cms.basetypes.Contact.class);
|
||||
|
||||
DataObject link = add(CONTACTS, contact);
|
||||
|
||||
|
|
@ -156,8 +156,8 @@ public class HealthCareFacility extends GenericOrganization {
|
|||
}
|
||||
|
||||
// Remove a contect for this health care facility
|
||||
public void removeContactEntry(BaseContact contact) {
|
||||
Assert.exists(contact, BaseContact.class);
|
||||
public void removeContactEntry(com.arsdigita.cms.basetypes.Contact contact) {
|
||||
Assert.exists(contact, com.arsdigita.cms.basetypes.Contact.class);
|
||||
remove(CONTACTS, contact);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,9 @@ public final class HealthCareFacilityConfig extends AbstractConfig {
|
|||
StringTokenizer keys = getContactTypeKeys();
|
||||
while(keys.hasMoreElements()) {
|
||||
index++;
|
||||
if(keys.nextToken().equals(key)) break;
|
||||
if(keys.nextToken().equals(key)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* BaseContactCollection.java
|
||||
* HealthCareFacilityContactCollection.java
|
||||
*
|
||||
* Created on 26. Juli 2009, 15:30
|
||||
*
|
||||
|
|
@ -17,16 +17,16 @@ import java.math.BigDecimal;
|
|||
*
|
||||
* @author quasi
|
||||
*/
|
||||
public class BaseContactCollection extends DomainCollection {
|
||||
public class HealthCareFacilityContactCollection extends DomainCollection {
|
||||
|
||||
public static final String ORDER = "link.contact_order asc";
|
||||
public static final String CONTACT_TYPE = "link.contact_type";
|
||||
public static final String CONTACT_ORDER = "link.contact_order";
|
||||
|
||||
/**
|
||||
* Creates a new instance of BaseContactCollection
|
||||
* Creates a new instance of HealthCareFacilityContactCollection
|
||||
*/
|
||||
public BaseContactCollection(DataCollection dataCollection) {
|
||||
public HealthCareFacilityContactCollection(DataCollection dataCollection) {
|
||||
super(dataCollection);
|
||||
|
||||
m_dataCollection.addOrder(ORDER);
|
||||
|
|
@ -39,7 +39,7 @@ public class BaseContactCollection extends DomainCollection {
|
|||
|
||||
// Set the contact type of the link
|
||||
// public void setContactType(String contactType) {
|
||||
// getBaseContact().set(CONTACT_TYPE, contactType);
|
||||
// getContact().set(CONTACT_TYPE, contactType);
|
||||
// }
|
||||
|
||||
// Get the contact order of the link
|
||||
|
|
@ -55,11 +55,11 @@ public class BaseContactCollection extends DomainCollection {
|
|||
|
||||
// Set the contact order of the link
|
||||
// public void setContactOrder(long contactOrder) {
|
||||
// getBaseContact().set(CONTACT_ORDER, String.valueOf(contactOrder));
|
||||
// getContact().set(CONTACT_ORDER, String.valueOf(contactOrder));
|
||||
// }
|
||||
|
||||
public BaseContact getBaseContact() {
|
||||
return new BaseContact(m_dataCollection.getDataObject());
|
||||
public com.arsdigita.cms.basetypes.Contact getContact() {
|
||||
return new com.arsdigita.cms.basetypes.Contact(m_dataCollection.getDataObject());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -18,9 +18,7 @@
|
|||
*/
|
||||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.*;
|
||||
import org.apache.log4j.Logger;
|
||||
import com.arsdigita.runtime.LegacyInitEvent;
|
||||
|
||||
/**
|
||||
* Initializer of the HealthCareFacility content type.
|
||||
|
|
@ -48,15 +46,4 @@ public class HealthCareFacilityInitializer extends ContentTypeInitializer {
|
|||
public String getStylesheet() {
|
||||
return "static/content-types/com/arsdigita/cms/contenttypes/HealthCareFacility.xsl";
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls the init method of the parent class.
|
||||
*
|
||||
* @param evt The init event. LegacyInitEvent is marked deprecated. What should be used insted?
|
||||
*/
|
||||
@Override
|
||||
public void init(LegacyInitEvent evt) {
|
||||
super.init(evt);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package com.arsdigita.cms.contenttypes;
|
||||
|
||||
import com.arsdigita.cms.contenttypes.*;
|
||||
import com.arsdigita.util.parameter.ResourceParameter;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.PageState;
|
||||
|
|
@ -18,9 +17,8 @@ import com.arsdigita.domain.DomainObject;
|
|||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||
import com.arsdigita.bebop.Component;
|
||||
import com.arsdigita.bebop.Label;
|
||||
import com.arsdigita.cms.contenttypes.BaseAddress;
|
||||
import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
||||
import com.arsdigita.cms.contenttypes.util.BaseAddressGlobalizationUtil;
|
||||
import com.arsdigita.cms.basetypes.util.BasetypesGlobalizationUtil;
|
||||
import com.arsdigita.cms.contenttypes.util.HealthCareFacilityGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
|
||||
|
|
@ -29,85 +27,86 @@ import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
|||
* @author quasi
|
||||
*/
|
||||
public class HealthCareFacilityAddressPropertiesStep extends SimpleEditStep {
|
||||
|
||||
|
||||
public static final String ADD_ADDRESS_SHEET_NAME = "addAddress";
|
||||
public static final String EDIT_ADDRESS_SHEET_NAME = "editAddress";
|
||||
public static final String CHANGE_ADDRESS_SHEET_NAME = "changeAddress";
|
||||
public static final String DELETE_ADDRESS_SHEET_NAME = "deleteAddress";
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of HealthCareFacilityAddressPropertiesStep
|
||||
*/
|
||||
public HealthCareFacilityAddressPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, "");
|
||||
}
|
||||
|
||||
|
||||
public HealthCareFacilityAddressPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent, String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
|
||||
// HealthCareFacility healthCareFacility = (HealthCareFacility)itemModel.getSelectedObject(state);
|
||||
|
||||
|
||||
//XXX
|
||||
// if(/*healthCareFacility.getAddress() == null*/ true) {
|
||||
BasicPageForm attachAddressSheet = new HealthCareFacilityAttachAddressPropertyForm(itemModel, this);
|
||||
add(ADD_ADDRESS_SHEET_NAME, (String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.attach_address").localize(), new WorkflowLockedComponentAccess(attachAddressSheet, itemModel), attachAddressSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
add(ADD_ADDRESS_SHEET_NAME, (String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.attach_address").localize(), new WorkflowLockedComponentAccess(attachAddressSheet, itemModel), attachAddressSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
/* Set the displayComponent for this step */
|
||||
// setDisplayComponent(getEmptyBaseAddressPropertySheet(itemModel));
|
||||
|
||||
|
||||
// } else {
|
||||
|
||||
|
||||
// editAddress
|
||||
BasicPageForm editAddressSheet = new HealthCareFacilityEditAddressPropertyForm(itemModel, this);
|
||||
add(EDIT_ADDRESS_SHEET_NAME, (String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.edit_address").localize(), new WorkflowLockedComponentAccess(editAddressSheet, itemModel), editAddressSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
add(EDIT_ADDRESS_SHEET_NAME, (String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.edit_address").localize(), new WorkflowLockedComponentAccess(editAddressSheet, itemModel), editAddressSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
// BasicPageForm attachAddressSheet = new HealthCareFacilityAttachAddressPropertyForm(itemModel, this);
|
||||
// add(CHANGE_ADDRESS_SHEET_NAME, (String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.reattach_address").localize(), new WorkflowLockedComponentAccess(attachAddressSheet, itemModel), attachAddressSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
|
||||
BasicPageForm deleteAddressSheet = new HealthCareFacilityDeleteAddressForm(itemModel, this);
|
||||
add(DELETE_ADDRESS_SHEET_NAME, (String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.delete_address").localize(), new WorkflowLockedComponentAccess(deleteAddressSheet, itemModel), deleteAddressSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
add(DELETE_ADDRESS_SHEET_NAME, (String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.delete_address").localize(), new WorkflowLockedComponentAccess(deleteAddressSheet, itemModel), deleteAddressSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
/* Set the displayComponent for this step */
|
||||
setDisplayComponent(getBaseAddressPropertySheet(itemModel));
|
||||
setDisplayComponent(getAddressPropertySheet(itemModel));
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static Component getBaseAddressPropertySheet(ItemSelectionModel itemModel) {
|
||||
|
||||
|
||||
public static Component getAddressPropertySheet(ItemSelectionModel itemModel) {
|
||||
|
||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||
|
||||
sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.address").localize(), "address." + BaseAddress.ADDRESS);
|
||||
if(!HealthCareFacility.getConfig().getHideAddressPostalCode())
|
||||
sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.postal_code").localize(), "address." + BaseAddress.POSTAL_CODE);
|
||||
sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.city").localize(), "address." + BaseAddress.CITY);
|
||||
if(!HealthCareFacility.getConfig().getHideAddressState())
|
||||
sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.state").localize(), "address." + BaseAddress.STATE);
|
||||
|
||||
if(!HealthCareFacility.getConfig().getHideAddressCountry()) {
|
||||
sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.iso_country_code").localize(),
|
||||
"address." + BaseAddress.ISO_COUNTRY_CODE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
public String format(DomainObject item,
|
||||
String attribute,
|
||||
PageState state) {
|
||||
BaseAddress baseAddress = ((HealthCareFacility)item).getAddress();
|
||||
if(baseAddress != null && baseAddress.getIsoCountryCode() != null) {
|
||||
return BaseAddress.getCountryNameFromIsoCode(baseAddress.getIsoCountryCode());
|
||||
} else {
|
||||
return (String)BaseAddressGlobalizationUtil.globalize
|
||||
("cms.ui.unknown").localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.address").localize(), "address." + com.arsdigita.cms.basetypes.Address.ADDRESS);
|
||||
if (!HealthCareFacility.getConfig().getHideAddressPostalCode()) {
|
||||
sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.postal_code").localize(), "address." + com.arsdigita.cms.basetypes.Address.POSTAL_CODE);
|
||||
}
|
||||
|
||||
sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.city").localize(), "address." + com.arsdigita.cms.basetypes.Address.CITY);
|
||||
if (!HealthCareFacility.getConfig().getHideAddressState()) {
|
||||
sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.state").localize(), "address." + com.arsdigita.cms.basetypes.Address.STATE);
|
||||
}
|
||||
|
||||
if (!HealthCareFacility.getConfig().getHideAddressCountry()) {
|
||||
sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.iso_country_code").localize(),
|
||||
"address." + com.arsdigita.cms.basetypes.Address.ISO_COUNTRY_CODE,
|
||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
|
||||
public String format(DomainObject item,
|
||||
String attribute,
|
||||
PageState state) {
|
||||
com.arsdigita.cms.basetypes.Address address = ((HealthCareFacility) item).getAddress();
|
||||
if (address != null && address.getIsoCountryCode() != null) {
|
||||
return com.arsdigita.cms.basetypes.Address.getCountryNameFromIsoCode(address.getIsoCountryCode());
|
||||
} else {
|
||||
return (String) BasetypesGlobalizationUtil.globalize("cms.ui.unknown").localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return sheet;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static Component getEmptyBaseAddressPropertySheet(ItemSelectionModel itemModel) {
|
||||
return new Label(((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.emptyAddress").localize()));
|
||||
|
||||
public static Component getEmptyAddressPropertySheet(ItemSelectionModel itemModel) {
|
||||
return new Label(((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.emptyAddress").localize()));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.FormData;
|
||||
|
|
@ -23,7 +22,6 @@ import com.arsdigita.bebop.event.PrintListener;
|
|||
import com.arsdigita.bebop.form.Submit;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import com.arsdigita.cms.contenttypes.BaseAddress;
|
||||
import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
|
|
@ -37,28 +35,26 @@ import org.apache.log4j.Logger;
|
|||
* @author quasi
|
||||
*/
|
||||
public class HealthCareFacilityAttachAddressPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
||||
|
||||
|
||||
private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertyForm.class);
|
||||
|
||||
private HealthCareFacilityAddressPropertiesStep m_step;
|
||||
private ItemSearchWidget m_itemSearch;
|
||||
private SaveCancelSection m_saveCancelSection;
|
||||
private final String ITEM_SEARCH = "healthCareFacilityAddress";
|
||||
|
||||
/**
|
||||
* ID of the form
|
||||
*/
|
||||
public static final String ID = "HealthCareFacilityAttachAddress";
|
||||
|
||||
|
||||
/**
|
||||
* Constrctor taking an ItemSelectionModel
|
||||
*
|
||||
* @param itemModel
|
||||
*/
|
||||
public HealthCareFacilityAttachAddressPropertyForm(ItemSelectionModel itemModel) {
|
||||
public HealthCareFacilityAttachAddressPropertyForm(ItemSelectionModel itemModel) {
|
||||
this(itemModel, null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Constrctor taking an ItemSelectionModel and an instance of HealthCareFacilityPropertiesStep.
|
||||
*
|
||||
|
|
@ -68,60 +64,60 @@ public class HealthCareFacilityAttachAddressPropertyForm extends BasicPageForm i
|
|||
public HealthCareFacilityAttachAddressPropertyForm(ItemSelectionModel itemModel, HealthCareFacilityAddressPropertiesStep step) {
|
||||
super(ID, itemModel);
|
||||
addSubmissionListener(this);
|
||||
|
||||
|
||||
addSaveCancelSection();
|
||||
|
||||
|
||||
addInitListener(this);
|
||||
addSubmissionListener(this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
add(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address").localize()));
|
||||
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.BaseAddress"));
|
||||
add(new Label((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address").localize()));
|
||||
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.basetypes.Address"));
|
||||
add(this.m_itemSearch);
|
||||
}
|
||||
|
||||
|
||||
public void init(FormSectionEvent fse) {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
setVisible(state, true);
|
||||
|
||||
|
||||
if (healthCareFacility != null) {
|
||||
data.put(ITEM_SEARCH, healthCareFacility.getAddress());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void process(FormSectionEvent fse) {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
||||
healthCareFacility.setAddress((BaseAddress)data.get(ITEM_SEARCH));
|
||||
healthCareFacility.setAddress((com.arsdigita.cms.basetypes.Address) data.get(ITEM_SEARCH));
|
||||
}
|
||||
init(fse);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Creates the section with the save and the cancel button.
|
||||
*/
|
||||
@Override
|
||||
public void addSaveCancelSection() {
|
||||
try {
|
||||
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
|
||||
|
||||
|
||||
public void prepare(PrintEvent e) {
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(e.getPageState());
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(e.getPageState());
|
||||
Submit target = (Submit) e.getTarget();
|
||||
|
||||
|
||||
if (healthCareFacility.getAddress() != null) {
|
||||
target.setButtonLabel((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.change").localize());
|
||||
target.setButtonLabel((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.change").localize());
|
||||
} else {
|
||||
target.setButtonLabel((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.add").localize());
|
||||
target.setButtonLabel((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.add").localize());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -129,17 +125,18 @@ public class HealthCareFacilityAttachAddressPropertyForm extends BasicPageForm i
|
|||
throw new UncheckedWrapperException("this cannot happen", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void validate(FormSectionEvent e) throws FormProcessException {
|
||||
if (e.getFormData().get(ITEM_SEARCH) == null) {
|
||||
throw new FormProcessException((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.wrong_type").localize());
|
||||
throw new FormProcessException((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.wrong_type").localize());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void submitted(FormSectionEvent e) throws FormProcessException {
|
||||
if (getSaveCancelSection().getCancelButton().isSelected(e.getPageState())) {
|
||||
init(e);
|
||||
throw new FormProcessException((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.cancelled").localize());
|
||||
throw new FormProcessException((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address.cancelled").localize());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2004 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.util.HealthCareFacilityGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||
|
||||
/**
|
||||
* A UI step to manipulate <code>Phones </code> for the Contact object
|
||||
* which is retrieved from the ItemSelectionModel.
|
||||
*
|
||||
*
|
||||
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
|
||||
* @version $Id: PhoBaseContactEntriesPropertiesStepva 287 2005-02-22 00:29:02Z sskracic $
|
||||
*/
|
||||
public class HealthCareFacilityBaseContactPropertiesStep extends SimpleEditStep {
|
||||
|
||||
/** The name of the editing sheet added to this step */
|
||||
private static String ADD_CONTACT_SHEET_NAME = "addContact";
|
||||
|
||||
public HealthCareFacilityBaseContactPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public HealthCareFacilityBaseContactPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent, String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addContactSheet = new HealthCareFacilityBaseContactAddForm(itemModel);
|
||||
add(ADD_CONTACT_SHEET_NAME,
|
||||
(String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.add_contact").localize(),
|
||||
new WorkflowLockedComponentAccess(addContactSheet, itemModel),
|
||||
addContactSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
HealthCareFacilityBaseContactTable contactsTable = new HealthCareFacilityBaseContactTable(itemModel);
|
||||
setDisplayComponent(contactsTable);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -28,12 +28,11 @@ import com.arsdigita.bebop.form.SingleSelect;
|
|||
import com.arsdigita.bebop.parameters.NotNullValidationListener;
|
||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.BaseContact;
|
||||
import com.arsdigita.cms.contenttypes.util.BaseContactGlobalizationUtil;
|
||||
import com.arsdigita.cms.basetypes.util.BasetypesGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.bebop.parameters.StringParameter;
|
||||
import com.arsdigita.cms.ContentType;
|
||||
import com.arsdigita.cms.contenttypes.BaseContactCollection;
|
||||
import com.arsdigita.cms.contenttypes.HealthCareFacilityContactCollection;
|
||||
import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
||||
import com.arsdigita.cms.contenttypes.util.HealthCareFacilityGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||
|
|
@ -49,67 +48,67 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
|
||||
*/
|
||||
public class HealthCareFacilityBaseContactAddForm extends BasicItemForm {
|
||||
private static final Logger s_log = Logger.getLogger(HealthCareFacilityBaseContactAddForm.class);
|
||||
|
||||
public class HealthCareFacilityContactAddForm extends BasicItemForm {
|
||||
|
||||
private static final Logger s_log = Logger.getLogger(HealthCareFacilityContactAddForm.class);
|
||||
private HealthCareFacilityAddressPropertiesStep m_step;
|
||||
private ItemSearchWidget m_itemSearch;
|
||||
private SaveCancelSection m_saveCancelSection;
|
||||
private final String ITEM_SEARCH = "healthCareFacilityAddress";
|
||||
|
||||
private ItemSelectionModel m_itemModel;
|
||||
|
||||
|
||||
/** Creates a new instance of CategoryLocalizationAddForm */
|
||||
public HealthCareFacilityBaseContactAddForm(ItemSelectionModel itemModel) {
|
||||
|
||||
super("BaseContactEntryAddForm",itemModel);
|
||||
public HealthCareFacilityContactAddForm(ItemSelectionModel itemModel) {
|
||||
|
||||
super("ContactEntryAddForm", itemModel);
|
||||
m_itemModel = itemModel;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void addWidgets() {
|
||||
|
||||
|
||||
// Attach a Contact object
|
||||
add(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_contact").localize()));
|
||||
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.BaseContact"));
|
||||
add(new Label((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_contact").localize()));
|
||||
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.Contact"));
|
||||
add(this.m_itemSearch);
|
||||
|
||||
|
||||
// Contact type field
|
||||
add(new Label(BaseContactGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact.type")));
|
||||
ParameterModel contactTypeParam = new StringParameter(BaseContactCollection.CONTACT_TYPE);
|
||||
add(new Label(HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact.type")));
|
||||
ParameterModel contactTypeParam = new StringParameter(HealthCareFacilityContactCollection.CONTACT_TYPE);
|
||||
SingleSelect contactType = new SingleSelect(contactTypeParam);
|
||||
contactType.addValidationListener(new NotNullValidationListener());
|
||||
contactType.addOption(new Option("", new Label((String)BaseContactGlobalizationUtil.globalize("cms.ui.select_one").localize())));
|
||||
|
||||
contactType.addOption(new Option("", new Label((String) BasetypesGlobalizationUtil.globalize("cms.ui.select_one").localize())));
|
||||
|
||||
// Add the Options to the SingleSelect widget
|
||||
StringTokenizer keyList = HealthCareFacility.getConfig().getContactTypeKeys();
|
||||
while(keyList.hasMoreElements()) {
|
||||
while (keyList.hasMoreElements()) {
|
||||
String currentKey = keyList.nextToken();
|
||||
contactType.addOption(new Option(currentKey, ((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contactType.key." + currentKey).localize())));
|
||||
contactType.addOption(new Option(currentKey, ((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contactType.key." + currentKey).localize())));
|
||||
}
|
||||
|
||||
|
||||
add(contactType);
|
||||
}
|
||||
|
||||
|
||||
public void init(FormSectionEvent fse) {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
setVisible(state, true);
|
||||
}
|
||||
|
||||
|
||||
public void process(FormSectionEvent fse) {
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
//
|
||||
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
||||
healthCareFacility.addContact((BaseContact)data.get(ITEM_SEARCH),
|
||||
(String)data.get(BaseContactCollection.CONTACT_TYPE));
|
||||
healthCareFacility.addContact((com.arsdigita.cms.basetypes.Contact) data.get(ITEM_SEARCH),
|
||||
(String) data.get(HealthCareFacilityContactCollection.CONTACT_TYPE));
|
||||
}
|
||||
|
||||
|
||||
init(fse);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* Copyright (C) 2004 Red Hat Inc. All Rights Reserved.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2.1 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.contenttypes.util.HealthCareFacilityGlobalizationUtil;
|
||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
|
||||
|
||||
/**
|
||||
* @author Sören Bernstein
|
||||
*/
|
||||
public class HealthCareFacilityContactPropertiesStep extends SimpleEditStep {
|
||||
|
||||
/** The name of the editing sheet added to this step */
|
||||
private static String ADD_CONTACT_SHEET_NAME = "addContact";
|
||||
|
||||
public HealthCareFacilityContactPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) {
|
||||
this(itemModel, parent, null);
|
||||
}
|
||||
|
||||
public HealthCareFacilityContactPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent, String prefix) {
|
||||
super(itemModel, parent, prefix);
|
||||
|
||||
BasicItemForm addContactSheet = new HealthCareFacilityContactAddForm(itemModel);
|
||||
add(ADD_CONTACT_SHEET_NAME,
|
||||
(String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.add_contact").localize(),
|
||||
new WorkflowLockedComponentAccess(addContactSheet, itemModel),
|
||||
addContactSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
HealthCareFacilityContactTable contactsTable = new HealthCareFacilityContactTable(itemModel);
|
||||
setDisplayComponent(contactsTable);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -32,8 +32,7 @@ import com.arsdigita.bebop.table.TableModel;
|
|||
import com.arsdigita.bebop.table.TableModelBuilder;
|
||||
import com.arsdigita.cms.ItemSelectionModel;
|
||||
import com.arsdigita.cms.SecurityManager;
|
||||
import com.arsdigita.cms.contenttypes.BaseContact;
|
||||
import com.arsdigita.cms.contenttypes.BaseContactCollection;
|
||||
import com.arsdigita.cms.contenttypes.HealthCareFacilityContactCollection;
|
||||
import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
||||
import com.arsdigita.cms.contenttypes.util.HealthCareFacilityGlobalizationUtil;
|
||||
import com.arsdigita.cms.dispatcher.Utilities;
|
||||
|
|
@ -46,112 +45,109 @@ import java.math.BigDecimal;
|
|||
*
|
||||
* @author Sören Bernstein (quasimodo) quasi@barkhof.uni-bremen.de
|
||||
*/
|
||||
public class HealthCareFacilityBaseContactTable extends Table implements TableActionListener{
|
||||
|
||||
|
||||
public class HealthCareFacilityContactTable extends Table implements TableActionListener {
|
||||
|
||||
private final String TABLE_COL_EDIT = "table_col_edit";
|
||||
private final String TABLE_COL_DEL = "table_col_del";
|
||||
|
||||
private final String TABLE_COL_DEL = "table_col_del";
|
||||
private ItemSelectionModel m_itemModel;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new instance of HealthCareFacilityHealthCareFacilityTable
|
||||
*/
|
||||
public HealthCareFacilityBaseContactTable(final ItemSelectionModel itemModel) {
|
||||
|
||||
public HealthCareFacilityContactTable(final ItemSelectionModel itemModel) {
|
||||
|
||||
super();
|
||||
this.m_itemModel = itemModel;
|
||||
|
||||
|
||||
// if table is empty:
|
||||
setEmptyView(new Label(HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contacts.none")));
|
||||
TableColumnModel tab_model = getColumnModel();
|
||||
|
||||
|
||||
// define columns
|
||||
tab_model.add(new TableColumn(0, HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact.order").localize(), TABLE_COL_EDIT));
|
||||
tab_model.add(new TableColumn(1, HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact.type").localize()));
|
||||
tab_model.add(new TableColumn(2, HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact.title").localize()));
|
||||
tab_model.add(new TableColumn(3, HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact.action").localize(), TABLE_COL_DEL));
|
||||
|
||||
|
||||
setModelBuilder(new HealthCareFacilityTableModelBuilder(itemModel));
|
||||
|
||||
|
||||
tab_model.get(0).setCellRenderer(new EditCellRenderer());
|
||||
tab_model.get(3).setCellRenderer(new DeleteCellRenderer());
|
||||
|
||||
|
||||
addTableActionListener(this);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* XXXX
|
||||
*
|
||||
*/
|
||||
private class HealthCareFacilityTableModelBuilder extends LockableImpl implements TableModelBuilder {
|
||||
|
||||
|
||||
private ItemSelectionModel m_itemModel;
|
||||
|
||||
|
||||
public HealthCareFacilityTableModelBuilder(ItemSelectionModel itemModel) {
|
||||
m_itemModel = itemModel;
|
||||
}
|
||||
|
||||
|
||||
public TableModel makeModel(Table table, PageState state) {
|
||||
table.getRowSelectionModel().clearSelection(state);
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) m_itemModel.getSelectedObject(state);
|
||||
return new HealthCareFacilityTableModel(table, state, healthCareFacility);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* XXX
|
||||
*
|
||||
*/
|
||||
private class HealthCareFacilityTableModel implements TableModel {
|
||||
|
||||
|
||||
final private int MAX_DESC_LENGTH = 25;
|
||||
|
||||
private Table m_table;
|
||||
private BaseContactCollection m_baseContactCollection;
|
||||
private BaseContact m_baseContact;
|
||||
|
||||
private HealthCareFacilityContactCollection m_contactCollection;
|
||||
private com.arsdigita.cms.basetypes.Contact m_contact;
|
||||
|
||||
private HealthCareFacilityTableModel(Table t, PageState ps, HealthCareFacility healthCareFacility) {
|
||||
m_table = t;
|
||||
m_baseContactCollection = healthCareFacility.getContacts();
|
||||
m_contactCollection = healthCareFacility.getContacts();
|
||||
}
|
||||
|
||||
|
||||
public int getColumnCount() {
|
||||
return m_table.getColumnModel().size();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check collection for the existence of another row.
|
||||
*
|
||||
* If exists, fetch the value of current HealthCareFacilityEntryCollection object
|
||||
* into m_healthCareFacilityEntry class variable.
|
||||
* into m_comntact class variable.
|
||||
*/
|
||||
public boolean nextRow() {
|
||||
|
||||
if(m_baseContactCollection != null && m_baseContactCollection.next()){
|
||||
m_baseContact = m_baseContactCollection.getBaseContact();
|
||||
|
||||
if (m_contactCollection != null && m_contactCollection.next()) {
|
||||
m_contact = m_contactCollection.getContact();
|
||||
return true;
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the
|
||||
* @see com.arsdigita.bebop.table.TableModel#getElementAt(int)
|
||||
*/
|
||||
public Object getElementAt(int columnIndex) {
|
||||
switch (columnIndex){
|
||||
switch (columnIndex) {
|
||||
case 0:
|
||||
return m_baseContactCollection.getContactOrder();
|
||||
return m_contactCollection.getContactOrder();
|
||||
case 1:
|
||||
return (String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contactType.key." + m_baseContactCollection.getContactType()).localize();
|
||||
return (String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contactType.key." + m_contactCollection.getContactType()).localize();
|
||||
case 2:
|
||||
return m_baseContact.getTitle();
|
||||
return m_contact.getTitle();
|
||||
// case 2:
|
||||
// return (m_healthCareFacilityEntry.getDescription() != null && m_healthCareFacilityEntry.getDescription().length() > MAX_DESC_LENGTH)
|
||||
// ? m_healthCareFacilityEntry.getDescription().substring(0, MAX_DESC_LENGTH)
|
||||
|
|
@ -162,34 +158,33 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @see com.arsdigita.bebop.table.TableModel#getKeyAt(int)
|
||||
*/
|
||||
public Object getKeyAt(int columnIndex) {
|
||||
return m_baseContact.getID();
|
||||
return m_contact.getID();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check for the permissions to edit item and put either a Label or
|
||||
* a ControlLink accordingly.
|
||||
*/
|
||||
private class EditCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||
|
||||
|
||||
public Component getComponent(Table table, PageState state, Object value,
|
||||
boolean isSelected, Object key,
|
||||
int row, int column) {
|
||||
|
||||
|
||||
SecurityManager sm = Utilities.getSecurityManager(state);
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) m_itemModel.getSelectedObject(state);
|
||||
|
||||
|
||||
boolean canEdit = sm.canAccess(state.getRequest(),
|
||||
SecurityManager.EDIT_ITEM,
|
||||
healthCareFacility);
|
||||
if(canEdit) {
|
||||
if (canEdit) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
return link;
|
||||
} else {
|
||||
|
|
@ -197,24 +192,24 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check for the permissions to delete item and put either a Label or
|
||||
* a ControlLink accordingly.
|
||||
*/
|
||||
private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer {
|
||||
|
||||
|
||||
public Component getComponent(Table table, PageState state, Object value,
|
||||
boolean isSelected, Object key,
|
||||
int row, int column) {
|
||||
|
||||
|
||||
SecurityManager sm = Utilities.getSecurityManager(state);
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) m_itemModel.getSelectedObject(state);
|
||||
|
||||
|
||||
boolean canDelete = sm.canAccess(state.getRequest(),
|
||||
SecurityManager.DELETE_ITEM,
|
||||
healthCareFacility);
|
||||
if(canDelete) {
|
||||
if (canDelete) {
|
||||
ControlLink link = new ControlLink(value.toString());
|
||||
link.setConfirmation((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.confirm_delete").localize());
|
||||
return link;
|
||||
|
|
@ -223,38 +218,37 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provide implementation to TableActionListener method.
|
||||
* Code that comes into picture when a link on the table is clicked.
|
||||
* Handles edit and delete event.
|
||||
*/
|
||||
public void cellSelected(TableActionEvent evt) {
|
||||
|
||||
|
||||
PageState state = evt.getPageState();
|
||||
|
||||
// Get selected BaseContact
|
||||
BaseContact baseContact =
|
||||
new BaseContact(new BigDecimal(evt.getRowKey().toString()));
|
||||
|
||||
|
||||
// Get selected Contact
|
||||
com.arsdigita.cms.basetypes.Contact contact =
|
||||
new com.arsdigita.cms.basetypes.Contact(new BigDecimal(evt.getRowKey().toString()));
|
||||
|
||||
// Get HealthCareFacility
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) m_itemModel.getSelectedObject(state);
|
||||
|
||||
|
||||
// Get selected column
|
||||
TableColumn col = getColumnModel().get(evt.getColumn().intValue());
|
||||
|
||||
|
||||
// Edit
|
||||
if(col.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
||||
|
||||
if (col.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
||||
}
|
||||
|
||||
|
||||
// Delete
|
||||
if(col.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
||||
healthCareFacility.removeContactEntry(baseContact);
|
||||
if (col.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
||||
healthCareFacility.removeContactEntry(contact);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* provide Implementation to TableActionListener method.
|
||||
* Does nothing in our case.
|
||||
|
|
@ -262,6 +256,4 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
|||
public void headSelected(TableActionEvent e) {
|
||||
throw new UnsupportedOperationException("Not Implemented");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -6,7 +6,6 @@
|
|||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.FormProcessException;
|
||||
|
|
@ -28,7 +27,7 @@ import com.arsdigita.util.UncheckedWrapperException;
|
|||
* @author quasi
|
||||
*/
|
||||
public class HealthCareFacilityDeleteAddressForm extends BasicPageForm implements FormProcessListener {
|
||||
|
||||
|
||||
/**
|
||||
* ID of the form
|
||||
*/
|
||||
|
|
@ -40,39 +39,39 @@ public class HealthCareFacilityDeleteAddressForm extends BasicPageForm implement
|
|||
}
|
||||
|
||||
public void init(FormSectionEvent fse) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
add(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.delete_address.label").localize()));
|
||||
add(new Label((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.delete_address.label").localize()));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates the section with the save and the cancel button.
|
||||
*/
|
||||
@Override
|
||||
public void addSaveCancelSection() {
|
||||
try {
|
||||
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
|
||||
|
||||
public void prepare(PrintEvent e) {
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(e.getPageState());
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(e.getPageState());
|
||||
Submit target = (Submit) e.getTarget();
|
||||
target.setButtonLabel((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.delete_address.button_label").localize());
|
||||
target.setButtonLabel((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.delete_address.button_label").localize());
|
||||
}
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
throw new UncheckedWrapperException("this cannot happen", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public final void process(final FormSectionEvent fse) throws FormProcessException {
|
||||
|
||||
|
||||
final PageState state = fse.getPageState();
|
||||
final HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
final HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
if (healthCareFacility != null && healthCareFacility.getAddress() != null) {
|
||||
healthCareFacility.unsetAddress();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@
|
|||
* To change this template, choose Tools | Template Manager
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.arsdigita.cms.contenttypes.ui;
|
||||
|
||||
import com.arsdigita.bebop.FormData;
|
||||
|
|
@ -32,9 +31,8 @@ import com.arsdigita.cms.ItemSelectionModel;
|
|||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import com.arsdigita.cms.contenttypes.BaseAddress;
|
||||
import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
||||
import com.arsdigita.cms.contenttypes.util.BaseAddressGlobalizationUtil;
|
||||
import com.arsdigita.cms.basetypes.util.BasetypesGlobalizationUtil;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
|
@ -43,17 +41,14 @@ import org.apache.log4j.Logger;
|
|||
* @author quasi
|
||||
*/
|
||||
public class HealthCareFacilityEditAddressPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
||||
|
||||
|
||||
private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertyForm.class);
|
||||
|
||||
private HealthCareFacilityAddressPropertiesStep m_step;
|
||||
|
||||
public static final String ADDRESS = BaseAddress.ADDRESS;
|
||||
public static final String POSTAL_CODE = BaseAddress.POSTAL_CODE;
|
||||
public static final String CITY = BaseAddress.CITY;
|
||||
public static final String STATE = BaseAddress.STATE;
|
||||
public static final String ISO_COUNTRY_CODE = BaseAddress.ISO_COUNTRY_CODE;
|
||||
|
||||
public static final String ADDRESS = com.arsdigita.cms.basetypes.Address.ADDRESS;
|
||||
public static final String POSTAL_CODE = com.arsdigita.cms.basetypes.Address.POSTAL_CODE;
|
||||
public static final String CITY = com.arsdigita.cms.basetypes.Address.CITY;
|
||||
public static final String STATE = com.arsdigita.cms.basetypes.Address.STATE;
|
||||
public static final String ISO_COUNTRY_CODE = com.arsdigita.cms.basetypes.Address.ISO_COUNTRY_CODE;
|
||||
/**
|
||||
* ID of the form
|
||||
*/
|
||||
|
|
@ -64,7 +59,7 @@ public class HealthCareFacilityEditAddressPropertyForm extends BasicPageForm imp
|
|||
*
|
||||
* @param itemModel
|
||||
*/
|
||||
public HealthCareFacilityEditAddressPropertyForm(ItemSelectionModel itemModel) {
|
||||
public HealthCareFacilityEditAddressPropertyForm(ItemSelectionModel itemModel) {
|
||||
this(itemModel, null);
|
||||
}
|
||||
|
||||
|
|
@ -82,61 +77,61 @@ public class HealthCareFacilityEditAddressPropertyForm extends BasicPageForm imp
|
|||
|
||||
@Override
|
||||
public void addWidgets() {
|
||||
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.address").localize()));
|
||||
ParameterModel addressParam = new StringParameter(ADDRESS);
|
||||
addressParam.addParameterListener( new NotNullValidationListener( ) );
|
||||
addressParam.addParameterListener( new StringInRangeValidationListener(0, 1000) );
|
||||
TextArea address = new TextArea(addressParam);
|
||||
add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.address").localize()));
|
||||
ParameterModel addressParam = new StringParameter(ADDRESS);
|
||||
addressParam.addParameterListener(new NotNullValidationListener());
|
||||
addressParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
|
||||
TextArea address = new TextArea(addressParam);
|
||||
address.setRows(5);
|
||||
address.setCols(30);
|
||||
add(address);
|
||||
add(address);
|
||||
|
||||
if(!HealthCareFacility.getConfig().getHideAddressPostalCode()) {
|
||||
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.postal_code").localize()));
|
||||
if (!HealthCareFacility.getConfig().getHideAddressPostalCode()) {
|
||||
add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.postal_code").localize()));
|
||||
ParameterModel postalCodeParam = new StringParameter(POSTAL_CODE);
|
||||
TextField postalCode = new TextField(postalCodeParam);
|
||||
/* XXX NumberListener ?*/
|
||||
add(postalCode);
|
||||
}
|
||||
|
||||
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.city").localize()));
|
||||
ParameterModel cityParam = new StringParameter(CITY);
|
||||
TextField city = new TextField(cityParam);
|
||||
add(city);
|
||||
add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.city").localize()));
|
||||
ParameterModel cityParam = new StringParameter(CITY);
|
||||
TextField city = new TextField(cityParam);
|
||||
add(city);
|
||||
|
||||
if(!HealthCareFacility.getConfig().getHideAddressState()) {
|
||||
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.state").localize()));
|
||||
if (!HealthCareFacility.getConfig().getHideAddressState()) {
|
||||
add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.state").localize()));
|
||||
ParameterModel stateParam = new StringParameter(STATE);
|
||||
TextField state = new TextField(stateParam);
|
||||
add(state);
|
||||
}
|
||||
|
||||
|
||||
if (!HealthCareFacility.getConfig().getHideAddressCountry()) {
|
||||
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.iso_country_code").localize()));
|
||||
add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.iso_country_code").localize()));
|
||||
ParameterModel countryParam = new StringParameter(ISO_COUNTRY_CODE);
|
||||
countryParam.addParameterListener(new StringInRangeValidationListener(0, 2));
|
||||
|
||||
|
||||
SingleSelect country = new SingleSelect(countryParam);
|
||||
|
||||
country.addOption(new Option("", new Label((String)BaseAddressGlobalizationUtil.globalize("cms.ui.select_one" ).localize())));
|
||||
country.addOption(new Option("", new Label((String) BasetypesGlobalizationUtil.globalize("cms.ui.select_one").localize())));
|
||||
|
||||
Iterator countries = BaseAddress.getSortedListOfCountries(null).entrySet().iterator();
|
||||
while(countries.hasNext()) {
|
||||
Map.Entry<String,String> elem = (Map.Entry<String,String>)countries.next();
|
||||
Iterator countries = com.arsdigita.cms.basetypes.Address.getSortedListOfCountries(null).entrySet().iterator();
|
||||
while (countries.hasNext()) {
|
||||
Map.Entry<String, String> elem = (Map.Entry<String, String>) countries.next();
|
||||
country.addOption(new Option(elem.getValue().toString(), elem.getKey().toString()));
|
||||
}
|
||||
|
||||
|
||||
country.addValidationListener(
|
||||
new ParameterListener() {
|
||||
public void validate(ParameterEvent e) throws FormProcessException {
|
||||
ParameterData data = e.getParameterData();
|
||||
String isoCode = (String) data.getValue() ;
|
||||
if (isoCode == null || isoCode.length() == 0) {
|
||||
data.addError((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.error_iso_country").localize());
|
||||
new ParameterListener() {
|
||||
|
||||
public void validate(ParameterEvent e) throws FormProcessException {
|
||||
ParameterData data = e.getParameterData();
|
||||
String isoCode = (String) data.getValue();
|
||||
if (isoCode == null || isoCode.length() == 0) {
|
||||
data.addError((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.error_iso_country").localize());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
add(country);
|
||||
}
|
||||
|
|
@ -144,46 +139,46 @@ public class HealthCareFacilityEditAddressPropertyForm extends BasicPageForm imp
|
|||
}
|
||||
|
||||
public void init(FormSectionEvent fse) {
|
||||
FormData data = fse.getFormData();
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
if(healthCareFacility.getAddress() != null) {
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
if (healthCareFacility.getAddress() != null) {
|
||||
data.put(ADDRESS, healthCareFacility.getAddress().getAddress());
|
||||
data.put(POSTAL_CODE, healthCareFacility.getAddress().getPostalCode());
|
||||
data.put(CITY, healthCareFacility.getAddress().getCity());
|
||||
data.put(STATE, healthCareFacility.getAddress().getState());
|
||||
if(!BaseAddress.getConfig().getHideCountryCodeSelection()) {
|
||||
if (!com.arsdigita.cms.basetypes.Address.getConfig().getHideCountryCodeSelection()) {
|
||||
data.put(ISO_COUNTRY_CODE, healthCareFacility.getAddress().getIsoCountryCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void submitted(FormSectionEvent fse) {
|
||||
if (m_step != null &&
|
||||
getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) {
|
||||
m_step.cancelStreamlinedCreation(fse.getPageState());
|
||||
}
|
||||
if (m_step != null
|
||||
&& getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) {
|
||||
m_step.cancelStreamlinedCreation(fse.getPageState());
|
||||
}
|
||||
}
|
||||
|
||||
public void process(FormSectionEvent fse) {
|
||||
FormData data = fse.getFormData();
|
||||
FormData data = fse.getFormData();
|
||||
PageState state = fse.getPageState();
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||
|
||||
if (healthCareFacility.getAddress() != null &&
|
||||
getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
||||
healthCareFacility.getAddress().setAddress((String)data.get(ADDRESS));
|
||||
healthCareFacility.getAddress().setPostalCode((String)data.get(POSTAL_CODE));
|
||||
healthCareFacility.getAddress().setCity((String)data.get(CITY));
|
||||
healthCareFacility.getAddress().setState((String)data.get(STATE));
|
||||
healthCareFacility.getAddress().setIsoCountryCode((String)data.get(ISO_COUNTRY_CODE));
|
||||
|
||||
healthCareFacility.getAddress().save();
|
||||
}
|
||||
|
||||
if (m_step != null) {
|
||||
m_step.maybeForwardToNextStep(fse.getPageState());
|
||||
}
|
||||
if (healthCareFacility.getAddress() != null
|
||||
&& getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
||||
healthCareFacility.getAddress().setAddress((String) data.get(ADDRESS));
|
||||
healthCareFacility.getAddress().setPostalCode((String) data.get(POSTAL_CODE));
|
||||
healthCareFacility.getAddress().setCity((String) data.get(CITY));
|
||||
healthCareFacility.getAddress().setState((String) data.get(STATE));
|
||||
healthCareFacility.getAddress().setIsoCountryCode((String) data.get(ISO_COUNTRY_CODE));
|
||||
|
||||
healthCareFacility.getAddress().save();
|
||||
}
|
||||
|
||||
if (m_step != null) {
|
||||
m_step.maybeForwardToNextStep(fse.getPageState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import org.apache.log4j.Logger;
|
|||
public class HealthCareFacilityPropertiesStep extends SimpleEditStep {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertiesStep.class);
|
||||
|
||||
/**
|
||||
* Name of the this edit sheet (Don't know if this this really needed.
|
||||
* It has the same value in almost all PropertiesStep classes)
|
||||
|
|
@ -44,34 +43,34 @@ public class HealthCareFacilityPropertiesStep extends SimpleEditStep {
|
|||
|
||||
/* Use a Segmented Panel for the multiple parts of data */
|
||||
SegmentedPanel segmentedPanel = new SegmentedPanel();
|
||||
|
||||
|
||||
setDefaultEditKey(EDIT_BASIC_SHEET_NAME);
|
||||
|
||||
/* The different parts of information are displayed in seperated segments each containing a SimpleEditStep */
|
||||
/* Well, not so simple anymore... */
|
||||
|
||||
|
||||
/* A new SimpleEditStep */
|
||||
SimpleEditStep basicProperties = new SimpleEditStep(itemModel, parent, EDIT_BASIC_SHEET_NAME);
|
||||
|
||||
|
||||
/* Create the edit component for this SimpleEditStep and the corresponding link */
|
||||
BasicPageForm editBasicSheet = new HealthCareFacilityPropertyForm(itemModel, this);
|
||||
basicProperties.add(EDIT_BASIC_SHEET_NAME, (String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.edit_basic_properties").localize(), new WorkflowLockedComponentAccess(editBasicSheet, itemModel), editBasicSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
basicProperties.add(EDIT_BASIC_SHEET_NAME, (String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.edit_basic_properties").localize(), new WorkflowLockedComponentAccess(editBasicSheet, itemModel), editBasicSheet.getSaveCancelSection().getCancelButton());
|
||||
|
||||
/* Set the displayComponent for this step */
|
||||
basicProperties.setDisplayComponent(getHealthCareFacilityPropertySheet(itemModel));
|
||||
|
||||
/* Add the SimpleEditStep to the segmented panel */
|
||||
segmentedPanel.addSegment(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.basic_properties").localize()), basicProperties);
|
||||
segmentedPanel.addSegment(new Label((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.basic_properties").localize()), basicProperties);
|
||||
|
||||
// If not disabled via registry, add the ui for attaching a baseAddress
|
||||
if(!HealthCareFacility.getConfig().getHideAddress()) {
|
||||
// If not disabled via registry, add the ui for attaching an address
|
||||
if (!HealthCareFacility.getConfig().getHideAddress()) {
|
||||
HealthCareFacilityAddressPropertiesStep addressProperties = new HealthCareFacilityAddressPropertiesStep(itemModel, parent);
|
||||
segmentedPanel.addSegment(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.address").localize()), addressProperties);
|
||||
segmentedPanel.addSegment(new Label((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.address").localize()), addressProperties);
|
||||
}
|
||||
|
||||
HealthCareFacilityBaseContactPropertiesStep baseContacts = new HealthCareFacilityBaseContactPropertiesStep(itemModel, parent);
|
||||
segmentedPanel.addSegment(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact").localize()), baseContacts);
|
||||
|
||||
HealthCareFacilityContactPropertiesStep contactProperties = new HealthCareFacilityContactPropertiesStep(itemModel, parent);
|
||||
segmentedPanel.addSegment(new Label((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact").localize()), contactProperties);
|
||||
|
||||
/* Sets the composed segmentedPanel as display component */
|
||||
setDisplayComponent(segmentedPanel);
|
||||
}
|
||||
|
|
@ -85,24 +84,23 @@ public class HealthCareFacilityPropertiesStep extends SimpleEditStep {
|
|||
* @return The sheet for editing the properties of the organization.
|
||||
*/
|
||||
public static Component getHealthCareFacilityPropertySheet(ItemSelectionModel itemModel) {
|
||||
|
||||
|
||||
|
||||
/* The DisplayComponent for the Basic Properties */
|
||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),"name");
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),"title");
|
||||
|
||||
if(!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"), "name");
|
||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), "title");
|
||||
|
||||
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||
sheet.add(GlobalizationUtil.globalize("cms.ui.authoring.page_launch_date"), ContentPage.LAUNCH_DATE, new DomainObjectPropertySheet.AttributeFormatter() {
|
||||
|
||||
public String format(DomainObject obj, String attribute, PageState state) {
|
||||
ContentPage page = (ContentPage)obj;
|
||||
if(page.getLaunchDate() != null) {
|
||||
ContentPage page = (ContentPage) obj;
|
||||
if (page.getLaunchDate() != null) {
|
||||
return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate());
|
||||
}
|
||||
else {
|
||||
return (String)GlobalizationUtil.globalize("cms.ui.unknown").localize();
|
||||
} else {
|
||||
return (String) GlobalizationUtil.globalize("cms.ui.unknown").localize();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -110,5 +108,4 @@ public class HealthCareFacilityPropertiesStep extends SimpleEditStep {
|
|||
|
||||
return sheet;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,12 +18,9 @@ import org.apache.log4j.Logger;
|
|||
public class HealthCareFacilityPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertyForm.class);
|
||||
|
||||
private HealthCareFacilityPropertiesStep m_step;
|
||||
|
||||
public static final String ADRESS = HealthCareFacility.ADDRESS;
|
||||
public static final String CONTACTS= HealthCareFacility.CONTACTS;
|
||||
|
||||
public static final String CONTACTS = HealthCareFacility.CONTACTS;
|
||||
/**
|
||||
* ID of the form
|
||||
*/
|
||||
|
|
@ -34,7 +31,7 @@ public class HealthCareFacilityPropertyForm extends BasicPageForm implements For
|
|||
*
|
||||
* @param itemModel
|
||||
*/
|
||||
public HealthCareFacilityPropertyForm(ItemSelectionModel itemModel) {
|
||||
public HealthCareFacilityPropertyForm(ItemSelectionModel itemModel) {
|
||||
this(itemModel, null);
|
||||
}
|
||||
|
||||
|
|
@ -55,19 +52,19 @@ public class HealthCareFacilityPropertyForm extends BasicPageForm implements For
|
|||
public void addWidgets() {
|
||||
super.addWidgets();
|
||||
|
||||
/*
|
||||
/*
|
||||
add(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.basic_properties.description").localize())));
|
||||
TextArea description = new TextArea(DESCRIPTION);
|
||||
description.setRows(5);
|
||||
description.setCols(30);
|
||||
add(description);
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(FormSectionEvent e) throws FormProcessException {
|
||||
FormData data = e.getFormData();
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility)super.initBasicWidgets(e);
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) super.initBasicWidgets(e);
|
||||
|
||||
// data.put(DESCRIPTION, healthCareFacility.getDescription());
|
||||
}
|
||||
|
|
@ -76,22 +73,22 @@ public class HealthCareFacilityPropertyForm extends BasicPageForm implements For
|
|||
public void process(FormSectionEvent e) throws FormProcessException {
|
||||
FormData data = e.getFormData();
|
||||
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility)super.processBasicWidgets(e);
|
||||
HealthCareFacility healthCareFacility = (HealthCareFacility) super.processBasicWidgets(e);
|
||||
|
||||
if((healthCareFacility != null) && (getSaveCancelSection().getSaveButton().isSelected(e.getPageState()))) {
|
||||
if ((healthCareFacility != null) && (getSaveCancelSection().getSaveButton().isSelected(e.getPageState()))) {
|
||||
// healthCareFacility.setDescription((String)data.get(DESCRIPTION));
|
||||
|
||||
healthCareFacility.save();
|
||||
}
|
||||
|
||||
if(m_step != null) {
|
||||
if (m_step != null) {
|
||||
m_step.maybeForwardToNextStep(e.getPageState());
|
||||
}
|
||||
}
|
||||
|
||||
public void submitted(FormSectionEvent e) throws FormProcessException {
|
||||
if((m_step != null) && (getSaveCancelSection().getCancelButton().isSelected(e.getPageState()))) {
|
||||
if ((m_step != null) && (getSaveCancelSection().getCancelButton().isSelected(e.getPageState()))) {
|
||||
m_step.cancelStreamlinedCreation(e.getPageState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,36 +6,36 @@
|
|||
xmlns:cms="http://www.arsdigita.com/cms/1.0"
|
||||
version="1.0">
|
||||
|
||||
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.HealthCareOrganization']" mode="cms:CT_graphics"
|
||||
name="cms:CT_graphics_com_arsdigita_cms_contenttypes_BaseContact">
|
||||
<table width="435" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="contentTitle" align="left" valign="top">
|
||||
<xsl:value-of select="./title"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<xsl:if test="./address">
|
||||
<tr>
|
||||
<th>Address:</th>
|
||||
<td class="contentText" valign="top" align="left"><xsl:value-of select="./address"/></td>
|
||||
</tr>
|
||||
</xsl:if>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:template>
|
||||
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.HealthCareFacility']" mode="cms:CT_graphics"
|
||||
name="cms:CT_graphics_com_arsdigita_cms_contenttypes_HealthCareFacility">
|
||||
<table width="435" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="contentTitle" align="left" valign="top">
|
||||
<xsl:value-of select="./title"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<xsl:if test="./address">
|
||||
<tr>
|
||||
<th>Address:</th>
|
||||
<td class="contentText" valign="top" align="left"><xsl:value-of select="./address"/></td>
|
||||
</tr>
|
||||
</xsl:if>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.HealthCareOrganization']" mode="cms:CT_text"
|
||||
name="cms:CT_text_com_arsdigita_cms_contenttypes_BaseContact">
|
||||
<h1 class="title"><xsl:value-of select="./title"/></h1>
|
||||
<xsl:if test="./address">
|
||||
<span class="subtitle">Address</span>
|
||||
<span class="text"><xsl:value-of select="./address"/></span><br/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.HealthCareFacility']" mode="cms:CT_text"
|
||||
name="cms:CT_text_com_arsdigita_cms_contenttypes_HealthCareFacility">
|
||||
<h1 class="title"><xsl:value-of select="./title"/></h1>
|
||||
<xsl:if test="./address">
|
||||
<span class="subtitle">Address</span>
|
||||
<span class="text"><xsl:value-of select="./address"/></span><br/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
Loading…
Reference in New Issue