diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileResources.properties b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/PublicPersonalProfileResources.properties similarity index 100% rename from ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileResources.properties rename to ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/PublicPersonalProfileResources.properties diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileResources_de.properties b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/PublicPersonalProfileResources_de.properties similarity index 100% rename from ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileResources_de.properties rename to ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/PublicPersonalProfileResources_de.properties diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileCreate.java b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileCreate.java index 0dc155a3d..3b3d50ff2 100644 --- a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileCreate.java +++ b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileCreate.java @@ -86,12 +86,14 @@ public class PublicPersonalProfileCreate extends PageCreate { add(m_workflowSection, ColumnPanel.INSERT); add(new Label(GlobalizationUtil.globalize( "cms.ui.authoring.content_type"))); - add(new Label(type.getLabel())); + add(new Label(type.getLabel())); // the title or name of the type add(new Label(GlobalizationUtil.globalize("cms.ui.language.field"))); add(new LanguageWidget(LANGUAGE)); - add(new Label(PublicPersonalProfileGlobalizationUtil.globalize("publicpersonalprofile.ui.create.select_person"))); - final ParameterModel ownerModel = new StringParameter(PublicPersonalProfileBundle.OWNER); + add(new Label(PublicPersonalProfileGlobalizationUtil.globalize( + "publicpersonalprofile.ui.create.select_person"))); + final ParameterModel ownerModel = new + StringParameter(PublicPersonalProfileBundle.OWNER); final SingleSelect ownerSelect = new SingleSelect(ownerModel); ownerSelect.addValidationListener(new NotNullValidationListener()); @@ -111,9 +113,11 @@ public class PublicPersonalProfileCreate extends PageCreate { if (types.size() == 0) { personType = "com.arsdigita.cms.contenttypes.GenericPerson"; } - DataCollection persons = SessionManager.getSession().retrieve(personType); + DataCollection persons = SessionManager.getSession() + .retrieve(personType); //persons.addFilter("profile is null"); - persons.addFilter(String.format("version = '%s'", ContentItem.DRAFT)); + persons.addFilter(String.format("version = '%s'", + ContentItem.DRAFT)); persons.addOrder("surname asc"); persons.addOrder("givenname asc"); persons.addOrder("language asc"); diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileGlobalizationUtil.java b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileGlobalizationUtil.java index 2c2b3b9b2..2de90e371 100644 --- a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileGlobalizationUtil.java +++ b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileGlobalizationUtil.java @@ -34,7 +34,7 @@ public class PublicPersonalProfileGlobalizationUtil { /** Name of Java resource files to handle PPP's globalisation. */ public static final String BUNDLE_NAME = - "com.arsdigita.cms.contenttypes.ui.PublicPersonalProfileResources"; + "com.arsdigita.cms.contenttypes.PublicPersonalProfileResources"; /** * This returns a globalized message using the package specific bundle, diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileMiscStep.java b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileMiscStep.java index 376f6c139..170234d74 100644 --- a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileMiscStep.java +++ b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileMiscStep.java @@ -49,8 +49,8 @@ public class PublicPersonalProfileMiscStep extends SimpleEditStep { final BasicItemForm editPositionForm = new PublicPersonalProfileMiscEditForm( itemModel); add(EDIT_MISC_SHEET_NAME, - (String) PublicPersonalProfileGlobalizationUtil.globalize( - "publicpersonalprofile.ui.misc.edit").localize(), + PublicPersonalProfileGlobalizationUtil.globalize( + "publicpersonalprofile.ui.misc.edit"), new WorkflowLockedComponentAccess(editPositionForm, itemModel), editPositionForm.getSaveCancelSection().getCancelButton()); diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileNavigationAddForm.java b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileNavigationAddForm.java index 6a2c7836a..9a2e6542a 100644 --- a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileNavigationAddForm.java +++ b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileNavigationAddForm.java @@ -93,9 +93,8 @@ public class PublicPersonalProfileNavigationAddForm @Override public void addWidgets() { - add(new Label((String) PublicPersonalProfileGlobalizationUtil.globalize( - "publicpersonalprofile.ui.nav.select_nav_item"). - localize())); + add(new Label(PublicPersonalProfileGlobalizationUtil.globalize( + "publicpersonalprofile.ui.nav.select_nav_item") )); ParameterModel navItemModel = new StringParameter(PublicPersonalProfileNavItem.KEY); SingleSelect navItemSelect = new SingleSelect(navItemModel); @@ -109,7 +108,7 @@ public class PublicPersonalProfileNavigationAddForm select.addOption(new Option("", "")); PublicPersonalProfileNavItemCollection navItems = - new PublicPersonalProfileNavItemCollection(); + new PublicPersonalProfileNavItemCollection(); navItems.addLanguageFilter(GlobalizationHelper. getNegotiatedLocale(). getLanguage()); @@ -162,9 +161,8 @@ public class PublicPersonalProfileNavigationAddForm add(navItemSelect); //if (!showGenerated()) { - add(new Label((String) PublicPersonalProfileGlobalizationUtil.globalize( - "publicpersonalprofile.ui.nav.select_target"). - localize())); + add(new Label(PublicPersonalProfileGlobalizationUtil.globalize( + "publicpersonalprofile.ui.nav.select_target") )); itemSearch = new ItemSearchWidget(ITEM_SEARCH); itemSearch.addValidationListener(this); add(this.itemSearch); diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileNavigationStep.java b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileNavigationStep.java index 348f7c410..d4b4f3aec 100644 --- a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileNavigationStep.java +++ b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileNavigationStep.java @@ -51,8 +51,8 @@ public class PublicPersonalProfileNavigationStep extends SimpleEditStep { new PublicPersonalProfileNavigationAddForm(itemModel, this); add(EDIT_NAV_ITEM_SHEET_NAME, - (String) PublicPersonalProfileGlobalizationUtil.globalize( - "publicpersonalprofile.ui.profile.content.add").localize(), + PublicPersonalProfileGlobalizationUtil.globalize( + "publicpersonalprofile.ui.profile.content.add"), new WorkflowLockedComponentAccess(editNavItemSheet, itemModel), editNavItemSheet.getSaveCancelSection().getCancelButton()); diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileNavigationTable.java b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileNavigationTable.java index d73a4499a..4bcf5dba5 100644 --- a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileNavigationTable.java +++ b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileNavigationTable.java @@ -31,7 +31,6 @@ import com.arsdigita.bebop.table.TableColumn; import com.arsdigita.bebop.table.TableColumnModel; import com.arsdigita.bebop.table.TableModel; import com.arsdigita.bebop.table.TableModelBuilder; -import com.arsdigita.cms.CMS; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentSection; @@ -55,9 +54,8 @@ import org.apache.log4j.Logger; * @author Jens Pelzetter * @version $Id$ */ -public class PublicPersonalProfileNavigationTable - extends Table - implements TableActionListener { +public class PublicPersonalProfileNavigationTable extends Table + implements TableActionListener { private static final Logger logger = Logger.getLogger( PublicPersonalProfileNavigationTable.class); @@ -79,20 +77,20 @@ public class PublicPersonalProfileNavigationTable TableColumnModel colModel = getColumnModel(); colModel.add(new TableColumn( 0, - PublicPersonalProfileGlobalizationUtil.globalize( - "publicpersonalprofile.ui.nav.target").localize(), + new Label(PublicPersonalProfileGlobalizationUtil.globalize( + "publicpersonalprofile.ui.nav.target") ), TABLE_COL_EDIT)); colModel.add(new TableColumn( 1, - PublicPersonalProfileGlobalizationUtil.globalize( - "publicpersonalprofile.ui.nav.targetitem").localize(), + new Label(PublicPersonalProfileGlobalizationUtil.globalize( + "publicpersonalprofile.ui.nav.targetitem")), TABLE_COL_TARGET)); colModel.add(new TableColumn( 2, - PublicPersonalProfileGlobalizationUtil.globalize( - "publicpersonalprofile.ui.nav.remove").localize(), + new Label(PublicPersonalProfileGlobalizationUtil.globalize( + "publicpersonalprofile.ui.nav.remove")), TABLE_COL_DEL)); setModelBuilder(new PublicPersonalProfileNavigationTableModelBuilder( @@ -193,8 +191,11 @@ public class PublicPersonalProfileNavigationTable return targetItem; } case 2: - return PublicPersonalProfileGlobalizationUtil.globalize( - "publicpersonalprofile.ui.nav.remove").localize(); + // return PublicPersonalProfileGlobalizationUtil.globalize( + // "publicpersonalprofile.ui.nav.remove").localize(); + return new Label( + PublicPersonalProfileGlobalizationUtil.globalize( + "publicpersonalprofile.ui.nav.remove")); default: return null; } @@ -222,7 +223,8 @@ public class PublicPersonalProfileNavigationTable int col) { //com.arsdigita.cms.SecurityManager securityManager = Utilities.getSecurityManager(state); - return new Label((String) value); + // return new Label((String) value); + return (Component)value; } } @@ -293,13 +295,14 @@ public class PublicPersonalProfileNavigationTable if (canDelete) { ControlLink link = new ControlLink(value.toString()); - link.setConfirmation((String) PublicPersonalProfileGlobalizationUtil. - globalize("publicpersonalprofile.ui.nav.remove.confirm"). - localize()); + link.setConfirmation(PublicPersonalProfileGlobalizationUtil. + globalize("publicpersonalprofile.ui.nav.remove.confirm") + ); return link; } else { - Label label = new Label(value.toString()); - return label; + // Label label = new Label(value.toString()); + // return label; + return (Component)value; } } diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfilePositionEditForm.java b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfilePositionEditForm.java index ddab6e909..7c5b489cc 100644 --- a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfilePositionEditForm.java +++ b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfilePositionEditForm.java @@ -20,7 +20,6 @@ package com.arsdigita.cms.contenttypes.ui; import com.arsdigita.bebop.FormData; import com.arsdigita.bebop.FormProcessException; -import com.arsdigita.bebop.FormSection; import com.arsdigita.bebop.Label; import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.event.FormInitListener; diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfilePositionStep.java b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfilePositionStep.java index 878a16252..9108d1349 100644 --- a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfilePositionStep.java +++ b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfilePositionStep.java @@ -50,8 +50,8 @@ public class PublicPersonalProfilePositionStep extends SimpleEditStep { final BasicItemForm editPositionForm = new PublicPersonalProfilePositionEditForm( itemModel); add(EDIT_POSITION_SHEET_NAME, - (String) PublicPersonalProfileGlobalizationUtil.globalize( - "publicpersonalprofile.ui.position.edit").localize(), + PublicPersonalProfileGlobalizationUtil.globalize( + "publicpersonalprofile.ui.position.edit"), new WorkflowLockedComponentAccess(editPositionForm, itemModel), editPositionForm.getSaveCancelSection().getCancelButton()); diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfilePropertiesStep.java b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfilePropertiesStep.java index 9d5bca791..ae5f1dd76 100644 --- a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfilePropertiesStep.java +++ b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfilePropertiesStep.java @@ -59,22 +59,19 @@ public class PublicPersonalProfilePropertiesStep extends SimpleEditStep { BasicPageForm editBasicSheet = new PublicPersonalProfilePropertyForm(itemModel, this); - basicProperties.add(EDIT_SHEET_NAME, - (String) PublicPersonalProfileGlobalizationUtil. - globalize( - "publicpersonalprofile.ui.profile.edit_basic_properties"). - localize(), - new WorkflowLockedComponentAccess(editBasicSheet, - itemModel), - editBasicSheet.getSaveCancelSection(). - getCancelButton()); + basicProperties.add( + EDIT_SHEET_NAME, + PublicPersonalProfileGlobalizationUtil.globalize( + "publicpersonalprofile.ui.profile.edit_basic_properties"), + new WorkflowLockedComponentAccess(editBasicSheet,itemModel), + editBasicSheet.getSaveCancelSection().getCancelButton()); basicProperties.setDisplayComponent(getPublicPersonalProfilePropertySheet( itemModel)); - segmentedPanel.addSegment(new Label((String) PublicPersonalProfileGlobalizationUtil. - globalize("publicpersonalprofile.ui.profile.basic_properties"). - localize()), basicProperties); + segmentedPanel.addSegment(new Label(PublicPersonalProfileGlobalizationUtil. + globalize("publicpersonalprofile.ui.profile.basic_properties")), + basicProperties); setDisplayComponent(segmentedPanel); } diff --git a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileResearchInterestsStep.java b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileResearchInterestsStep.java index a4e99a887..054003c07 100644 --- a/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileResearchInterestsStep.java +++ b/ccm-cms-publicpersonalprofile/src/com/arsdigita/cms/contenttypes/ui/PublicPersonalProfileResearchInterestsStep.java @@ -51,9 +51,9 @@ public class PublicPersonalProfileResearchInterestsStep extends SimpleEditStep { final BasicItemForm editRiForm = new PublicPersonalProfileResearchInterestsEditForm (itemModel); - add(EDIT_RI_SHEET_NAME, (String) PublicPersonalProfileGlobalizationUtil. - globalize("publicpersonalprofile.ui.research_interests.edit"). - localize(), + add(EDIT_RI_SHEET_NAME, + PublicPersonalProfileGlobalizationUtil.globalize( + "publicpersonalprofile.ui.research_interests.edit"), new WorkflowLockedComponentAccess(editRiForm, itemModel), editRiForm.getSaveCancelSection().getCancelButton()); @@ -66,7 +66,7 @@ public class PublicPersonalProfileResearchInterestsStep extends SimpleEditStep { itemModel); sheet.add(PublicPersonalProfileGlobalizationUtil.globalize( - "publicpersonalprofile.ui.research_interests"), + "publicpersonalprofile.ui.research_interests"), PublicPersonalProfile.INTERESTS); return sheet; diff --git a/ccm-cms/src/com/arsdigita/cms/ContentType.java b/ccm-cms/src/com/arsdigita/cms/ContentType.java index 40fea2ec4..ba5dbb3e2 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentType.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentType.java @@ -60,10 +60,13 @@ import java.util.StringTokenizer; public class ContentType extends ACSObject { public static final String BASE_DATA_OBJECT_TYPE = - "com.arsdigita.cms.ContentType"; + "com.arsdigita.cms.ContentType"; public static final String OBJECT_TYPE = "associatedObjectType"; + /** The name or title of the content type, e.g. "File Storage Item" */ public static final String LABEL = "label"; + /** A short description of the type, what is is meant to do / to use for. */ public static final String DESCRIPTION = "description"; + /** Fully qualified name of the (main) domain class (and main entry point)*/ public static final String CLASSNAME = "className"; public static final String MODE = "mode"; public static final String AUTHORING_KIT = "authoringKit"; diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/DomainObjectPropertySheet.java b/ccm-core/src/com/arsdigita/toolbox/ui/DomainObjectPropertySheet.java index 6cd7b08ef..ee145af78 100755 --- a/ccm-core/src/com/arsdigita/toolbox/ui/DomainObjectPropertySheet.java +++ b/ccm-core/src/com/arsdigita/toolbox/ui/DomainObjectPropertySheet.java @@ -39,7 +39,7 @@ import java.util.StringTokenizer; /** * Displays a list of label-value pairs, which represent the attributes * of a domain object. - *
+ * * Typical usage is *
+ * * The first argument is the visible label for the property, and * the second argument is the name of the property as it appears in * the PDL file. - ** DomainObjectPropertySheet mySheet = @@ -47,20 +47,22 @@ import java.util.StringTokenizer; * mySheet.add("Name:", ContentPage.NAME); * mySheet.add("Title:", ContentPage.TITLE); *
+ * * Instead of specifying the property directly, you may specify the "path" * to the property. For example, *
+ * * The code above tells the* mySheet.add("Address Line 1:", "user.address.street"); *
DomainObjectPropertySheet to look for
* the child of the current object named "user"; then look for the child
* of the user named "address", and finally to return the property of
* the address named "street".
- *
+ *
* Note that, by default, DomainObjectPropertySheet retrieves
* the values for its properties directly from the underlying {@link DataObject}
* of the {@link DomainObject}. This means that the Java getXXX
@@ -69,8 +71,8 @@ import java.util.StringTokenizer;
* will call the appropriate methods.
*
* @author Stanislav Freidin
+ * @author Peter Boy (localization)
* @version $Id: DomainObjectPropertySheet.java 287 2005-02-22 00:29:02Z sskracic $
- *
*/
public class DomainObjectPropertySheet extends PropertySheet {
@@ -83,8 +85,7 @@ public class DomainObjectPropertySheet extends PropertySheet {
* Construct a new DomainObjectPropertySheet
*
* @param objModel The selection model which feeds domain objects to this
- * property sheet.
- *
+ * property sheet.
*/
public DomainObjectPropertySheet(DomainObjectSelectionModel objModel) {
this(objModel, false);
@@ -94,13 +95,13 @@ public class DomainObjectPropertySheet extends PropertySheet {
* Construct a new DomainObjectPropertySheet
*
* @param objModel The selection model which feeds domain objects to this
- * property sheet
+ * property sheet
* @param valueOutputEscape The value of the label-value pair(i.e.,
- * column[1])'s output-escaping
- *
+ * column[1])'s output-escaping
*/
- public DomainObjectPropertySheet(
- DomainObjectSelectionModel objModel, boolean valueOutputEscape) {
+ public DomainObjectPropertySheet( DomainObjectSelectionModel objModel,
+ boolean valueOutputEscape) {
+
super(new DomainObjectModelBuilder(), valueOutputEscape);
m_objModel = objModel;
@@ -177,7 +178,8 @@ public class DomainObjectPropertySheet extends PropertySheet {
* PDL property)
* @param formatter An instance of AttributeFormatter
*/
- public void add(GlobalizedMessage label, String attribute,
+ public void add(GlobalizedMessage label,
+ String attribute,
AttributeFormatter f) {
m_props.add(new Property(label, attribute, f));
}
@@ -234,6 +236,13 @@ public class DomainObjectPropertySheet extends PropertySheet {
private String m_attr;
private AttributeFormatter m_formatter;
+ /**
+ * Constructor, takes the set of parameter to create a new Property.
+ *
+ * @param l the lebael for the attribute
+ * @param a the attribute (as String, i.e name of the property)
+ * @param f the formatter to convert the attribute a into a String
+ */
public Property(GlobalizedMessage l, String a, AttributeFormatter f) {
m_label = l;
m_attr = a;
@@ -247,22 +256,38 @@ public class DomainObjectPropertySheet extends PropertySheet {
return m_label.getKey();
}
+ /**
+ * Fetch the (globalizes) label of the property.
+ * @return
+ */
public GlobalizedMessage getGlobalizedLabel() {
return m_label;
}
+ /**
+ * Fetch the attribute.
+ *
+ * @return name of the attribute (a String)
+ */
public String getAttribute() {
return m_attr;
}
+ /**
+ * Fetch the formatter for the attribute
+ * @return
+ */
public AttributeFormatter getFormatter() {
return m_formatter;
}
}
- // Build up the object properties model from the iterator over all properties
- private static class DomainObjectPropertiesModel implements
- PropertySheetModel {
+ /**
+ * Build up the object properties model from the iterator over all
+ * properties.
+ */
+ private static class DomainObjectPropertiesModel
+ implements PropertySheetModel {
private DomainObject m_obj;
private PageState m_state;
@@ -271,14 +296,25 @@ public class DomainObjectPropertySheet extends PropertySheet {
private static String ERROR =
"No current property. Make sure that nextRow() was called at least once.";
- public DomainObjectPropertiesModel(
- DomainObject obj, Iterator props, PageState state) {
+ /**
+ *
+ * @param obj
+ * @param props
+ * @param state
+ */
+ public DomainObjectPropertiesModel( DomainObject obj,
+ Iterator props,
+ PageState state) {
m_obj = obj;
m_props = props;
m_state = state;
m_current = null;
}
+ /**
+ *
+ * @return
+ */
public boolean nextRow() {
if (!m_props.hasNext()) {
return false;
@@ -295,6 +331,10 @@ public class DomainObjectPropertySheet extends PropertySheet {
return getGlobalizedLabel().getKey();
}
+ /**
+ *
+ * @return
+ */
public GlobalizedMessage getGlobalizedLabel() {
if (m_current == null) {
throw new IllegalStateException(ERROR);
@@ -302,6 +342,10 @@ public class DomainObjectPropertySheet extends PropertySheet {
return m_current.getGlobalizedLabel();
}
+ /**
+ *
+ * @return
+ */
public String getValue() {
if (m_current == null) {
throw new IllegalStateException(ERROR);
@@ -312,7 +356,9 @@ public class DomainObjectPropertySheet extends PropertySheet {
}
}
- // Builds an DomainObjectPropertiesModel
+ /**
+ * Builds an DomainObjectPropertiesModel.
+ */
private static class DomainObjectModelBuilder extends LockableImpl
implements PropertySheetModelBuilder {
@@ -325,72 +371,128 @@ public class DomainObjectPropertySheet extends PropertySheet {
}
}
- // Abstract formatter which maintains a "default" string
+ /**
+ * Abstract AttributeFormatter class which maintains a "default" value for
+ * the attribute. The default value is a GlobalizedMessage, which will be
+ * formatted to a String by the default format method.
+ */
private static abstract class DefaultAttributeFormatter
- extends DomainService
- implements AttributeFormatter {
+ extends DomainService
+ implements AttributeFormatter {
- private String m_default;
+ private GlobalizedMessage m_default;
+ /**
+ * Default Constructor which creates a default GlobalizedMessage to
+ * be used as default value for an attribute.
+ */
public DefaultAttributeFormatter() {
- this((String)GlobalizationUtil.globalize("cms.ui.unknown").localize());
+ m_default = new GlobalizedMessage(
+ "toolbox.ui.na",
+ "com.arsdigita.toolbox.ui.ToolboxResources");
}
- public DefaultAttributeFormatter(String def) {
+ /**
+ * Constructor which takes a custom GlobalizedMessage to be used as a
+ * default value.
+ *
+ * @param def GlobalizedMessage used as default value
+ */
+ public DefaultAttributeFormatter(GlobalizedMessage def) {
m_default = def;
}
- public String getDefaultString() {
+ public GlobalizedMessage getDefaultValue() {
return m_default;
}
}
- // A simple attribute formatter that calls get on the object with the
- // specified attribute
+ /**
+ * A simple attribute formatter that calls get on the object with the
+ * specified attribute.
+ */
private static class SimpleAttributeFormatter
- extends DefaultAttributeFormatter {
+ extends DefaultAttributeFormatter {
+ /**
+ * Constructor, simply calls the super class. Uses a default value for
+ * empty attributes.
+ */
public SimpleAttributeFormatter() {
super();
}
- public SimpleAttributeFormatter(String def) {
+ /**
+ * Constructor which takes a custom GlobalizedMessage to be used as a
+ * default value.
+ *
+ * @param def GlobalizedMessage used as default value
+ */
+ public SimpleAttributeFormatter(GlobalizedMessage def) {
super(def);
}
+ /**
+ * Formatter method, invoked at every page request!
+ *
+ * @param obj
+ * @param attribute
+ * @param state
+ * @return
+ */
public String format(DomainObject obj, String attribute, PageState state) {
- if (obj == null) {
- return getDefaultString();
- }
-
+
+ /* Determine the default value */
+ GlobalizedMessage defaultMsg = getDefaultValue();
Object value = get(obj, attribute);
if (value == null) {
- return getDefaultString();
+ return (String)defaultMsg.localize();
} else {
return value.toString();
}
}
}
- // A more advanced attribute formatter. Folows the path to the value
- // by following the names in the attribute string. For example, if
- // the string says "foo.bar.baz", the formatter will attempt to call
- // obj.get("foo").get("bar").get("baz");
+ /**
+ * A more advanced attribute formatter. Follows the path to the value
+ * by following the names in the attribute string. For example, if
+ * the string says "foo.bar.baz", the formatter will attempt to call
+ * obj.get("foo").get("bar").get("baz");
+ */
private static class RecursiveAttributeFormatter
- extends DefaultAttributeFormatter {
+ extends DefaultAttributeFormatter {
+ /**
+ * Constructor, simply calls the super class. Uses a default value for
+ * empty attributes.
+ */
public RecursiveAttributeFormatter() {
super();
}
- public RecursiveAttributeFormatter(String def) {
+ /**
+ * Constructor which takes a custom GlobalizedMessage to be used as a
+ * default value.
+ *
+ * @param def GlobalizedMessage used as default value
+ */
+ public RecursiveAttributeFormatter(GlobalizedMessage def) {
super(def);
}
+ /**
+ * Formatter method, invoked at every page request!
+ *
+ * @param obj
+ * @param attribute
+ * @param state
+ * @return
+ */
public String format(DomainObject obj, String attribute, PageState state) {
+
if (obj == null) {
- return getDefaultString();
+ return (String)getDefaultValue().localize();
}
StringTokenizer tokenizer = new StringTokenizer(attribute, ".");
@@ -402,13 +504,13 @@ public class DomainObjectPropertySheet extends PropertySheet {
// Null check
value = ((DataObject) value).get(token);
if (value == null) {
- return getDefaultString();
+ return (String)getDefaultValue().localize();
}
}
// Extract leaf value
if (token == null || value == null) {
- return getDefaultString();
+ return (String)getDefaultValue().localize();
}
return value.toString();
diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/ToolboxResources.properties b/ccm-core/src/com/arsdigita/toolbox/ui/ToolboxResources.properties
index 01f000eae..76b69bf6d 100755
--- a/ccm-core/src/com/arsdigita/toolbox/ui/ToolboxResources.properties
+++ b/ccm-core/src/com/arsdigita/toolbox/ui/ToolboxResources.properties
@@ -1,3 +1,2 @@
toolbox.ui.na=N/A
toolbox.ui.no_results=No Results.
-cms.ui.unknown=unknown
diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/ToolboxResources_de.properties b/ccm-core/src/com/arsdigita/toolbox/ui/ToolboxResources_de.properties
index 22b9c790c..3663c33f2 100644
--- a/ccm-core/src/com/arsdigita/toolbox/ui/ToolboxResources_de.properties
+++ b/ccm-core/src/com/arsdigita/toolbox/ui/ToolboxResources_de.properties
@@ -1,3 +1,2 @@
-toolbox.ui.na=N/A
+toolbox.ui.na=(nicht eingetragen)
toolbox.ui.no_results=Keine Ergebnisse.
-cms.ui.unknown=unbekannt
diff --git a/ccm-core/src/com/arsdigita/toolbox/ui/ToolboxResources_fr.properties b/ccm-core/src/com/arsdigita/toolbox/ui/ToolboxResources_fr.properties
index c64eaeb26..b2fab7a0a 100755
--- a/ccm-core/src/com/arsdigita/toolbox/ui/ToolboxResources_fr.properties
+++ b/ccm-core/src/com/arsdigita/toolbox/ui/ToolboxResources_fr.properties
@@ -1,3 +1,2 @@
toolbox.ui.na=N/A
toolbox.ui.no_results=Pas de r\u00e9sultats
-cms.ui.unknown=
diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ContactResources.properties b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ContactResources.properties
index 5cfd277fd..40d9d2f86 100755
--- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ContactResources.properties
+++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ContactResources.properties
@@ -29,3 +29,7 @@ london.contenttypes.ui.contact.phonetable.header_delete=Delete
london.contenttypes.ui.contact.phonetable.confirm_delete=Delete this Phone?
london.contenttypes.ui.contact.phonetable.link_delete=delete
london.contenttypes.ui.contact.phonetable.delete_confirmation=Delete this Phone?
+london.contenttypes.ui.contact.remove_contact=Remove contact
+london.contenttypes.ui.contact.search_contact_label=Search for Contact:
+london.contenttypes.ui.contact.no_contacts_yet=This item does not have a contact.
+london.contenttypes.ui.contact.add_contact=Add
diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ContactResources_de.properties b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ContactResources_de.properties
index ff799a317..07ea932a1 100755
--- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ContactResources_de.properties
+++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ContactResources_de.properties
@@ -21,7 +21,7 @@ london.contenttypes.ui.contact.emails=E-Mail
com.arsdigita.london.contenttypes.contact_authoring_step_description=Kontakteintrag
com.arsdigita.london.contenttypes.contact_authoring_step_label=Kontakt
com.arsdigita.london.contenttypes.ui.contact.select_contact=Einen Kontakt ausw\u00e4hlen
-london.contenttypes.ui.contact.add_phone_button=Telefonnummer hinzuf\u00fchren
+london.contenttypes.ui.contact.add_phone_button=Telefonnummer hinzuf\u00fcgen
london.contenttypes.ui.contact.phonetable.no_entries_msg=Es sind keine Telefonnummer mit diesem Kontakt verkn\u00fcpft.
london.contenttypes.ui.contact.phonetable.header_type=Telefon Typ
london.contenttypes.ui.contact.phonetable.header_num=Telefonnummer
@@ -29,3 +29,7 @@ london.contenttypes.ui.contact.phonetable.header_delete=L\u00f6schen
london.contenttypes.ui.contact.phonetable.confirm_delete=Delete this Phone?
london.contenttypes.ui.contact.phonetable.link_delete=l\u00f6schen
london.contenttypes.ui.contact.phonetable.delete_confirmation=Diesen Eintrag l\u00f6schen?
+london.contenttypes.ui.contact.remove_contact=Kontakt entfernen
+london.contenttypes.ui.contact.search_contact_label=Nach Kontakt suchen:
+london.contenttypes.ui.contact.no_contacts_yet=es ist kein Kontakt zugeordnet.
+london.contenttypes.ui.contact.add_contact=Hinzuf\u00fcgen
diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ContactResources_fr.properties b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ContactResources_fr.properties
index 5cfd277fd..40d9d2f86 100755
--- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ContactResources_fr.properties
+++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ContactResources_fr.properties
@@ -29,3 +29,7 @@ london.contenttypes.ui.contact.phonetable.header_delete=Delete
london.contenttypes.ui.contact.phonetable.confirm_delete=Delete this Phone?
london.contenttypes.ui.contact.phonetable.link_delete=delete
london.contenttypes.ui.contact.phonetable.delete_confirmation=Delete this Phone?
+london.contenttypes.ui.contact.remove_contact=Remove contact
+london.contenttypes.ui.contact.search_contact_label=Search for Contact:
+london.contenttypes.ui.contact.no_contacts_yet=This item does not have a contact.
+london.contenttypes.ui.contact.add_contact=Add
diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactAddressProperties.java b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactAddressProperties.java
index 1a8ea389c..56abe6b10 100755
--- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactAddressProperties.java
+++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactAddressProperties.java
@@ -42,7 +42,7 @@ public class ContactAddressProperties extends SimpleEditStep {
public static String EDIT_SHEET_NAME = "edit-contact-address";
public ContactAddressProperties(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
+ AuthoringKitWizard parent) {
super(itemModel, parent);
BasicItemForm form;
diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertiesAddStep.java b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertiesAddStep.java
index 0ff2b3348..83a4d1a76 100644
--- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertiesAddStep.java
+++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertiesAddStep.java
@@ -109,7 +109,8 @@ public class ContactPropertiesAddStep extends ResettableContainer {
m_contact = new RequestLocal() {
@Override
protected Object initialValue(PageState s) {
- ContentItem item = (ContentItem) ((ItemSelectionModel) getSingleSelectionModel())
+ ContentItem item = (ContentItem) (
+ (ItemSelectionModel) getSingleSelectionModel())
.getSelectedObject(s);
Assert.exists(item);
return Contact.getContactForItem(item);
@@ -166,7 +167,8 @@ public class ContactPropertiesAddStep extends ResettableContainer {
private void addWidgets() {
m_contactPropertySheet = getContactPropertySheet(m_contactSelectionModel);
- m_noContact = new Label("This item does not have a contact.");
+ m_noContact = new Label(ContactGlobalizationUtil.globalize(
+ "london.contenttypes.ui.contact.no_contacts_yet"));
m_noContact.setFontWeight(Label.ITALIC);
add(m_contactPropertySheet);
add(m_noContact);
@@ -188,61 +190,64 @@ public class ContactPropertiesAddStep extends ResettableContainer {
private Component getContactPropertySheet(ItemSelectionModel itemModel) {
DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
itemModel);
- sheet.add(ContactGlobalizationUtil
- .globalize("com.arsdigita.london.contenttypes.ui.name"),
- Contact.NAME);
+ sheet.add(ContactGlobalizationUtil.globalize(
+ "com.arsdigita.london.contenttypes.ui.name"),
+ Contact.NAME);
- sheet.add(ContactGlobalizationUtil
- .globalize("com.arsdigita.london.contenttypes.ui.title"),
- Contact.TITLE);
+ sheet.add(ContactGlobalizationUtil.globalize(
+ "com.arsdigita.london.contenttypes.ui.title"),
+ Contact.TITLE);
- sheet.add(ContactGlobalizationUtil
- .globalize("com.arsdigita.london.contenttypes.ui.contact_givenname"),
- Contact.GIVEN_NAME);
+ sheet.add(ContactGlobalizationUtil.globalize(
+ "com.arsdigita.london.contenttypes.ui.contact_givenname"),
+ Contact.GIVEN_NAME);
- sheet.add(ContactGlobalizationUtil
- .globalize("com.arsdigita.london.contenttypes.ui.contact_familyname"),
- Contact.FAMILY_NAME);
+ sheet.add(ContactGlobalizationUtil.globalize(
+ "com.arsdigita.london.contenttypes.ui.contact_familyname"),
+ Contact.FAMILY_NAME);
- sheet.add(ContactGlobalizationUtil
- .globalize("com.arsdigita.london.contenttypes.ui.contact_type"),
- Contact.CONTACT_TYPE,
- new DomainObjectPropertySheet.AttributeFormatter() {
- public String format(DomainObject item,
- String attribute, PageState state) {
- Contact contact = (Contact) item;
- if (contact != null
- && contact.getContactType() != null) {
- return contact.getContactTypeName();
- } else {
- return "unknown";
- }
- }
- });
+ sheet.add(ContactGlobalizationUtil.globalize(
+ "com.arsdigita.london.contenttypes.ui.contact_type"),
+ Contact.CONTACT_TYPE,
+ new DomainObjectPropertySheet.AttributeFormatter() {
+ public String format(DomainObject item,
+ String attribute,
+ PageState state) {
+ Contact contact = (Contact) item;
+ if (contact != null
+ && contact.getContactType() != null) {
+ return contact.getContactTypeName();
+ } else {
+ return (String)GlobalizationUtil
+ .globalize("cms.ui.unknown")
+ .localize();
+ }
+ }
+ });
- sheet.add(ContactGlobalizationUtil
- .globalize("com.arsdigita.london.contenttypes.ui.description"),
- Contact.DESCRIPTION);
+ sheet.add(ContactGlobalizationUtil.globalize(
+ "com.arsdigita.london.contenttypes.ui.description"),
+ Contact.DESCRIPTION);
- sheet.add(ContactGlobalizationUtil
- .globalize("com.arsdigita.london.contenttypes.ui.contact_emails"),
- Contact.EMAILS);
+ sheet.add(ContactGlobalizationUtil.globalize(
+ "com.arsdigita.london.contenttypes.ui.contact_emails"),
+ Contact.EMAILS);
- sheet.add(ContactGlobalizationUtil
- .globalize("com.arsdigita.london.contenttypes.ui.contact_suffix"),
- Contact.SUFFIX);
+ sheet.add(ContactGlobalizationUtil.globalize(
+ "com.arsdigita.london.contenttypes.ui.contact_suffix"),
+ Contact.SUFFIX);
- sheet.add(ContactGlobalizationUtil
- .globalize("com.arsdigita.london.contenttypes.ui.contact_orgname"),
- Contact.ORG_NAME);
+ sheet.add(ContactGlobalizationUtil.globalize(
+ "com.arsdigita.london.contenttypes.ui.contact_orgname"),
+ Contact.ORG_NAME);
- sheet.add(ContactGlobalizationUtil
- .globalize("com.arsdigita.london.contenttypes.ui.contact_deptname"),
- Contact.DEPT_NAME);
+ sheet.add(ContactGlobalizationUtil.globalize(
+ "com.arsdigita.london.contenttypes.ui.contact_deptname"),
+ Contact.DEPT_NAME);
- sheet.add(ContactGlobalizationUtil
- .globalize("com.arsdigita.london.contenttypes.ui.contact_role"),
- Contact.ROLE);
+ sheet.add(ContactGlobalizationUtil.globalize(
+ "com.arsdigita.london.contenttypes.ui.contact_role"),
+ Contact.ROLE);
return sheet;
}
diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertyForm.java b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertyForm.java
index c7e560851..9979a8a02 100755
--- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertyForm.java
+++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactPropertyForm.java
@@ -38,32 +38,37 @@ import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.util.GlobalizationUtil;
/**
- * Form to edit basic properties of Contact object. Used by
+ * Form to edit basic properties of
+ * Contact object. Used by
* ContactPropertiesStep authoring kit step.
- *
- * @author Shashin Shinde sshinde@redhat.com
+ *
+ * @author Shashin Shinde sshinde@redhat.com
* @version $Id: ContactPropertyForm.java 287 2005-02-22 00:29:02Z sskracic $
*/
public class ContactPropertyForm extends BasicPageForm {
- /** Name of this form */
- public static final String ID = "Contact_edit";
-
- /**
- * Creates a new form to edit the Contact object specified by the item
- * selection model passed in.
- *
- * @param itemModel
- * The ItemSelectionModel to use to obtain the Contact to work on
- */
- public ContactPropertyForm(ItemSelectionModel itemModel) {
- super(ID, itemModel);
- }
+ /**
+ * Name of this form
+ */
+ public static final String ID = "Contact_edit";
/**
- * Adds widgets to the form. This has been cut into small methods
- * so that subclasses can pick and choose.
+ * Creates a new form to edit the Contact object specified by the item
+ * selection model passed in.
+ *
+ * @param itemModel The ItemSelectionModel to use to obtain the Contact to
+ * work on
*/
+ public ContactPropertyForm(ItemSelectionModel itemModel) {
+ super(ID, itemModel);
+ }
+
+ /**
+ * Adds widgets to the form. This has been cut into small methods so that
+ * subclasses can pick and choose.
+ */
+ @Override
protected void addWidgets() {
addBasicPageFormWidgets();
addGivenNameWidget();
@@ -83,7 +88,7 @@ public class ContactPropertyForm extends BasicPageForm {
protected void addGivenNameWidget() {
add(new Label(ContactGlobalizationUtil.globalize(
- "london.contenttypes.ui.contact.givenname")));
+ "london.contenttypes.ui.contact.givenname")));
ParameterModel givenNameParam = new StringParameter(Contact.GIVEN_NAME);
TextField givenName = new TextField(givenNameParam);
add(givenName);
@@ -91,23 +96,23 @@ public class ContactPropertyForm extends BasicPageForm {
protected void addFamilyNameWidget() {
add(new Label(ContactGlobalizationUtil.globalize(
- "london.contenttypes.ui.contact.familyname")));
+ "london.contenttypes.ui.contact.familyname")));
ParameterModel familyNameParam = new StringParameter(Contact.FAMILY_NAME);
TextField familyName = new TextField(familyNameParam);
add(familyName);
}
-
+
protected void addSuffixWidget() {
add(new Label(ContactGlobalizationUtil.globalize(
- "london.contenttypes.ui.contact.suffix")));
+ "london.contenttypes.ui.contact.suffix")));
ParameterModel suffixParam = new StringParameter(Contact.SUFFIX);
TextField suffix = new TextField(suffixParam);
add(suffix);
}
-
+
protected void addContactTypeWidget() {
add(new Label(ContactGlobalizationUtil.globalize(
- "london.contenttypes.ui.contact.type")));
+ "london.contenttypes.ui.contact.type")));
ParameterModel contactTypeParam = new StringParameter(Contact.CONTACT_TYPE);
SingleSelect contactType = new SingleSelect(contactTypeParam);
add(contactType);
@@ -120,13 +125,13 @@ public class ContactPropertyForm extends BasicPageForm {
protected void addDescriptionWidget() {
add(new Label(GlobalizationUtil.globalize(
- "cms.contenttypes.ui.description")));
+ "cms.contenttypes.ui.description")));
ParameterModel descParam = new StringParameter(Contact.DESCRIPTION);
TextArea desc = new TextArea(descParam);
desc.setRows(5);
add(desc);
}
-
+
protected void addEmailsWidget() {
add(new Label(ContactGlobalizationUtil
.globalize("london.contenttypes.ui.contact.emails")));
@@ -134,7 +139,7 @@ public class ContactPropertyForm extends BasicPageForm {
TextField emails = new TextField(emailsParam);
add(emails);
}
-
+
protected void addOrganizationNameWidget() {
add(new Label(ContactGlobalizationUtil
.globalize("london.contenttypes.ui.contact.orgname")));
@@ -142,7 +147,7 @@ public class ContactPropertyForm extends BasicPageForm {
TextField orgName = new TextField(orgNameParam);
add(orgName);
}
-
+
protected void addDepartmentNameWidget() {
add(new Label(ContactGlobalizationUtil
.globalize("london.contenttypes.ui.contact.deptname")));
@@ -150,66 +155,66 @@ public class ContactPropertyForm extends BasicPageForm {
TextField deptName = new TextField(deptParam);
add(deptName);
}
-
+
protected void addRoleWidget() {
add(new Label(ContactGlobalizationUtil
.globalize("london.contenttypes.ui.contact.role")));
ParameterModel roleParam = new StringParameter(Contact.ROLE);
TextField role = new TextField(roleParam);
- add(role);
+ add(role);
}
- /**
- * Initialize Form values from Contact object.
- */
- public void init(FormSectionEvent fse) {
+ /**
+ * Initialize Form values from Contact object.
+ */
+ public void init(FormSectionEvent fse) {
- FormData data = fse.getFormData();
- Contact contact = (Contact) super.initBasicWidgets(fse);
+ FormData data = fse.getFormData();
+ Contact contact = (Contact) super.initBasicWidgets(fse);
- if (contact.getContactType() != null) {
- data.put(Contact.CONTACT_TYPE, contact.getContactType().getID());
+ if (contact.getContactType() != null) {
+ data.put(Contact.CONTACT_TYPE, contact.getContactType().getID());
+ }
+
+ data.put(Contact.GIVEN_NAME, contact.getGivenName());
+ data.put(Contact.FAMILY_NAME, contact.getFamilyName());
+ data.put(Contact.SUFFIX, contact.getSuffix());
+ data.put(Contact.EMAILS, contact.getEmails());
+ data.put(Contact.DESCRIPTION, contact.getDescription());
+ data.put(Contact.ORG_NAME, contact.getOrganisationName());
+ data.put(Contact.DEPT_NAME, contact.getDeptName());
+ data.put(Contact.ROLE, contact.getRole());
}
- data.put(Contact.GIVEN_NAME, contact.getGivenName());
- data.put(Contact.FAMILY_NAME, contact.getFamilyName());
- data.put(Contact.SUFFIX, contact.getSuffix());
- data.put(Contact.EMAILS, contact.getEmails());
- data.put(Contact.DESCRIPTION, contact.getDescription());
- data.put(Contact.ORG_NAME, contact.getOrganisationName());
- data.put(Contact.DEPT_NAME, contact.getDeptName());
- data.put(Contact.ROLE, contact.getRole());
- }
+ /**
+ * Process the form submission event.
+ */
+ public void process(FormSectionEvent fse) {
- /**
- * Process the form submission event.
- */
- public void process(FormSectionEvent fse) {
+ FormData data = fse.getFormData();
+ Contact contact = (Contact) super.processBasicWidgets(fse);
- FormData data = fse.getFormData();
- Contact contact = (Contact) super.processBasicWidgets(fse);
+ // save only if save button was pressed
+ if (contact != null
+ && getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
- // save only if save button was pressed
- if (contact != null
- && getSaveCancelSection().getSaveButton().isSelected(fse.getPageState())) {
+ contact.setGivenName((String) data.get(Contact.GIVEN_NAME));
+ contact.setFamilyName((String) data.get(Contact.FAMILY_NAME));
+ contact.setSuffix((String) data.get(Contact.SUFFIX));
+ contact.setEmails((String) data.get(Contact.EMAILS));
+ String contactTypeIDStr = (String) data.get(Contact.CONTACT_TYPE);
+ if (contactTypeIDStr != null) {
+ BigDecimal contactTypeID =
+ new BigDecimal(contactTypeIDStr);
+ ContactType ctType = new ContactType(contactTypeID);
+ contact.setContactType(ctType);
+ }
- contact.setGivenName((String) data.get(Contact.GIVEN_NAME));
- contact.setFamilyName((String) data.get(Contact.FAMILY_NAME));
- contact.setSuffix((String) data.get(Contact.SUFFIX));
- contact.setEmails((String) data.get(Contact.EMAILS));
- String contactTypeIDStr = (String) data.get(Contact.CONTACT_TYPE);
- if (contactTypeIDStr != null) {
- BigDecimal contactTypeID =
- new BigDecimal(contactTypeIDStr);
- ContactType ctType = new ContactType(contactTypeID);
- contact.setContactType(ctType);
- }
-
- contact.setDescription((String) data.get(Contact.DESCRIPTION));
- contact.setOrganisationName((String) data.get(Contact.ORG_NAME));
- contact.setDeptName((String) data.get(Contact.DEPT_NAME));
- contact.setRole((String) data.get(Contact.ROLE));
- contact.save();
+ contact.setDescription((String) data.get(Contact.DESCRIPTION));
+ contact.setOrganisationName((String) data.get(Contact.ORG_NAME));
+ contact.setDeptName((String) data.get(Contact.DEPT_NAME));
+ contact.setRole((String) data.get(Contact.ROLE));
+ contact.save();
+ }
}
- }
}
diff --git a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactToItemAddForm.java b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactToItemAddForm.java
index ea1cd3343..9ff21b255 100644
--- a/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactToItemAddForm.java
+++ b/ccm-ldn-types-contact/src/com/arsdigita/london/contenttypes/ui/ContactToItemAddForm.java
@@ -21,6 +21,7 @@ import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.london.contenttypes.Contact;
import com.arsdigita.cms.ui.ItemSearchWidget;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
+import com.arsdigita.london.contenttypes.util.ContactGlobalizationUtil;
public class ContactToItemAddForm extends FormSection implements
FormInitListener, FormValidationListener, FormProcessListener,
@@ -44,8 +45,8 @@ public class ContactToItemAddForm extends FormSection implements
private AuthoringKitWizard m_parent;
- private Label m_removeLinkText = new Label(GlobalizationUtil
- .globalize("Remove contact"));
+ private Label m_removeLinkText = new Label(ContactGlobalizationUtil
+ .globalize("london.contenttypes.ui.contact.remove_contact"));
private ActionLink m_removeLink;
@@ -87,10 +88,11 @@ public class ContactToItemAddForm extends FormSection implements
add(m_removeLink, ColumnPanel.FULL_WIDTH);
- m_searchFormLabel = new Label("Search for Contact:");
+ m_searchFormLabel = new Label(ContactGlobalizationUtil.globalize(
+ "london.contenttypes.ui.contact.search_contact_label"));
add(m_searchFormLabel);
m_itemSearch = new ItemSearchWidget(CONTACT_SEARCH,
- Contact.BASE_DATA_OBJECT_TYPE);
+ Contact.BASE_DATA_OBJECT_TYPE);
add(m_itemSearch);
}
@@ -101,7 +103,9 @@ public class ContactToItemAddForm extends FormSection implements
/** Adds the saveCancelSection */
public void addSaveCancelSection() {
m_saveCancelSection = new SaveCancelSection();
- m_saveCancelSection.getSaveButton().setButtonLabel("Add");
+ m_saveCancelSection.getSaveButton()
+ .setButtonLabel(ContactGlobalizationUtil.globalize(
+ "london.contenttypes.ui.contact.add_contact"));
add(m_saveCancelSection, ColumnPanel.FULL_WIDTH);
}