diff --git a/ccm-core/src/com/arsdigita/bebop/ControlLink.java b/ccm-core/src/com/arsdigita/bebop/ControlLink.java index 2b171924d..0e844ae1e 100755 --- a/ccm-core/src/com/arsdigita/bebop/ControlLink.java +++ b/ccm-core/src/com/arsdigita/bebop/ControlLink.java @@ -63,7 +63,8 @@ import com.arsdigita.xml.Element; * * @author Stanislav Freidin * @author David Lutterkort - * @version $Id: ControlLink.java 287 2005-02-22 00:29:02Z sskracic $ */ + * @version $Id: ControlLink.java 287 2005-02-22 00:29:02Z sskracic $ + */ public class ControlLink extends BaseLink { /** @@ -170,7 +171,6 @@ public class ControlLink extends BaseLink { try { parent.addAttribute("href", state.stateAsURL()); } catch (IOException e) { -// e.printStackTrace(); parent.addAttribute("href", ""); } exportAttributes(parent); diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactAddressProperties.java b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactAddressProperties.java index 8a9f76cf1..1a8ea389c 100755 --- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactAddressProperties.java +++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactAddressProperties.java @@ -35,7 +35,6 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; * @author Shashin Shinde sshinde@redhat.com * * @version $Id: ContactAddressProperties.java 287 2005-02-22 00:29:02Z sskracic $ - * */ public class ContactAddressProperties extends SimpleEditStep { diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactCreate.java b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactCreate.java index 1a1f56a0a..e49f80a85 100755 --- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactCreate.java +++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactCreate.java @@ -53,6 +53,7 @@ public class ContactCreate extends PageCreate { m_parent = parent; } + @Override protected void addWidgets() { /* Add the standard widgets title, name, and optional launchdate */ diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPhonesTable.java b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPhonesTable.java index 969bc2cd8..4374a33ea 100755 --- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPhonesTable.java +++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPhonesTable.java @@ -74,9 +74,6 @@ class ContactPhonesTable extends Table implements TableActionListener { super(); m_selContact = selContact; - setEmptyView(new Label(ContactGlobalizationUtil.globalize( - "london.contenttypes.ui.contact.phonetable.no_entries_msg"))); - TableColumnModel model = getColumnModel(); model.add(new TableColumn( COL_INDEX_PHONE_TYPE, @@ -94,6 +91,9 @@ class ContactPhonesTable extends Table implements TableActionListener { "london.contenttypes.ui.contact.phonetable.header_delete") ) )); + setEmptyView(new Label(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.phonetable.no_entries_msg"))); + model.get(2).setCellRenderer(new DeleteCellRenderer()); setModelBuilder(new PhonesTableModelBuilder(selContact)); @@ -103,7 +103,7 @@ class ContactPhonesTable extends Table implements TableActionListener { } /** - * + * Private class Model Builder to build the required data for the table. */ private class PhonesTableModelBuilder extends LockableImpl implements TableModelBuilder { @@ -180,12 +180,11 @@ class ContactPhonesTable extends Table implements TableActionListener { public Object getElementAt(int columnIndex) { switch (columnIndex) { - case 0: + case COL_INDEX_PHONE_TYPE: return m_phone.getPhoneType(); - case 1: + case COL_INDEX_PHONE_NUM: return m_phone.getPhoneNumber(); - case 2: - // return "Delete"; + case COL_INDEX_DELETE: return new Label( ContactGlobalizationUtil.globalize( "london.contenttypes.ui.contact.phonetable.link_delete") @@ -207,7 +206,9 @@ class ContactPhonesTable extends Table implements TableActionListener { } /** - * Private class to check for the permissions to delete item and put either + * Internal private class to handle the click on the delete link in the + * table of available contacts. + * Checks for the permissions to delete item and put either * a Lable or a ControlLink accordingly. */ private class DeleteCellRenderer extends LockableImpl @@ -222,7 +223,8 @@ class ContactPhonesTable extends Table implements TableActionListener { * @param key * @param row * @param column - * @return + * @return the link to delete the selected + * entry or just a label without link. */ public Component getComponent(Table table, PageState state, Object value, boolean isSelected, @@ -240,28 +242,17 @@ class ContactPhonesTable extends Table implements TableActionListener { 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); - // } + ControlLink link = new ControlLink( (Component)value ); + link.setConfirmation(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.phonetable.confirm_delete")); + ret = link; + } else { + ret = (Component)value; + } } else { - // return new Label(value.toString()); /* Just returns the label without underlying link */ - ret = new Label(value.toString()); + ret = (Component)value; } return ret; @@ -278,7 +269,6 @@ class ContactPhonesTable extends Table implements TableActionListener { 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); diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertiesStep.java b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertiesStep.java index c62b8f12d..0d663565a 100755 --- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertiesStep.java +++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertiesStep.java @@ -37,7 +37,6 @@ import com.arsdigita.bebop.PageState; * @author Shashin Shinde sshinde@redhat.com * * @version $Id: ContactPropertiesStep.java 287 2005-02-22 00:29:02Z sskracic $ - * */ public class ContactPropertiesStep extends SimpleEditStep { diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources.properties b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources.properties index 2c884cee9..d63002168 100755 --- a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources.properties +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources.properties @@ -1 +1,5 @@ -com.arsdigita.london.contenttypes.ui.esdservice.servicetimes=Service Times +london.contenttypes.ui.esdservice.servicetimes=Service Times +london.contenttypes.ui.esdservice.select_contact=Select Contact +london.contenttypes.ui.esdservice.no_contacts=No contacts assoziated yet. +london.contenttypes.ui.esdservice.select=select +london.contenttypes.ui.esdservice.select_this_contact=Select this Contact? diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources_de.properties b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources_de.properties new file mode 100755 index 000000000..eb5691a78 --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources_de.properties @@ -0,0 +1,7 @@ +london.contenttypes.ui.esdservice.servicetimes=\u00d6ffnungszeiten +london.contenttypes.ui.esdservice.select_contact=Kontakt ausw\u00e4hlen +#No contacts assoziated yet. +london.contenttypes.ui.esdservice.no_contacts=Bisher sind keine Kontakte zugeordnet. +london.contenttypes.ui.esdservice.select=ausw\u00e4hlen +london.contenttypes.ui.esdservice.select_this_contact=Diesen Kontakt ausw\u00e4hlen? +iesen Kontakt ausw\u00e4hlen? diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources_en.properties b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources_en.properties new file mode 100755 index 000000000..843d6244a --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources_en.properties @@ -0,0 +1,6 @@ +london.contenttypes.ui.esdservice.servicetimes=Service Times +london.contenttypes.ui.esdservice.select_contact=Select Contact +#No contacts assoziated yet. +london.contenttypes.ui.esdservice.no_contacts=No contacts assoziated yet. +london.contenttypes.ui.esdservice.select=select +london.contenttypes.ui.esdservice.select_this_contact=Select this Contact? diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources_fr.properties b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources_fr.properties new file mode 100755 index 000000000..843d6244a --- /dev/null +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ESDServiceResources_fr.properties @@ -0,0 +1,6 @@ +london.contenttypes.ui.esdservice.servicetimes=Service Times +london.contenttypes.ui.esdservice.select_contact=Select Contact +#No contacts assoziated yet. +london.contenttypes.ui.esdservice.no_contacts=No contacts assoziated yet. +london.contenttypes.ui.esdservice.select=select +london.contenttypes.ui.esdservice.select_this_contact=Select this Contact? diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServiceChooseContactStep.java b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServiceChooseContactStep.java index d9b57bc96..75bd383f2 100755 --- a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServiceChooseContactStep.java +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServiceChooseContactStep.java @@ -19,10 +19,11 @@ package com.arsdigita.london.contenttypes.ui; import com.arsdigita.bebop.Component; import com.arsdigita.cms.ItemSelectionModel; -import com.arsdigita.london.contenttypes.util.ContactGlobalizationUtil; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; +import com.arsdigita.london.contenttypes.util.ContactGlobalizationUtil; +import com.arsdigita.london.contenttypes.util.ESDServiceGlobalizationUtil; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; /** @@ -32,7 +33,6 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; * @author Shashin Shinde sshinde@redhat.com * * @version $Id: ESDServiceChooseContactStep.java 287 2005-02-22 00:29:02Z sskracic $ - * */ public class ESDServiceChooseContactStep extends SimpleEditStep { @@ -51,8 +51,9 @@ public class ESDServiceChooseContactStep extends SimpleEditStep { ESDServiceContactsTable table = new ESDServiceContactsTable(itemModel , this); addComponent(EDIT_SHEET_NAME, - "Select Contact", - new WorkflowLockedComponentAccess(table, itemModel)); + ESDServiceGlobalizationUtil.globalize( + "london.contenttypes.ui.esdservice.select_contact"), + new WorkflowLockedComponentAccess(table, itemModel)); setDisplayComponent(getContactPropertiesSheet(itemModel)); } @@ -65,20 +66,17 @@ public class ESDServiceChooseContactStep extends SimpleEditStep { private Component getContactPropertiesSheet(ItemSelectionModel itemModel) { DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); - sheet.add( - ContactGlobalizationUtil - .globalize("com.arsdigita.london.contenttypes.ui.contact_givenname"), - "serviceContact.givenName"); + sheet.add(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.givenname"), + "serviceContact.givenName"); - sheet.add( - ContactGlobalizationUtil - .globalize("com.arsdigita.london.contenttypes.ui.contact_familyname"), - "serviceContact.familyName"); + sheet.add(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.familyname"), + "serviceContact.familyName"); - sheet.add( - ContactGlobalizationUtil - .globalize("com.arsdigita.london.contenttypes.ui.contact_type"), - "serviceContact.contactType.typeName"); + sheet.add(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.type"), + "serviceContact.contactType.typeName"); return sheet; } diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServiceContactsTable.java b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServiceContactsTable.java index 707c4ea25..06a3d8ad8 100755 --- a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServiceContactsTable.java +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServiceContactsTable.java @@ -17,11 +17,6 @@ */ package com.arsdigita.london.contenttypes.ui; -import com.arsdigita.cms.ContentItem; -import com.arsdigita.cms.ItemSelectionModel; -import com.arsdigita.london.contenttypes.Contact; -import com.arsdigita.london.contenttypes.ESDService; - import com.arsdigita.bebop.Component; import com.arsdigita.bebop.ControlLink; import com.arsdigita.bebop.Label; @@ -34,7 +29,13 @@ import com.arsdigita.bebop.table.TableColumn; import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModelBuilder; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.domain.DomainObjectFactory; +import com.arsdigita.london.contenttypes.Contact; +import com.arsdigita.london.contenttypes.ESDService; +import com.arsdigita.london.contenttypes.util.ContactGlobalizationUtil; +import com.arsdigita.london.contenttypes.util.ESDServiceGlobalizationUtil; import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.OID; import com.arsdigita.persistence.SessionManager; @@ -43,167 +44,213 @@ import com.arsdigita.util.LockableImpl; import java.math.BigDecimal; /** - * - * A table which displays a list of Contact objects to choose - * from for the ESDService content type. - * - * @author Shashin Shinde sshinde@redhat.com + * A table which displays a list of + * Contact objects to choose from for the + * ESDService content type. + * + * @author Shashin Shinde sshinde@redhat.com * * @version $Id: ESDServiceContactsTable.java 451 2005-03-20 23:11:22Z mbooth $ - * */ -public class ESDServiceContactsTable extends Table implements TableActionListener{ +public class ESDServiceContactsTable extends Table implements TableActionListener { - private static final String COL_CONTACT_GIVENNAME = "Given Name"; - private static final String COL_CONTACT_FAMILYNAME = "Family Name"; - private static final String COL_CONTACT_TYPE = "Contact Type"; - private static final String COL_CHOOSE_CONTACT = "Select"; - - private ItemSelectionModel m_selService; - private ESDServiceChooseContactStep m_parent; - - /** - * Constructor. - * @param selService, selection model which will give the ESDService - * object that we are dealing with. - * @param parent, component whose display pane will be shown when the selection - * of desired contact is done. - */ - public ESDServiceContactsTable(ItemSelectionModel selService, - ESDServiceChooseContactStep parent) { - super(); + // match columns by (symbolic) index, makes for easier reordering + private static final int GIVENNAME_COL_IDX = 0; + private static final int FAMILYNAME_COL_IDX = 1; + private static final int TYPE_COL_IDX = 2; + private static final int CHOOSE_COL_IDX = 3; - m_parent = parent; - m_selService = selService; - - TableColumnModel model = getColumnModel(); - model.add( new TableColumn( 0, COL_CONTACT_GIVENNAME)); - model.add( new TableColumn( 1, COL_CONTACT_FAMILYNAME )); - model.add( new TableColumn( 2, COL_CONTACT_TYPE)); - model.add( new TableColumn( 3, COL_CHOOSE_CONTACT)); - - setEmptyView(new Label("No Contacts available.")); - setModelBuilder(new ContactsTableModelBuilder()); - - model.get(3).setCellRenderer(new SelectCellRenderer()); - - addTableActionListener(this); - - } + private static final String COL_CHOOSE_CONTACT = "Select"; + private ItemSelectionModel m_selService; + private ESDServiceChooseContactStep m_parent; - /** - * Model Builder to build the required data for the table. - */ - private class ContactsTableModelBuilder extends LockableImpl implements TableModelBuilder { + /** + * Constructor. + * + * @param selService, selection model which will give + * the ESDService object that we are dealing with. + * @param parent, component whose display pane will be shown when the + * selection of desired contact is done. + */ + public ESDServiceContactsTable(ItemSelectionModel selService, + ESDServiceChooseContactStep parent) { + super(); - public TableModel makeModel ( Table table, PageState state ) { - table.getRowSelectionModel().clearSelection(state); - DataCollection m_contacts = SessionManager.getSession().retrieve(Contact.BASE_DATA_OBJECT_TYPE); - m_contacts.addEqualsFilter(ContentItem.VERSION, ContentItem.DRAFT); - return new ContactsTableModel(table, m_contacts); - } - } - - private class ContactsTableModel implements TableModel{ - - private Table m_table; - private DataCollection m_contacts; - private Contact m_contact; + m_parent = parent; + m_selService = selService; + + TableColumnModel model = getColumnModel(); + model.add(new TableColumn( + GIVENNAME_COL_IDX, + new Label(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.givenname") + ) )); + model.add(new TableColumn( + FAMILYNAME_COL_IDX, + new Label(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.familyname") + ) )); + model.add(new TableColumn( + TYPE_COL_IDX, + new Label(ContactGlobalizationUtil.globalize( + "london.contenttypes.ui.contact.type") + ) )); + model.add(new TableColumn( + CHOOSE_COL_IDX, + new Label(ESDServiceGlobalizationUtil.globalize( + "london.contenttypes.ui.esdservice.select_contact") + ) )); + + setEmptyView(new Label(ESDServiceGlobalizationUtil.globalize( + "london.contenttypes.ui.esdservice.no_contacts") + )); + setModelBuilder(new ContactsTableModelBuilder()); + + model.get(3).setCellRenderer(new SelectCellRenderer()); + + addTableActionListener(this); - private ContactsTableModel(Table t , DataCollection cts){ - m_table = t; - m_contacts = cts; - } - - /** Return the no. of columns in column model we have constructed. */ - public int getColumnCount() { - return m_table.getColumnModel().size(); } /** - * check collection for the existence of another row.If it has fetch the - * value of Contact object into m_contact class variable. + * Private class Model Builder to build the required data for the table. */ - public boolean nextRow() { - if(m_contacts.next()){ - m_contact = (Contact) DomainObjectFactory.newInstance(m_contacts.getDataObject()); - return true; - }else{ - return false; - } - } - - /** - * Return the attributes of Contact object in the current row. - * @see com.arsdigita.bebop.table.TableModel#getElementAt(int) - */ - public Object getElementAt(int columnIndex) { + private class ContactsTableModelBuilder extends LockableImpl + implements TableModelBuilder { - switch (columnIndex){ - case 0: - return m_contact.getGivenName(); - case 1: - return m_contact.getFamilyName(); - case 2: - return m_contact.getContactTypeName(); - case 3: - return COL_CHOOSE_CONTACT; - default: - return null; - } + public TableModel makeModel(Table table, PageState state) { + table.getRowSelectionModel().clearSelection(state); + DataCollection m_contacts = SessionManager.getSession() + .retrieve(Contact.BASE_DATA_OBJECT_TYPE); + m_contacts.addEqualsFilter(ContentItem.VERSION, ContentItem.DRAFT); + return new ContactsTableModel(table, m_contacts); + } } /** - * Always return the ID of Contact represented by current row. - * @see com.arsdigita.bebop.table.TableModel#getKeyAt(int) + * Internal private class */ - public Object getKeyAt(int columnIndex) { - return m_contact.getID(); - } - } - - /** - * TODO:Check for the permissions to EDIT item and put either a Lable or - * a ControlLink accordingly. - */ - private class SelectCellRenderer extends LockableImpl implements TableCellRenderer{ + private class ContactsTableModel implements TableModel { - public Component getComponent(Table table,PageState state,Object value, - boolean isSelected,Object key, - int row,int column) { + private Table m_table; + private DataCollection m_contacts; + private Contact m_contact; - - ControlLink link = new ControlLink(value.toString()); - link.setConfirmation("Select this Contact ?"); - return link; - } - } - - /** - * Provide implementation to TableActionListener method. - * Code that comes into picture when select link in the table is clicked. - * Handles selection event. - */ - public void cellSelected(TableActionEvent evt) { - PageState state = evt.getPageState(); - TableColumn col = getColumnModel().get(evt.getColumn().intValue()); - String colName = (String) col.getHeaderValue(); - - if ( COL_CHOOSE_CONTACT.equals(colName) ) { - m_parent.showDisplayPane(state); - BigDecimal contactID = new BigDecimal(evt.getRowKey().toString()); - ESDService service = (ESDService) m_selService.getSelectedObject(state); - Contact ct = (Contact) DomainObjectFactory.newInstance(new OID(Contact.BASE_DATA_OBJECT_TYPE,contactID)); - service.setContact(ct); - } - } + private ContactsTableModel(Table t, DataCollection cts) { + m_table = t; + m_contacts = cts; + } - /** - * provide Implementation to TableActionListener method. - * Does nothing in our case. - */ - public void headSelected(TableActionEvent e) { - throw new UnsupportedOperationException("Not Implemented"); - } + /** + * Return the no. of columns in column model we have constructed. + */ + public int getColumnCount() { + return m_table.getColumnModel().size(); + } + + /** + * check collection for the existence of another row.If it has fetch the + * value of Contact object into m_contact class variable. + */ + public boolean nextRow() { + if (m_contacts.next()) { + m_contact = (Contact) DomainObjectFactory + .newInstance(m_contacts.getDataObject()); + return true; + } else { + return false; + } + } + + /** + * Return the attributes of Contact object in the current row. + * + * @see com.arsdigita.bebop.table.TableModel#getElementAt(int) + */ + public Object getElementAt(int columnIndex) { + + switch (columnIndex) { + case GIVENNAME_COL_IDX: + return m_contact.getGivenName(); + case FAMILYNAME_COL_IDX: + return m_contact.getFamilyName(); + case TYPE_COL_IDX: + return m_contact.getContactTypeName(); + case CHOOSE_COL_IDX: + return new Label(ESDServiceGlobalizationUtil.globalize( + "london.contenttypes.ui.esdservice.select") + ); + default: + return null; + } + } + + /** + * Always return the ID of + * Contact represented by current row. + * + * @see com.arsdigita.bebop.table.TableModel#getKeyAt(int) + */ + public Object getKeyAt(int columnIndex) { + return m_contact.getID(); + } + } + + /** + * Internal private class to handle the click on the select link in the + * table of available contacts. + */ + private class SelectCellRenderer extends LockableImpl + implements TableCellRenderer { + + /** + * + * @param table + * @param state + * @param value + * @param isSelected + * @param key + * @param row + * @param column + * @return the link to assoziate the selected + * contact entry with the service editet. + */ + public Component getComponent(Table table, PageState state, Object value, + boolean isSelected, Object key, + int row, int column) { + + ControlLink link = new ControlLink( (Component)value ); + link.setConfirmation(ESDServiceGlobalizationUtil.globalize( + "london.contenttypes.ui.esdservice.select_this_contact")); + return link; + } + } + + /** + * Provide implementation to TableActionListener method. Code that comes + * into picture when select link in the table is clicked. Handles selection + * event. + */ + public void cellSelected(TableActionEvent evt) { + + PageState state = evt.getPageState(); + TableColumn col = getColumnModel().get(evt.getColumn().intValue()); + + if ( CHOOSE_COL_IDX == evt.getColumn() ) { + m_parent.showDisplayPane(state); + BigDecimal contactID = new BigDecimal(evt.getRowKey().toString()); + ESDService service = (ESDService) m_selService.getSelectedObject(state); + Contact ct = (Contact) DomainObjectFactory.newInstance(new OID(Contact.BASE_DATA_OBJECT_TYPE, contactID)); + service.setContact(ct); + } + } + + /** + * provide Implementation to TableActionListener method. Does nothing in our + * case. + */ + public void headSelected(TableActionEvent e) { + throw new UnsupportedOperationException("Not Implemented"); + } } - diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesForm.java b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesForm.java index c6ef09348..5c6c790d6 100755 --- a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesForm.java +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesForm.java @@ -53,10 +53,12 @@ public class ESDServicePropertiesForm extends BasicPageForm { * Adds widgets to the form. **/ protected void addWidgets() { - super.addWidgets(); - add(new Label(ESDServiceGlobalizationUtil - .globalize("com.arsdigita.london.contenttypes.ui.esdservice.servicetimes"))); + /* Add standard widgets Title & name/url */ + super.addWidgets(); + + add(new Label(ESDServiceGlobalizationUtil.globalize( + "london.contenttypes.ui.esdservice.servicetimes"))); ParameterModel serviceTimesParam = new StringParameter(ESDService.SERVICE_TIMES); TextField serviceTimes = new TextField(serviceTimesParam); add(serviceTimes); diff --git a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesStep.java b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesStep.java index 18c1f7b5d..46e465356 100755 --- a/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesStep.java +++ b/ccm-ldn-types-esdservice/src/com/arsdigita/london/contenttypes/ui/ESDServicePropertiesStep.java @@ -28,61 +28,64 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.cms.util.GlobalizationUtil; /** - * Authoring kit step to edit the basic properties of ESDService - * content type object. - * - * @author Shashin Shinde sshinde@redhat.com + * Authoring kit step to edit the basic properties of + * ESDService content type object. + * + * @author Shashin Shinde sshinde@redhat.com + * + * @version $Id: ESDServicePropertiesStep.java 287 2005-02-22 00:29:02Z sskracic + * $ * - * @version $Id: ESDServicePropertiesStep.java 287 2005-02-22 00:29:02Z sskracic $ - * */ public class ESDServicePropertiesStep extends SimpleEditStep { - /** The name of the editing sheet added to this step */ - private static String EDIT_SHEET_NAME = "edit"; - - /** - * @param itemModel - * @param parent - */ - public ESDServicePropertiesStep(ItemSelectionModel itemModel, - AuthoringKitWizard parent) { - super(itemModel, parent); + /** + * The name of the editing sheet added to this step + */ + private static String EDIT_SHEET_NAME = "edit"; - ESDServicePropertiesForm editSheet; + /** + * @param itemModel + * @param parent + */ + public ESDServicePropertiesStep(ItemSelectionModel itemModel, + AuthoringKitWizard parent) { + super(itemModel, parent); - editSheet = new ESDServicePropertiesForm(itemModel); - add(EDIT_SHEET_NAME, - "Edit", - new WorkflowLockedComponentAccess(editSheet, itemModel), - editSheet.getSaveCancelSection().getCancelButton()); + ESDServicePropertiesForm editSheet; - setDisplayComponent(getESDServicePropertySheet(itemModel)); - } + editSheet = new ESDServicePropertiesForm(itemModel); + add(EDIT_SHEET_NAME, + GlobalizationUtil.globalize("cms.ui.edit"), + new WorkflowLockedComponentAccess(editSheet, itemModel), + editSheet.getSaveCancelSection().getCancelButton()); - /** - * Returns a component that displays the properties of the ESDService - * specified by the ItemSelectionModel passed in. + setDisplayComponent(getESDServicePropertySheet(itemModel)); + } + + /** + * Returns a component that displays the properties of the ESDService + * specified by the ItemSelectionModel passed in. + * + * @param itemModel The ItemSelectionModel to use + * @pre itemModel != null + * @return A component to display the state of the basic properties of the * - * @param itemModel The ItemSelectionModel to use - * @pre itemModel != null - * @return A component to display the state of the basic properties - * of the - **/ - public static Component getESDServicePropertySheet(ItemSelectionModel itemModel) { - DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); + */ + public static Component getESDServicePropertySheet(ItemSelectionModel itemModel) { + DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); - sheet.add( - GlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.name"), - ESDService.NAME); - - sheet.add( - ESDServiceGlobalizationUtil - .globalize("com.arsdigita.london.contenttypes.ui.esdservice.servicetimes"), - ESDService.SERVICE_TIMES); + sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), + ESDService.TITLE); + sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"), + ESDService.NAME); - return sheet; + sheet.add(ESDServiceGlobalizationUtil.globalize( + "london.contenttypes.ui.esdservice.servicetimes"), + ESDService.SERVICE_TIMES); - } + return sheet; + } }