Ergänzen der Lokalisierung.
git-svn-id: https://svn.libreccm.org/ccm/trunk@2225 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
c58251ff82
commit
ede1f2036b
|
|
@ -63,7 +63,8 @@ import com.arsdigita.xml.Element;
|
||||||
*
|
*
|
||||||
* @author Stanislav Freidin
|
* @author Stanislav Freidin
|
||||||
* @author David Lutterkort
|
* @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 {
|
public class ControlLink extends BaseLink {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -170,7 +171,6 @@ public class ControlLink extends BaseLink {
|
||||||
try {
|
try {
|
||||||
parent.addAttribute("href", state.stateAsURL());
|
parent.addAttribute("href", state.stateAsURL());
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// e.printStackTrace();
|
|
||||||
parent.addAttribute("href", "");
|
parent.addAttribute("href", "");
|
||||||
}
|
}
|
||||||
exportAttributes(parent);
|
exportAttributes(parent);
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,6 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
* @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: ContactAddressProperties.java 287 2005-02-22 00:29:02Z sskracic $
|
* @version $Id: ContactAddressProperties.java 287 2005-02-22 00:29:02Z sskracic $
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ContactAddressProperties extends SimpleEditStep {
|
public class ContactAddressProperties extends SimpleEditStep {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ public class ContactCreate extends PageCreate {
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
|
|
||||||
/* Add the standard widgets title, name, and optional launchdate */
|
/* Add the standard widgets title, name, and optional launchdate */
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,6 @@ class ContactPhonesTable extends Table implements TableActionListener {
|
||||||
super();
|
super();
|
||||||
m_selContact = selContact;
|
m_selContact = selContact;
|
||||||
|
|
||||||
setEmptyView(new Label(ContactGlobalizationUtil.globalize(
|
|
||||||
"london.contenttypes.ui.contact.phonetable.no_entries_msg")));
|
|
||||||
|
|
||||||
TableColumnModel model = getColumnModel();
|
TableColumnModel model = getColumnModel();
|
||||||
model.add(new TableColumn(
|
model.add(new TableColumn(
|
||||||
COL_INDEX_PHONE_TYPE,
|
COL_INDEX_PHONE_TYPE,
|
||||||
|
|
@ -94,6 +91,9 @@ class ContactPhonesTable extends Table implements TableActionListener {
|
||||||
"london.contenttypes.ui.contact.phonetable.header_delete")
|
"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());
|
model.get(2).setCellRenderer(new DeleteCellRenderer());
|
||||||
|
|
||||||
setModelBuilder(new PhonesTableModelBuilder(selContact));
|
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
|
private class PhonesTableModelBuilder extends LockableImpl
|
||||||
implements TableModelBuilder {
|
implements TableModelBuilder {
|
||||||
|
|
@ -180,12 +180,11 @@ class ContactPhonesTable extends Table implements TableActionListener {
|
||||||
public Object getElementAt(int columnIndex) {
|
public Object getElementAt(int columnIndex) {
|
||||||
|
|
||||||
switch (columnIndex) {
|
switch (columnIndex) {
|
||||||
case 0:
|
case COL_INDEX_PHONE_TYPE:
|
||||||
return m_phone.getPhoneType();
|
return m_phone.getPhoneType();
|
||||||
case 1:
|
case COL_INDEX_PHONE_NUM:
|
||||||
return m_phone.getPhoneNumber();
|
return m_phone.getPhoneNumber();
|
||||||
case 2:
|
case COL_INDEX_DELETE:
|
||||||
// return "Delete";
|
|
||||||
return new Label(
|
return new Label(
|
||||||
ContactGlobalizationUtil.globalize(
|
ContactGlobalizationUtil.globalize(
|
||||||
"london.contenttypes.ui.contact.phonetable.link_delete")
|
"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.
|
* a Lable or a ControlLink accordingly.
|
||||||
*/
|
*/
|
||||||
private class DeleteCellRenderer extends LockableImpl
|
private class DeleteCellRenderer extends LockableImpl
|
||||||
|
|
@ -222,7 +223,8 @@ class ContactPhonesTable extends Table implements TableActionListener {
|
||||||
* @param key
|
* @param key
|
||||||
* @param row
|
* @param row
|
||||||
* @param column
|
* @param column
|
||||||
* @return
|
* @return the link to delete the selected
|
||||||
|
* entry or just a label without link.
|
||||||
*/
|
*/
|
||||||
public Component getComponent(Table table, PageState state,
|
public Component getComponent(Table table, PageState state,
|
||||||
Object value, boolean isSelected,
|
Object value, boolean isSelected,
|
||||||
|
|
@ -240,28 +242,17 @@ class ContactPhonesTable extends Table implements TableActionListener {
|
||||||
if ( value instanceof Label ) { // just the delete Controllink
|
if ( value instanceof Label ) { // just the delete Controllink
|
||||||
|
|
||||||
if (canDelete) {
|
if (canDelete) {
|
||||||
ret = new ControlLink((Component)value);
|
ControlLink link = new ControlLink( (Component)value );
|
||||||
// ret.setConfirmation(ContactGlobalizationUtil.globalize(
|
link.setConfirmation(ContactGlobalizationUtil.globalize(
|
||||||
// "london.contenttypes.ui.contact.phonetable.confirm_delete"));
|
"london.contenttypes.ui.contact.phonetable.confirm_delete"));
|
||||||
} else {
|
ret = link;
|
||||||
ret = (Component)value;
|
} 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 {
|
} else {
|
||||||
// return new Label(value.toString());
|
|
||||||
/* Just returns the label without underlying link */
|
/* Just returns the label without underlying link */
|
||||||
ret = new Label(value.toString());
|
ret = (Component)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
@ -278,7 +269,6 @@ class ContactPhonesTable extends Table implements TableActionListener {
|
||||||
TableColumn col = getColumnModel().get(evt.getColumn().intValue());
|
TableColumn col = getColumnModel().get(evt.getColumn().intValue());
|
||||||
int columnIndex = col.getModelIndex();
|
int columnIndex = col.getModelIndex();
|
||||||
|
|
||||||
// if (COL_DELETE.equals(colName)) {
|
|
||||||
if ( columnIndex == COL_INDEX_DELETE ) {
|
if ( columnIndex == COL_INDEX_DELETE ) {
|
||||||
BigDecimal phoneID = new BigDecimal(evt.getRowKey().toString());
|
BigDecimal phoneID = new BigDecimal(evt.getRowKey().toString());
|
||||||
Contact contact = (Contact) m_selContact.getSelectedObject(state);
|
Contact contact = (Contact) m_selContact.getSelectedObject(state);
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ import com.arsdigita.bebop.PageState;
|
||||||
* @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: ContactPropertiesStep.java 287 2005-02-22 00:29:02Z sskracic $
|
* @version $Id: ContactPropertiesStep.java 287 2005-02-22 00:29:02Z sskracic $
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ContactPropertiesStep extends SimpleEditStep {
|
public class ContactPropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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?
|
||||||
|
|
|
||||||
|
|
@ -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?
|
||||||
|
|
@ -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?
|
||||||
|
|
@ -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?
|
||||||
|
|
@ -19,10 +19,11 @@ 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.util.ContactGlobalizationUtil;
|
|
||||||
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
|
||||||
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;
|
||||||
|
import com.arsdigita.london.contenttypes.util.ESDServiceGlobalizationUtil;
|
||||||
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -32,7 +33,6 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
* @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: ESDServiceChooseContactStep.java 287 2005-02-22 00:29:02Z sskracic $
|
* @version $Id: ESDServiceChooseContactStep.java 287 2005-02-22 00:29:02Z sskracic $
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ESDServiceChooseContactStep extends SimpleEditStep {
|
public class ESDServiceChooseContactStep extends SimpleEditStep {
|
||||||
|
|
||||||
|
|
@ -51,8 +51,9 @@ public class ESDServiceChooseContactStep extends SimpleEditStep {
|
||||||
ESDServiceContactsTable table = new ESDServiceContactsTable(itemModel , this);
|
ESDServiceContactsTable table = new ESDServiceContactsTable(itemModel , this);
|
||||||
|
|
||||||
addComponent(EDIT_SHEET_NAME,
|
addComponent(EDIT_SHEET_NAME,
|
||||||
"Select Contact",
|
ESDServiceGlobalizationUtil.globalize(
|
||||||
new WorkflowLockedComponentAccess(table, itemModel));
|
"london.contenttypes.ui.esdservice.select_contact"),
|
||||||
|
new WorkflowLockedComponentAccess(table, itemModel));
|
||||||
|
|
||||||
setDisplayComponent(getContactPropertiesSheet(itemModel));
|
setDisplayComponent(getContactPropertiesSheet(itemModel));
|
||||||
}
|
}
|
||||||
|
|
@ -65,20 +66,17 @@ public class ESDServiceChooseContactStep extends SimpleEditStep {
|
||||||
private Component getContactPropertiesSheet(ItemSelectionModel itemModel) {
|
private Component getContactPropertiesSheet(ItemSelectionModel itemModel) {
|
||||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||||
|
|
||||||
sheet.add(
|
sheet.add(ContactGlobalizationUtil.globalize(
|
||||||
ContactGlobalizationUtil
|
"london.contenttypes.ui.contact.givenname"),
|
||||||
.globalize("com.arsdigita.london.contenttypes.ui.contact_givenname"),
|
"serviceContact.givenName");
|
||||||
"serviceContact.givenName");
|
|
||||||
|
|
||||||
sheet.add(
|
sheet.add(ContactGlobalizationUtil.globalize(
|
||||||
ContactGlobalizationUtil
|
"london.contenttypes.ui.contact.familyname"),
|
||||||
.globalize("com.arsdigita.london.contenttypes.ui.contact_familyname"),
|
"serviceContact.familyName");
|
||||||
"serviceContact.familyName");
|
|
||||||
|
|
||||||
sheet.add(
|
sheet.add(ContactGlobalizationUtil.globalize(
|
||||||
ContactGlobalizationUtil
|
"london.contenttypes.ui.contact.type"),
|
||||||
.globalize("com.arsdigita.london.contenttypes.ui.contact_type"),
|
"serviceContact.contactType.typeName");
|
||||||
"serviceContact.contactType.typeName");
|
|
||||||
|
|
||||||
return sheet;
|
return sheet;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.london.contenttypes.ui;
|
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.Component;
|
||||||
import com.arsdigita.bebop.ControlLink;
|
import com.arsdigita.bebop.ControlLink;
|
||||||
import com.arsdigita.bebop.Label;
|
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.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.ContentItem;
|
||||||
|
import com.arsdigita.cms.ItemSelectionModel;
|
||||||
import com.arsdigita.domain.DomainObjectFactory;
|
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.DataCollection;
|
||||||
import com.arsdigita.persistence.OID;
|
import com.arsdigita.persistence.OID;
|
||||||
import com.arsdigita.persistence.SessionManager;
|
import com.arsdigita.persistence.SessionManager;
|
||||||
|
|
@ -43,167 +44,213 @@ import com.arsdigita.util.LockableImpl;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* A table which displays a list of
|
||||||
* A table which displays a list of <code>Contact</code> objects to choose
|
* <code>Contact</code> objects to choose from for the
|
||||||
* from for the <code>ESDService</code> content type.
|
* <code>ESDService</code> content type.
|
||||||
*
|
*
|
||||||
* @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: ESDServiceContactsTable.java 451 2005-03-20 23:11:22Z mbooth $
|
* @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";
|
// match columns by (symbolic) index, makes for easier reordering
|
||||||
private static final String COL_CONTACT_FAMILYNAME = "Family Name";
|
private static final int GIVENNAME_COL_IDX = 0;
|
||||||
private static final String COL_CONTACT_TYPE = "Contact Type";
|
private static final int FAMILYNAME_COL_IDX = 1;
|
||||||
private static final String COL_CHOOSE_CONTACT = "Select";
|
private static final int TYPE_COL_IDX = 2;
|
||||||
|
private static final int CHOOSE_COL_IDX = 3;
|
||||||
private ItemSelectionModel m_selService;
|
|
||||||
private ESDServiceChooseContactStep m_parent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
* @param selService, selection model which will give the <code>ESDService</code>
|
|
||||||
* 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();
|
|
||||||
|
|
||||||
m_parent = parent;
|
private static final String COL_CHOOSE_CONTACT = "Select";
|
||||||
m_selService = selService;
|
private ItemSelectionModel m_selService;
|
||||||
|
private ESDServiceChooseContactStep m_parent;
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model Builder to build the required data for the table.
|
* Constructor.
|
||||||
*/
|
*
|
||||||
private class ContactsTableModelBuilder extends LockableImpl implements TableModelBuilder {
|
* @param selService, selection model which will give
|
||||||
|
* the <code>ESDService</code> 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 ) {
|
m_parent = parent;
|
||||||
table.getRowSelectionModel().clearSelection(state);
|
m_selService = selService;
|
||||||
DataCollection m_contacts = SessionManager.getSession().retrieve(Contact.BASE_DATA_OBJECT_TYPE);
|
|
||||||
m_contacts.addEqualsFilter(ContentItem.VERSION, ContentItem.DRAFT);
|
TableColumnModel model = getColumnModel();
|
||||||
return new ContactsTableModel(table, m_contacts);
|
model.add(new TableColumn(
|
||||||
}
|
GIVENNAME_COL_IDX,
|
||||||
}
|
new Label(ContactGlobalizationUtil.globalize(
|
||||||
|
"london.contenttypes.ui.contact.givenname")
|
||||||
private class ContactsTableModel implements TableModel{
|
) ));
|
||||||
|
model.add(new TableColumn(
|
||||||
private Table m_table;
|
FAMILYNAME_COL_IDX,
|
||||||
private DataCollection m_contacts;
|
new Label(ContactGlobalizationUtil.globalize(
|
||||||
private Contact m_contact;
|
"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
|
* Private class Model Builder to build the required data for the table.
|
||||||
* value of Contact object into m_contact class variable.
|
|
||||||
*/
|
*/
|
||||||
public boolean nextRow() {
|
private class ContactsTableModelBuilder extends LockableImpl
|
||||||
if(m_contacts.next()){
|
implements TableModelBuilder {
|
||||||
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){
|
public TableModel makeModel(Table table, PageState state) {
|
||||||
case 0:
|
table.getRowSelectionModel().clearSelection(state);
|
||||||
return m_contact.getGivenName();
|
DataCollection m_contacts = SessionManager.getSession()
|
||||||
case 1:
|
.retrieve(Contact.BASE_DATA_OBJECT_TYPE);
|
||||||
return m_contact.getFamilyName();
|
m_contacts.addEqualsFilter(ContentItem.VERSION, ContentItem.DRAFT);
|
||||||
case 2:
|
return new ContactsTableModel(table, m_contacts);
|
||||||
return m_contact.getContactTypeName();
|
}
|
||||||
case 3:
|
|
||||||
return COL_CHOOSE_CONTACT;
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Always return the ID of <code>Contact</code> represented by current row.
|
* Internal private class
|
||||||
* @see com.arsdigita.bebop.table.TableModel#getKeyAt(int)
|
|
||||||
*/
|
*/
|
||||||
public Object getKeyAt(int columnIndex) {
|
private class ContactsTableModel implements TableModel {
|
||||||
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{
|
|
||||||
|
|
||||||
public Component getComponent(Table table,PageState state,Object value,
|
private Table m_table;
|
||||||
boolean isSelected,Object key,
|
private DataCollection m_contacts;
|
||||||
int row,int column) {
|
private Contact m_contact;
|
||||||
|
|
||||||
|
private ContactsTableModel(Table t, DataCollection cts) {
|
||||||
ControlLink link = new ControlLink(value.toString());
|
m_table = t;
|
||||||
link.setConfirmation("Select this Contact ?");
|
m_contacts = cts;
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* provide Implementation to TableActionListener method.
|
* Return the no. of columns in column model we have constructed.
|
||||||
* Does nothing in our case.
|
*/
|
||||||
*/
|
public int getColumnCount() {
|
||||||
public void headSelected(TableActionEvent e) {
|
return m_table.getColumnModel().size();
|
||||||
throw new UnsupportedOperationException("Not Implemented");
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
* <code>Contact</code> 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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,12 @@ public class ESDServicePropertiesForm extends BasicPageForm {
|
||||||
* Adds widgets to the form.
|
* Adds widgets to the form.
|
||||||
**/
|
**/
|
||||||
protected void addWidgets() {
|
protected void addWidgets() {
|
||||||
super.addWidgets();
|
|
||||||
|
|
||||||
add(new Label(ESDServiceGlobalizationUtil
|
/* Add standard widgets Title & name/url */
|
||||||
.globalize("com.arsdigita.london.contenttypes.ui.esdservice.servicetimes")));
|
super.addWidgets();
|
||||||
|
|
||||||
|
add(new Label(ESDServiceGlobalizationUtil.globalize(
|
||||||
|
"london.contenttypes.ui.esdservice.servicetimes")));
|
||||||
ParameterModel serviceTimesParam = new StringParameter(ESDService.SERVICE_TIMES);
|
ParameterModel serviceTimesParam = new StringParameter(ESDService.SERVICE_TIMES);
|
||||||
TextField serviceTimes = new TextField(serviceTimesParam);
|
TextField serviceTimes = new TextField(serviceTimesParam);
|
||||||
add(serviceTimes);
|
add(serviceTimes);
|
||||||
|
|
|
||||||
|
|
@ -28,61 +28,64 @@ import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
|
||||||
import com.arsdigita.cms.util.GlobalizationUtil;
|
import com.arsdigita.cms.util.GlobalizationUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Authoring kit step to edit the basic properties of <code>ESDService</code>
|
* Authoring kit step to edit the basic properties of
|
||||||
* content type object.
|
* <code>ESDService</code> content type object.
|
||||||
*
|
*
|
||||||
* @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: 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 {
|
public class ESDServicePropertiesStep extends SimpleEditStep {
|
||||||
|
|
||||||
/** The name of the editing sheet added to this step */
|
/**
|
||||||
private static String EDIT_SHEET_NAME = "edit";
|
* 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);
|
|
||||||
|
|
||||||
ESDServicePropertiesForm editSheet;
|
/**
|
||||||
|
* @param itemModel
|
||||||
|
* @param parent
|
||||||
|
*/
|
||||||
|
public ESDServicePropertiesStep(ItemSelectionModel itemModel,
|
||||||
|
AuthoringKitWizard parent) {
|
||||||
|
super(itemModel, parent);
|
||||||
|
|
||||||
editSheet = new ESDServicePropertiesForm(itemModel);
|
ESDServicePropertiesForm editSheet;
|
||||||
add(EDIT_SHEET_NAME,
|
|
||||||
"Edit",
|
|
||||||
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
|
||||||
editSheet.getSaveCancelSection().getCancelButton());
|
|
||||||
|
|
||||||
setDisplayComponent(getESDServicePropertySheet(itemModel));
|
editSheet = new ESDServicePropertiesForm(itemModel);
|
||||||
}
|
add(EDIT_SHEET_NAME,
|
||||||
|
GlobalizationUtil.globalize("cms.ui.edit"),
|
||||||
|
new WorkflowLockedComponentAccess(editSheet, itemModel),
|
||||||
|
editSheet.getSaveCancelSection().getCancelButton());
|
||||||
|
|
||||||
/**
|
setDisplayComponent(getESDServicePropertySheet(itemModel));
|
||||||
* Returns a component that displays the properties of the ESDService
|
}
|
||||||
* specified by the ItemSelectionModel passed in.
|
|
||||||
|
/**
|
||||||
|
* 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
|
public static Component getESDServicePropertySheet(ItemSelectionModel itemModel) {
|
||||||
* @return A component to display the state of the basic properties
|
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
||||||
* of the
|
|
||||||
**/
|
|
||||||
public static Component getESDServicePropertySheet(ItemSelectionModel itemModel) {
|
|
||||||
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
|
|
||||||
|
|
||||||
sheet.add(
|
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"),
|
||||||
GlobalizationUtil.globalize("com.arsdigita.london.contenttypes.ui.name"),
|
ESDService.TITLE);
|
||||||
ESDService.NAME);
|
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.name"),
|
||||||
|
ESDService.NAME);
|
||||||
sheet.add(
|
|
||||||
ESDServiceGlobalizationUtil
|
|
||||||
.globalize("com.arsdigita.london.contenttypes.ui.esdservice.servicetimes"),
|
|
||||||
ESDService.SERVICE_TIMES);
|
|
||||||
|
|
||||||
return sheet;
|
sheet.add(ESDServiceGlobalizationUtil.globalize(
|
||||||
|
"london.contenttypes.ui.esdservice.servicetimes"),
|
||||||
|
ESDService.SERVICE_TIMES);
|
||||||
|
|
||||||
}
|
return sheet;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue