Verbesserung der Lokalisierung LDN Contact. Noch nicht fehlerfrei!.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2224 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2013-06-20 15:14:57 +00:00
parent 9c7a80b93d
commit c58251ff82
16 changed files with 598 additions and 436 deletions

View File

@ -38,7 +38,6 @@ import com.arsdigita.cms.SecurityManager;
import com.arsdigita.cms.contenttypes.ArticleSection; import com.arsdigita.cms.contenttypes.ArticleSection;
import com.arsdigita.cms.contenttypes.ArticleSectionCollection; import com.arsdigita.cms.contenttypes.ArticleSectionCollection;
import com.arsdigita.cms.contenttypes.MultiPartArticle; import com.arsdigita.cms.contenttypes.MultiPartArticle;
import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.cms.contenttypes.util.MPArticleGlobalizationUtil; import com.arsdigita.cms.contenttypes.util.MPArticleGlobalizationUtil;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
@ -58,8 +57,7 @@ import java.math.BigDecimal;
*/ */
public class SectionTable extends Table public class SectionTable extends Table
{ {
private static final Logger log = private static final Logger s_log = Logger.getLogger(SectionTable.class);
Logger.getLogger(SectionTable.class.getName());
// match columns by (symbolic) index, makes for easier reordering // match columns by (symbolic) index, makes for easier reordering
public static final int COL_INDEX_TITLE = 0; // "Section"; public static final int COL_INDEX_TITLE = 0; // "Section";
@ -69,18 +67,18 @@ public class SectionTable extends Table
private ItemSelectionModel m_selArticle; private ItemSelectionModel m_selArticle;
private ItemSelectionModel m_selSection; private ItemSelectionModel m_selSection;
private ItemSelectionModel m_moveSection; private ItemSelectionModel m_moveSection;
private static final Logger s_log = Logger.getLogger(SectionTable.class);
/** /**
* Constructor. * Constructor. Create an instance of this class.
* *
* @param selArticle a selection model that returns the MultiPartArticle * @param selArticle a selection model that returns the MultiPartArticle
* which holds the sections to display. * which holds the sections to display.
* @param moveSection * @param moveSection
*/ */
public SectionTable ( ItemSelectionModel selArticle, ItemSelectionModel moveSection ) { public SectionTable ( ItemSelectionModel selArticle,
ItemSelectionModel moveSection ) {
super(); super();
m_selArticle = selArticle; m_selArticle = selArticle;
m_moveSection = moveSection; m_moveSection = moveSection;
@ -177,12 +175,17 @@ public class SectionTable extends Table
* The model builder to generate a suitable model for the SectionTable * The model builder to generate a suitable model for the SectionTable
*/ */
protected class SectionTableModelBuilder extends LockableImpl protected class SectionTableModelBuilder extends LockableImpl
implements TableModelBuilder implements TableModelBuilder {
{
protected ItemSelectionModel m_selArticle; protected ItemSelectionModel m_selArticle;
protected ItemSelectionModel m_moveSection; protected ItemSelectionModel m_moveSection;
/**
* Private class constructor.
* @param selArticle
* @param moveSection
*/
public SectionTableModelBuilder ( ItemSelectionModel selArticle, public SectionTableModelBuilder ( ItemSelectionModel selArticle,
ItemSelectionModel moveSection ) { ItemSelectionModel moveSection ) {
m_selArticle = selArticle; m_selArticle = selArticle;
@ -190,6 +193,12 @@ public class SectionTable extends Table
} }
/**
*
* @param table
* @param state
* @return
*/
public TableModel makeModel ( Table table, PageState state ) { public TableModel makeModel ( Table table, PageState state ) {
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
@ -202,9 +211,10 @@ public class SectionTable extends Table
} }
protected class SectionTableModel /**
implements TableModel * Internal class
{ */
protected class SectionTableModel implements TableModel {
private TableColumnModel m_colModel; private TableColumnModel m_colModel;
private SectionTable m_table; private SectionTable m_table;
@ -318,7 +328,6 @@ public class SectionTable extends Table
Object key, int row, int column ) { Object key, int row, int column ) {
Component ret = null; Component ret = null;
// SecurityManager sm = Utilities.getSecurityManager(state);
SecurityManager sm = CMS.getSecurityManager(state); SecurityManager sm = CMS.getSecurityManager(state);
ContentItem item = (ContentItem)m_selArticle.getSelectedObject(state); ContentItem item = (ContentItem)m_selArticle.getSelectedObject(state);

View File

@ -981,7 +981,6 @@ cms.contenttypes.ui.person.delete_alias=Remove former name
cms.contenttypes.ui.person.alias.none=No former name cms.contenttypes.ui.person.alias.none=No former name
cms.contenttypes.ui.person.alias=Former name cms.contenttypes.ui.person.alias=Former name
cms.contenttypes.ui.person.alias.select=Select former name cms.contenttypes.ui.person.alias.select=Select former name
cms.contenttypes.ui.contact.alias.select.add=Select former name
cms.contenttypes.person.alias.select.wrong_type=No person selected cms.contenttypes.person.alias.select.wrong_type=No person selected
cms.contenttypes.person.alias.select.same_as_person=Selected person is the same as the current person. Alias and person can't be identical. cms.contenttypes.person.alias.select.same_as_person=Selected person is the same as the current person. Alias and person can't be identical.
cms.contenttypes.person.alias.select.no_suitable_language_variant=The selected item has no suitable language variant. cms.contenttypes.person.alias.select.no_suitable_language_variant=The selected item has no suitable language variant.

View File

@ -972,7 +972,6 @@ cms.contenttypes.ui.person.delete_alias=Fr\u00fcheren Namen entfernen
cms.contenttypes.ui.person.alias.none=Kein fr\u00fcherer Name cms.contenttypes.ui.person.alias.none=Kein fr\u00fcherer Name
cms.contenttypes.ui.person.alias=Fr\u00fcherer Name cms.contenttypes.ui.person.alias=Fr\u00fcherer Name
cms.contenttypes.ui.person.alias.select=Fr\u00fcheren Namen ausw\u00e4hlen cms.contenttypes.ui.person.alias.select=Fr\u00fcheren Namen ausw\u00e4hlen
cms.contenttypes.ui.contact.alias.select.add=Fr\u00fcheren Namen ausw\u00e4hlen
cms.contenttypes.person.alias.select.wrong_type=Kein Personendatensatz ausgew\u00e4hlt cms.contenttypes.person.alias.select.wrong_type=Kein Personendatensatz ausgew\u00e4hlt
cms.contenttypes.person.alias.select.same_as_person=Der ausgew\u00e4hlte Datensatz ist der gleiche Datensatz wie der aktuelle Datensatz. Alias und Person k\u00f6nnen nicht identisch sein. cms.contenttypes.person.alias.select.same_as_person=Der ausgew\u00e4hlte Datensatz ist der gleiche Datensatz wie der aktuelle Datensatz. Alias und Person k\u00f6nnen nicht identisch sein.
cms.contenttypes.person.alias.select.no_suitable_language_variant=Das ausgew\u00e4hlte Item hat keine passende Sprachvariante. cms.contenttypes.person.alias.select.no_suitable_language_variant=Das ausgew\u00e4hlte Item hat keine passende Sprachvariante.

View File

@ -20,7 +20,6 @@ cms.contenttypes.ui.person.delete_alias=Remove former name
cms.contenttypes.ui.person.alias.none=No former name cms.contenttypes.ui.person.alias.none=No former name
cms.contenttypes.ui.person.alias=Former name cms.contenttypes.ui.person.alias=Former name
cms.contenttypes.ui.person.alias.select=Select former name cms.contenttypes.ui.person.alias.select=Select former name
cms.contenttypes.ui.contact.alias.select.add=Select former name
cms.contenttypes.person.alias.select.wrong_type=No person selected cms.contenttypes.person.alias.select.wrong_type=No person selected
cms.contenttypes.person.alias.select.same_as_person=Selected person is the same as the current person. Alias and person can't be identical. cms.contenttypes.person.alias.select.same_as_person=Selected person is the same as the current person. Alias and person can't be identical.
cms.contenttypes.person.alias.select.no_suitable_language_variant=The selected item has no suitable language variant. cms.contenttypes.person.alias.select.no_suitable_language_variant=The selected item has no suitable language variant.

View File

@ -501,7 +501,6 @@ cms.contenttypes.ui.person.delete_alias=Remove former name
cms.contenttypes.ui.person.alias.none=No former name cms.contenttypes.ui.person.alias.none=No former name
cms.contenttypes.ui.person.alias=Former name cms.contenttypes.ui.person.alias=Former name
cms.contenttypes.ui.person.alias.select=Select former name cms.contenttypes.ui.person.alias.select=Select former name
cms.contenttypes.ui.contact.alias.select.add=Select former name
cms.contenttypes.person.alias.select.wrong_type=No person selected cms.contenttypes.person.alias.select.wrong_type=No person selected
cms.contenttypes.person.alias.select.same_as_person=Selected person is the same as the current person. Alias and person can't be identical. cms.contenttypes.person.alias.select.same_as_person=Selected person is the same as the current person. Alias and person can't be identical.
cms.contenttypes.person.alias.select.no_suitable_language_variant=The selected item has no suitable language variant. cms.contenttypes.person.alias.select.no_suitable_language_variant=The selected item has no suitable language variant.

View File

@ -1,26 +1,31 @@
com.arsdigita.london.contenttypes.ui.contact.address_saon=SAON london.contenttypes.ui.contact.address.saon=SAON
com.arsdigita.london.contenttypes.ui.contact.address_paon=PAON london.contenttypes.ui.contact.address.paon=PAON
com.arsdigita.london.contenttypes.ui.contact.address_streetdesc=Street Description london.contenttypes.ui.contact.address.streetdesc=Street Description
com.arsdigita.london.contenttypes.ui.contact.address_streetrefno=Street Reference No london.contenttypes.ui.contact.address.streetrefno=Street Reference No
com.arsdigita.london.contenttypes.ui.contact.address_locality=Locality london.contenttypes.ui.contact.address.locality=Locality
com.arsdigita.london.contenttypes.ui.contact.address_town=Town london.contenttypes.ui.contact.address.town=Town
com.arsdigita.london.contenttypes.ui.contact.address_administrative_area=Administrative Area london.contenttypes.ui.contact.address.administrative_area=Administrative Area
com.arsdigita.london.contenttypes.ui.contact.address_posttown=Postal Town london.contenttypes.ui.contact.address.posttown=Postal Town
com.arsdigita.london.contenttypes.ui.contact.address_postcode=Postal Code london.contenttypes.ui.contact.address.postcode=Postal Code
com.arsdigita.london.contenttypes.ui.contact.address_proprefno=Property Reference No london.contenttypes.ui.contact.address.proprefno=Property Reference No
com.arsdigita.london.contenttypes.ui.contact_type=Contact Type london.contenttypes.ui.contact.type=Contact Type
com.arsdigita.london.contenttypes.ui.contact_orgname=Organization Name london.contenttypes.ui.contact.orgname=Organization Name
com.arsdigita.london.contenttypes.ui.contact_deptname=Department Name london.contenttypes.ui.contact.deptname=Department Name
com.arsdigita.london.contenttypes.ui.contact_role=Role of Contact london.contenttypes.ui.contact.role=Role of Contact
com.arsdigita.london.contenttypes.ui.contact_givenname=Given Name london.contenttypes.ui.contact.givenname=Given Name
com.arsdigita.london.contenttypes.ui.contact_familyname=Family Name london.contenttypes.ui.contact.familyname=Family Name
com.arsdigita.london.contenttypes.ui.contact_suffix=Suffix london.contenttypes.ui.contact.suffix=Suffix
com.arsdigita.london.contenttypes.ui.contact_description=Contact Description london.contenttypes.ui.contact.phone_number=Number
com.arsdigita.london.contenttypes.ui.contact.phone_number=Number london.contenttypes.ui.contact.phone_type=Types
com.arsdigita.london.contenttypes.ui.phone_type=Types london.contenttypes.ui.contact.emails=Emails
com.arsdigita.london.contenttypes.ui.contact_emails=Emails
com.arsdigita.london.contenttypes.contact_authoring_step_description=Contact com.arsdigita.london.contenttypes.contact_authoring_step_description=Contact
com.arsdigita.london.contenttypes.contact_authoring_step_label=Contact com.arsdigita.london.contenttypes.contact_authoring_step_label=Contact
com.arsdigita.london.contenttypes.ui.name=Name com.arsdigita.london.contenttypes.ui.contact.select_contact=Select Contact
com.arsdigita.london.contenttypes.ui.title=Title london.contenttypes.ui.contact.add_phone_button=Add Phone
com.arsdigita.london.contenttypes.ui.description=Description london.contenttypes.ui.contact.phonetable.no_entries_msg=No Phones associated with this Contact
london.contenttypes.ui.contact.phonetable.header_type=Phone Type
london.contenttypes.ui.contact.phonetable.header_num=Phone Number
london.contenttypes.ui.contact.phonetable.header_delete=Delete
london.contenttypes.ui.contact.phonetable.confirm_delete=Delete this Phone?
london.contenttypes.ui.contact.phonetable.link_delete=delete
london.contenttypes.ui.contact.phonetable.delete_confirmation=Delete this Phone?

View File

@ -0,0 +1,31 @@
london.contenttypes.ui.contact.address.saon=SAON
london.contenttypes.ui.contact.address.paon=PAON
london.contenttypes.ui.contact.address.streetdesc=Stra\u00dfenname
london.contenttypes.ui.contact.address.streetrefno=Stra\u00dfennummer
london.contenttypes.ui.contact.address.locality=Region
london.contenttypes.ui.contact.address.town=Ort
london.contenttypes.ui.contact.address.administrative_area=Administrative Area
london.contenttypes.ui.contact.address.posttown=Postalischer Ort
london.contenttypes.ui.contact.address.postcode=Postalischer Code
london.contenttypes.ui.contact.address.proprefno=Gebietsreferenz
london.contenttypes.ui.contact.type=Kontakt Typ
london.contenttypes.ui.contact.orgname=Organisation (Name)
london.contenttypes.ui.contact.deptname=Kreis
london.contenttypes.ui.contact.role=Rolle des Kontakts
london.contenttypes.ui.contact.givenname=Vorname
london.contenttypes.ui.contact.familyname=Familienname
london.contenttypes.ui.contact.suffix=Erg\u00e4nzung
london.contenttypes.ui.contact.phone_number=Telefonnummer
london.contenttypes.ui.contact.phone_type=Telefon Typ
london.contenttypes.ui.contact.emails=E-Mail
com.arsdigita.london.contenttypes.contact_authoring_step_description=Kontakteintrag
com.arsdigita.london.contenttypes.contact_authoring_step_label=Kontakt
com.arsdigita.london.contenttypes.ui.contact.select_contact=Einen Kontakt ausw\u00e4hlen
london.contenttypes.ui.contact.add_phone_button=Telefonnummer hinzuf\u00fchren
london.contenttypes.ui.contact.phonetable.no_entries_msg=Es sind keine Telefonnummer mit diesem Kontakt verkn\u00fcpft.
london.contenttypes.ui.contact.phonetable.header_type=Telefon Typ
london.contenttypes.ui.contact.phonetable.header_num=Telefonnummer
london.contenttypes.ui.contact.phonetable.header_delete=L\u00f6schen
london.contenttypes.ui.contact.phonetable.confirm_delete=Delete this Phone?
london.contenttypes.ui.contact.phonetable.link_delete=l\u00f6schen
london.contenttypes.ui.contact.phonetable.delete_confirmation=Diesen Eintrag l\u00f6schen?

View File

@ -0,0 +1,31 @@
london.contenttypes.ui.contact.address.saon=SAON
london.contenttypes.ui.contact.address.paon=PAON
london.contenttypes.ui.contact.address.streetdesc=Street Description
london.contenttypes.ui.contact.address.streetrefno=Street Reference No
london.contenttypes.ui.contact.address.locality=Locality
london.contenttypes.ui.contact.address.town=Town
london.contenttypes.ui.contact.address.administrative_area=Administrative Area
london.contenttypes.ui.contact.address.posttown=Postal Town
london.contenttypes.ui.contact.address.postcode=Postal Code
london.contenttypes.ui.contact.address.proprefno=Property Reference No
london.contenttypes.ui.contact.type=Contact Type
london.contenttypes.ui.contact.orgname=Organization Name
london.contenttypes.ui.contact.deptname=Department Name
london.contenttypes.ui.contact.role=Role of Contact
london.contenttypes.ui.contact.givenname=Given Name
london.contenttypes.ui.contact.familyname=Family Name
london.contenttypes.ui.contact.suffix=Suffix
london.contenttypes.ui.contact.phone_number=Number
london.contenttypes.ui.contact.phone_type=Types
london.contenttypes.ui.contact.emails=Emails
com.arsdigita.london.contenttypes.contact_authoring_step_description=Contact
com.arsdigita.london.contenttypes.contact_authoring_step_label=Contact
com.arsdigita.london.contenttypes.ui.contact.select_contact=Select Contact
london.contenttypes.ui.contact.add_phone_button=Add Phone
london.contenttypes.ui.contact.phonetable.no_entries_msg=No Phones associated with this Contact
london.contenttypes.ui.contact.phonetable.header_type=Phone Type
london.contenttypes.ui.contact.phonetable.header_num=Phone Number
london.contenttypes.ui.contact.phonetable.header_delete=Delete
london.contenttypes.ui.contact.phonetable.confirm_delete=Delete this Phone?
london.contenttypes.ui.contact.phonetable.link_delete=delete
london.contenttypes.ui.contact.phonetable.delete_confirmation=Delete this Phone?

View File

@ -25,6 +25,7 @@ import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicItemForm; import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
/** /**
@ -50,9 +51,9 @@ public class ContactAddressProperties extends SimpleEditStep {
form = new ContactAddressPropertyForm(itemModel); form = new ContactAddressPropertyForm(itemModel);
add(EDIT_SHEET_NAME, add(EDIT_SHEET_NAME,
"Edit", GlobalizationUtil.globalize("cms.ui.edit"),
new WorkflowLockedComponentAccess(form, itemModel), new WorkflowLockedComponentAccess(form, itemModel),
form.getSaveCancelSection().getCancelButton()); form.getSaveCancelSection().getCancelButton());
setDisplayComponent(getAddressPropertySheet(itemModel)); setDisplayComponent(getAddressPropertySheet(itemModel));
} }
@ -69,45 +70,45 @@ public class ContactAddressProperties extends SimpleEditStep {
public static Component getAddressPropertySheet(ItemSelectionModel itemModel) { public static Component getAddressPropertySheet(ItemSelectionModel itemModel) {
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact.address_saon"), "london.contenttypes.ui.contact.address.saon"),
"contactAddress.saon"); "contactAddress.saon");
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact.address_paon"), "london.contenttypes.ui.contact.address.paon"),
"contactAddress.paon"); "contactAddress.paon");
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact.address_streetdesc"), "london.contenttypes.ui.contact.address.streetdesc"),
"contactAddress.streetDesc"); "contactAddress.streetDesc");
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact.address_streetrefno"), "london.contenttypes.ui.contact.address.streetrefno"),
"contactAddress.streetRefNo"); "contactAddress.streetRefNo");
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact.address_locality"), "london.contenttypes.ui.contact.address.locality"),
"contactAddress.locality"); "contactAddress.locality");
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact.address_town"), "london.contenttypes.ui.contact.address.town"),
"contactAddress.town"); "contactAddress.town");
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact.address_administrative_area"), "london.contenttypes.ui.contact.address.administrative_area"),
"contactAddress.administrativeArea"); "contactAddress.administrativeArea");
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact.address_posttown"), "london.contenttypes.ui.contact.address.posttown"),
"contactAddress.postTown"); "contactAddress.postTown");
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact.address_postcode"), "london.contenttypes.ui.contact.address.postcode"),
"contactAddress.postCode"); "contactAddress.postCode");
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact.address_proprefno"), "london.contenttypes.ui.contact.address.proprefno"),
"contactAddress.referenceNo"); "contactAddress.referenceNo");
return sheet; return sheet;
} }

View File

@ -42,20 +42,21 @@ import com.arsdigita.cms.ui.authoring.BasicItemForm;
* *
*/ */
public class ContactAddressPropertyForm extends BasicItemForm { public class ContactAddressPropertyForm extends BasicItemForm {
private static final Logger s_log = Logger.getLogger(
ContactAddressPropertyForm.class);
/** Name of this form */ /** Name of this form */
private static final String ID = "Contact_address_edit"; private static final String ID = "Contact_address_edit";
private static final Logger s_log = Logger.getLogger(ContactAddressPropertyForm.class);
/** /**
* Creates a new form to edit the <code>ContactAddress</code> object * Creates a new form to edit the <code>ContactAddress</code> object properties
* properties associated with the <code>Contact</code> object specified by * associated with the <code>Contact</code> object specified by the
* the item selection model passed in. * item selection model passed in.
* *
* @param itemModel The ItemSelectionModel to use to obtain the Contact * @param itemModel The ItemSelectionModel to use to obtain the Contact
* object to work on * object to work on
**/ */
public ContactAddressPropertyForm(ItemSelectionModel itemModel) { public ContactAddressPropertyForm(ItemSelectionModel itemModel) {
super(ID, itemModel); super(ID, itemModel);
} }
@ -81,7 +82,7 @@ public class ContactAddressPropertyForm extends BasicItemForm {
protected void addSAON() { protected void addSAON() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact.address_saon"))); .globalize("london.contenttypes.ui.contact.address.saon")));
ParameterModel saonParam = new StringParameter(ContactAddress.SAON); ParameterModel saonParam = new StringParameter(ContactAddress.SAON);
TextField saon = new TextField(saonParam); TextField saon = new TextField(saonParam);
add(saon); add(saon);
@ -89,7 +90,7 @@ public class ContactAddressPropertyForm extends BasicItemForm {
protected void addPAON() { protected void addPAON() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact.address_paon"))); .globalize("london.contenttypes.ui.contact.address.paon")));
ParameterModel paonParam = new StringParameter(ContactAddress.PAON); ParameterModel paonParam = new StringParameter(ContactAddress.PAON);
TextField paon = new TextField(paonParam); TextField paon = new TextField(paonParam);
paon.addValidationListener(new NotNullValidationListener()); paon.addValidationListener(new NotNullValidationListener());
@ -98,7 +99,7 @@ public class ContactAddressPropertyForm extends BasicItemForm {
protected void addStreetDesc() { protected void addStreetDesc() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact.address_streetdesc"))); .globalize("london.contenttypes.ui.contact.address.streetdesc")));
ParameterModel streetDescParam = new StringParameter(ContactAddress.STREET_DESC); ParameterModel streetDescParam = new StringParameter(ContactAddress.STREET_DESC);
TextField streetDesc = new TextField(streetDescParam); TextField streetDesc = new TextField(streetDescParam);
streetDesc.addValidationListener(new NotNullValidationListener()); streetDesc.addValidationListener(new NotNullValidationListener());
@ -107,7 +108,7 @@ public class ContactAddressPropertyForm extends BasicItemForm {
protected void addStreetRefNo() { protected void addStreetRefNo() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact.address_streetrefno"))); .globalize("london.contenttypes.ui.contact.address.streetrefno")));
ParameterModel streetRefNoParam = new StringParameter(ContactAddress.STREET_REF_NO); ParameterModel streetRefNoParam = new StringParameter(ContactAddress.STREET_REF_NO);
TextField streetRefNo = new TextField(streetRefNoParam); TextField streetRefNo = new TextField(streetRefNoParam);
add(streetRefNo); add(streetRefNo);
@ -115,7 +116,7 @@ public class ContactAddressPropertyForm extends BasicItemForm {
protected void addLocality() { protected void addLocality() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact.address_locality"))); .globalize("london.contenttypes.ui.contact.address.locality")));
ParameterModel localityParam = new StringParameter(ContactAddress.LOCALITY); ParameterModel localityParam = new StringParameter(ContactAddress.LOCALITY);
TextField locality = new TextField(localityParam); TextField locality = new TextField(localityParam);
add(locality); add(locality);
@ -123,7 +124,7 @@ public class ContactAddressPropertyForm extends BasicItemForm {
protected void addTown() { protected void addTown() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact.address_town"))); .globalize("london.contenttypes.ui.contact.address.town")));
ParameterModel townParam = new StringParameter(ContactAddress.TOWN); ParameterModel townParam = new StringParameter(ContactAddress.TOWN);
TextField town = new TextField(townParam); TextField town = new TextField(townParam);
add(town); add(town);
@ -131,7 +132,7 @@ public class ContactAddressPropertyForm extends BasicItemForm {
protected void addArea() { protected void addArea() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact.address_administrative_area"))); .globalize("london.contenttypes.ui.contact.address.administrative_area")));
ParameterModel adAreaParam = new StringParameter(ContactAddress.ADMINISTRATIVE_AREA); ParameterModel adAreaParam = new StringParameter(ContactAddress.ADMINISTRATIVE_AREA);
TextField adArea = new TextField(adAreaParam); TextField adArea = new TextField(adAreaParam);
add(adArea); add(adArea);
@ -139,7 +140,7 @@ public class ContactAddressPropertyForm extends BasicItemForm {
protected void addPostTown() { protected void addPostTown() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact.address_posttown"))); .globalize("london.contenttypes.ui.contact.address.posttown")));
ParameterModel postTownParam = new StringParameter(ContactAddress.POST_TOWN); ParameterModel postTownParam = new StringParameter(ContactAddress.POST_TOWN);
TextField postTown = new TextField(postTownParam); TextField postTown = new TextField(postTownParam);
add(postTown); add(postTown);
@ -147,7 +148,7 @@ public class ContactAddressPropertyForm extends BasicItemForm {
protected void addPostCode() { protected void addPostCode() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact.address_postcode"))); .globalize("london.contenttypes.ui.contact.address.postcode")));
ParameterModel postCodeParam = new StringParameter(ContactAddress.POST_CODE); ParameterModel postCodeParam = new StringParameter(ContactAddress.POST_CODE);
TextField postCode = new TextField(postCodeParam); TextField postCode = new TextField(postCodeParam);
add(postCode); add(postCode);
@ -155,7 +156,7 @@ public class ContactAddressPropertyForm extends BasicItemForm {
protected void addPropRefNo() { protected void addPropRefNo() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact.address_proprefno"))); .globalize("london.contenttypes.ui.contact.address.proprefno")));
ParameterModel propRefNoParam = new StringParameter(ContactAddress.PROP_REF_NO); ParameterModel propRefNoParam = new StringParameter(ContactAddress.PROP_REF_NO);
TextField propRefNo = new TextField(propRefNoParam); TextField propRefNo = new TextField(propRefNoParam);
add(propRefNo); add(propRefNo);

View File

@ -35,67 +35,72 @@ import com.arsdigita.cms.ui.authoring.CreationSelector;
import com.arsdigita.cms.ui.authoring.PageCreate; import com.arsdigita.cms.ui.authoring.PageCreate;
/** /**
* Authoring kit create component to create objects of <code>Contact</code> * Authoring kit create component to create objects of <code>Contact</code>
* ContentType objects. * ContentType objects. Replaces the default PageCreate class usually used
* * for most content items.
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
* *
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
* @version $Id: ContactCreate.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: ContactCreate.java 287 2005-02-22 00:29:02Z sskracic $
*
*/ */
public class ContactCreate extends PageCreate { public class ContactCreate extends PageCreate {
private CreationSelector m_parent; private CreationSelector m_parent;
public ContactCreate(ItemSelectionModel itemModel, public ContactCreate(ItemSelectionModel itemModel,
CreationSelector parent) { CreationSelector parent) {
super(itemModel, parent); super(itemModel, parent);
m_parent = parent; m_parent = parent;
} }
protected void addWidgets () {
super.addWidgets(); protected void addWidgets() {
TextField givenName = new TextField(Contact.GIVEN_NAME); /* Add the standard widgets title, name, and optional launchdate */
add(new Label(ContactGlobalizationUtil super.addWidgets();
.globalize("com.arsdigita.london.contenttypes.ui.contact_givenname")));
givenName.addValidationListener(new NotNullValidationListener());
add(givenName);
TextField familyName = new TextField(Contact.FAMILY_NAME); TextField givenName = new TextField(Contact.GIVEN_NAME);
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact_familyname"))); .globalize("london.contenttypes.ui.contact.givenname")));
familyName.addValidationListener(new NotNullValidationListener()); givenName.addValidationListener(new NotNullValidationListener());
add(familyName); add(givenName);
}
public void process ( FormSectionEvent e ) throws FormProcessException{ TextField familyName = new TextField(Contact.FAMILY_NAME);
add(new Label(ContactGlobalizationUtil
.globalize("london.contenttypes.ui.contact.familyname")));
familyName.addValidationListener(new NotNullValidationListener());
add(familyName);
}
FormData data = e.getFormData(); /**
PageState state = e.getPageState(); *
* @param e
* @throws FormProcessException
*/
@Override
public void process(FormSectionEvent e) throws FormProcessException {
// try to get the contact section from the state parameter FormData data = e.getFormData();
Folder f = m_parent.getFolder(state); PageState state = e.getPageState();
ContentSection sec = m_parent.getContentSection(state);
Contact contact = (Contact) createContentPage(state);
contact.setLanguage((String) data.get(LANGUAGE));
contact.setName((String)data.get(NAME));
contact.setTitle((String)data.get(TITLE));
contact.setGivenName((String)data.get(Contact.GIVEN_NAME));
contact.setFamilyName((String)data.get(Contact.FAMILY_NAME));
contact.save();
final ContentBundle bundle = new ContentBundle(contact); // try to get the contact section from the state parameter
bundle.setParent(f); Folder f = m_parent.getFolder(state);
bundle.setContentSection(m_parent.getContentSection(state)); ContentSection sec = m_parent.getContentSection(state);
bundle.save(); Contact contact = (Contact) createContentPage(state);
contact.setLanguage((String) data.get(LANGUAGE));
contact.setName((String) data.get(NAME));
contact.setTitle((String) data.get(TITLE));
contact.setGivenName((String) data.get(Contact.GIVEN_NAME));
contact.setFamilyName((String) data.get(Contact.FAMILY_NAME));
contact.save();
// aplaws default workflow final ContentBundle bundle = new ContentBundle(contact);
getWorkflowSection().applyWorkflow(state, contact); bundle.setParent(f);
bundle.setContentSection(m_parent.getContentSection(state));
bundle.save();
m_parent.editItem(state, contact); // aplaws default workflow
} getWorkflowSection().applyWorkflow(state, contact);
m_parent.editItem(state, contact);
}
} }

View File

@ -38,85 +38,83 @@ import java.util.ArrayList;
/** /**
* Form to Create objects of type <code>ContactPhone</code>. * Form to Create objects of type <code>ContactPhone</code>.
* *
* @author Shashin Shinde <sshinde@redhat.com> * @author Shashin Shinde <sshinde@redhat.com>
*
* @version $Id: ContactCreatePhone.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: ContactCreatePhone.java 287 2005-02-22 00:29:02Z sskracic $
*
*/ */
class ContactCreatePhone extends BasicItemForm { class ContactCreatePhone extends BasicItemForm {
private ItemSelectionModel m_model; private ItemSelectionModel m_model;
/** /**
* Creates a new form to create the <code>ContactPhone</code> object * Creates a new form to create the
* type associated with the <code>Contact</code> object specified * <code>ContactPhone</code> object type associated with the
* by the item selection model passed in. * <code>Contact</code> object specified by the item selection model passed
* * in.
* @param itemModel *
* The ItemSelectionModel to use to obtain the Contact object to * @param itemModel The ItemSelectionModel to use to obtain the Contact
* work on * object to work on
*/ */
public ContactCreatePhone(ItemSelectionModel itemModel) { public ContactCreatePhone(ItemSelectionModel itemModel) {
super("Contact_phone_create", itemModel); super("Contact_phone_create", itemModel);
m_model = itemModel; m_model = itemModel;
} }
/** /**
* Adds widgets to edit the address properties to form. Only paon and * Adds widgets to edit the address properties to form. Only paon and
* streetDesc are required, rest are optional. * streetDesc are required, rest are optional.
*/ */
@Override @Override
protected void addWidgets() { protected void addWidgets() {
add(new Label(ContactGlobalizationUtil.globalize( add(new Label(ContactGlobalizationUtil.globalize(
"com.arsdigita.london.contenttypes.ui.contact.phone_number"))); "london.contenttypes.ui.contact.phone_number")));
ParameterModel phoneNoParam = new StringParameter(ContactPhone.PHONE_NUMBER); ParameterModel phoneNoParam = new StringParameter(ContactPhone.PHONE_NUMBER);
TextField phoneNo = new TextField(phoneNoParam); TextField phoneNo = new TextField(phoneNoParam);
phoneNo.addValidationListener(new NotNullValidationListener()); phoneNo.addValidationListener(new NotNullValidationListener());
add(phoneNo); add(phoneNo);
add(new Label(ContactGlobalizationUtil.globalize( add(new Label(ContactGlobalizationUtil.globalize(
"com.arsdigita.london.contenttypes.ui.phone_type"))); "london.contenttypes.ui.contact.phone_type")));
ParameterModel phoneTypeParam = new StringParameter(ContactPhone.PHONE_TYPE); ParameterModel phoneTypeParam = new StringParameter(ContactPhone.PHONE_TYPE);
SingleSelect phoneType = new SingleSelect(phoneTypeParam); SingleSelect phoneType = new SingleSelect(phoneTypeParam);
add(phoneType); add(phoneType);
// retrieve static Phone types // retrieve static Phone types
ArrayList phTypes = ContactInitializer.getPhoneTypes(); ArrayList phTypes = ContactInitializer.getPhoneTypes();
for (int i = 0; i < phTypes.size(); i++) { for (int i = 0; i < phTypes.size(); i++) {
phoneType.addOption( phoneType.addOption(
new Option(phTypes.get(i).toString(), phTypes.get(i).toString())); new Option(phTypes.get(i).toString(), phTypes.get(i).toString()));
}
} }
}
/** /**
*/ */
public void init(FormSectionEvent e) { public void init(FormSectionEvent e) {
//Do nothing. //Do nothing.
} }
/** /**
* Create an object of type <code>ContactPhone</code> and add it to Contact * Create an object of type <code>ContactPhone</code> and add it
* object retrieved from passed in ItemSelectionModel. * to Contact object retrieved from passed in ItemSelectionModel.
*/ */
public void process(FormSectionEvent fse) { public void process(FormSectionEvent fse) {
FormData data = fse.getFormData(); FormData data = fse.getFormData();
Contact contact = (Contact) m_model.getSelectedObject(fse.getPageState()); Contact contact = (Contact) m_model.getSelectedObject(fse.getPageState());
// save only if save button was pressed // save only if save button was pressed
if (contact != null if (contact != null
&& getSaveCancelSection().getSaveButton().isSelected( && getSaveCancelSection().getSaveButton().isSelected(
fse.getPageState())) { fse.getPageState())) {
ContactPhone cph = new ContactPhone(); ContactPhone cph = new ContactPhone();
cph.setName("phone-for-contact-" + contact.getID()); cph.setName("phone-for-contact-" + contact.getID());
cph.setPhoneType((String) data.get(ContactPhone.PHONE_TYPE)); cph.setPhoneType((String) data.get(ContactPhone.PHONE_TYPE));
cph.setPhoneNumber((String) data.get(ContactPhone.PHONE_NUMBER)); cph.setPhoneNumber((String) data.get(ContactPhone.PHONE_NUMBER));
cph.save(); cph.save();
//Add it to the contact. //Add it to the contact.
contact.addPhone(cph); contact.addPhone(cph);
}
} }
}
} }

View File

@ -23,35 +23,36 @@ import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicItemForm; import com.arsdigita.cms.ui.authoring.BasicItemForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.london.contenttypes.util.ContactGlobalizationUtil;
/** /**
* A UI step to manipulate <code>Phones </code> for the Contact object * A UI step to manipulate <code>Phones </code> for the Contact object which is
* which is retrieved from the ItemSelectionModel. * retrieved from the ItemSelectionModel.
* *
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a> * @author Shashin Shinde <a
* * href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
* @version $Id: ContactPhonesPanel.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: ContactPhonesPanel.java 287 2005-02-22 00:29:02Z sskracic $
*
*/ */
public class ContactPhonesPanel extends SimpleEditStep { public class ContactPhonesPanel extends SimpleEditStep {
/** The name of the editing sheet added to this step */ /**
private static String EDIT_SHEET_NAME = "manage-phones"; * The name of the editing sheet added to this step
*/
private static String EDIT_SHEET_NAME = "manage-phones";
public ContactPhonesPanel(ItemSelectionModel itemModel, AuthoringKitWizard parent) { public ContactPhonesPanel(ItemSelectionModel itemModel,
super(itemModel, parent); AuthoringKitWizard parent) {
super(itemModel, parent);
BasicItemForm form = new ContactCreatePhone(itemModel); BasicItemForm form = new ContactCreatePhone(itemModel);
add(EDIT_SHEET_NAME,
ContactGlobalizationUtil.globalize(
"london.contenttypes.ui.contact.add_phone_button"),
new WorkflowLockedComponentAccess(form, itemModel),
form.getSaveCancelSection().getCancelButton());
add( ContactPhonesTable phTable = new ContactPhonesTable(itemModel);
EDIT_SHEET_NAME, setDisplayComponent(phTable);
"Add Phone",
new WorkflowLockedComponentAccess(form, itemModel),
form.getSaveCancelSection().getCancelButton());
ContactPhonesTable phTable = new ContactPhonesTable(itemModel);
setDisplayComponent(phTable);
}
}
} }

View File

@ -30,182 +30,268 @@ import com.arsdigita.bebop.table.TableColumn;
import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableColumnModel;
import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModel;
import com.arsdigita.bebop.table.TableModelBuilder; import com.arsdigita.bebop.table.TableModelBuilder;
import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.SecurityManager; import com.arsdigita.cms.SecurityManager;
import com.arsdigita.london.contenttypes.Contact; import com.arsdigita.london.contenttypes.Contact;
import com.arsdigita.london.contenttypes.ContactPhone; import com.arsdigita.london.contenttypes.ContactPhone;
import com.arsdigita.london.contenttypes.ContactPhonesCollection; import com.arsdigita.london.contenttypes.ContactPhonesCollection;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.london.contenttypes.util.ContactGlobalizationUtil;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import org.apache.log4j.Logger;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* A Table to display the Phones associated with the Contact object. * A Table to display the Phones associated with the Contact object. Provides
* Provides links to delete the corresponding phone in each row. * links to delete the corresponding phone in each row.
* *
* @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a> * @author Shashin Shinde <a href="mailto:sshinde@redhat.com">sshinde@redhat.com</a>
*
* @version $Id: ContactPhonesTable.java 287 2005-02-22 00:29:02Z sskracic $ * @version $Id: ContactPhonesTable.java 287 2005-02-22 00:29:02Z sskracic $
*
*/ */
class ContactPhonesTable extends Table implements TableActionListener{ class ContactPhonesTable extends Table implements TableActionListener {
private ItemSelectionModel m_contactSel; private static final Logger log =
Logger.getLogger(ContactPhonesTable.class.getName());
private static final String COL_PHONE_TYPE ="Phone Type";
private static final String COL_PHONE_NUM="Phone Number";
private static final String COL_DELETE ="Delete";
/**
* Constructor.Create an instance of this class.
*
* @param selContact , ItemSelectionModel which provides the
* <code>Contact</code> object whose Phones are to be manipulated.
*/
public ContactPhonesTable(ItemSelectionModel selContact) {
super();
m_contactSel = selContact;
setEmptyView(new Label("No Phones associated with this Contact")); // match columns by (symbolic) index, makes for easier reordering
private static final int COL_INDEX_PHONE_TYPE = 0; //"Phone Type";
private static final int COL_INDEX_PHONE_NUM = 1; //"Phone Number";
private static final int COL_INDEX_DELETE = 2; //"Delete";
TableColumnModel model = getColumnModel(); private ItemSelectionModel m_selContact;
model.add( new TableColumn( 0, COL_PHONE_TYPE ));
model.add( new TableColumn( 1, COL_PHONE_NUM ));
model.add( new TableColumn( 2, COL_DELETE ));
setModelBuilder(new PhonesTableModelBuilder(selContact)); /**
* Constructor. Create an instance of this class.
model.get(2).setCellRenderer(new DeleteCellRenderer()); *
* @param selContact ItemSelectionModel which provides the
addTableActionListener(this); * <code>Contact</code> object whose Phones are to be
* manipulated.
*/
public ContactPhonesTable(ItemSelectionModel selContact) {
} super();
m_selContact = selContact;
private class PhonesTableModelBuilder extends LockableImpl implements TableModelBuilder { setEmptyView(new Label(ContactGlobalizationUtil.globalize(
"london.contenttypes.ui.contact.phonetable.no_entries_msg")));
private ItemSelectionModel m_sel; TableColumnModel model = getColumnModel();
model.add(new TableColumn(
private PhonesTableModelBuilder(ItemSelectionModel sel){ COL_INDEX_PHONE_TYPE,
m_sel = sel; new Label(ContactGlobalizationUtil.globalize(
} "london.contenttypes.ui.contact.phonetable.header_type")
) ));
model.add(new TableColumn(
COL_INDEX_PHONE_NUM,
new Label(ContactGlobalizationUtil.globalize(
"london.contenttypes.ui.contact.phonetable.header_num")
) ));
model.add(new TableColumn(
COL_INDEX_DELETE,
new Label(ContactGlobalizationUtil.globalize(
"london.contenttypes.ui.contact.phonetable.header_delete")
) ));
public TableModel makeModel ( Table table, PageState state ) { model.get(2).setCellRenderer(new DeleteCellRenderer());
table.getRowSelectionModel().clearSelection(state);
Contact contact = (Contact) m_sel.getSelectedObject(state); setModelBuilder(new PhonesTableModelBuilder(selContact));
addTableActionListener(this);
return new PhonesTableModel(table, state, contact);
}
}
private class PhonesTableModel implements TableModel{
private Table m_table;
private ContactPhonesCollection m_phones;
private ContactPhone m_phone;
private PhonesTableModel(Table t,PageState ps,Contact c){
m_table = t;
m_phones = c.getPhones();
}
public int getColumnCount() {
return m_table.getColumnModel().size();
} }
/** /**
* check collection for the existence of another row.If it has fetch the *
* value of Current Phone object into m_phone class variable.
*/ */
public boolean nextRow() { private class PhonesTableModelBuilder extends LockableImpl
if(m_phones != null && m_phones.next()){ implements TableModelBuilder {
m_phone = m_phones.getPhone();
return true;
} else {
return false;
}
}
/**
* Return the phoneType and phoneNumber attributes for the Type and
* Number columns respectively.
* @see com.arsdigita.bebop.table.TableModel#getElementAt(int)
*/
public Object getElementAt(int columnIndex) {
switch (columnIndex){
case 0:
return m_phone.getPhoneType();
case 1:
return m_phone.getPhoneNumber();
case 2:
return "Delete";
default:
return null;
}
}
/** private ItemSelectionModel m_sel;
* Always return the ID of <code>Phone</code> represented by current row.
* @see com.arsdigita.bebop.table.TableModel#getKeyAt(int)
*/
public Object getKeyAt(int columnIndex) {
return m_phone.getID();
}
} /**
* Private class constructor
/** * @param sel
* Check for the permissions to delete item and put either a Lable or */
* a ControlLink accordingly. private PhonesTableModelBuilder(ItemSelectionModel sel) {
*/ m_sel = sel;
private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer{ }
public Component getComponent(Table table,PageState state,Object value, /**
boolean isSelected,Object key, *
int row,int column) { * @param table
* @param state
* @return
*/
public TableModel makeModel(Table table, PageState state) {
table.getRowSelectionModel().clearSelection(state);
Contact contact = (Contact) m_sel.getSelectedObject(state);
SecurityManager sm = Utilities.getSecurityManager(state);
Contact item = (Contact) m_contactSel.getSelectedObject(state); return new PhonesTableModel(table, state, contact);
boolean canDelete = sm.canAccess(state.getRequest(),
SecurityManager.DELETE_ITEM,
item);
if ( canDelete) {
ControlLink link = new ControlLink(value.toString());
link.setConfirmation("Delete this Phone ?");
return link;
} else {
return new Label(value.toString());
} }
} }
}
/** /**
* Provide implementation to TableActionListener method. * Internal private class.
* Code that comes into picture when a link on the table is clicked. */
* Handles delete event. private class PhonesTableModel implements TableModel {
*/
public void cellSelected(TableActionEvent evt) {
PageState state = evt.getPageState();
TableColumn col = getColumnModel().get(evt.getColumn().intValue()); private Table m_table;
String colName = (String) col.getHeaderValue(); private ContactPhonesCollection m_phones;
private ContactPhone m_phone;
if ( COL_DELETE.equals(colName) ) {
BigDecimal phoneID = new BigDecimal(evt.getRowKey().toString()); /**
Contact contact = (Contact) m_contactSel.getSelectedObject(state); * Private class constructor.
ContactPhone ph = new ContactPhone(phoneID); * @param t
contact.removePhone(ph); * @param ps
* @param c
*/
private PhonesTableModel(Table t, PageState ps, Contact c) {
m_table = t;
m_phones = c.getPhones();
}
/** Return the number of columsn this TableModel has. */
public int getColumnCount() {
return m_table.getColumnModel().size();
}
/**
* check collection for the existence of another row. If it has fetch
* the value of Current Phone object into m_phone class variable.
*/
public boolean nextRow() {
if (m_phones != null && m_phones.next()) {
m_phone = m_phones.getPhone();
return true;
} else {
return false;
}
}
/**
* Return the phoneType and phoneNumber attributes for the Type and
* Number columns respectively.
*
* @see com.arsdigita.bebop.table.TableModel#getElementAt(int)
*/
public Object getElementAt(int columnIndex) {
switch (columnIndex) {
case 0:
return m_phone.getPhoneType();
case 1:
return m_phone.getPhoneNumber();
case 2:
// return "Delete";
return new Label(
ContactGlobalizationUtil.globalize(
"london.contenttypes.ui.contact.phonetable.link_delete")
);
default:
return null;
}
}
/**
* Always return the ID of
* <code>Phone</code> represented by current row.
*
* @see com.arsdigita.bebop.table.TableModel#getKeyAt(int)
*/
public Object getKeyAt(int columnIndex) {
return m_phone.getID();
}
} }
}
/** /**
* provide Implementation to TableActionListener method. * Private class to check for the permissions to delete item and put either
* Does nothing in our case. * a Lable or a ControlLink accordingly.
*/ */
public void headSelected(TableActionEvent e) { private class DeleteCellRenderer extends LockableImpl
throw new UnsupportedOperationException("Not Implemented"); implements TableCellRenderer {
}
/**
*
* @param table
* @param state
* @param value
* @param isSelected
* @param key
* @param row
* @param column
* @return
*/
public Component getComponent(Table table, PageState state,
Object value, boolean isSelected,
Object key, int row, int column) {
Component ret = null;
SecurityManager sm = CMS.getSecurityManager(state);
Contact item = (Contact) m_selContact.getSelectedObject(state);
/* Check for permission to delete item */
boolean canDelete = sm.canAccess(state.getRequest(),
SecurityManager.DELETE_ITEM,
item);
if ( value instanceof Label ) { // just the delete Controllink
if (canDelete) {
ret = new ControlLink((Component)value);
// ret.setConfirmation(ContactGlobalizationUtil.globalize(
// "london.contenttypes.ui.contact.phonetable.confirm_delete"));
} else {
ret = (Component)value;
}
} else if ( value instanceof String ) { // phone type and value
// if (canDelete) {
// ret = new ControlLink(value.toString());
// ret = new ControlLink((String)value);
// link.setConfirmation("Delete this Phone ?");
// return link;
// } else {
ret = new Label((String)value);
// }
} else {
// return new Label(value.toString());
/* Just returns the label without underlying link */
ret = new Label(value.toString());
}
return ret;
}
}
/**
* Provide implementation to TableActionListener method. Code that comes
* into picture when a link on the table is clicked. Handles delete event.
*/
public void cellSelected(TableActionEvent evt) {
PageState state = evt.getPageState();
TableColumn col = getColumnModel().get(evt.getColumn().intValue());
int columnIndex = col.getModelIndex();
// if (COL_DELETE.equals(colName)) {
if ( columnIndex == COL_INDEX_DELETE ) {
BigDecimal phoneID = new BigDecimal(evt.getRowKey().toString());
Contact contact = (Contact) m_selContact.getSelectedObject(state);
ContactPhone ph = new ContactPhone(phoneID);
contact.removePhone(ph);
}
}
/**
* provide Implementation to TableActionListener method. Does nothing in our
* case.
*/
public void headSelected(TableActionEvent e) {
throw new UnsupportedOperationException("Not Implemented");
}
} }

View File

@ -20,14 +20,14 @@ package com.arsdigita.london.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.london.contenttypes.Contact;
import com.arsdigita.london.contenttypes.util.ContactGlobalizationUtil;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.domain.DomainObject; import com.arsdigita.domain.DomainObject;
import com.arsdigita.london.contenttypes.Contact;
import com.arsdigita.london.contenttypes.util.ContactGlobalizationUtil;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
@ -51,11 +51,10 @@ public class ContactPropertiesStep extends SimpleEditStep {
BasicPageForm editSheet; BasicPageForm editSheet;
editSheet = new ContactPropertyForm(itemModel); editSheet = new ContactPropertyForm(itemModel);
add( add(EDIT_SHEET_NAME,
EDIT_SHEET_NAME, GlobalizationUtil.globalize("cms.ui.edit"),
"Edit", new WorkflowLockedComponentAccess(editSheet, itemModel),
new WorkflowLockedComponentAccess(editSheet, itemModel), editSheet.getSaveCancelSection().getCancelButton());
editSheet.getSaveCancelSection().getCancelButton());
setDisplayComponent(getContactPropertySheet(itemModel)); setDisplayComponent(getContactPropertySheet(itemModel));
} }
@ -71,62 +70,60 @@ public class ContactPropertiesStep extends SimpleEditStep {
public static Component getContactPropertySheet(ItemSelectionModel itemModel) { public static Component getContactPropertySheet(ItemSelectionModel itemModel) {
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
sheet.add( sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),
GlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.title"), Contact.TITLE);
Contact.TITLE);
sheet.add( sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
GlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.name"), Contact.NAME);
Contact.NAME);
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize( "london.contenttypes.ui.contact.givenname"),
"com.arsdigita.london.contenttypes.ui.contact_givenname"), Contact.GIVEN_NAME);
Contact.GIVEN_NAME);
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize( "london.contenttypes.ui.contact.familyname"),
"com.arsdigita.london.contenttypes.ui.contact_familyname"), Contact.FAMILY_NAME);
Contact.FAMILY_NAME);
sheet.add(ContactGlobalizationUtil.globalize(
"london.contenttypes.ui.contact.suffix"),
Contact.SUFFIX);
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("cms.contenttypes.ui.contact_type"), "london.contenttypes.ui.contact.type"),
Contact.CONTACT_TYPE, Contact.CONTACT_TYPE,
new DomainObjectPropertySheet.AttributeFormatter() { new DomainObjectPropertySheet.AttributeFormatter() {
public String format(DomainObject item,String attribute,PageState state) { public String format(DomainObject item,
Contact contact = (Contact) item; String attribute,
if (contact.getContactType() != null) { PageState state) {
return contact.getContactTypeName(); Contact contact = (Contact) item;
} else { if (contact.getContactType() != null) {
return "unknown"; return contact.getContactTypeName();
} } else {
} return (String) GlobalizationUtil
}); .globalize("cms.ui.unknown")
.localize();
}
}
});
sheet.add( sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.description"),
GlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.description"), Contact.DESCRIPTION);
Contact.DESCRIPTION);
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact_emails"), "london.contenttypes.ui.contact.emails"),
Contact.EMAILS); Contact.EMAILS);
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact_suffix"), "london.contenttypes.ui.contact.orgname"),
Contact.SUFFIX); Contact.ORG_NAME);
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact_orgname"), "london.contenttypes.ui.contact.deptname"),
Contact.ORG_NAME); Contact.DEPT_NAME);
sheet.add( sheet.add(ContactGlobalizationUtil.globalize(
ContactGlobalizationUtil.globalize( "london.contenttypes.ui.contact.role"),
"com.arsdigita.london.contenttypes.ui.contact_deptname"), Contact.ROLE);
Contact.DEPT_NAME);
sheet.add(
ContactGlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.contact_role"),
Contact.ROLE);
return sheet; return sheet;
} }

View File

@ -35,6 +35,7 @@ import com.arsdigita.london.contenttypes.ContactType;
import com.arsdigita.london.contenttypes.ContactTypesCollection; import com.arsdigita.london.contenttypes.ContactTypesCollection;
import com.arsdigita.london.contenttypes.util.ContactGlobalizationUtil; import com.arsdigita.london.contenttypes.util.ContactGlobalizationUtil;
import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.util.GlobalizationUtil;
/** /**
* Form to edit basic properties of <code>Contact</code> object. Used by * Form to edit basic properties of <code>Contact</code> object. Used by
@ -81,32 +82,32 @@ public class ContactPropertyForm extends BasicPageForm {
} }
protected void addGivenNameWidget() { protected void addGivenNameWidget() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil.globalize(
.globalize("com.arsdigita.london.contenttypes.ui.contact_givenname"))); "london.contenttypes.ui.contact.givenname")));
ParameterModel givenNameParam = new StringParameter(Contact.GIVEN_NAME); ParameterModel givenNameParam = new StringParameter(Contact.GIVEN_NAME);
TextField givenName = new TextField(givenNameParam); TextField givenName = new TextField(givenNameParam);
add(givenName); add(givenName);
} }
protected void addFamilyNameWidget() { protected void addFamilyNameWidget() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil.globalize(
.globalize("com.arsdigita.london.contenttypes.ui.contact_familyname"))); "london.contenttypes.ui.contact.familyname")));
ParameterModel familyNameParam = new StringParameter(Contact.FAMILY_NAME); ParameterModel familyNameParam = new StringParameter(Contact.FAMILY_NAME);
TextField familyName = new TextField(familyNameParam); TextField familyName = new TextField(familyNameParam);
add(familyName); add(familyName);
} }
protected void addSuffixWidget() { protected void addSuffixWidget() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil.globalize(
.globalize("com.arsdigita.london.contenttypes.ui.contact_suffix"))); "london.contenttypes.ui.contact.suffix")));
ParameterModel suffixParam = new StringParameter(Contact.SUFFIX); ParameterModel suffixParam = new StringParameter(Contact.SUFFIX);
TextField suffix = new TextField(suffixParam); TextField suffix = new TextField(suffixParam);
add(suffix); add(suffix);
} }
protected void addContactTypeWidget() { protected void addContactTypeWidget() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil.globalize(
.globalize("com.arsdigita.london.contenttypes.ui.contact_type"))); "london.contenttypes.ui.contact.type")));
ParameterModel contactTypeParam = new StringParameter(Contact.CONTACT_TYPE); ParameterModel contactTypeParam = new StringParameter(Contact.CONTACT_TYPE);
SingleSelect contactType = new SingleSelect(contactTypeParam); SingleSelect contactType = new SingleSelect(contactTypeParam);
add(contactType); add(contactType);
@ -118,8 +119,8 @@ public class ContactPropertyForm extends BasicPageForm {
} }
protected void addDescriptionWidget() { protected void addDescriptionWidget() {
add(new Label(ContactGlobalizationUtil add(new Label(GlobalizationUtil.globalize(
.globalize("com.arsdigita.london.contenttypes.ui.contact_description"))); "cms.contenttypes.ui.description")));
ParameterModel descParam = new StringParameter(Contact.DESCRIPTION); ParameterModel descParam = new StringParameter(Contact.DESCRIPTION);
TextArea desc = new TextArea(descParam); TextArea desc = new TextArea(descParam);
desc.setRows(5); desc.setRows(5);
@ -128,7 +129,7 @@ public class ContactPropertyForm extends BasicPageForm {
protected void addEmailsWidget() { protected void addEmailsWidget() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact_emails"))); .globalize("london.contenttypes.ui.contact.emails")));
ParameterModel emailsParam = new StringParameter(Contact.EMAILS); ParameterModel emailsParam = new StringParameter(Contact.EMAILS);
TextField emails = new TextField(emailsParam); TextField emails = new TextField(emailsParam);
add(emails); add(emails);
@ -136,7 +137,7 @@ public class ContactPropertyForm extends BasicPageForm {
protected void addOrganizationNameWidget() { protected void addOrganizationNameWidget() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact_orgname"))); .globalize("london.contenttypes.ui.contact.orgname")));
ParameterModel orgNameParam = new StringParameter(Contact.ORG_NAME); ParameterModel orgNameParam = new StringParameter(Contact.ORG_NAME);
TextField orgName = new TextField(orgNameParam); TextField orgName = new TextField(orgNameParam);
add(orgName); add(orgName);
@ -144,7 +145,7 @@ public class ContactPropertyForm extends BasicPageForm {
protected void addDepartmentNameWidget() { protected void addDepartmentNameWidget() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact_deptname"))); .globalize("london.contenttypes.ui.contact.deptname")));
ParameterModel deptParam = new StringParameter(Contact.DEPT_NAME); ParameterModel deptParam = new StringParameter(Contact.DEPT_NAME);
TextField deptName = new TextField(deptParam); TextField deptName = new TextField(deptParam);
add(deptName); add(deptName);
@ -152,7 +153,7 @@ public class ContactPropertyForm extends BasicPageForm {
protected void addRoleWidget() { protected void addRoleWidget() {
add(new Label(ContactGlobalizationUtil add(new Label(ContactGlobalizationUtil
.globalize("com.arsdigita.london.contenttypes.ui.contact_role"))); .globalize("london.contenttypes.ui.contact.role")));
ParameterModel roleParam = new StringParameter(Contact.ROLE); ParameterModel roleParam = new StringParameter(Contact.ROLE);
TextField role = new TextField(roleParam); TextField role = new TextField(roleParam);
add(role); add(role);