Weitere Ergänzungen Lokalisierung.

git-svn-id: https://svn.libreccm.org/ccm/trunk@2190 8810af33-2d31-482b-a856-94f89814c4df
master
pb 2013-06-08 22:47:20 +00:00
parent 93fc75c28d
commit 259f4dbc59
37 changed files with 436 additions and 227 deletions

View File

@ -72,7 +72,8 @@ public abstract class ContentGroupPropertiesStep extends SimpleEditStep {
*/ */
public Component getPropertySheet(ItemSelectionModel itemModel) { public Component getPropertySheet(ItemSelectionModel itemModel) {
GridPanel panel = new GridPanel(2); GridPanel panel = new GridPanel(2);
panel.add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.content_group_name"))); panel.add(new Label(GlobalizationUtil
.globalize("cms.contenttypes.ui.content_group_name")));
panel.add(new Label(new PrintListener() { panel.add(new Label(new PrintListener() {
public void prepare(PrintEvent e) { public void prepare(PrintEvent e) {
Label label = (Label)e.getTarget(); Label label = (Label)e.getTarget();
@ -82,7 +83,9 @@ public abstract class ContentGroupPropertiesStep extends SimpleEditStep {
ContentGroup group = ContentGroup group =
item.getContentGroup(getMainAttributeName()); item.getContentGroup(getMainAttributeName());
if (group == null) { if (group == null) {
label.setLabel("None", e.getPageState()); label.setLabel(GlobalizationUtil.globalize(
"cms.contenttypes.ui.content_group_name"),
e.getPageState());
label.setFontWeight(Label.ITALIC); label.setFontWeight(Label.ITALIC);
} else { } else {
label.setLabel(group.getName(), e.getPageState()); label.setLabel(group.getName(), e.getPageState());

View File

@ -78,13 +78,15 @@ public class ContentGroupPropertyForm extends BasicItemForm {
* Adds widgets to the form. * Adds widgets to the form.
*/ */
protected void addWidgets() { protected void addWidgets() {
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.content_group_name"))); add(new Label(GlobalizationUtil
.globalize("cms.contenttypes.ui.content_group_name")));
TextField nameWidget = TextField nameWidget =
new TextField(new TrimmedStringParameter(ContentGroup.NAME)); new TextField(new TrimmedStringParameter(ContentGroup.NAME));
nameWidget.addValidationListener(new NotNullValidationListener()); nameWidget.addValidationListener(new NotNullValidationListener());
add(nameWidget); add(nameWidget);
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.content_group_current_items")) { add(new Label(GlobalizationUtil
.globalize("cms.contenttypes.ui.content_group_current_items")) {
public boolean isVisible(PageState state) { public boolean isVisible(PageState state) {
ContentGroupContainer item = ContentGroupContainer item =
(ContentGroupContainer) getItemSelectionModel() (ContentGroupContainer) getItemSelectionModel()
@ -106,7 +108,8 @@ public class ContentGroupPropertyForm extends BasicItemForm {
}; };
add(m_checkboxGroup); add(m_checkboxGroup);
add(new Label(GlobalizationUtil.globalize("cms.contenttypes.ui.content_group_new_item"))); add(new Label(GlobalizationUtil
.globalize("cms.contenttypes.ui.content_group_new_item")));
try { try {
add(new ItemSearchWidget(RELATED_ITEM, getSearchContentType())); add(new ItemSearchWidget(RELATED_ITEM, getSearchContentType()));
} catch (DataObjectNotFoundException de) { } catch (DataObjectNotFoundException de) {

View File

@ -56,7 +56,8 @@ public class GenericArticlePropertyForm extends BasicPageForm
* GenericArticle to work on * GenericArticle to work on
* @param step The GenericArticlePropertiesStep which controls this form. * @param step The GenericArticlePropertiesStep which controls this form.
*/ */
public GenericArticlePropertyForm(ItemSelectionModel itemModel, GenericArticlePropertiesStep step) { public GenericArticlePropertyForm(ItemSelectionModel itemModel,
GenericArticlePropertiesStep step) {
super(ID, itemModel); super(ID, itemModel);
m_step = step; m_step = step;
addSubmissionListener(this); addSubmissionListener(this);

View File

@ -91,26 +91,26 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep {
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
itemModel); itemModel);
sheet.add((String) ContenttypesGlobalizationUtil.globalize( sheet.add(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.address").localize(), "cms.contenttypes.ui.address.address"),
"address." + GenericAddress.ADDRESS); "address." + GenericAddress.ADDRESS);
if (!GenericContact.getConfig().getHideAddressPostalCode()) { if (!GenericContact.getConfig().getHideAddressPostalCode()) {
sheet.add((String) ContenttypesGlobalizationUtil.globalize( sheet.add(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.postal_code").localize(), "cms.contenttypes.ui.address.postal_code"),
"address." + GenericAddress.POSTAL_CODE); "address." + GenericAddress.POSTAL_CODE);
} }
sheet.add((String) ContenttypesGlobalizationUtil.globalize( sheet.add(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.city").localize(), "cms.contenttypes.ui.address.city"),
"address." + GenericAddress.CITY); "address." + GenericAddress.CITY);
if (!GenericContact.getConfig().getHideAddressState()) { if (!GenericContact.getConfig().getHideAddressState()) {
sheet.add((String) ContenttypesGlobalizationUtil.globalize( sheet.add(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.state").localize(), "cms.contenttypes.ui.address.state"),
"address." + GenericAddress.STATE); "address." + GenericAddress.STATE);
} }
if (!GenericContact.getConfig().getHideAddressCountry()) { if (!GenericContact.getConfig().getHideAddressCountry()) {
sheet.add((String) ContenttypesGlobalizationUtil.globalize( sheet.add(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.address.iso_country_code").localize(), "cms.contenttypes.ui.address.iso_country_code"),
"address." + GenericAddress.ISO_COUNTRY_CODE, "address." + GenericAddress.ISO_COUNTRY_CODE,
new DomainObjectPropertySheet.AttributeFormatter() { new DomainObjectPropertySheet.AttributeFormatter() {
@ -138,11 +138,12 @@ public class GenericContactAddressPropertiesStep extends SimpleEditStep {
public static Component getEmptyBaseAddressPropertySheet( public static Component getEmptyBaseAddressPropertySheet(
ItemSelectionModel itemModel) { ItemSelectionModel itemModel) {
return new Label( return new Label(
((String) ContenttypesGlobalizationUtil.globalize( (ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.emptyAddress").localize())); "cms.contenttypes.ui.contact.emptyAddress")));
} }
private class EditAddressWorkflowLockedComponentAccess extends WorkflowLockedComponentAccess { private class EditAddressWorkflowLockedComponentAccess
extends WorkflowLockedComponentAccess {
public EditAddressWorkflowLockedComponentAccess(Component c, public EditAddressWorkflowLockedComponentAccess(Component c,
ItemSelectionModel i) { ItemSelectionModel i) {

View File

@ -72,8 +72,8 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm
@Override @Override
public void addWidgets() { public void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize( add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.select_address").localize())); "cms.contenttypes.ui.contact.select_address")));
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType. this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType( findByAssociatedObjectType(
"com.arsdigita.cms.contenttypes.GenericAddress")); "com.arsdigita.cms.contenttypes.GenericAddress"));
@ -130,15 +130,13 @@ public class GenericContactAttachAddressPropertyForm extends BasicPageForm
Submit target = (Submit) e.getTarget(); Submit target = (Submit) e.getTarget();
if (contact.getAddress() != null) { if (contact.getAddress() != null) {
target.setButtonLabel((String) ContenttypesGlobalizationUtil. target.setButtonLabel(ContenttypesGlobalizationUtil.
globalize( globalize(
"cms.contenttypes.ui.contact.select_address.change"). "cms.contenttypes.ui.contact.select_address.change"));
localize());
} else { } else {
target.setButtonLabel((String) ContenttypesGlobalizationUtil. target.setButtonLabel(ContenttypesGlobalizationUtil.
globalize( globalize(
"cms.contenttypes.ui.contact.select_address.add"). "cms.contenttypes.ui.contact.select_address.add"));
localize());
} }
} }
}); });

View File

@ -82,8 +82,8 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
@Override @Override
public void addWidgets() { public void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize( add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.select_person").localize())); "cms.contenttypes.ui.contact.select_person")));
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType. this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType( findByAssociatedObjectType(
"com.arsdigita.cms.contenttypes.GenericPerson")); "com.arsdigita.cms.contenttypes.GenericPerson"));
@ -97,8 +97,8 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
SingleSelect contactType = new SingleSelect(contactTypeParam); SingleSelect contactType = new SingleSelect(contactTypeParam);
contactType.addValidationListener(new NotNullValidationListener()); contactType.addValidationListener(new NotNullValidationListener());
contactType.addOption(new Option("", contactType.addOption(new Option("",
new Label((String) ContenttypesGlobalizationUtil. new Label(ContenttypesGlobalizationUtil
globalize("cms.ui.select_one").localize()))); .globalize("cms.ui.select_one"))));
// Add the Options to the SingleSelect widget // Add the Options to the SingleSelect widget
GenericContactTypeCollection contacttypes = GenericContactTypeCollection contacttypes =
@ -160,15 +160,13 @@ public class GenericContactAttachPersonPropertyForm extends BasicPageForm
Submit target = (Submit) e.getTarget(); Submit target = (Submit) e.getTarget();
if (contact.getPerson() != null) { if (contact.getPerson() != null) {
target.setButtonLabel((String) ContenttypesGlobalizationUtil. target.setButtonLabel(ContenttypesGlobalizationUtil.
globalize( globalize(
"cms.contenttypes.ui.contact.select_person.change"). "cms.contenttypes.ui.contact.select_person.change"));
localize());
} else { } else {
target.setButtonLabel((String) ContenttypesGlobalizationUtil. target.setButtonLabel(ContenttypesGlobalizationUtil.
globalize( globalize(
"cms.contenttypes.ui.contact.select_person.add"). "cms.contenttypes.ui.contact.select_person.add"));
localize());
} }
} }
}); });

View File

@ -43,7 +43,8 @@ public class GenericContactDeleteAddressForm extends BasicPageForm implements Fo
@Override @Override
public void addWidgets() { public void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.delete_address.label").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.delete_address.label")));
} }
/** /**
@ -55,9 +56,13 @@ public class GenericContactDeleteAddressForm extends BasicPageForm implements Fo
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() { getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() {
public void prepare(PrintEvent e) { public void prepare(PrintEvent e) {
GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(e.getPageState()); GenericContact contact = (GenericContact)
getItemSelectionModel()
.getSelectedObject(e.getPageState());
Submit target = (Submit) e.getTarget(); Submit target = (Submit) e.getTarget();
target.setButtonLabel((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.delete_address.button_label").localize()); target.setButtonLabel(ContenttypesGlobalizationUtil
.globalize(
"cms.contenttypes.ui.contact.delete_address.button_label"));
} }
}); });
} catch (Exception ex) { } catch (Exception ex) {
@ -68,7 +73,8 @@ public class GenericContactDeleteAddressForm extends BasicPageForm implements Fo
public final void process(final FormSectionEvent fse) throws FormProcessException { public final void process(final FormSectionEvent fse) throws FormProcessException {
final PageState state = fse.getPageState(); final PageState state = fse.getPageState();
final GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(state); final GenericContact contact = (GenericContact) getItemSelectionModel()
.getSelectedObject(state);
if (contact != null && contact.getAddress() != null) { if (contact != null && contact.getAddress() != null) {
contact.unsetAddress(); contact.unsetAddress();

View File

@ -27,14 +27,16 @@ import com.arsdigita.util.UncheckedWrapperException;
* *
* @author quasi * @author quasi
*/ */
public class GenericContactDeletePersonForm extends BasicPageForm implements FormProcessListener { public class GenericContactDeletePersonForm extends BasicPageForm
implements FormProcessListener {
/** /**
* ID of the form * ID of the form
*/ */
public static final String ID = "ContactDeletePerson"; public static final String ID = "ContactDeletePerson";
GenericContactDeletePersonForm(ItemSelectionModel itemModel, GenericContactPersonPropertiesStep step) { GenericContactDeletePersonForm(ItemSelectionModel itemModel,
GenericContactPersonPropertiesStep step) {
super(ID, itemModel); super(ID, itemModel);
addSaveCancelSection(); addSaveCancelSection();
} }
@ -45,7 +47,8 @@ public class GenericContactDeletePersonForm extends BasicPageForm implements For
@Override @Override
public void addWidgets() { public void addWidgets() {
add(new Label((String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.delete_person.label").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.delete_person.label")));
} }
/** /**
@ -54,12 +57,16 @@ public class GenericContactDeletePersonForm extends BasicPageForm implements For
@Override @Override
public void addSaveCancelSection() { public void addSaveCancelSection() {
try { try {
getSaveCancelSection().getSaveButton().addPrintListener(new PrintListener() { getSaveCancelSection().getSaveButton()
.addPrintListener(new PrintListener() {
public void prepare(PrintEvent e) { public void prepare(PrintEvent e) {
GenericContact contact = (GenericContact)getItemSelectionModel().getSelectedObject(e.getPageState()); GenericContact contact = (GenericContact)
getItemSelectionModel()
.getSelectedObject(e.getPageState());
Submit target = (Submit) e.getTarget(); Submit target = (Submit) e.getTarget();
target.setButtonLabel((String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.delete_person").localize()); target.setButtonLabel(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.delete_person"));
} }
}); });
} catch (Exception ex) { } catch (Exception ex) {
@ -70,7 +77,8 @@ public class GenericContactDeletePersonForm extends BasicPageForm implements For
public final void process(final FormSectionEvent fse) throws FormProcessException { public final void process(final FormSectionEvent fse) throws FormProcessException {
final PageState state = fse.getPageState(); final PageState state = fse.getPageState();
final GenericContact contact = (GenericContact)getItemSelectionModel().getSelectedObject(state); final GenericContact contact = (GenericContact)getItemSelectionModel()
.getSelectedObject(state);
if (contact != null && contact.getPerson() != null) { if (contact != null && contact.getPerson() != null) {
contact.unsetPerson(); contact.unsetPerson();

View File

@ -78,7 +78,8 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
@Override @Override
public void addWidgets() { public void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.address").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.address.address")));
ParameterModel addressParam = new StringParameter(ADDRESS); ParameterModel addressParam = new StringParameter(ADDRESS);
addressParam.addParameterListener(new NotNullValidationListener()); addressParam.addParameterListener(new NotNullValidationListener());
addressParam.addParameterListener(new StringInRangeValidationListener(0, 1000)); addressParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
@ -88,33 +89,40 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
add(address); add(address);
if (!GenericContact.getConfig().getHideAddressPostalCode()) { if (!GenericContact.getConfig().getHideAddressPostalCode()) {
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.postal_code").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.address.postal_code")));
ParameterModel postalCodeParam = new StringParameter(POSTAL_CODE); ParameterModel postalCodeParam = new StringParameter(POSTAL_CODE);
TextField postalCode = new TextField(postalCodeParam); TextField postalCode = new TextField(postalCodeParam);
/* XXX NumberListener ?*/ /* XXX NumberListener ?*/
add(postalCode); add(postalCode);
} }
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.city").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.address.city")));
ParameterModel cityParam = new StringParameter(CITY); ParameterModel cityParam = new StringParameter(CITY);
TextField city = new TextField(cityParam); TextField city = new TextField(cityParam);
add(city); add(city);
if (!GenericContact.getConfig().getHideAddressState()) { if (!GenericContact.getConfig().getHideAddressState()) {
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.state").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.address.state")));
ParameterModel stateParam = new StringParameter(STATE); ParameterModel stateParam = new StringParameter(STATE);
TextField state = new TextField(stateParam); TextField state = new TextField(stateParam);
add(state); add(state);
} }
if (!GenericContact.getConfig().getHideAddressCountry()) { if (!GenericContact.getConfig().getHideAddressCountry()) {
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.iso_country_code").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.address.iso_country_code")));
ParameterModel countryParam = new StringParameter(ISO_COUNTRY_CODE); ParameterModel countryParam = new StringParameter(ISO_COUNTRY_CODE);
countryParam.addParameterListener(new StringInRangeValidationListener(0, 2)); countryParam.addParameterListener(new StringInRangeValidationListener(0, 2));
SingleSelect country = new SingleSelect(countryParam); SingleSelect country = new SingleSelect(countryParam);
country.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize()))); country.addOption(new
Option("",
new Label(ContenttypesGlobalizationUtil
.globalize("cms.ui.select_one"))));
Iterator countries = GenericAddress.getSortedListOfCountries(null).entrySet().iterator(); Iterator countries = GenericAddress.getSortedListOfCountries(null).entrySet().iterator();
while (countries.hasNext()) { while (countries.hasNext()) {
@ -126,14 +134,16 @@ public class GenericContactEditAddressPropertyForm extends BasicPageForm impleme
new ParameterListener() { new ParameterListener() {
@Override @Override
public void validate(ParameterEvent e) throws FormProcessException { public void validate(ParameterEvent e) throws FormProcessException {
ParameterData data = e.getParameterData(); ParameterData data = e.getParameterData();
String isoCode = (String) data.getValue(); String isoCode = (String) data.getValue();
if (isoCode == null || isoCode.length() == 0) { if (isoCode == null || isoCode.length() == 0) {
data.addError((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.address.error_iso_country").localize()); data.addError((String) ContenttypesGlobalizationUtil
} .globalize("cms.contenttypes.ui.address.error_iso_country")
} .localize());
}); }
}
});
add(country); add(country);
} }

View File

@ -65,12 +65,14 @@ public class GenericContactEditPersonPropertyForm extends BasicPageForm implemen
} }
/** /**
* Constrctor taking an ItemSelectionModel and an instance of ContactPropertiesStep. * Constructor taking an ItemSelectionModel and an instance of
* ContactPropertiesStep.
* *
* @param itemModel * @param itemModel
* @param step * @param step
*/ */
public GenericContactEditPersonPropertyForm(ItemSelectionModel itemModel, GenericContactPersonPropertiesStep step) { public GenericContactEditPersonPropertyForm(ItemSelectionModel itemModel,
GenericContactPersonPropertiesStep step) {
super(ID, itemModel); super(ID, itemModel);
m_step = step; m_step = step;
addSubmissionListener(this); addSubmissionListener(this);
@ -78,42 +80,51 @@ public class GenericContactEditPersonPropertyForm extends BasicPageForm implemen
@Override @Override
public void addWidgets() { public void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.person.surname")));
ParameterModel surnameParam = new StringParameter(SURNAME); ParameterModel surnameParam = new StringParameter(SURNAME);
surnameParam.addParameterListener(new NotNullValidationListener()); surnameParam.addParameterListener(new NotNullValidationListener());
surnameParam.addParameterListener(new StringInRangeValidationListener(0, 1000)); surnameParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
TextField surname = new TextField(surnameParam); TextField surname = new TextField(surnameParam);
add(surname); add(surname);
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.person.givenname")));
ParameterModel givennameParam = new StringParameter(GIVENNAME); ParameterModel givennameParam = new StringParameter(GIVENNAME);
givennameParam.addParameterListener(new NotNullValidationListener()); givennameParam.addParameterListener(new NotNullValidationListener());
givennameParam.addParameterListener(new StringInRangeValidationListener(0, 1000)); givennameParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
TextField givenname = new TextField(givennameParam); TextField givenname = new TextField(givennameParam);
add(givenname); add(givenname);
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.person.titlepre")));
ParameterModel titlepreParam = new StringParameter(TITLEPRE); ParameterModel titlepreParam = new StringParameter(TITLEPRE);
titlepreParam.addParameterListener(new StringInRangeValidationListener(0, 1000)); titlepreParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
TextField titlepre = new TextField(titlepreParam); TextField titlepre = new TextField(titlepreParam);
add(titlepre); add(titlepre);
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.person.titlepost")));
ParameterModel titlepostParam = new StringParameter(TITLEPOST); ParameterModel titlepostParam = new StringParameter(TITLEPOST);
titlepostParam.addParameterListener(new StringInRangeValidationListener(0, 1000)); titlepostParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
TextField titlepost = new TextField(titlepostParam); TextField titlepost = new TextField(titlepostParam);
add(titlepost); add(titlepost);
// GenericContact type field // GenericContact type field
add(new Label(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.contact.type"))); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.person.contact.type")));
ParameterModel contactTypeParam = new StringParameter(CONTACTS_KEY); ParameterModel contactTypeParam = new StringParameter(CONTACTS_KEY);
SingleSelect contactType = new SingleSelect(contactTypeParam); SingleSelect contactType = new SingleSelect(contactTypeParam);
contactType.addValidationListener(new NotNullValidationListener()); contactType.addValidationListener(new NotNullValidationListener());
contactType.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize()))); contactType.addOption(new
Option("",
new Label(ContenttypesGlobalizationUtil
.globalize("cms.ui.select_one"))));
// Add the Options to the SingleSelect widget // Add the Options to the SingleSelect widget
GenericContactTypeCollection contacttypes = new GenericContactTypeCollection(); GenericContactTypeCollection contacttypes = new GenericContactTypeCollection();
contacttypes.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage()); contacttypes.addLanguageFilter(GlobalizationHelper
.getNegotiatedLocale().getLanguage());
while (contacttypes.next()) { while (contacttypes.next()) {
RelationAttribute ct = contacttypes.getRelationAttribute(); RelationAttribute ct = contacttypes.getRelationAttribute();
@ -126,7 +137,8 @@ public class GenericContactEditPersonPropertyForm extends BasicPageForm implemen
public void init(FormSectionEvent fse) { public void init(FormSectionEvent fse) {
FormData data = fse.getFormData(); FormData data = fse.getFormData();
PageState state = fse.getPageState(); PageState state = fse.getPageState();
GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(state); GenericContact contact = (GenericContact) getItemSelectionModel()
.getSelectedObject(state);
if (contact.getPerson() != null) { if (contact.getPerson() != null) {
data.put(SURNAME, contact.getPerson().getSurname()); data.put(SURNAME, contact.getPerson().getSurname());
@ -147,7 +159,8 @@ public class GenericContactEditPersonPropertyForm extends BasicPageForm implemen
public void process(FormSectionEvent fse) { public void process(FormSectionEvent fse) {
FormData data = fse.getFormData(); FormData data = fse.getFormData();
PageState state = fse.getPageState(); PageState state = fse.getPageState();
GenericContact contact = (GenericContact) getItemSelectionModel().getSelectedObject(state); GenericContact contact = (GenericContact) getItemSelectionModel()
.getSelectedObject(state);
if (getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) { if (getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {

View File

@ -38,15 +38,35 @@ public class GenericContactEntriesPropertiesStep extends SimpleEditStep {
/** The name of the editing sheet added to this step */ /** The name of the editing sheet added to this step */
private static String ADD_CONTACT_ENTRY_SHEET_NAME = "addContactEntry"; private static String ADD_CONTACT_ENTRY_SHEET_NAME = "addContactEntry";
public GenericContactEntriesPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) { /**
*
* @param itemModel
* @param parent
*/
public GenericContactEntriesPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
this(itemModel, parent, null); this(itemModel, parent, null);
} }
public GenericContactEntriesPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent, String prefix) { /**
*
* @param itemModel
* @param parent
* @param prefix
*/
public GenericContactEntriesPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent,
String prefix) {
super(itemModel, parent, prefix); super(itemModel, parent, prefix);
BasicItemForm addContactEntrySheet = new GenericContactEntryAddForm(itemModel); BasicItemForm addContactEntrySheet = new GenericContactEntryAddForm(itemModel);
add(ADD_CONTACT_ENTRY_SHEET_NAME, (String)ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.add_contactEntry").localize(), new WorkflowLockedComponentAccess(addContactEntrySheet, itemModel), addContactEntrySheet.getSaveCancelSection().getCancelButton()); add(ADD_CONTACT_ENTRY_SHEET_NAME,
(String)ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.add_contactEntry")
.localize(),
new WorkflowLockedComponentAccess(addContactEntrySheet,
itemModel),
addContactEntrySheet.getSaveCancelSection().getCancelButton());
GenericContactEntriesTable contactEntriesTable = new GenericContactEntriesTable(itemModel); GenericContactEntriesTable contactEntriesTable = new GenericContactEntriesTable(itemModel);
setDisplayComponent(contactEntriesTable); setDisplayComponent(contactEntriesTable);

View File

@ -63,14 +63,34 @@ public class GenericContactEntriesTable extends Table implements TableActionList
this.m_itemModel = itemModel; this.m_itemModel = itemModel;
// if table is empty: // if table is empty:
setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.contactEntry.none"))); setEmptyView(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.contactEntry.none")));
TableColumnModel tab_model = getColumnModel(); TableColumnModel tab_model = getColumnModel();
// define columns // define columns
tab_model.add(new TableColumn(0, ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.contactEntry.key").localize(), TABLE_COL_EDIT)); tab_model.add(new TableColumn(
tab_model.add(new TableColumn(1, ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.contactEntry.value").localize())); 0,
tab_model.add(new TableColumn(2, ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.contactEntry.description").localize())); ContenttypesGlobalizationUtil.globalize(
tab_model.add(new TableColumn(3, ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.contactEntry.action").localize(), TABLE_COL_DEL)); "cms.contenttypes.ui.contact.contactEntry.key")
,
TABLE_COL_EDIT));
tab_model.add(new TableColumn(
1,
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.contactEntry.value")
));
tab_model.add(new TableColumn(
2,
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.contactEntry.description")
.localize()));
tab_model.add(new TableColumn(
3,
ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.contactEntry.action")
.localize(),
TABLE_COL_DEL));
setModelBuilder(new ContactTableModelBuilder(itemModel)); setModelBuilder(new ContactTableModelBuilder(itemModel));
@ -85,7 +105,8 @@ public class GenericContactEntriesTable extends Table implements TableActionList
* XXXX * XXXX
* *
*/ */
private class ContactTableModelBuilder extends LockableImpl implements TableModelBuilder { private class ContactTableModelBuilder extends LockableImpl
implements TableModelBuilder {
private ItemSelectionModel m_itemModel; private ItemSelectionModel m_itemModel;
@ -97,7 +118,8 @@ public class GenericContactEntriesTable extends Table implements TableActionList
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
GenericContact contact = (GenericContact) m_itemModel.getSelectedObject(state); GenericContact contact = (GenericContact)
m_itemModel.getSelectedObject(state);
return new ContactTableModel(table, state, contact); return new ContactTableModel(table, state, contact);
} }
} }
@ -148,8 +170,11 @@ public class GenericContactEntriesTable extends Table implements TableActionList
public Object getElementAt(int columnIndex) { public Object getElementAt(int columnIndex) {
switch (columnIndex) { switch (columnIndex) {
case 0: case 0:
GenericContactEntryKeys keys = new GenericContactEntryKeys(m_contactEntry.getKey()); GenericContactEntryKeys keys = new
keys.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().getLanguage()); GenericContactEntryKeys(m_contactEntry.getKey());
keys.addLanguageFilter(
GlobalizationHelper.getNegotiatedLocale()
.getLanguage());
if (keys.next()) { if (keys.next()) {
Object key = keys.getName(); Object key = keys.getName();
@ -162,11 +187,15 @@ public class GenericContactEntriesTable extends Table implements TableActionList
case 1: case 1:
return m_contactEntry.getValue(); return m_contactEntry.getValue();
case 2: case 2:
return (m_contactEntry.getDescription() != null && m_contactEntry.getDescription().length() > MAX_DESC_LENGTH) return (m_contactEntry.getDescription() != null
? m_contactEntry.getDescription().substring(0, MAX_DESC_LENGTH) && m_contactEntry.getDescription().length() >
MAX_DESC_LENGTH)
? m_contactEntry.getDescription().substring(
0, MAX_DESC_LENGTH)
: m_contactEntry.getDescription(); : m_contactEntry.getDescription();
case 3: case 3:
return GlobalizationUtil.globalize("cms.ui.delete").localize(); // return GlobalizationUtil.globalize("cms.ui.delete").localize();
return GlobalizationUtil.globalize("cms.ui.delete");
default: default:
return null; return null;
} }
@ -210,21 +239,25 @@ public class GenericContactEntriesTable extends Table implements TableActionList
* Check for the permissions to delete item and put either a Label or * Check for the permissions to delete item and put either a Label or
* a ControlLink accordingly. * a ControlLink accordingly.
*/ */
private class DeleteCellRenderer extends LockableImpl implements TableCellRenderer { private class DeleteCellRenderer extends LockableImpl
implements TableCellRenderer {
public Component getComponent(Table table, PageState state, Object value, public Component getComponent(Table table, PageState state, Object value,
boolean isSelected, Object key, boolean isSelected, Object key,
int row, int column) { int row, int column) {
SecurityManager sm = Utilities.getSecurityManager(state); SecurityManager sm = Utilities.getSecurityManager(state);
GenericContact contact = (GenericContact) m_itemModel.getSelectedObject(state); GenericContact contact = (GenericContact)
m_itemModel.getSelectedObject(state);
boolean canDelete = sm.canAccess(state.getRequest(), boolean canDelete = sm.canAccess(state.getRequest(),
SecurityManager.DELETE_ITEM, SecurityManager.DELETE_ITEM,
contact); contact);
if (canDelete) { if (canDelete) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink(value.toString());
link.setConfirmation((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.confirm_delete").localize()); link.setConfirmation(
ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.confirm_delete"));
return link; return link;
} else { } else {
return new Label(value.toString()); return new Label(value.toString());

View File

@ -58,7 +58,8 @@ public class GenericContactEntryAddForm extends BasicItemForm {
protected void addWidgets() { protected void addWidgets() {
// Key field // Key field
add(new Label(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.contactEntry.key"))); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.contactEntry.key")));
ParameterModel contactEntryKeyParam = new StringParameter(GenericContactEntry.KEY); ParameterModel contactEntryKeyParam = new StringParameter(GenericContactEntry.KEY);
SingleSelect contactEntryKey = new SingleSelect(contactEntryKeyParam); SingleSelect contactEntryKey = new SingleSelect(contactEntryKeyParam);
contactEntryKey.addValidationListener(new NotNullValidationListener()); contactEntryKey.addValidationListener(new NotNullValidationListener());
@ -75,14 +76,16 @@ public class GenericContactEntryAddForm extends BasicItemForm {
add(contactEntryKey); add(contactEntryKey);
// Value field // Value field
add(new Label(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.contactEntry.value"))); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.contactEntry.value")));
ParameterModel contactEntryValueParam = new StringParameter(GenericContactEntry.VALUE); ParameterModel contactEntryValueParam = new StringParameter(GenericContactEntry.VALUE);
TextField contactEntryValue = new TextField(contactEntryValueParam); TextField contactEntryValue = new TextField(contactEntryValueParam);
contactEntryValue.addValidationListener(new NotNullValidationListener()); contactEntryValue.addValidationListener(new NotNullValidationListener());
add(contactEntryValue); add(contactEntryValue);
// Description field, only for internal usage // Description field, only for internal usage
add(new Label(ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.contactEntry.description"))); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.contactEntry.description")));
ParameterModel contactEntryDescriptionParam = new StringParameter(GenericContactEntry.DESCRIPTION); ParameterModel contactEntryDescriptionParam = new StringParameter(GenericContactEntry.DESCRIPTION);
TextField contactEntryDescription = new TextField(contactEntryDescriptionParam); TextField contactEntryDescription = new TextField(contactEntryDescriptionParam);
add(contactEntryDescription); add(contactEntryDescription);

View File

@ -34,16 +34,25 @@ public class GenericContactPersonPropertiesStep extends SimpleEditStep {
/** /**
* Creates a new instance of GenericContactPersonPropertiesStep * Creates a new instance of GenericContactPersonPropertiesStep
*/ */
public GenericContactPersonPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) { public GenericContactPersonPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
this(itemModel, parent, ""); this(itemModel, parent, "");
} }
public GenericContactPersonPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent, String prefix) { public GenericContactPersonPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent,
String prefix) {
super(itemModel, parent, prefix); super(itemModel, parent, prefix);
BasicPageForm addPersonSheet = new GenericContactAttachPersonPropertyForm(itemModel, this); BasicPageForm addPersonSheet = new
GenericContactAttachPersonPropertyForm(itemModel, this);
addPerson = new WorkflowLockedComponentAccess(addPersonSheet, itemModel); addPerson = new WorkflowLockedComponentAccess(addPersonSheet, itemModel);
add(ADD_PERSON_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.attach_person").localize(), addPerson, addPersonSheet.getSaveCancelSection().getCancelButton()); add(ADD_PERSON_SHEET_NAME,
(String) ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.attach_person")
.localize(),
addPerson,
addPersonSheet.getSaveCancelSection().getCancelButton());
/* Set the displayComponent for this step */ /* Set the displayComponent for this step */
setDisplayComponent(getPersonPropertySheet(itemModel)); setDisplayComponent(getPersonPropertySheet(itemModel));

View File

@ -67,7 +67,8 @@ public class GenericContactPersonSheet
colModel.add(new TableColumn( colModel.add(new TableColumn(
0, 0,
ContenttypesGlobalizationUtil.globalize( ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.person").localize(), // "cms.contenttypes.ui.contact.person").localize(),
"cms.contenttypes.ui.contact.person"),
TABLE_COL_EDIT)); TABLE_COL_EDIT));
colModel.add(new TableColumn( colModel.add(new TableColumn(
1, 1,
@ -97,7 +98,8 @@ public class GenericContactPersonSheet
@Override @Override
public TableModel makeModel(Table table, PageState state) { public TableModel makeModel(Table table, PageState state) {
table.getRowSelectionModel().clearSelection(state); table.getRowSelectionModel().clearSelection(state);
GenericContact contact = (GenericContact) m_itemModel.getSelectedObject(state); GenericContact contact = (GenericContact)
m_itemModel.getSelectedObject(state);
return new GenericContactPersonSheetModel(table, return new GenericContactPersonSheetModel(table,
state, state,
contact); contact);
@ -145,8 +147,9 @@ public class GenericContactPersonSheet
return m_person.getFullName(); return m_person.getFullName();
case 1: case 1:
return ContenttypesGlobalizationUtil.globalize( return ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.delete_person"). "cms.contenttypes.ui.contact.delete_person")
localize(); // .localize();
;
default: default:
return null; return null;
} }
@ -170,8 +173,10 @@ public class GenericContactPersonSheet
int row, int row,
int column) { int column) {
com.arsdigita.cms.SecurityManager securityManager = Utilities.getSecurityManager(state); com.arsdigita.cms.SecurityManager securityManager =
GenericContact contact = (GenericContact) m_itemModel.getSelectedObject(state); Utilities.getSecurityManager(state);
GenericContact contact = (GenericContact)
m_itemModel.getSelectedObject(state);
boolean canEdit = securityManager.canAccess( boolean canEdit = securityManager.canAccess(
state.getRequest(), state.getRequest(),
@ -190,7 +195,11 @@ public class GenericContactPersonSheet
ContentSection section = person.getContentSection();//CMS.getContext().getContentSection(); ContentSection section = person.getContentSection();//CMS.getContext().getContentSection();
ItemResolver resolver = section.getItemResolver(); ItemResolver resolver = section.getItemResolver();
return new Link(value.toString(), resolver.generateItemURL(state, person, section, person.getVersion())); return new Link(value.toString(),
resolver.generateItemURL(state,
person,
section,
person.getVersion()));
} else { } else {
@ -224,10 +233,10 @@ public class GenericContactPersonSheet
if (canEdit) { if (canEdit) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink(value.toString());
link.setConfirmation((String) ContenttypesGlobalizationUtil.globalize( link.setConfirmation(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.person" "cms.contenttypes.ui.contact.person"
+ ".confirm_remove"). + ".confirm_remove")
localize()); );
return link; return link;
} else { } else {
Label label = new Label(value.toString()); Label label = new Label(value.toString());

View File

@ -25,7 +25,8 @@ import org.apache.log4j.Logger;
*/ */
public class GenericContactPropertiesStep extends SimpleEditStep { public class GenericContactPropertiesStep extends SimpleEditStep {
private static final Logger logger = Logger.getLogger(GenericContactPropertiesStep.class); private static final Logger logger = Logger.getLogger(
GenericContactPropertiesStep.class);
/** /**
* Name of the this edit sheet (Don't know if this this really needed. * Name of the this edit sheet (Don't know if this this really needed.
* It has the same value in almost all PropertiesStep classes) * It has the same value in almost all PropertiesStep classes)
@ -38,7 +39,8 @@ public class GenericContactPropertiesStep extends SimpleEditStep {
* @param itemModel * @param itemModel
* @param parent * @param parent
*/ */
public GenericContactPropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) { public GenericContactPropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
super(itemModel, parent); super(itemModel, parent);
setDefaultEditKey(EDIT_BASIC_SHEET_NAME); setDefaultEditKey(EDIT_BASIC_SHEET_NAME);
@ -48,42 +50,75 @@ public class GenericContactPropertiesStep extends SimpleEditStep {
setDisplayComponent(segmentedPanel); setDisplayComponent(segmentedPanel);
} }
protected SegmentedPanel createEditSheet(ItemSelectionModel itemModel, AuthoringKitWizard parent) { /**
*
* @param itemModel
* @param parent
* @return
*/
protected SegmentedPanel createEditSheet(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
/* Use a Segmented Panel for the multiple parts of data */ /* Use a Segmented Panel for the multiple parts of data */
SegmentedPanel segmentedPanel = new SegmentedPanel(); SegmentedPanel segmentedPanel = new SegmentedPanel();
/* The different parts of information are displayed in seperated segments each containing a SimpleEditStep */ /* The different parts of information are displayed in seperated
* segments each containing a SimpleEditStep */
/* Well, not so simple anymore... */ /* Well, not so simple anymore... */
/* A new SimpleEditStep */ /* A new SimpleEditStep */
SimpleEditStep basicProperties = new SimpleEditStep(itemModel, parent, EDIT_BASIC_SHEET_NAME); SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
parent,
EDIT_BASIC_SHEET_NAME);
/* Create the edit component for this SimpleEditStep and the corresponding link */ /* Create the edit component for this SimpleEditStep and the corresponding link */
BasicPageForm editBasicSheet = new GenericContactPropertyForm(itemModel, this); BasicPageForm editBasicSheet = new GenericContactPropertyForm(itemModel, this);
basicProperties.add(EDIT_BASIC_SHEET_NAME, (String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.edit_basic_properties").localize(), new WorkflowLockedComponentAccess(editBasicSheet, itemModel), editBasicSheet.getSaveCancelSection().getCancelButton()); basicProperties.add(
EDIT_BASIC_SHEET_NAME,
(String) ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.edit_basic_properties")
.localize(),
new WorkflowLockedComponentAccess(
editBasicSheet,
itemModel),
editBasicSheet.getSaveCancelSection().getCancelButton());
/* Set the displayComponent for this step */ /* Set the displayComponent for this step */
basicProperties.setDisplayComponent(getContactPropertySheet(itemModel)); basicProperties.setDisplayComponent(getContactPropertySheet(itemModel));
/* Add the SimpleEditStep to the segmented panel */ /* Add the SimpleEditStep to the segmented panel */
segmentedPanel.addSegment(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.basic_properties").localize()), basicProperties); segmentedPanel
.addSegment(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.basic_properties")),
basicProperties);
// If not disabled via registry, add the ui for attaching a person // If not disabled via registry, add the ui for attaching a person
if (!GenericContact.getConfig().getHidePerson()) { if (!GenericContact.getConfig().getHidePerson()) {
GenericContactPersonPropertiesStep personProperties = new GenericContactPersonPropertiesStep(itemModel, parent); GenericContactPersonPropertiesStep personProperties = new
segmentedPanel.addSegment(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.person").localize()), personProperties); GenericContactPersonPropertiesStep(itemModel, parent);
segmentedPanel
.addSegment(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.person")),
personProperties);
} }
if (!GenericContact.getConfig().getHideAddress()) { if (!GenericContact.getConfig().getHideAddress()) {
GenericContactAddressPropertiesStep addressProperties = new GenericContactAddressPropertiesStep(itemModel, parent); GenericContactAddressPropertiesStep addressProperties = new
segmentedPanel.addSegment(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.address").localize()), addressProperties); GenericContactAddressPropertiesStep(itemModel, parent);
segmentedPanel
.addSegment(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.address")),
addressProperties);
} }
GenericContactEntriesPropertiesStep contactEntries = new GenericContactEntriesPropertiesStep(itemModel, parent); GenericContactEntriesPropertiesStep contactEntries = new
segmentedPanel.addSegment(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contact.contactEntry").localize()), contactEntries); GenericContactEntriesPropertiesStep(itemModel, parent);
segmentedPanel
.addSegment(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contact.contactEntry")),
contactEntries);
return segmentedPanel; return segmentedPanel;
} }
@ -105,7 +140,10 @@ public class GenericContactPropertiesStep extends SimpleEditStep {
sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), "title"); sheet.add(GlobalizationUtil.globalize("cms.contenttypes.ui.title"), "title");
if (!ContentSection.getConfig().getHideLaunchDate()) { if (!ContentSection.getConfig().getHideLaunchDate()) {
sheet.add(GlobalizationUtil.globalize("cms.ui.authoring.page_launch_date"), ContentPage.LAUNCH_DATE, new DomainObjectPropertySheet.AttributeFormatter() {
sheet.add(GlobalizationUtil.globalize("cms.ui.authoring.page_launch_date"),
ContentPage.LAUNCH_DATE,
new DomainObjectPropertySheet.AttributeFormatter() {
public String format(DomainObject obj, String attribute, PageState state) { public String format(DomainObject obj, String attribute, PageState state) {
ContentPage page = (ContentPage) obj; ContentPage page = (ContentPage) obj;

View File

@ -15,9 +15,13 @@ import org.apache.log4j.Logger;
/** /**
* Form for editing the basic properties of a basic contact. * Form for editing the basic properties of a basic contact.
*/ */
public class GenericContactPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener, FormSubmissionListener { public class GenericContactPropertyForm extends BasicPageForm
implements FormProcessListener,
FormInitListener,
FormSubmissionListener {
private static final Logger logger = Logger.getLogger(GenericContactPropertyForm.class); private static final Logger logger = Logger.getLogger(
GenericContactPropertyForm.class);
private GenericContactPropertiesStep m_step; private GenericContactPropertiesStep m_step;
@ -40,23 +44,30 @@ public class GenericContactPropertyForm extends BasicPageForm implements FormPro
} }
/** /**
* Constrctor taking an ItemSelectionModel and an instance of BaseContactPropertiesStep. * Constructor taking an ItemSelectionModel and an instance of
* BaseContactPropertiesStep.
* *
* @param itemModel * @param itemModel
* @param step * @param step
*/ */
public GenericContactPropertyForm(ItemSelectionModel itemModel, GenericContactPropertiesStep step) { public GenericContactPropertyForm(ItemSelectionModel itemModel,
GenericContactPropertiesStep step) {
super(ID, itemModel); super(ID, itemModel);
m_step = step; m_step = step;
addSubmissionListener(this); addSubmissionListener(this);
} }
/**
*
*/
@Override @Override
public void addWidgets() { public void addWidgets() {
super.addWidgets(); super.addWidgets();
/* /*
add(new Label((String)BaseContactGlobalizationUtil.globalize("cms.contenttypes.ui.contact.basic_properties.description").localize()))); add(new Label(BaseContactGlobalizationUtil.globalize(
"cms.contenttypes.ui.contact.basic_properties.description")
)));
TextArea description = new TextArea(DESCRIPTION); TextArea description = new TextArea(DESCRIPTION);
description.setRows(5); description.setRows(5);
description.setCols(30); description.setCols(30);
@ -78,9 +89,9 @@ public class GenericContactPropertyForm extends BasicPageForm implements FormPro
GenericContact contact = (GenericContact)super.processBasicWidgets(e); GenericContact contact = (GenericContact)super.processBasicWidgets(e);
if((contact != null) && (getSaveCancelSection().getSaveButton().isSelected(e.getPageState()))) { if((contact != null)
&& (getSaveCancelSection().getSaveButton().isSelected(e.getPageState()))) {
// contact.setDescription((String)data.get(DESCRIPTION)); // contact.setDescription((String)data.get(DESCRIPTION));
contact.save(); contact.save();
} }
@ -90,7 +101,8 @@ public class GenericContactPropertyForm extends BasicPageForm implements FormPro
} }
public void submitted(FormSectionEvent e) throws FormProcessException { public void submitted(FormSectionEvent e) throws FormProcessException {
if((m_step != null) && (getSaveCancelSection().getCancelButton().isSelected(e.getPageState()))) { if((m_step != null)
&& (getSaveCancelSection().getCancelButton().isSelected(e.getPageState()))) {
m_step.cancelStreamlinedCreation(e.getPageState()); m_step.cancelStreamlinedCreation(e.getPageState());
} }
} }

View File

@ -52,10 +52,12 @@ import org.apache.log4j.Logger;
*/ */
public class GenericContactTypeAddForm extends BasicItemForm { public class GenericContactTypeAddForm extends BasicItemForm {
private static final Logger s_log = Logger.getLogger(
GenericContactTypeAddForm.class);
public final static String KEY = RelationAttribute.KEY; public final static String KEY = RelationAttribute.KEY;
public final static String LANGUAGE = RelationAttribute.LANGUAGE; public final static String LANGUAGE = RelationAttribute.LANGUAGE;
public final static String NAME = RelationAttribute.NAME; public final static String NAME = RelationAttribute.NAME;
private static final Logger s_log = Logger.getLogger(GenericContactTypeAddForm.class);
private GenericPersonPropertiesStep m_step; private GenericPersonPropertiesStep m_step;
private SaveCancelSection m_saveCancelSection; private SaveCancelSection m_saveCancelSection;
private ItemSelectionModel m_itemModel; private ItemSelectionModel m_itemModel;
@ -72,7 +74,8 @@ public class GenericContactTypeAddForm extends BasicItemForm {
@Override @Override
protected void addWidgets() { protected void addWidgets() {
// Key // Key
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contacttypes.key").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contacttypes.key")));
ParameterModel keyParam = new StringParameter(KEY); ParameterModel keyParam = new StringParameter(KEY);
keyParam.addParameterListener(new NotNullValidationListener()); keyParam.addParameterListener(new NotNullValidationListener());
keyParam.addParameterListener(new StringInRangeValidationListener(0, 1000)); keyParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
@ -80,14 +83,16 @@ public class GenericContactTypeAddForm extends BasicItemForm {
add(key); add(key);
// Language // Language
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contacttypes.language").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contacttypes.language")));
ParameterModel languageParam = new StringParameter(LANGUAGE); ParameterModel languageParam = new StringParameter(LANGUAGE);
language = new SingleSelect(languageParam); language = new SingleSelect(languageParam);
language.addValidationListener(new NotNullValidationListener()); language.addValidationListener(new NotNullValidationListener());
language.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize()))); language.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize())));
// Name // Name
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contacttypes.name").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contacttypes.name")));
ParameterModel nameParam = new StringParameter(NAME); ParameterModel nameParam = new StringParameter(NAME);
nameParam.addParameterListener(new NotNullValidationListener()); nameParam.addParameterListener(new NotNullValidationListener());
nameParam.addParameterListener(new StringInRangeValidationListener(0, 1000)); nameParam.addParameterListener(new StringInRangeValidationListener(0, 1000));
@ -100,8 +105,11 @@ public class GenericContactTypeAddForm extends BasicItemForm {
public void init(FormSectionEvent fse) { public void init(FormSectionEvent fse) {
FormData data = fse.getFormData(); FormData data = fse.getFormData();
PageState state = fse.getPageState(); PageState state = fse.getPageState();
RelationAttribute contacttype = (RelationAttribute) getItemSelectionModel().getSelectedObject(state); RelationAttribute contacttype = (RelationAttribute)
GenericContactTypeCollection contacttypeCollection = new GenericContactTypeCollection(contacttype.getKey()); getItemSelectionModel()
.getSelectedObject(state);
GenericContactTypeCollection contacttypeCollection = new
GenericContactTypeCollection(contacttype.getKey());
// all supported languages (by registry entry) // all supported languages (by registry entry)
KernelConfig kernelConfig = Kernel.getConfig(); KernelConfig kernelConfig = Kernel.getConfig();
@ -113,7 +121,10 @@ public class GenericContactTypeAddForm extends BasicItemForm {
// If lanuage exists, remove it from the selection list // If lanuage exists, remove it from the selection list
if (!contacttypeCollection.hasLanguage(code)) { if (!contacttypeCollection.hasLanguage(code)) {
language.addOption(new Option(code, new Locale(code).getDisplayLanguage()), state); language.addOption(new
Option(code,
new Locale(code).getDisplayLanguage()),
state);
} }
} }
@ -127,7 +138,9 @@ public class GenericContactTypeAddForm extends BasicItemForm {
public void process(FormSectionEvent fse) { public void process(FormSectionEvent fse) {
FormData data = fse.getFormData(); FormData data = fse.getFormData();
PageState state = fse.getPageState(); PageState state = fse.getPageState();
RelationAttribute contacttype = (RelationAttribute) getItemSelectionModel().getSelectedObject(state); RelationAttribute contacttype = (RelationAttribute)
getItemSelectionModel()
.getSelectedObject(state);
// //
if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) { if (!this.getSaveCancelSection().getCancelButton().isSelected(state)) {

View File

@ -33,20 +33,25 @@ public class GenericContactTypePropertiesStep extends SimpleEditStep {
/** The name of the editing sheet added to this step */ /** The name of the editing sheet added to this step */
private static String ADD_CONTACT_SHEET_NAME = "addContactType"; private static String ADD_CONTACT_SHEET_NAME = "addContactType";
public GenericContactTypePropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent) { public GenericContactTypePropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent) {
this(itemModel, parent, null); this(itemModel, parent, null);
} }
public GenericContactTypePropertiesStep(ItemSelectionModel itemModel, AuthoringKitWizard parent, String prefix) { public GenericContactTypePropertiesStep(ItemSelectionModel itemModel,
AuthoringKitWizard parent,
String prefix) {
super(itemModel, parent, prefix); super(itemModel, parent, prefix);
BasicItemForm addContactTypeSheet = new GenericContactTypeAddForm(itemModel); BasicItemForm addContactTypeSheet = new GenericContactTypeAddForm(itemModel);
add(ADD_CONTACT_SHEET_NAME, add(ADD_CONTACT_SHEET_NAME,
(String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.add_contacttype").localize(), (String) ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.person.add_contacttype").localize(),
new WorkflowLockedComponentAccess(addContactTypeSheet, itemModel), new WorkflowLockedComponentAccess(addContactTypeSheet, itemModel),
addContactTypeSheet.getSaveCancelSection().getCancelButton()); addContactTypeSheet.getSaveCancelSection().getCancelButton());
GenericContactTypeTable contacttypesTable = new GenericContactTypeTable(itemModel); GenericContactTypeTable contacttypesTable = new
GenericContactTypeTable(itemModel);
setDisplayComponent(contacttypesTable); setDisplayComponent(contacttypesTable);
} }

View File

@ -64,9 +64,26 @@ public class GenericContactTypeTable extends Table implements TableActionListene
TableColumnModel tab_model = getColumnModel(); TableColumnModel tab_model = getColumnModel();
// define columns // define columns
tab_model.add(new TableColumn(0, ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contacttypes.key").localize(), TABLE_COL_EDIT)); tab_model.add(new TableColumn(
tab_model.add(new TableColumn(1, ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contacttypes.title").localize())); 0,
tab_model.add(new TableColumn(2, ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contacttypes.action").localize(), TABLE_COL_DEL)); ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contacttypes.key")
// .localize()
,
TABLE_COL_EDIT));
tab_model.add(new TableColumn(
1,
ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contacttypes.title")
//.localize()
));
tab_model.add(new TableColumn(
2,
ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.contacttypes.action")
.localize()
,
TABLE_COL_DEL));
setModelBuilder(new GenericContactTypeTableModelBuilder(itemModel)); setModelBuilder(new GenericContactTypeTableModelBuilder(itemModel));
@ -81,7 +98,8 @@ public class GenericContactTypeTable extends Table implements TableActionListene
* XXXX * XXXX
* *
*/ */
private class GenericContactTypeTableModelBuilder extends LockableImpl implements TableModelBuilder { private class GenericContactTypeTableModelBuilder extends LockableImpl
implements TableModelBuilder {
private ItemSelectionModel m_itemModel; private ItemSelectionModel m_itemModel;
@ -105,12 +123,16 @@ public class GenericContactTypeTable extends Table implements TableActionListene
final private int MAX_DESC_LENGTH = 25; final private int MAX_DESC_LENGTH = 25;
private Table m_table; private Table m_table;
private RelationAttribute m_contacttype; private RelationAttribute m_contacttype;
private GenericContactTypeCollection m_contacttypeCollection = new GenericContactTypeCollection(); private GenericContactTypeCollection m_contacttypeCollection = new
GenericContactTypeCollection();
private GenericContactTypeTableModel(Table t, PageState ps, RelationAttribute contacttype) { private GenericContactTypeTableModel(Table t,
PageState ps,
RelationAttribute contacttype) {
m_table = t; m_table = t;
m_contacttype = contacttype; m_contacttype = contacttype;
// m_contacttypeCollection.addLanguageFilter(DispatcherHelper.getNegotiatedLocale().getLanguage()); // m_contacttypeCollection.addLanguageFilter(
// DispatcherHelper.getNegotiatedLocale().getLanguage());
} }
public int getColumnCount() { public int getColumnCount() {
@ -147,7 +169,9 @@ public class GenericContactTypeTable extends Table implements TableActionListene
case 1: case 1:
return m_contacttypeCollection.getName(); return m_contacttypeCollection.getName();
case 2: case 2:
return GlobalizationUtil.globalize("cms.ui.delete").localize(); return GlobalizationUtil.globalize("cms.ui.delete")
//.localize()
;
default: default:
return null; return null;
} }
@ -173,7 +197,8 @@ public class GenericContactTypeTable extends Table implements TableActionListene
int row, int column) { int row, int column) {
SecurityManager sm = Utilities.getSecurityManager(state); SecurityManager sm = Utilities.getSecurityManager(state);
RelationAttribute contacttype = (RelationAttribute) m_itemModel.getSelectedObject(state); RelationAttribute contacttype = (RelationAttribute)
m_itemModel.getSelectedObject(state);
// boolean canEdit = sm.canAccess(state.getRequest(), // boolean canEdit = sm.canAccess(state.getRequest(),
// SecurityManager.EDIT_ITEM, // SecurityManager.EDIT_ITEM,
@ -198,14 +223,18 @@ public class GenericContactTypeTable extends Table implements TableActionListene
int row, int column) { int row, int column) {
SecurityManager sm = Utilities.getSecurityManager(state); SecurityManager sm = Utilities.getSecurityManager(state);
RelationAttribute contacttype = (RelationAttribute) m_itemModel.getSelectedObject(state); RelationAttribute contacttype = (RelationAttribute)
m_itemModel.getSelectedObject(state);
// boolean canDelete = sm.canAccess(state.getRequest(), // boolean canDelete = sm.canAccess(state.getRequest(),
// SecurityManager.DELETE_ITEM, // SecurityManager.DELETE_ITEM,
// contacttype); // contacttype);
// if (canDelete) { // if (canDelete) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink(value.toString());
link.setConfirmation((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.contacttype.confirm_delete").localize()); link.setConfirmation(ContenttypesGlobalizationUtil
.globalize(
"cms.contenttypes.ui.contacttype.confirm_delete")
);
return link; return link;
// } else { // } else {
// return new Label(value.toString()); // return new Label(value.toString());
@ -223,7 +252,8 @@ public class GenericContactTypeTable extends Table implements TableActionListene
PageState state = evt.getPageState(); PageState state = evt.getPageState();
// Get selected GenericContactType // Get selected GenericContactType
RelationAttribute contacttype = new RelationAttribute(new BigDecimal(evt.getRowKey().toString())); RelationAttribute contacttype = new RelationAttribute(new
BigDecimal(evt.getRowKey().toString()));
// Get selected column // Get selected column
TableColumn col = getColumnModel().get(evt.getColumn().intValue()); TableColumn col = getColumnModel().get(evt.getColumn().intValue());

View File

@ -33,7 +33,7 @@ import org.apache.log4j.Logger;
* jensp $ * jensp $
*/ */
public abstract class GenericOrgaUnitExtraXmlGenerator public abstract class GenericOrgaUnitExtraXmlGenerator
implements ExtraXMLGenerator { implements ExtraXMLGenerator {
private final static Logger logger = private final static Logger logger =
Logger.getLogger( Logger.getLogger(

View File

@ -151,7 +151,7 @@ public abstract class GenericOrgaUnitMembersTab implements GenericOrgaUnitTab {
final List<GenericPerson> persons, final List<GenericPerson> persons,
final PageState state) { final PageState state) {
final GenericOrganizationalUnitSubordinateCollection subOrgaUnits = final GenericOrganizationalUnitSubordinateCollection subOrgaUnits =
orgaunit.getSubordinateOrgaUnits(); orgaunit.getSubordinateOrgaUnits();
final StringBuffer assocTypeFilter = new StringBuffer(); final StringBuffer assocTypeFilter = new StringBuffer();
for (String assocType : getAssocTypesToMerge()) { for (String assocType : getAssocTypesToMerge()) {
if (assocTypeFilter.length() > 0) { if (assocTypeFilter.length() > 0) {

View File

@ -73,8 +73,8 @@ public class GenericOrganizationalUnitContactAddForm
@Override @Override
protected void addWidgets() { protected void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize( add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_contact").localize())); "cms.contenttypes.ui.genericorgaunit.select_contact")));
m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType. m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(GenericContact.class.getName())); findByAssociatedObjectType(GenericContact.class.getName()));
m_itemSearch.setDisableCreatePane(false); m_itemSearch.setDisableCreatePane(false);
@ -90,8 +90,8 @@ public class GenericOrganizationalUnitContactAddForm
SingleSelect contactType = new SingleSelect(contactTypeParam); SingleSelect contactType = new SingleSelect(contactTypeParam);
contactType.addValidationListener(new NotNullValidationListener()); contactType.addValidationListener(new NotNullValidationListener());
contactType.addOption(new Option("", contactType.addOption(new Option("",
new Label((String) ContenttypesGlobalizationUtil. new Label(ContenttypesGlobalizationUtil.
globalize("cms.ui.select_one").localize()))); globalize("cms.ui.select_one"))));
GenericContactTypeCollection contacttypes = GenericContactTypeCollection contacttypes =
new GenericContactTypeCollection(); new GenericContactTypeCollection();
@ -197,7 +197,7 @@ public class GenericOrganizationalUnitContactAddForm
if ((editStep.getSelectedContact() == null) if ((editStep.getSelectedContact() == null)
&& (data.get(ITEM_SEARCH) == null)) { && (data.get(ITEM_SEARCH) == null)) {
data.addError( data.addError(
"cms.contenttypes.ui.genericorgaunit.select_contact.no_contact_selected"); "cms.contenttypes.ui.genericorgaunit.select_contact.no_contact_selected");
return; return;
} }

View File

@ -83,11 +83,11 @@ public class GenericOrganizationalUnitContactTable extends Table implements
tabModel.add(new TableColumn( tabModel.add(new TableColumn(
0, 0,
ContenttypesGlobalizationUtil.globalize( ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.contact.type").localize())); "cms.contenttypes.ui.genericorgaunit.contact.type")));
tabModel.add(new TableColumn( tabModel.add(new TableColumn(
1, 1,
ContenttypesGlobalizationUtil.globalize( ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.contact.title").localize(), "cms.contenttypes.ui.genericorgaunit.contact.title"),
TABLE_COL_EDIT)); TABLE_COL_EDIT));
tabModel.add(new TableColumn( tabModel.add(new TableColumn(
2, 2,

View File

@ -74,8 +74,8 @@ public class GenericOrganizationalUnitPersonAddForm
@Override @Override
protected void addWidgets() { protected void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize( add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.select_person").localize())); "cms.contenttypes.ui.genericorgaunit.select_person")));
m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType. m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType(getPersonType())); findByAssociatedObjectType(getPersonType()));
/*m_itemSearch.getItemField().addValidationListener( /*m_itemSearch.getItemField().addValidationListener(
@ -95,8 +95,8 @@ public class GenericOrganizationalUnitPersonAddForm
roleSelect.addValidationListener(new NotNullValidationListener()); roleSelect.addValidationListener(new NotNullValidationListener());
roleSelect.addOption( roleSelect.addOption(
new Option("", new Option("",
new Label((String) ContenttypesGlobalizationUtil. new Label(ContenttypesGlobalizationUtil
globalize("cms.ui.select_one").localize()))); .globalize("cms.ui.select_one"))));
RelationAttributeCollection roles = new RelationAttributeCollection( RelationAttributeCollection roles = new RelationAttributeCollection(
getRoleAttributeName()); getRoleAttributeName());
roles.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale(). roles.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
@ -116,8 +116,8 @@ public class GenericOrganizationalUnitPersonAddForm
SingleSelect statusSelect = new SingleSelect(statusModel); SingleSelect statusSelect = new SingleSelect(statusModel);
statusSelect.addValidationListener(new NotNullValidationListener()); statusSelect.addValidationListener(new NotNullValidationListener());
statusSelect.addOption(new Option("", statusSelect.addOption(new Option("",
new Label((String) ContenttypesGlobalizationUtil. new Label(ContenttypesGlobalizationUtil.
globalize("cms.ui.select_one").localize()))); globalize("cms.ui.select_one"))));
RelationAttributeCollection statusColl = RelationAttributeCollection statusColl =
new RelationAttributeCollection( new RelationAttributeCollection(
getStatusAttributeName()); getStatusAttributeName());

View File

@ -70,18 +70,18 @@ public class GenericOrganizationalUnitPersonsTable extends Table implements
this.personSelector = personSelector; this.personSelector = personSelector;
setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize( setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.persons.none"))); "cms.contenttypes.ui.genericorgaunit.persons.none")));
TableColumnModel tabModel = getColumnModel(); TableColumnModel tabModel = getColumnModel();
tabModel.add(new TableColumn( tabModel.add(new TableColumn(
0, 0,
ContenttypesGlobalizationUtil.globalize( ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.persons.name").localize(), "cms.contenttypes.ui.genericorgaunit.persons.name"),
TABLE_COL_EDIT)); TABLE_COL_EDIT));
tabModel.add(new TableColumn( tabModel.add(new TableColumn(
1, 1,
ContenttypesGlobalizationUtil.globalize( ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.persons.role").localize())); "cms.contenttypes.ui.genericorgaunit.persons.role")));
tabModel.add( tabModel.add(
new TableColumn( new TableColumn(
2, 2,

View File

@ -123,9 +123,8 @@ public class GenericOrganizationalUnitPropertiesStep extends SimpleEditStep {
itemModel)); itemModel));
segmentedPanel.addSegment( segmentedPanel.addSegment(
new Label((String) ContenttypesGlobalizationUtil.globalize( new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorganunit.basic_properties"). "cms.contenttypes.ui.genericorganunit.basic_properties")),
localize()),
basicProperties); basicProperties);
} }

View File

@ -76,8 +76,8 @@ public class GenericOrganizationalUnitPropertyForm
add(name);*/ add(name);*/
add(new Label( add(new Label(
(String) ContenttypesGlobalizationUtil.globalize( ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.genericorgaunit.addendum").localize())); "cms.contenttypes.ui.genericorgaunit.addendum")));
ParameterModel addendumParam = new StringParameter(ADDENDUM); ParameterModel addendumParam = new StringParameter(ADDENDUM);
TextField addendum = new TextField(addendumParam); TextField addendum = new TextField(addendumParam);
add(addendum); add(addendum);

View File

@ -35,13 +35,10 @@ import com.arsdigita.cms.CMS;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitBundle;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitSuperiorCollection; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitSuperiorCollection;
import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.cms.dispatcher.Utilities; import com.arsdigita.cms.dispatcher.Utilities;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.globalization.GlobalizationHelper; import com.arsdigita.globalization.GlobalizationHelper;
import com.arsdigita.persistence.OID;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
import java.math.BigDecimal; import java.math.BigDecimal;

View File

@ -53,8 +53,8 @@ public class GenericPersonAliasDeleteForm
@Override @Override
public void addWidgets() { public void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize( add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.person.alias.delete.confirm").localize())); "cms.contenttypes.ui.person.alias.delete.confirm")));
} }
@Override @Override
@ -65,7 +65,8 @@ public class GenericPersonAliasDeleteForm
@Override @Override
public void process(final FormSectionEvent fse) throws FormProcessException { public void process(final FormSectionEvent fse) throws FormProcessException {
final PageState state = fse.getPageState(); final PageState state = fse.getPageState();
final GenericPerson person = (GenericPerson) getItemSelectionModel().getSelectedObject(state); final GenericPerson person = (GenericPerson) getItemSelectionModel()
.getSelectedObject(state);
if ((person != null) && (person.getAlias() != null)) { if ((person != null) && (person.getAlias() != null)) {
person.unsetAlias(); person.unsetAlias();
@ -87,10 +88,9 @@ public class GenericPersonAliasDeleteForm
(GenericPerson) getItemSelectionModel(). (GenericPerson) getItemSelectionModel().
getSelectedObject(event.getPageState()); getSelectedObject(event.getPageState());
Submit target = (Submit) event.getTarget(); Submit target = (Submit) event.getTarget();
target.setButtonLabel((String) ContenttypesGlobalizationUtil. target.setButtonLabel(ContenttypesGlobalizationUtil.
globalize( globalize(
"cms.contenttypes.ui.person.alias.delete.label"). "cms.contenttypes.ui.person.alias.delete.label"));
localize());
} }
}); });
} catch (Exception ex) { } catch (Exception ex) {

View File

@ -69,8 +69,8 @@ public class GenericPersonAliasSetForm
@Override @Override
public void addWidgets() { public void addWidgets() {
add(new Label((String) ContenttypesGlobalizationUtil.globalize( add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.person.alias.select").localize())); "cms.contenttypes.ui.person.alias.select")));
itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType. itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType( findByAssociatedObjectType(
"com.arsdigita.cms.contenttypes.GenericPerson")); "com.arsdigita.cms.contenttypes.GenericPerson"));
@ -125,15 +125,13 @@ public class GenericPersonAliasSetForm
Submit target = (Submit) event.getTarget(); Submit target = (Submit) event.getTarget();
if (person.getAlias() != null) { if (person.getAlias() != null) {
target.setButtonLabel((String) ContenttypesGlobalizationUtil. target.setButtonLabel(ContenttypesGlobalizationUtil.
globalize( globalize(
"cms.contenttypes.ui.contact.alias.select.change"). "cms.contenttypes.ui.contact.alias.select.change"));
localize());
} else { } else {
target.setButtonLabel((String) ContenttypesGlobalizationUtil. target.setButtonLabel(ContenttypesGlobalizationUtil.
globalize( globalize(
"cms.contenttypes.ui.contact.alias.select.add"). "cms.contenttypes.ui.contact.alias.select.add"));
localize());
} }
} }
}); });

View File

@ -76,8 +76,8 @@ public class GenericPersonContactAddForm extends BasicItemForm {
protected void addWidgets() { protected void addWidgets() {
// Attach a GenericContact object // Attach a GenericContact object
add(new Label((String) ContenttypesGlobalizationUtil.globalize( add(new Label(ContenttypesGlobalizationUtil.globalize(
"cms.contenttypes.ui.person.select_contact").localize())); "cms.contenttypes.ui.person.select_contact")));
this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType. this.m_itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
findByAssociatedObjectType( findByAssociatedObjectType(
"com.arsdigita.cms.contenttypes.GenericContact")); "com.arsdigita.cms.contenttypes.GenericContact"));
@ -92,8 +92,8 @@ public class GenericPersonContactAddForm extends BasicItemForm {
SingleSelect contactType = new SingleSelect(contactTypeParam); SingleSelect contactType = new SingleSelect(contactTypeParam);
contactType.addValidationListener(new NotNullValidationListener()); contactType.addValidationListener(new NotNullValidationListener());
contactType.addOption(new Option("", contactType.addOption(new Option("",
new Label((String) ContenttypesGlobalizationUtil. new Label(ContenttypesGlobalizationUtil.
globalize("cms.ui.select_one").localize()))); globalize("cms.ui.select_one"))));
// Add the Options to the SingleSelect widget // Add the Options to the SingleSelect widget
GenericContactTypeCollection contacttypes = GenericContactTypeCollection contacttypes =

View File

@ -305,9 +305,8 @@ public class GenericPersonContactTable extends Table implements
person); person);
if (canDelete) { if (canDelete) {
ControlLink link = new ControlLink(value.toString()); ControlLink link = new ControlLink(value.toString());
link.setConfirmation((String) ContenttypesGlobalizationUtil. link.setConfirmation(ContenttypesGlobalizationUtil.
globalize("cms.contenttypes.ui.person.confirm_delete"). globalize("cms.contenttypes.ui.person.confirm_delete"));
localize());
return link; return link;
} else { } else {
return new Label(value.toString()); return new Label(value.toString());

View File

@ -28,7 +28,6 @@ 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.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
@ -36,7 +35,6 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitBundleCollection;
import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.GenericPerson;
import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil; import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
import com.arsdigita.cms.dispatcher.ItemResolver; import com.arsdigita.cms.dispatcher.ItemResolver;
import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.util.LockableImpl; import com.arsdigita.util.LockableImpl;
@ -59,16 +57,19 @@ public class GenericPersonOrgaUnitsTable extends Table {
this.itemModel = itemModel; this.itemModel = itemModel;
setEmptyView(new Label(ContenttypesGlobalizationUtil.globalize("person.ui.orgaunits.none"))); setEmptyView(new Label(ContenttypesGlobalizationUtil
.globalize("person.ui.orgaunits.none")));
final TableColumnModel columnModel = getColumnModel(); final TableColumnModel columnModel = getColumnModel();
columnModel.add(new TableColumn( columnModel.add(new TableColumn(
0, 0,
ContenttypesGlobalizationUtil.globalize("person.ui.orgaunits.columns.name").localize(), ContenttypesGlobalizationUtil
.globalize("person.ui.orgaunits.columns.name").localize(),
TABLE_COL_EDIT)); TABLE_COL_EDIT));
columnModel.add(new TableColumn( columnModel.add(new TableColumn(
2, 2,
ContenttypesGlobalizationUtil.globalize("person.ui.orgaunits.columns.type").localize(), ContenttypesGlobalizationUtil
.globalize("person.ui.orgaunits.columns.type").localize(),
TABLE_COL_TYPE)); TABLE_COL_TYPE));
setModelBuilder(new ModelBuilder(itemModel)); setModelBuilder(new ModelBuilder(itemModel));

View File

@ -69,9 +69,10 @@ public class GenericPersonPropertiesStep extends SimpleEditStep {
itemModel)); itemModel));
/* Add the SimpleEditStep to the segmented panel */ /* Add the SimpleEditStep to the segmented panel */
segmentedPanel.addSegment(new Label((String) ContenttypesGlobalizationUtil. segmentedPanel.addSegment(new
globalize("cms.contenttypes.ui.person.basic_properties"). Label(ContenttypesGlobalizationUtil
localize()), basicProperties); .globalize("cms.contenttypes.ui.person.basic_properties")),
basicProperties);
// GenericPersonContactPropertiesStep contactProperties = new GenericPersonContactPropertiesStep(itemModel, parent); // GenericPersonContactPropertiesStep contactProperties = new GenericPersonContactPropertiesStep(itemModel, parent);
@ -80,8 +81,8 @@ public class GenericPersonPropertiesStep extends SimpleEditStep {
GenericPersonAliasPropertiesStep aliasStep = GenericPersonAliasPropertiesStep aliasStep =
new GenericPersonAliasPropertiesStep( new GenericPersonAliasPropertiesStep(
itemModel, parent); itemModel, parent);
segmentedPanel.addSegment(new Label((String) ContenttypesGlobalizationUtil. segmentedPanel.addSegment(new Label(ContenttypesGlobalizationUtil.
globalize("cms.contenttypes.ui.person.alias").localize()), globalize("cms.contenttypes.ui.person.alias")),
aliasStep); aliasStep);
/* Sets the composed segmentedPanel as display component */ /* Sets the composed segmentedPanel as display component */

View File

@ -76,14 +76,16 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
super.addWidgets(); super.addWidgets();
mandatoryFieldWidgets(this); mandatoryFieldWidgets(this);
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.birthdate").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.person.birthdate")));
ParameterModel birthdateParam = new DateParameter(BIRTHDATE); ParameterModel birthdateParam = new DateParameter(BIRTHDATE);
com.arsdigita.bebop.form.Date birthdate = new com.arsdigita.bebop.form.Date(birthdateParam); com.arsdigita.bebop.form.Date birthdate = new com.arsdigita.bebop.form.Date(birthdateParam);
Calendar today = new GregorianCalendar(); Calendar today = new GregorianCalendar();
birthdate.setYearRange(1900, today.get(Calendar.YEAR)); birthdate.setYearRange(1900, today.get(Calendar.YEAR));
add(birthdate); add(birthdate);
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.gender").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.person.gender")));
ParameterModel genderParam = new StringParameter(GENDER); ParameterModel genderParam = new StringParameter(GENDER);
SingleSelect gender = new SingleSelect(genderParam); SingleSelect gender = new SingleSelect(genderParam);
gender.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize()))); gender.addOption(new Option("", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.ui.select_one").localize())));
@ -91,7 +93,8 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
gender.addOption(new Option("m", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.gender.m").localize()))); gender.addOption(new Option("m", new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.gender.m").localize())));
add(gender); add(gender);
add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.description").localize())); add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.person.description")));
ParameterModel descriptionParam = new StringParameter(DESCRIPTION); ParameterModel descriptionParam = new StringParameter(DESCRIPTION);
TextArea description = new TextArea(descriptionParam); TextArea description = new TextArea(descriptionParam);
description.setCols(50); description.setCols(50);
@ -101,23 +104,27 @@ public class GenericPersonPropertyForm extends BasicPageForm implements FormProc
} }
public static void mandatoryFieldWidgets(FormSection form) { public static void mandatoryFieldWidgets(FormSection form) {
form.add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepre").localize())); form.add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.person.titlepre")));
ParameterModel titlepreParam = new StringParameter(TITLEPRE); ParameterModel titlepreParam = new StringParameter(TITLEPRE);
TextField titlepre = new TextField(titlepreParam); TextField titlepre = new TextField(titlepreParam);
form.add(titlepre); form.add(titlepre);
form.add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.surname").localize())); form.add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.person.surname")));
ParameterModel surnameParam = new StringParameter(SURNAME); ParameterModel surnameParam = new StringParameter(SURNAME);
surnameParam.addParameterListener(new NotNullValidationListener()); surnameParam.addParameterListener(new NotNullValidationListener());
TextField surname = new TextField(surnameParam); TextField surname = new TextField(surnameParam);
form.add(surname); form.add(surname);
form.add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.givenname").localize())); form.add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.person.givenname")));
ParameterModel givennameParam = new StringParameter(GIVENNAME); ParameterModel givennameParam = new StringParameter(GIVENNAME);
TextField givenname = new TextField(givennameParam); TextField givenname = new TextField(givennameParam);
form.add(givenname); form.add(givenname);
form.add(new Label((String) ContenttypesGlobalizationUtil.globalize("cms.contenttypes.ui.person.titlepost").localize())); form.add(new Label(ContenttypesGlobalizationUtil
.globalize("cms.contenttypes.ui.person.titlepost")));
ParameterModel titlepostParam = new StringParameter(TITLEPOST); ParameterModel titlepostParam = new StringParameter(TITLEPOST);
TextField titlepost = new TextField(titlepostParam); TextField titlepost = new TextField(titlepostParam);
form.add(titlepost); form.add(titlepost);

View File

@ -33,19 +33,13 @@ import java.util.Iterator;
* *
* @author <a href="mailto:phong@arsdigita.com">Phong Nguyen</a> * @author <a href="mailto:phong@arsdigita.com">Phong Nguyen</a>
* @version $Revision: #7 $ * @version $Revision: #7 $
**/ */
public class ResettableContainer extends SimpleContainer implements Resettable { public class ResettableContainer extends SimpleContainer implements Resettable {
// $Source: /cvsroot/content-types/apps/content-types/src/ui/ResettableContainer.java,v $ /** A list of all resettable components in this container */
// $Revision: #7 $
// $Date: 2004/08/17 $
// $Author: sskracic $
// A list of all resettable components in this container
private ArrayList m_resettableComponents = new ArrayList(); private ArrayList m_resettableComponents = new ArrayList();
// A list of all components that are not visible by default /** A list of all components that are not visible by default */
private ArrayList m_componentsNotVisibleByDefault = new ArrayList(); private ArrayList m_componentsNotVisibleByDefault = new ArrayList();