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-core" version="6.6.0" relation="ge"/>
|
||||||
<ccm:requires name="ccm-cms" 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-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:dependencies>
|
||||||
<ccm:directories>
|
<ccm:directories>
|
||||||
<ccm:directory name="pdl"/>
|
<ccm:directory name="pdl"/>
|
||||||
|
|
|
||||||
|
|
@ -1,36 +1,36 @@
|
||||||
model com.arsdigita.cms.contenttypes;
|
model com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.GenricOrganization;
|
import com.arsdigita.cms.contenttypes.GenricOrganization;
|
||||||
import com.arsdigita.cms.contenttypes.BaseAddress;
|
import com.arsdigita.cms.basetypes.Address;
|
||||||
import com.arsdigita.cms.contenttypes.BaseContact;
|
import com.arsdigita.cms.basetypes.Contact;
|
||||||
//import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
|
||||||
import com.arsdigita.kernel.ACSObject;
|
import com.arsdigita.kernel.ACSObject;
|
||||||
import com.arsdigita.cms.*;
|
import com.arsdigita.cms.*;
|
||||||
|
|
||||||
// HealthCareFacility Object
|
// HealthCareFacility Object
|
||||||
object type HealthCareFacility extends GenericOrganization {
|
object type HealthCareFacility extends GenericOrganization {
|
||||||
|
|
||||||
BaseAddress[0..1] address = join ct_healthCareFacilities.address_id
|
com.arsdigita.cms.basetypes.Address[0..1] address = join ct_healthCareFacilities.address_id
|
||||||
to ct_baseAddresses.address_id;
|
to cms_addresses.address_id;
|
||||||
|
|
||||||
reference key ( ct_healthCareFacilities.hcf_id );
|
reference key ( ct_healthCareFacilities.hcf_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
association {
|
association {
|
||||||
|
|
||||||
BaseContact[0..n] contacts = join ct_healthCareFacilities.hcf_id
|
com.arsdigita.cms.basetypes.Contact[0..n] contacts = join ct_healthCareFacilities.hcf_id
|
||||||
to ct_healthCareFacility_baseContact_map.hcf_id,
|
to ct_healthCareFacility_contact_map.hcf_id,
|
||||||
join ct_healthCareFacility_baseContact_map.contact_id
|
join ct_healthCareFacility_contact_map.contact_id
|
||||||
to ct_baseContacts.contact_id;
|
to cms_contacts.contact_id;
|
||||||
|
|
||||||
HealthCareFacility[0..n] healthCareFacilities = join ct_baseContacts.contact_id
|
HealthCareFacility[0..n] healthCareFacilities = join cms_contacts.contact_id
|
||||||
to ct_healthCareFacility_baseContact_map.contact_id,
|
to ct_healthCareFacility_contact_map.contact_id,
|
||||||
join ct_healthCareFacility_baseContact_map.hcf_id
|
join ct_healthCareFacility_contact_map.hcf_id
|
||||||
to ct_healthCareFacilities.hcf_id;
|
to ct_healthCareFacilities.hcf_id;
|
||||||
|
|
||||||
// Link Attribute
|
// Link Attribute
|
||||||
String contact_type = ct_healthCareFacility_baseContact_map.contact_type VARCHAR(100);
|
String contact_type = ct_healthCareFacility_contact_map.contact_type VARCHAR(100);
|
||||||
BigDecimal contact_order = ct_healthCareFacility_baseContact_map.contact_order INTEGER;
|
BigDecimal contact_order = ct_healthCareFacility_contact_map.contact_order INTEGER;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,10 @@
|
||||||
<table name="acs_objects"/>
|
<table name="acs_objects"/>
|
||||||
<table name="cms_items"/>
|
<table name="cms_items"/>
|
||||||
<table name="ct_genericorganizations"/>
|
<table name="ct_genericorganizations"/>
|
||||||
<table name="ct_baseAddresses"/>
|
|
||||||
<table name="ct_baseContacts"/>
|
|
||||||
<initializer class="com.arsdigita.cms.Initializer"/>
|
<initializer class="com.arsdigita.cms.Initializer"/>
|
||||||
</requires>
|
</requires>
|
||||||
<provides>
|
<provides>
|
||||||
<table name="ct_healtCareFacilities"/>
|
<table name="ct_healthCareFacilities"/>
|
||||||
<!-- <table name="ct_healtCareFacility_baseContact_map"/> -->
|
|
||||||
<initializer class="com.arsdigita.cms.contenttypes.HealthCareFacilityInitializer"/>
|
<initializer class="com.arsdigita.cms.contenttypes.HealthCareFacilityInitializer"/>
|
||||||
</provides>
|
</provides>
|
||||||
<scripts>
|
<scripts>
|
||||||
|
|
|
||||||
|
|
@ -123,12 +123,12 @@ public class HealthCareFacility extends GenericOrganization {
|
||||||
/* accessors *************************************************/
|
/* accessors *************************************************/
|
||||||
|
|
||||||
// Get the address for this contact
|
// Get the address for this contact
|
||||||
public BaseAddress getAddress() {
|
public com.arsdigita.cms.basetypes.Address getAddress() {
|
||||||
return (BaseAddress)DomainObjectFactory.newInstance((DataObject)get(ADDRESS));
|
return (com.arsdigita.cms.basetypes.Address)DomainObjectFactory.newInstance((DataObject)get(ADDRESS));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the address for this contact
|
// Set the address for this contact
|
||||||
public void setAddress(BaseAddress address) {
|
public void setAddress(com.arsdigita.cms.basetypes.Address address) {
|
||||||
set(ADDRESS, address);
|
set(ADDRESS, address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -138,13 +138,13 @@ public class HealthCareFacility extends GenericOrganization {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get all contacts for this health care facility
|
// Get all contacts for this health care facility
|
||||||
public BaseContactCollection getContacts() {
|
public HealthCareFacilityContactCollection getContacts() {
|
||||||
return new BaseContactCollection((DataCollection) get(CONTACTS));
|
return new HealthCareFacilityContactCollection((DataCollection) get(CONTACTS));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add a contact for this health care facility
|
// Add a contact for this health care facility
|
||||||
public void addContact(BaseContact contact, String contactType) {
|
public void addContact(com.arsdigita.cms.basetypes.Contact contact, String contactType) {
|
||||||
Assert.exists(contact, BaseContact.class);
|
Assert.exists(contact, com.arsdigita.cms.basetypes.Contact.class);
|
||||||
|
|
||||||
DataObject link = add(CONTACTS, contact);
|
DataObject link = add(CONTACTS, contact);
|
||||||
|
|
||||||
|
|
@ -156,8 +156,8 @@ public class HealthCareFacility extends GenericOrganization {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove a contect for this health care facility
|
// Remove a contect for this health care facility
|
||||||
public void removeContactEntry(BaseContact contact) {
|
public void removeContactEntry(com.arsdigita.cms.basetypes.Contact contact) {
|
||||||
Assert.exists(contact, BaseContact.class);
|
Assert.exists(contact, com.arsdigita.cms.basetypes.Contact.class);
|
||||||
remove(CONTACTS, contact);
|
remove(CONTACTS, contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,9 @@ public final class HealthCareFacilityConfig extends AbstractConfig {
|
||||||
StringTokenizer keys = getContactTypeKeys();
|
StringTokenizer keys = getContactTypeKeys();
|
||||||
while(keys.hasMoreElements()) {
|
while(keys.hasMoreElements()) {
|
||||||
index++;
|
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
|
* Created on 26. Juli 2009, 15:30
|
||||||
*
|
*
|
||||||
|
|
@ -17,16 +17,16 @@ import java.math.BigDecimal;
|
||||||
*
|
*
|
||||||
* @author quasi
|
* @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 ORDER = "link.contact_order asc";
|
||||||
public static final String CONTACT_TYPE = "link.contact_type";
|
public static final String CONTACT_TYPE = "link.contact_type";
|
||||||
public static final String CONTACT_ORDER = "link.contact_order";
|
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);
|
super(dataCollection);
|
||||||
|
|
||||||
m_dataCollection.addOrder(ORDER);
|
m_dataCollection.addOrder(ORDER);
|
||||||
|
|
@ -39,7 +39,7 @@ public class BaseContactCollection extends DomainCollection {
|
||||||
|
|
||||||
// Set the contact type of the link
|
// Set the contact type of the link
|
||||||
// public void setContactType(String contactType) {
|
// public void setContactType(String contactType) {
|
||||||
// getBaseContact().set(CONTACT_TYPE, contactType);
|
// getContact().set(CONTACT_TYPE, contactType);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Get the contact order of the link
|
// Get the contact order of the link
|
||||||
|
|
@ -55,11 +55,11 @@ public class BaseContactCollection extends DomainCollection {
|
||||||
|
|
||||||
// Set the contact order of the link
|
// Set the contact order of the link
|
||||||
// public void setContactOrder(long contactOrder) {
|
// public void setContactOrder(long contactOrder) {
|
||||||
// getBaseContact().set(CONTACT_ORDER, String.valueOf(contactOrder));
|
// getContact().set(CONTACT_ORDER, String.valueOf(contactOrder));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public BaseContact getBaseContact() {
|
public com.arsdigita.cms.basetypes.Contact getContact() {
|
||||||
return new BaseContact(m_dataCollection.getDataObject());
|
return new com.arsdigita.cms.basetypes.Contact(m_dataCollection.getDataObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -18,9 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.contenttypes;
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.*;
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import com.arsdigita.runtime.LegacyInitEvent;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializer of the HealthCareFacility content type.
|
* Initializer of the HealthCareFacility content type.
|
||||||
|
|
@ -48,15 +46,4 @@ public class HealthCareFacilityInitializer extends ContentTypeInitializer {
|
||||||
public String getStylesheet() {
|
public String getStylesheet() {
|
||||||
return "static/content-types/com/arsdigita/cms/contenttypes/HealthCareFacility.xsl";
|
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;
|
package com.arsdigita.cms.contenttypes;
|
||||||
|
|
||||||
import com.arsdigita.cms.contenttypes.*;
|
|
||||||
import com.arsdigita.util.parameter.ResourceParameter;
|
import com.arsdigita.util.parameter.ResourceParameter;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
* To change this template, choose Tools | Template Manager
|
* To change this template, choose Tools | Template Manager
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
|
|
@ -18,9 +17,8 @@ import com.arsdigita.domain.DomainObject;
|
||||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.cms.contenttypes.BaseAddress;
|
|
||||||
import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
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.contenttypes.util.HealthCareFacilityGlobalizationUtil;
|
||||||
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
import com.arsdigita.cms.ui.authoring.SimpleEditStep;
|
||||||
|
|
||||||
|
|
@ -50,7 +48,7 @@ public class HealthCareFacilityAddressPropertiesStep extends SimpleEditStep {
|
||||||
//XXX
|
//XXX
|
||||||
// if(/*healthCareFacility.getAddress() == null*/ true) {
|
// if(/*healthCareFacility.getAddress() == null*/ true) {
|
||||||
BasicPageForm attachAddressSheet = new HealthCareFacilityAttachAddressPropertyForm(itemModel, this);
|
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 */
|
/* Set the displayComponent for this step */
|
||||||
// setDisplayComponent(getEmptyBaseAddressPropertySheet(itemModel));
|
// setDisplayComponent(getEmptyBaseAddressPropertySheet(itemModel));
|
||||||
|
|
@ -59,44 +57,46 @@ public class HealthCareFacilityAddressPropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
// editAddress
|
// editAddress
|
||||||
BasicPageForm editAddressSheet = new HealthCareFacilityEditAddressPropertyForm(itemModel, this);
|
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);
|
// 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());
|
// 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);
|
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 */
|
/* 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);
|
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||||
|
|
||||||
sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.address").localize(), "address." + BaseAddress.ADDRESS);
|
sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.address").localize(), "address." + com.arsdigita.cms.basetypes.Address.ADDRESS);
|
||||||
if(!HealthCareFacility.getConfig().getHideAddressPostalCode())
|
if (!HealthCareFacility.getConfig().getHideAddressPostalCode()) {
|
||||||
sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.postal_code").localize(), "address." + BaseAddress.POSTAL_CODE);
|
sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.postal_code").localize(), "address." + com.arsdigita.cms.basetypes.Address.POSTAL_CODE);
|
||||||
sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.city").localize(), "address." + BaseAddress.CITY);
|
}
|
||||||
if(!HealthCareFacility.getConfig().getHideAddressState())
|
sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.city").localize(), "address." + com.arsdigita.cms.basetypes.Address.CITY);
|
||||||
sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.state").localize(), "address." + BaseAddress.STATE);
|
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()) {
|
if (!HealthCareFacility.getConfig().getHideAddressCountry()) {
|
||||||
sheet.add((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.iso_country_code").localize(),
|
sheet.add((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.iso_country_code").localize(),
|
||||||
"address." + BaseAddress.ISO_COUNTRY_CODE,
|
"address." + com.arsdigita.cms.basetypes.Address.ISO_COUNTRY_CODE,
|
||||||
new DomainObjectPropertySheet.AttributeFormatter() {
|
new DomainObjectPropertySheet.AttributeFormatter() {
|
||||||
|
|
||||||
public String format(DomainObject item,
|
public String format(DomainObject item,
|
||||||
String attribute,
|
String attribute,
|
||||||
PageState state) {
|
PageState state) {
|
||||||
BaseAddress baseAddress = ((HealthCareFacility)item).getAddress();
|
com.arsdigita.cms.basetypes.Address address = ((HealthCareFacility) item).getAddress();
|
||||||
if(baseAddress != null && baseAddress.getIsoCountryCode() != null) {
|
if (address != null && address.getIsoCountryCode() != null) {
|
||||||
return BaseAddress.getCountryNameFromIsoCode(baseAddress.getIsoCountryCode());
|
return com.arsdigita.cms.basetypes.Address.getCountryNameFromIsoCode(address.getIsoCountryCode());
|
||||||
} else {
|
} else {
|
||||||
return (String)BaseAddressGlobalizationUtil.globalize
|
return (String) BasetypesGlobalizationUtil.globalize("cms.ui.unknown").localize();
|
||||||
("cms.ui.unknown").localize();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -106,8 +106,7 @@ public class HealthCareFacilityAddressPropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Component getEmptyBaseAddressPropertySheet(ItemSelectionModel itemModel) {
|
public static Component getEmptyAddressPropertySheet(ItemSelectionModel itemModel) {
|
||||||
return new Label(((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.emptyAddress").localize()));
|
return new Label(((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.emptyAddress").localize()));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
* To change this template, choose Tools | Template Manager
|
* To change this template, choose Tools | Template Manager
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
|
|
@ -23,7 +22,6 @@ import com.arsdigita.bebop.event.PrintListener;
|
||||||
import com.arsdigita.bebop.form.Submit;
|
import com.arsdigita.bebop.form.Submit;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
import com.arsdigita.cms.contenttypes.BaseAddress;
|
|
||||||
import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
||||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
import com.arsdigita.cms.ContentType;
|
import com.arsdigita.cms.ContentType;
|
||||||
|
|
@ -39,12 +37,10 @@ import org.apache.log4j.Logger;
|
||||||
public class HealthCareFacilityAttachAddressPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
public class HealthCareFacilityAttachAddressPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertyForm.class);
|
private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertyForm.class);
|
||||||
|
|
||||||
private HealthCareFacilityAddressPropertiesStep m_step;
|
private HealthCareFacilityAddressPropertiesStep m_step;
|
||||||
private ItemSearchWidget m_itemSearch;
|
private ItemSearchWidget m_itemSearch;
|
||||||
private SaveCancelSection m_saveCancelSection;
|
private SaveCancelSection m_saveCancelSection;
|
||||||
private final String ITEM_SEARCH = "healthCareFacilityAddress";
|
private final String ITEM_SEARCH = "healthCareFacilityAddress";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the form
|
* ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
@ -78,15 +74,15 @@ public class HealthCareFacilityAttachAddressPropertyForm extends BasicPageForm i
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWidgets() {
|
public void addWidgets() {
|
||||||
add(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_address").localize()));
|
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"));
|
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.basetypes.Address"));
|
||||||
add(this.m_itemSearch);
|
add(this.m_itemSearch);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(FormSectionEvent fse) {
|
public void init(FormSectionEvent fse) {
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
PageState state = fse.getPageState();
|
PageState state = fse.getPageState();
|
||||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
setVisible(state, true);
|
setVisible(state, true);
|
||||||
|
|
||||||
|
|
@ -98,30 +94,30 @@ public class HealthCareFacilityAttachAddressPropertyForm extends BasicPageForm i
|
||||||
public void process(FormSectionEvent fse) {
|
public void process(FormSectionEvent fse) {
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
PageState state = fse.getPageState();
|
PageState state = fse.getPageState();
|
||||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
if (!this.getSaveCancelSection().getCancelButton().isSelected(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);
|
init(fse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the section with the save and the cancel button.
|
* Creates the section with the save and the cancel button.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addSaveCancelSection() {
|
public void addSaveCancelSection() {
|
||||||
try {
|
try {
|
||||||
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
|
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
|
||||||
|
|
||||||
public void prepare(PrintEvent e) {
|
public void prepare(PrintEvent e) {
|
||||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(e.getPageState());
|
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(e.getPageState());
|
||||||
Submit target = (Submit) e.getTarget();
|
Submit target = (Submit) e.getTarget();
|
||||||
|
|
||||||
if (healthCareFacility.getAddress() != null) {
|
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 {
|
} 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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -130,16 +126,17 @@ public class HealthCareFacilityAttachAddressPropertyForm extends BasicPageForm i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void validate(FormSectionEvent e) throws FormProcessException {
|
public void validate(FormSectionEvent e) throws FormProcessException {
|
||||||
if (e.getFormData().get(ITEM_SEARCH) == null) {
|
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 {
|
public void submitted(FormSectionEvent e) throws FormProcessException {
|
||||||
if (getSaveCancelSection().getCancelButton().isSelected(e.getPageState())) {
|
if (getSaveCancelSection().getCancelButton().isSelected(e.getPageState())) {
|
||||||
init(e);
|
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.NotNullValidationListener;
|
||||||
import com.arsdigita.bebop.parameters.ParameterModel;
|
import com.arsdigita.bebop.parameters.ParameterModel;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.contenttypes.BaseContact;
|
import com.arsdigita.cms.basetypes.util.BasetypesGlobalizationUtil;
|
||||||
import com.arsdigita.cms.contenttypes.util.BaseContactGlobalizationUtil;
|
|
||||||
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
import com.arsdigita.cms.ui.authoring.BasicItemForm;
|
||||||
import com.arsdigita.bebop.parameters.StringParameter;
|
import com.arsdigita.bebop.parameters.StringParameter;
|
||||||
import com.arsdigita.cms.ContentType;
|
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.HealthCareFacility;
|
||||||
import com.arsdigita.cms.contenttypes.util.HealthCareFacilityGlobalizationUtil;
|
import com.arsdigita.cms.contenttypes.util.HealthCareFacilityGlobalizationUtil;
|
||||||
import com.arsdigita.cms.ui.ItemSearchWidget;
|
import com.arsdigita.cms.ui.ItemSearchWidget;
|
||||||
|
|
@ -49,43 +48,43 @@ import org.apache.log4j.Logger;
|
||||||
*
|
*
|
||||||
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
|
* @author Sören Bernstein (quasimodo) quasi@zes.uni-bremen.de
|
||||||
*/
|
*/
|
||||||
public class HealthCareFacilityBaseContactAddForm extends BasicItemForm {
|
public class HealthCareFacilityContactAddForm extends BasicItemForm {
|
||||||
private static final Logger s_log = Logger.getLogger(HealthCareFacilityBaseContactAddForm.class);
|
|
||||||
|
|
||||||
|
private static final Logger s_log = Logger.getLogger(HealthCareFacilityContactAddForm.class);
|
||||||
private HealthCareFacilityAddressPropertiesStep m_step;
|
private HealthCareFacilityAddressPropertiesStep m_step;
|
||||||
private ItemSearchWidget m_itemSearch;
|
private ItemSearchWidget m_itemSearch;
|
||||||
private SaveCancelSection m_saveCancelSection;
|
private SaveCancelSection m_saveCancelSection;
|
||||||
private final String ITEM_SEARCH = "healthCareFacilityAddress";
|
private final String ITEM_SEARCH = "healthCareFacilityAddress";
|
||||||
|
|
||||||
private ItemSelectionModel m_itemModel;
|
private ItemSelectionModel m_itemModel;
|
||||||
|
|
||||||
/** Creates a new instance of CategoryLocalizationAddForm */
|
/** Creates a new instance of CategoryLocalizationAddForm */
|
||||||
public HealthCareFacilityBaseContactAddForm(ItemSelectionModel itemModel) {
|
public HealthCareFacilityContactAddForm(ItemSelectionModel itemModel) {
|
||||||
|
|
||||||
super("BaseContactEntryAddForm",itemModel);
|
super("ContactEntryAddForm", itemModel);
|
||||||
m_itemModel = itemModel;
|
m_itemModel = itemModel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
|
|
||||||
// Attach a Contact object
|
// Attach a Contact object
|
||||||
add(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.select_contact").localize()));
|
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"));
|
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.findByAssociatedObjectType("com.arsdigita.cms.contenttypes.Contact"));
|
||||||
add(this.m_itemSearch);
|
add(this.m_itemSearch);
|
||||||
|
|
||||||
// Contact type field
|
// Contact type field
|
||||||
add(new Label(BaseContactGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact.type")));
|
add(new Label(HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact.type")));
|
||||||
ParameterModel contactTypeParam = new StringParameter(BaseContactCollection.CONTACT_TYPE);
|
ParameterModel contactTypeParam = new StringParameter(HealthCareFacilityContactCollection.CONTACT_TYPE);
|
||||||
SingleSelect contactType = new SingleSelect(contactTypeParam);
|
SingleSelect contactType = new SingleSelect(contactTypeParam);
|
||||||
contactType.addValidationListener(new NotNullValidationListener());
|
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
|
// Add the Options to the SingleSelect widget
|
||||||
StringTokenizer keyList = HealthCareFacility.getConfig().getContactTypeKeys();
|
StringTokenizer keyList = HealthCareFacility.getConfig().getContactTypeKeys();
|
||||||
while(keyList.hasMoreElements()) {
|
while (keyList.hasMoreElements()) {
|
||||||
String currentKey = keyList.nextToken();
|
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);
|
add(contactType);
|
||||||
|
|
@ -94,7 +93,7 @@ public class HealthCareFacilityBaseContactAddForm extends BasicItemForm {
|
||||||
public void init(FormSectionEvent fse) {
|
public void init(FormSectionEvent fse) {
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
PageState state = fse.getPageState();
|
PageState state = fse.getPageState();
|
||||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
setVisible(state, true);
|
setVisible(state, true);
|
||||||
}
|
}
|
||||||
|
|
@ -102,12 +101,12 @@ public class HealthCareFacilityBaseContactAddForm extends BasicItemForm {
|
||||||
public void process(FormSectionEvent fse) {
|
public void process(FormSectionEvent fse) {
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
PageState state = fse.getPageState();
|
PageState state = fse.getPageState();
|
||||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
//
|
//
|
||||||
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {
|
||||||
healthCareFacility.addContact((BaseContact)data.get(ITEM_SEARCH),
|
healthCareFacility.addContact((com.arsdigita.cms.basetypes.Contact) data.get(ITEM_SEARCH),
|
||||||
(String)data.get(BaseContactCollection.CONTACT_TYPE));
|
(String) data.get(HealthCareFacilityContactCollection.CONTACT_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
init(fse);
|
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.bebop.table.TableModelBuilder;
|
||||||
import com.arsdigita.cms.ItemSelectionModel;
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.SecurityManager;
|
import com.arsdigita.cms.SecurityManager;
|
||||||
import com.arsdigita.cms.contenttypes.BaseContact;
|
import com.arsdigita.cms.contenttypes.HealthCareFacilityContactCollection;
|
||||||
import com.arsdigita.cms.contenttypes.BaseContactCollection;
|
|
||||||
import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
||||||
import com.arsdigita.cms.contenttypes.util.HealthCareFacilityGlobalizationUtil;
|
import com.arsdigita.cms.contenttypes.util.HealthCareFacilityGlobalizationUtil;
|
||||||
import com.arsdigita.cms.dispatcher.Utilities;
|
import com.arsdigita.cms.dispatcher.Utilities;
|
||||||
|
|
@ -46,18 +45,16 @@ import java.math.BigDecimal;
|
||||||
*
|
*
|
||||||
* @author Sören Bernstein (quasimodo) quasi@barkhof.uni-bremen.de
|
* @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_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;
|
private ItemSelectionModel m_itemModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance of HealthCareFacilityHealthCareFacilityTable
|
* Creates a new instance of HealthCareFacilityHealthCareFacilityTable
|
||||||
*/
|
*/
|
||||||
public HealthCareFacilityBaseContactTable(final ItemSelectionModel itemModel) {
|
public HealthCareFacilityContactTable(final ItemSelectionModel itemModel) {
|
||||||
|
|
||||||
super();
|
super();
|
||||||
this.m_itemModel = itemModel;
|
this.m_itemModel = itemModel;
|
||||||
|
|
@ -107,14 +104,13 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
||||||
private class HealthCareFacilityTableModel implements TableModel {
|
private class HealthCareFacilityTableModel implements TableModel {
|
||||||
|
|
||||||
final private int MAX_DESC_LENGTH = 25;
|
final private int MAX_DESC_LENGTH = 25;
|
||||||
|
|
||||||
private Table m_table;
|
private Table m_table;
|
||||||
private BaseContactCollection m_baseContactCollection;
|
private HealthCareFacilityContactCollection m_contactCollection;
|
||||||
private BaseContact m_baseContact;
|
private com.arsdigita.cms.basetypes.Contact m_contact;
|
||||||
|
|
||||||
private HealthCareFacilityTableModel(Table t, PageState ps, HealthCareFacility healthCareFacility) {
|
private HealthCareFacilityTableModel(Table t, PageState ps, HealthCareFacility healthCareFacility) {
|
||||||
m_table = t;
|
m_table = t;
|
||||||
m_baseContactCollection = healthCareFacility.getContacts();
|
m_contactCollection = healthCareFacility.getContacts();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColumnCount() {
|
public int getColumnCount() {
|
||||||
|
|
@ -125,12 +121,12 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
||||||
* Check collection for the existence of another row.
|
* Check collection for the existence of another row.
|
||||||
*
|
*
|
||||||
* If exists, fetch the value of current HealthCareFacilityEntryCollection object
|
* If exists, fetch the value of current HealthCareFacilityEntryCollection object
|
||||||
* into m_healthCareFacilityEntry class variable.
|
* into m_comntact class variable.
|
||||||
*/
|
*/
|
||||||
public boolean nextRow() {
|
public boolean nextRow() {
|
||||||
|
|
||||||
if(m_baseContactCollection != null && m_baseContactCollection.next()){
|
if (m_contactCollection != null && m_contactCollection.next()) {
|
||||||
m_baseContact = m_baseContactCollection.getBaseContact();
|
m_contact = m_contactCollection.getContact();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -145,13 +141,13 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
||||||
* @see com.arsdigita.bebop.table.TableModel#getElementAt(int)
|
* @see com.arsdigita.bebop.table.TableModel#getElementAt(int)
|
||||||
*/
|
*/
|
||||||
public Object getElementAt(int columnIndex) {
|
public Object getElementAt(int columnIndex) {
|
||||||
switch (columnIndex){
|
switch (columnIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
return m_baseContactCollection.getContactOrder();
|
return m_contactCollection.getContactOrder();
|
||||||
case 1:
|
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:
|
case 2:
|
||||||
return m_baseContact.getTitle();
|
return m_contact.getTitle();
|
||||||
// case 2:
|
// case 2:
|
||||||
// return (m_healthCareFacilityEntry.getDescription() != null && m_healthCareFacilityEntry.getDescription().length() > MAX_DESC_LENGTH)
|
// return (m_healthCareFacilityEntry.getDescription() != null && m_healthCareFacilityEntry.getDescription().length() > MAX_DESC_LENGTH)
|
||||||
// ? m_healthCareFacilityEntry.getDescription().substring(0, MAX_DESC_LENGTH)
|
// ? m_healthCareFacilityEntry.getDescription().substring(0, MAX_DESC_LENGTH)
|
||||||
|
|
@ -168,9 +164,8 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
||||||
* @see com.arsdigita.bebop.table.TableModel#getKeyAt(int)
|
* @see com.arsdigita.bebop.table.TableModel#getKeyAt(int)
|
||||||
*/
|
*/
|
||||||
public Object getKeyAt(int columnIndex) {
|
public Object getKeyAt(int columnIndex) {
|
||||||
return m_baseContact.getID();
|
return m_contact.getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -189,7 +184,7 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
||||||
boolean canEdit = sm.canAccess(state.getRequest(),
|
boolean canEdit = sm.canAccess(state.getRequest(),
|
||||||
SecurityManager.EDIT_ITEM,
|
SecurityManager.EDIT_ITEM,
|
||||||
healthCareFacility);
|
healthCareFacility);
|
||||||
if(canEdit) {
|
if (canEdit) {
|
||||||
ControlLink link = new ControlLink(value.toString());
|
ControlLink link = new ControlLink(value.toString());
|
||||||
return link;
|
return link;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -214,7 +209,7 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
||||||
boolean canDelete = sm.canAccess(state.getRequest(),
|
boolean canDelete = sm.canAccess(state.getRequest(),
|
||||||
SecurityManager.DELETE_ITEM,
|
SecurityManager.DELETE_ITEM,
|
||||||
healthCareFacility);
|
healthCareFacility);
|
||||||
if(canDelete) {
|
if (canDelete) {
|
||||||
ControlLink link = new ControlLink(value.toString());
|
ControlLink link = new ControlLink(value.toString());
|
||||||
link.setConfirmation((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.confirm_delete").localize());
|
link.setConfirmation((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.confirm_delete").localize());
|
||||||
return link;
|
return link;
|
||||||
|
|
@ -233,9 +228,9 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
||||||
|
|
||||||
PageState state = evt.getPageState();
|
PageState state = evt.getPageState();
|
||||||
|
|
||||||
// Get selected BaseContact
|
// Get selected Contact
|
||||||
BaseContact baseContact =
|
com.arsdigita.cms.basetypes.Contact contact =
|
||||||
new BaseContact(new BigDecimal(evt.getRowKey().toString()));
|
new com.arsdigita.cms.basetypes.Contact(new BigDecimal(evt.getRowKey().toString()));
|
||||||
|
|
||||||
// Get HealthCareFacility
|
// Get HealthCareFacility
|
||||||
HealthCareFacility healthCareFacility = (HealthCareFacility) m_itemModel.getSelectedObject(state);
|
HealthCareFacility healthCareFacility = (HealthCareFacility) m_itemModel.getSelectedObject(state);
|
||||||
|
|
@ -244,13 +239,12 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
||||||
TableColumn col = getColumnModel().get(evt.getColumn().intValue());
|
TableColumn col = getColumnModel().get(evt.getColumn().intValue());
|
||||||
|
|
||||||
// Edit
|
// Edit
|
||||||
if(col.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
if (col.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if(col.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
if (col.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
|
||||||
healthCareFacility.removeContactEntry(baseContact);
|
healthCareFacility.removeContactEntry(contact);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -262,6 +256,4 @@ public class HealthCareFacilityBaseContactTable extends Table implements TableAc
|
||||||
public void headSelected(TableActionEvent e) {
|
public void headSelected(TableActionEvent e) {
|
||||||
throw new UnsupportedOperationException("Not Implemented");
|
throw new UnsupportedOperationException("Not Implemented");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
* To change this template, choose Tools | Template Manager
|
* To change this template, choose Tools | Template Manager
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormProcessException;
|
import com.arsdigita.bebop.FormProcessException;
|
||||||
|
|
@ -40,24 +39,25 @@ public class HealthCareFacilityDeleteAddressForm extends BasicPageForm implement
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(FormSectionEvent fse) {
|
public void init(FormSectionEvent fse) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addWidgets() {
|
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.
|
* Creates the section with the save and the cancel button.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addSaveCancelSection() {
|
public void addSaveCancelSection() {
|
||||||
try {
|
try {
|
||||||
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
|
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
|
||||||
|
|
||||||
public void prepare(PrintEvent e) {
|
public void prepare(PrintEvent e) {
|
||||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(e.getPageState());
|
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(e.getPageState());
|
||||||
Submit target = (Submit) e.getTarget();
|
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) {
|
} catch (Exception ex) {
|
||||||
|
|
@ -68,11 +68,10 @@ public class HealthCareFacilityDeleteAddressForm extends BasicPageForm implement
|
||||||
public final void process(final FormSectionEvent fse) throws FormProcessException {
|
public final void process(final FormSectionEvent fse) throws FormProcessException {
|
||||||
|
|
||||||
final PageState state = fse.getPageState();
|
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) {
|
if (healthCareFacility != null && healthCareFacility.getAddress() != null) {
|
||||||
healthCareFacility.unsetAddress();
|
healthCareFacility.unsetAddress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,6 @@
|
||||||
* To change this template, choose Tools | Template Manager
|
* To change this template, choose Tools | Template Manager
|
||||||
* and open the template in the editor.
|
* and open the template in the editor.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.arsdigita.cms.contenttypes.ui;
|
package com.arsdigita.cms.contenttypes.ui;
|
||||||
|
|
||||||
import com.arsdigita.bebop.FormData;
|
import com.arsdigita.bebop.FormData;
|
||||||
|
|
@ -32,9 +31,8 @@ import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
import com.arsdigita.cms.ui.authoring.BasicPageForm;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import com.arsdigita.cms.contenttypes.BaseAddress;
|
|
||||||
import com.arsdigita.cms.contenttypes.HealthCareFacility;
|
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;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
|
@ -45,15 +43,12 @@ import org.apache.log4j.Logger;
|
||||||
public class HealthCareFacilityEditAddressPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
public class HealthCareFacilityEditAddressPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertyForm.class);
|
private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertyForm.class);
|
||||||
|
|
||||||
private HealthCareFacilityAddressPropertiesStep m_step;
|
private HealthCareFacilityAddressPropertiesStep m_step;
|
||||||
|
public static final String ADDRESS = com.arsdigita.cms.basetypes.Address.ADDRESS;
|
||||||
public static final String ADDRESS = BaseAddress.ADDRESS;
|
public static final String POSTAL_CODE = com.arsdigita.cms.basetypes.Address.POSTAL_CODE;
|
||||||
public static final String POSTAL_CODE = BaseAddress.POSTAL_CODE;
|
public static final String CITY = com.arsdigita.cms.basetypes.Address.CITY;
|
||||||
public static final String CITY = BaseAddress.CITY;
|
public static final String STATE = com.arsdigita.cms.basetypes.Address.STATE;
|
||||||
public static final String STATE = BaseAddress.STATE;
|
public static final String ISO_COUNTRY_CODE = com.arsdigita.cms.basetypes.Address.ISO_COUNTRY_CODE;
|
||||||
public static final String ISO_COUNTRY_CODE = BaseAddress.ISO_COUNTRY_CODE;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the form
|
* ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
@ -82,61 +77,61 @@ public class HealthCareFacilityEditAddressPropertyForm extends BasicPageForm imp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addWidgets() {
|
public void addWidgets() {
|
||||||
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.address").localize()));
|
add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.address").localize()));
|
||||||
ParameterModel addressParam = new StringParameter(ADDRESS);
|
ParameterModel addressParam = new StringParameter(ADDRESS);
|
||||||
addressParam.addParameterListener( new NotNullValidationListener( ) );
|
addressParam.addParameterListener(new NotNullValidationListener());
|
||||||
addressParam.addParameterListener( new StringInRangeValidationListener(0, 1000) );
|
addressParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
|
||||||
TextArea address = new TextArea(addressParam);
|
TextArea address = new TextArea(addressParam);
|
||||||
address.setRows(5);
|
address.setRows(5);
|
||||||
address.setCols(30);
|
address.setCols(30);
|
||||||
add(address);
|
add(address);
|
||||||
|
|
||||||
if(!HealthCareFacility.getConfig().getHideAddressPostalCode()) {
|
if (!HealthCareFacility.getConfig().getHideAddressPostalCode()) {
|
||||||
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.postal_code").localize()));
|
add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.postal_code").localize()));
|
||||||
ParameterModel postalCodeParam = new StringParameter(POSTAL_CODE);
|
ParameterModel postalCodeParam = new StringParameter(POSTAL_CODE);
|
||||||
TextField postalCode = new TextField(postalCodeParam);
|
TextField postalCode = new TextField(postalCodeParam);
|
||||||
/* XXX NumberListener ?*/
|
/* XXX NumberListener ?*/
|
||||||
add(postalCode);
|
add(postalCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.city").localize()));
|
add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.city").localize()));
|
||||||
ParameterModel cityParam = new StringParameter(CITY);
|
ParameterModel cityParam = new StringParameter(CITY);
|
||||||
TextField city = new TextField(cityParam);
|
TextField city = new TextField(cityParam);
|
||||||
add(city);
|
add(city);
|
||||||
|
|
||||||
if(!HealthCareFacility.getConfig().getHideAddressState()) {
|
if (!HealthCareFacility.getConfig().getHideAddressState()) {
|
||||||
add(new Label((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.state").localize()));
|
add(new Label((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.state").localize()));
|
||||||
ParameterModel stateParam = new StringParameter(STATE);
|
ParameterModel stateParam = new StringParameter(STATE);
|
||||||
TextField state = new TextField(stateParam);
|
TextField state = new TextField(stateParam);
|
||||||
add(state);
|
add(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!HealthCareFacility.getConfig().getHideAddressCountry()) {
|
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);
|
ParameterModel countryParam = new StringParameter(ISO_COUNTRY_CODE);
|
||||||
countryParam.addParameterListener(new StringInRangeValidationListener(0, 2));
|
countryParam.addParameterListener(new StringInRangeValidationListener(0, 2));
|
||||||
|
|
||||||
SingleSelect country = new SingleSelect(countryParam);
|
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();
|
Iterator countries = com.arsdigita.cms.basetypes.Address.getSortedListOfCountries(null).entrySet().iterator();
|
||||||
while(countries.hasNext()) {
|
while (countries.hasNext()) {
|
||||||
Map.Entry<String,String> elem = (Map.Entry<String,String>)countries.next();
|
Map.Entry<String, String> elem = (Map.Entry<String, String>) countries.next();
|
||||||
country.addOption(new Option(elem.getValue().toString(), elem.getKey().toString()));
|
country.addOption(new Option(elem.getValue().toString(), elem.getKey().toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
country.addValidationListener(
|
country.addValidationListener(
|
||||||
new ParameterListener() {
|
new ParameterListener() {
|
||||||
|
|
||||||
public void validate(ParameterEvent e) throws FormProcessException {
|
public void validate(ParameterEvent e) throws FormProcessException {
|
||||||
ParameterData data = e.getParameterData();
|
ParameterData data = e.getParameterData();
|
||||||
String isoCode = (String) data.getValue() ;
|
String isoCode = (String) data.getValue();
|
||||||
if (isoCode == null || isoCode.length() == 0) {
|
if (isoCode == null || isoCode.length() == 0) {
|
||||||
data.addError((String)BaseAddressGlobalizationUtil.globalize("cms.contenttypes.ui.baseAddress.error_iso_country").localize());
|
data.addError((String) BasetypesGlobalizationUtil.globalize("cms.basetypes.ui.address.error_iso_country").localize());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
add(country);
|
add(country);
|
||||||
}
|
}
|
||||||
|
|
@ -146,22 +141,22 @@ public class HealthCareFacilityEditAddressPropertyForm extends BasicPageForm imp
|
||||||
public void init(FormSectionEvent fse) {
|
public void init(FormSectionEvent fse) {
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
PageState state = fse.getPageState();
|
PageState state = fse.getPageState();
|
||||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
if(healthCareFacility.getAddress() != null) {
|
if (healthCareFacility.getAddress() != null) {
|
||||||
data.put(ADDRESS, healthCareFacility.getAddress().getAddress());
|
data.put(ADDRESS, healthCareFacility.getAddress().getAddress());
|
||||||
data.put(POSTAL_CODE, healthCareFacility.getAddress().getPostalCode());
|
data.put(POSTAL_CODE, healthCareFacility.getAddress().getPostalCode());
|
||||||
data.put(CITY, healthCareFacility.getAddress().getCity());
|
data.put(CITY, healthCareFacility.getAddress().getCity());
|
||||||
data.put(STATE, healthCareFacility.getAddress().getState());
|
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());
|
data.put(ISO_COUNTRY_CODE, healthCareFacility.getAddress().getIsoCountryCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void submitted(FormSectionEvent fse) {
|
public void submitted(FormSectionEvent fse) {
|
||||||
if (m_step != null &&
|
if (m_step != null
|
||||||
getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) {
|
&& getSaveCancelSection().getCancelButton().isSelected(fse.getPageState())) {
|
||||||
m_step.cancelStreamlinedCreation(fse.getPageState());
|
m_step.cancelStreamlinedCreation(fse.getPageState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -169,15 +164,15 @@ public class HealthCareFacilityEditAddressPropertyForm extends BasicPageForm imp
|
||||||
public void process(FormSectionEvent fse) {
|
public void process(FormSectionEvent fse) {
|
||||||
FormData data = fse.getFormData();
|
FormData data = fse.getFormData();
|
||||||
PageState state = fse.getPageState();
|
PageState state = fse.getPageState();
|
||||||
HealthCareFacility healthCareFacility = (HealthCareFacility)getItemSelectionModel().getSelectedObject(state);
|
HealthCareFacility healthCareFacility = (HealthCareFacility) getItemSelectionModel().getSelectedObject(state);
|
||||||
|
|
||||||
if (healthCareFacility.getAddress() != null &&
|
if (healthCareFacility.getAddress() != null
|
||||||
getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
&& getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
|
||||||
healthCareFacility.getAddress().setAddress((String)data.get(ADDRESS));
|
healthCareFacility.getAddress().setAddress((String) data.get(ADDRESS));
|
||||||
healthCareFacility.getAddress().setPostalCode((String)data.get(POSTAL_CODE));
|
healthCareFacility.getAddress().setPostalCode((String) data.get(POSTAL_CODE));
|
||||||
healthCareFacility.getAddress().setCity((String)data.get(CITY));
|
healthCareFacility.getAddress().setCity((String) data.get(CITY));
|
||||||
healthCareFacility.getAddress().setState((String)data.get(STATE));
|
healthCareFacility.getAddress().setState((String) data.get(STATE));
|
||||||
healthCareFacility.getAddress().setIsoCountryCode((String)data.get(ISO_COUNTRY_CODE));
|
healthCareFacility.getAddress().setIsoCountryCode((String) data.get(ISO_COUNTRY_CODE));
|
||||||
|
|
||||||
healthCareFacility.getAddress().save();
|
healthCareFacility.getAddress().save();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,6 @@ import org.apache.log4j.Logger;
|
||||||
public class HealthCareFacilityPropertiesStep extends SimpleEditStep {
|
public class HealthCareFacilityPropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertiesStep.class);
|
private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertiesStep.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Name of the this edit sheet (Don't know if this this really needed.
|
* Name of the this edit sheet (Don't know if this this really needed.
|
||||||
* It has the same value in almost all PropertiesStep classes)
|
* It has the same value in almost all PropertiesStep classes)
|
||||||
|
|
@ -55,22 +54,22 @@ public class HealthCareFacilityPropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
/* Create the edit component for this SimpleEditStep and the corresponding link */
|
/* Create the edit component for this SimpleEditStep and the corresponding link */
|
||||||
BasicPageForm editBasicSheet = new HealthCareFacilityPropertyForm(itemModel, this);
|
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 */
|
/* Set the displayComponent for this step */
|
||||||
basicProperties.setDisplayComponent(getHealthCareFacilityPropertySheet(itemModel));
|
basicProperties.setDisplayComponent(getHealthCareFacilityPropertySheet(itemModel));
|
||||||
|
|
||||||
/* Add the SimpleEditStep to the segmented panel */
|
/* 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 not disabled via registry, add the ui for attaching an address
|
||||||
if(!HealthCareFacility.getConfig().getHideAddress()) {
|
if (!HealthCareFacility.getConfig().getHideAddress()) {
|
||||||
HealthCareFacilityAddressPropertiesStep addressProperties = new HealthCareFacilityAddressPropertiesStep(itemModel, parent);
|
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);
|
HealthCareFacilityContactPropertiesStep contactProperties = new HealthCareFacilityContactPropertiesStep(itemModel, parent);
|
||||||
segmentedPanel.addSegment(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact").localize()), baseContacts);
|
segmentedPanel.addSegment(new Label((String) HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.contact").localize()), contactProperties);
|
||||||
|
|
||||||
/* Sets the composed segmentedPanel as display component */
|
/* Sets the composed segmentedPanel as display component */
|
||||||
setDisplayComponent(segmentedPanel);
|
setDisplayComponent(segmentedPanel);
|
||||||
|
|
@ -90,19 +89,18 @@ public class HealthCareFacilityPropertiesStep extends SimpleEditStep {
|
||||||
/* The DisplayComponent for the Basic Properties */
|
/* The DisplayComponent for the Basic Properties */
|
||||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||||
|
|
||||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),"name");
|
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"), "name");
|
||||||
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),"title");
|
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), "title");
|
||||||
|
|
||||||
if(!ContentSection.getConfig().getHideLaunchDate()) {
|
if (!ContentSection.getConfig().getHideLaunchDate()) {
|
||||||
sheet.add(GlobalizationUtil.globalize("cms.ui.authoring.page_launch_date"), ContentPage.LAUNCH_DATE, new DomainObjectPropertySheet.AttributeFormatter() {
|
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) {
|
public String format(DomainObject obj, String attribute, PageState state) {
|
||||||
ContentPage page = (ContentPage)obj;
|
ContentPage page = (ContentPage) obj;
|
||||||
if(page.getLaunchDate() != null) {
|
if (page.getLaunchDate() != null) {
|
||||||
return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate());
|
return DateFormat.getDateInstance(DateFormat.LONG).format(page.getLaunchDate());
|
||||||
}
|
} else {
|
||||||
else {
|
return (String) GlobalizationUtil.globalize("cms.ui.unknown").localize();
|
||||||
return (String)GlobalizationUtil.globalize("cms.ui.unknown").localize();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -110,5 +108,4 @@ public class HealthCareFacilityPropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -18,12 +18,9 @@ import org.apache.log4j.Logger;
|
||||||
public class HealthCareFacilityPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
public class HealthCareFacilityPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertyForm.class);
|
private static final Logger logger = Logger.getLogger(HealthCareFacilityPropertyForm.class);
|
||||||
|
|
||||||
private HealthCareFacilityPropertiesStep m_step;
|
private HealthCareFacilityPropertiesStep m_step;
|
||||||
|
|
||||||
public static final String ADRESS = HealthCareFacility.ADDRESS;
|
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
|
* ID of the form
|
||||||
*/
|
*/
|
||||||
|
|
@ -55,19 +52,19 @@ public class HealthCareFacilityPropertyForm extends BasicPageForm implements For
|
||||||
public void addWidgets() {
|
public void addWidgets() {
|
||||||
super.addWidgets();
|
super.addWidgets();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
add(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.basic_properties.description").localize())));
|
add(new Label((String)HealthCareFacilityGlobalizationUtil.globalize("cms.contenttypes.ui.healthCareFacility.basic_properties.description").localize())));
|
||||||
TextArea description = new TextArea(DESCRIPTION);
|
TextArea description = new TextArea(DESCRIPTION);
|
||||||
description.setRows(5);
|
description.setRows(5);
|
||||||
description.setCols(30);
|
description.setCols(30);
|
||||||
add(description);
|
add(description);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(FormSectionEvent e) throws FormProcessException {
|
public void init(FormSectionEvent e) throws FormProcessException {
|
||||||
FormData data = e.getFormData();
|
FormData data = e.getFormData();
|
||||||
HealthCareFacility healthCareFacility = (HealthCareFacility)super.initBasicWidgets(e);
|
HealthCareFacility healthCareFacility = (HealthCareFacility) super.initBasicWidgets(e);
|
||||||
|
|
||||||
// data.put(DESCRIPTION, healthCareFacility.getDescription());
|
// data.put(DESCRIPTION, healthCareFacility.getDescription());
|
||||||
}
|
}
|
||||||
|
|
@ -76,21 +73,21 @@ public class HealthCareFacilityPropertyForm extends BasicPageForm implements For
|
||||||
public void process(FormSectionEvent e) throws FormProcessException {
|
public void process(FormSectionEvent e) throws FormProcessException {
|
||||||
FormData data = e.getFormData();
|
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.setDescription((String)data.get(DESCRIPTION));
|
||||||
|
|
||||||
healthCareFacility.save();
|
healthCareFacility.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(m_step != null) {
|
if (m_step != null) {
|
||||||
m_step.maybeForwardToNextStep(e.getPageState());
|
m_step.maybeForwardToNextStep(e.getPageState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void submitted(FormSectionEvent e) throws FormProcessException {
|
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());
|
m_step.cancelStreamlinedCreation(e.getPageState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
xmlns:cms="http://www.arsdigita.com/cms/1.0"
|
xmlns:cms="http://www.arsdigita.com/cms/1.0"
|
||||||
version="1.0">
|
version="1.0">
|
||||||
|
|
||||||
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.HealthCareOrganization']" mode="cms:CT_graphics"
|
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.HealthCareFacility']" mode="cms:CT_graphics"
|
||||||
name="cms:CT_graphics_com_arsdigita_cms_contenttypes_BaseContact">
|
name="cms:CT_graphics_com_arsdigita_cms_contenttypes_HealthCareFacility">
|
||||||
<table width="435" border="0" cellspacing="0" cellpadding="0">
|
<table width="435" border="0" cellspacing="0" cellpadding="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="contentTitle" align="left" valign="top">
|
<td class="contentTitle" align="left" valign="top">
|
||||||
|
|
@ -29,8 +29,8 @@
|
||||||
</table>
|
</table>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.HealthCareOrganization']" mode="cms:CT_text"
|
<xsl:template match="cms:item[objectType='com.arsdigita.cms.contenttypes.HealthCareFacility']" mode="cms:CT_text"
|
||||||
name="cms:CT_text_com_arsdigita_cms_contenttypes_BaseContact">
|
name="cms:CT_text_com_arsdigita_cms_contenttypes_HealthCareFacility">
|
||||||
<h1 class="title"><xsl:value-of select="./title"/></h1>
|
<h1 class="title"><xsl:value-of select="./title"/></h1>
|
||||||
<xsl:if test="./address">
|
<xsl:if test="./address">
|
||||||
<span class="subtitle">Address</span>
|
<span class="subtitle">Address</span>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue