From: <pb...@fe...> - 2013-01-07 22:07:04
|
Author: pboy Date: 2013-01-07 22:06:54 +0000 (Mon, 07 Jan 2013) New Revision: 2452 Added: contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormResources.properties contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormResources_de.properties contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormResources_en.properties contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/util/ contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/util/EFormGlobalizedMsg.java contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/util/EFormResourceBundle.java contrib/camden/ccm-lbc-eforms/src/com/arsdigita/cms/ Modified: contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EForm.java contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormLoader.java contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertiesStep.java contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertyForm.java Log: Migration to version 2.0 basically done, smoke test successful. Modified: contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EForm.java =================================================================== --- contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EForm.java 2013-01-06 15:54:16 UTC (rev 2451) +++ contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EForm.java 2013-01-07 22:06:54 UTC (rev 2452) @@ -18,11 +18,11 @@ */ package com.arsdigita.camden.cms.contenttypes; +import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentType; -import com.arsdigita.cms.ContentPage; import com.arsdigita.domain.DataObjectNotFoundException; +import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.OID; -import com.arsdigita.persistence.DataObject; import java.math.BigDecimal; @@ -66,27 +66,47 @@ } } + /** + * Constructor. + * @param id + * @throws DataObjectNotFoundException + */ public EForm( BigDecimal id ) throws DataObjectNotFoundException { this( new OID( BASE_DATA_OBJECT_TYPE, id ) ); } + /** + * Constructor. + * @param id + * @throws DataObjectNotFoundException + */ public EForm( OID id ) throws DataObjectNotFoundException { super( id ); } + /** + * Constructor + * @param obj + */ public EForm( DataObject obj ) { super( obj ); } + /** + * Constructor. + * @param type + */ public EForm( String type ) { super( type ); } /** - * TODO: Add documentation! + * Retrieve the target URL for this e-Form object. + * + * TODO: Add detailed documentation! * @return */ public String getURL() { @@ -94,7 +114,8 @@ } /** - * TODO: Add documentation! + * Set the target URL for this e-Form object. + * TODO: Add detaileddocumentation! * @return */ public void setURL( String url ) { @@ -102,7 +123,9 @@ } /** - * TODO: Add documentation! + * Retrieve the description for this e-Form object. + * + * TODO: Add detailed documentation! * @return */ @Override @@ -111,7 +134,9 @@ } /** - * TODO: Add documentation! + * Set the description for this e-Form object. + * + * TODO: Add detailed documentation! * @return */ @Override Modified: contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormLoader.java =================================================================== --- contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormLoader.java 2013-01-06 15:54:16 UTC (rev 2451) +++ contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormLoader.java 2013-01-07 22:06:54 UTC (rev 2452) @@ -16,41 +16,44 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ + package com.arsdigita.camden.cms.contenttypes; import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.contenttypes.AbstractContentTypeLoader; import com.arsdigita.cms.lifecycle.LifecycleDefinition; -import com.arsdigita.util.UncheckedWrapperException; import com.arsdigita.util.parameter.Parameter; import com.arsdigita.util.parameter.ResourceParameter; -import com.arsdigita.util.parameter.URLParameter; import com.arsdigita.workflow.simple.WorkflowTemplate; import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; /** - * Loads the database after the e-Form content type data model has been - * created. + * Loader executes nonrecurring once at install time and loads the e-Form + * contenttype package persistently into database. * - * Executes nonrecurring at install time and loads (installs and initializes) - * the ccm-lbc-eforms package persistently into database. + * It uses the base class to create the database schema and the required + * table entries for the contenttype. + * + * NOTE: Configuration parameters used at load time MUST be part of Loader + * class and can not delegated to a Config object (derived from AbstractConfig). + * They will (and can) not be persisted into an registry object (file). * * @author Alan Pevec * @version $Id$ */ public class EFormLoader extends AbstractContentTypeLoader { + /** Defines the xml file containing the EForm content types property + * definitions. */ private static final String[] TYPES = { "/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/EForm.xml" }; - // URL resource parameter removed! - // private URLParameter m_template; - /** Create parameter for... */ + /** + * Configures a special default template to register at install time. + */ private final Parameter m_template = new ResourceParameter( "com.arsdigita.camden.cms.contenttypes.eform.defaulttemplate", Parameter.REQUIRED, @@ -58,30 +61,30 @@ ); /** - * Constructor + * Constructor, just registers Loader parameter. */ public EFormLoader() { -/* URL resource protocol removed. See cms.CMSConfig for details. - try { - m_template = new URLParameter - ("com.arsdigita.camden.cms.contenttypes.eform.defaulttemplate", - Parameter.REQUIRED, - new URL(null, - "resource:///WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes" + - "/eform-item.jsp")); - } catch (MalformedURLException ex) { - throw new UncheckedWrapperException("cannot parse url", ex); - } -*/ register(m_template); + } + /** + * Provides the of EForm contenttype property definitions. + * + * The file defines the types name as displayed in content center + * select box and the authoring steps. These are loaded into database. + * + * Implements the method of the parent class. + * + * @return String array of fully qualified file names + */ public String[] getTypes() { return TYPES; } /** + * Overwrites base class to register its own specific default template. * * @param section * @param type @@ -97,7 +100,6 @@ setDefaultTemplate("EFormDefaultTemplate", "eform-item", - // (URL)get(m_template), (InputStream) get(m_template), section, type,ld, wf); Added: contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormResources.properties =================================================================== --- contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormResources.properties (rev 0) +++ contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormResources.properties 2013-01-07 22:06:54 UTC (rev 2452) @@ -0,0 +1,9 @@ +# EventResources.properties +# +eform.authoring.basic_properties.description=Edit the title, name, location (URL), and description +# +camden.cms.contenttypes.eform.name=Name (URL): +camden.cms.contenttypes.eform.title=Title: +# +camden.cms.contenttypes.eform.description=Form description: +camden.cms.contenttypes.eform.location=Location (remote URL): Added: contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormResources_de.properties =================================================================== --- contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormResources_de.properties (rev 0) +++ contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormResources_de.properties 2013-01-07 22:06:54 UTC (rev 2452) @@ -0,0 +1,11 @@ +# EventResources_de.properties +# Alle deutschem Umlaute muessen als UTF-8 eingetragen werden: +eform.authoring.basic_properties.description=Bearbeitung des Titels, Namens, Ort (URL) und Beschreibung +# +# useless here, must be transferred to CMSResources +# +camden.cms.contenttypes.eform.name=Name (URL): +camden.cms.contenttypes.eform.title=Titel: +# +camden.cms.contenttypes.eform.description=Formularbeschreibung: +camden.cms.contenttypes.eform.location=Ort (Ziel URL): Added: contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormResources_en.properties =================================================================== --- contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormResources_en.properties (rev 0) +++ contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/EFormResources_en.properties 2013-01-07 22:06:54 UTC (rev 2452) @@ -0,0 +1,9 @@ +# EventResources.properties +# +eform.authoring.basic_properties.description=Edit the title, name, location (URL), and description +# +camden.cms.contenttypes.eform.name=Name (URL): +camden.cms.contenttypes.eform.title=Title: +# +camden.cms.contenttypes.eform.description=Additional date description: +camden.cms.contenttypes.eform.location=Location (remote URL): Modified: contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertiesStep.java =================================================================== --- contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertiesStep.java 2013-01-06 15:54:16 UTC (rev 2451) +++ contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertiesStep.java 2013-01-07 22:06:54 UTC (rev 2452) @@ -20,6 +20,7 @@ import com.arsdigita.bebop.Component; import com.arsdigita.camden.cms.contenttypes.EForm; +import com.arsdigita.camden.cms.contenttypes.util.EFormGlobalizedMsg; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.BasicPageForm; @@ -29,17 +30,22 @@ /** - * Authoring step to edit the simple attributes of the EForm content + * Authoring step to view/edit the simple attributes of the EForm content * type (and its subclasses). */ -public class EFormPropertiesStep - extends SimpleEditStep { +public class EFormPropertiesStep extends SimpleEditStep { /** The name of the editing sheet added to this step */ public static final String EDIT_SHEET_NAME = "edit"; + /** + * Constructor. + * + * @param itemModel + * @param parent + */ public EFormPropertiesStep( ItemSelectionModel itemModel, - AuthoringKitWizard parent ) { + AuthoringKitWizard parent ) { super( itemModel, parent ); BasicPageForm editSheet; @@ -54,7 +60,8 @@ /** * Returns a component that displays the properties of the - * EForm specified by the ItemSelectionModel passed in. + * EForm content item specified by the ItemSelectionModel passed in. + * * @param itemModel The ItemSelectionModel to use * @pre itemModel != null * @return A component to display the state of the basic properties @@ -63,14 +70,14 @@ * Method add deprecated, use add(GlobalizedMessage label, String attribute) * instead (but probably Camden doesn't use globalized strings). */ - public static Component getEFormPropertySheet( ItemSelectionModel - itemModel ) { + public static Component getEFormPropertySheet(ItemSelectionModel itemModel ) { + DomainObjectPropertySheet sheet = new DomainObjectPropertySheet( itemModel ); - sheet.add( "Name:", EForm.NAME ); - sheet.add( "Title:", EForm.TITLE ); - sheet.add( "URL:", EForm.URL ); - sheet.add( "Description:", EForm.DESCRIPTION ); + sheet.add( EFormGlobalizedMsg.getName(), EForm.NAME ); + sheet.add( EFormGlobalizedMsg.getTitle(), EForm.TITLE ); + sheet.add( EFormGlobalizedMsg.getLocation(), EForm.URL ); + sheet.add( EFormGlobalizedMsg.getDescription(), EForm.DESCRIPTION ); return sheet; } Modified: contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertyForm.java =================================================================== --- contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertyForm.java 2013-01-06 15:54:16 UTC (rev 2451) +++ contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/ui/EFormPropertyForm.java 2013-01-07 22:06:54 UTC (rev 2452) @@ -26,43 +26,59 @@ import com.arsdigita.bebop.form.TextArea; import com.arsdigita.bebop.form.TextField; import com.arsdigita.camden.cms.contenttypes.EForm; +// import com.arsdigita.camden.cms.contenttypes.util.EFormGlobalizationUtil; +import com.arsdigita.camden.cms.contenttypes.util.EFormGlobalizedMsg; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ui.authoring.BasicPageForm; /** - * Form to edit the basic properties of an EForm. This form can be - * extended to create forms for EForm subclasses. + * Form to edit the basic properties of an EForm. + * + * Used by <code>EFormPropertiesStep</code> authoring kit step. + * <br /> + * This form can be extended to create forms for EForm subclasses. */ public class EFormPropertyForm extends BasicPageForm implements FormProcessListener, FormInitListener { + /** Name of this form */ + public static final String ID = "eform_edit"; // formerly "eFormEdit" + private TextField m_url; private TextArea m_description; /** * Creates a new form to edit the EForm object specified * by the item selection model passed in. + * * @param itemModel The ItemSelectionModel to use to obtain the * EForm to work on */ public EFormPropertyForm(ItemSelectionModel itemModel) { - super("eFormEdit", itemModel); + super(ID, itemModel); } /** - * Adds widgets to the form. + * Adds widgets to the forms basic properties (name and title). */ @Override protected void addWidgets() { super.addWidgets(); - add(new Label("URL:")); + add(new Label(EFormGlobalizedMsg.getLocation()) ); + // add(new Label( + // (String) EFormGlobalizationUtil + // .globalize("camden.cms.contenttypes.eform.location").localize()) + // ); m_url = new TextField(EForm.URL); m_url.setSize(40); add(m_url); - add(new Label("Description:")); + add(new Label(EFormGlobalizedMsg.getDescription()) ); + // (String) EFormGlobalizationUtil + // .globalize("camden.cms.contenttypes.eform.description").localize()) + // ); m_description = new TextArea(EForm.DESCRIPTION, 5, 40, TextArea.SOFT); add(m_description); } Added: contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/util/EFormGlobalizedMsg.java =================================================================== --- contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/util/EFormGlobalizedMsg.java (rev 0) +++ contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/util/EFormGlobalizedMsg.java 2013-01-07 22:06:54 UTC (rev 2452) @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2013 University of Bremen. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +package com.arsdigita.camden.cms.contenttypes.util; + +import com.arsdigita.globalization.GlobalizedMessage; + +/** + * Provides simplified methods to acquire a GlobalizedMessage object + * for EForm's labels, strings and other messages. + * + * @author pb + */ +public class EFormGlobalizedMsg { + + /** Name of the Java class to handle Event's globalisation. */ + final public static String BUNDLE_NAME = + "com.arsdigita.camden.cms.contenttypes.util.EFormResourceBundle"; + + /** + * This returns a localized globalized message for the NAME entry field + * using the type specific bundle, BUNDLE_NAME + */ + public static GlobalizedMessage getTitle() { + return new GlobalizedMessage( + "camden.cms.contenttypes.eform.title", + BUNDLE_NAME); + } + + /** + * This returns a localized globalized message for the NAME entry field + * using the type specific bundle, BUNDLE_NAME + */ + public static GlobalizedMessage getLocation() { + return new GlobalizedMessage( + "camden.cms.contenttypes.eform.location", + BUNDLE_NAME); + } + + /** + * This returns a localized globalized message for the NAME entry field + * using the type specific bundle, BUNDLE_NAME + */ + public static GlobalizedMessage getDescription() { + return new GlobalizedMessage( + "camden.cms.contenttypes.eform.description", + BUNDLE_NAME); + } + + /** + * This returns a localized globalized message for the NAME entry field + * using the type specific bundle, BUNDLE_NAME + */ + public static GlobalizedMessage getName() { + return new GlobalizedMessage( + "camden.cms.contenttypes.eform.name", + BUNDLE_NAME); + } + + /** + * This returns a localized globalized message based on its key and using + * the type specific bundle, BUNDLE_NAME + */ + public static GlobalizedMessage get(String key) { + + return new GlobalizedMessage(key, BUNDLE_NAME); + + } + + +} Added: contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/util/EFormResourceBundle.java =================================================================== --- contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/util/EFormResourceBundle.java (rev 0) +++ contrib/camden/ccm-lbc-eforms/src/com/arsdigita/camden/cms/contenttypes/util/EFormResourceBundle.java 2013-01-07 22:06:54 UTC (rev 2452) @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2004 Red Hat Inc. All Rights Reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ +package com.arsdigita.camden.cms.contenttypes.util; + +import com.arsdigita.cms.CMSGlobalized; +import com.arsdigita.globalization.ChainedResourceBundle; + +import java.util.PropertyResourceBundle; + +/** + * Resource Bundle used in UI for Event ContentType. + * + * @author Shashin Shinde (ss...@re...) + */ +public class EFormResourceBundle extends ChainedResourceBundle + implements CMSGlobalized { + + public final static String EVENT_BUNDLE_NAME = + "com.arsdigita.camden.cms.contenttypes.EFormResources"; + + public EFormResourceBundle() { + super(); + addBundle((PropertyResourceBundle)getBundle(EVENT_BUNDLE_NAME)); + addBundle((PropertyResourceBundle)getBundle(BUNDLE_NAME)); + } +} |