[FEATURE]

EFormGlobalizedMsg.java durch eine ExternalLinkGlobalizationUtil.java ersetzt um den vernünftigen Zugriff auf die ExternalLinkResources.properties zu ermöglichen.

[UPDATE]
In dem Paket ccm-cms-types-externallink überall wo EForm auftauchte durch ExternalLink ersetzt. 

git-svn-id: https://svn.libreccm.org/ccm/trunk@3261 8810af33-2d31-482b-a856-94f89814c4df
master
tosmers 2015-02-22 18:30:37 +00:00
parent 56d730bd68
commit 84bb57926c
15 changed files with 216 additions and 133 deletions

View File

@ -15,7 +15,7 @@
// License along with this library; if not, write to the Free Software // License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// //
// $Id: EForm.pdl 1494 2007-03-19 14:58:34Z apevec $ // $Id: ExternalLink.pdl 1494 2007-03-19 14:58:34Z apevec $
model com.arsdigita.cms.contenttypes; model com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentPage;

View File

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd"> <ctd:content-types xmlns:ctd="http://xmlns.redhat.com/cms/content-types"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
<ctd:content-type label="URL Redirect" <ctd:content-type label="URL Redirect"
description="An item representing an external web application" description="An item representing an external web application"

View File

@ -1,9 +0,0 @@
# 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):

View File

@ -1,11 +0,0 @@
# 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):

View File

@ -1,9 +0,0 @@
# 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):

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005 Red Hat Inc. All Rights Reserved. * Copyright (C) 2015 University of Bremen. All Rights Reserved.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.camden.cms.contenttypes; package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentPage; import com.arsdigita.cms.ContentPage;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
@ -28,14 +28,15 @@ import java.math.BigDecimal;
/** /**
* This content type represents an redirect to an external form or an other resource identified by * This content type represents an redirect to an external link or an
* an URL. * other resource identified by an URL.
* *
* The item stores a description text about the form/resource and an URL. * The item stores a description text about the link/resource and an URL.
* *
* @version $Id: EForm.java 2570 2013-11-19 12:49:34Z jensp $ * @author tosmers
* @version $Revision: #1 $ $Date: 2015/02/22 $
*/ */
public class EForm extends ContentPage { public class ExternalLink extends ContentPage {
/** /**
* PDL property name for definition * PDL property name for definition
@ -47,67 +48,68 @@ public class EForm extends ContentPage {
* Data object type for this domain object * Data object type for this domain object
*/ */
public static final String BASE_DATA_OBJECT_TYPE public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.camden.cms.contenttypes.EForm"; = "com.arsdigita.cms.contenttypes.ExternalLink";
/** /**
* Data object type for this domain object (for CMS compatibility) * Data object type for this domain object (for CMS compatibility)
*/ */
public static final String TYPE = BASE_DATA_OBJECT_TYPE; public static final String TYPE = BASE_DATA_OBJECT_TYPE;
/** /**
* Default Constructor. Creates a new eForm item. * Default Constructor. Creates a new ExternalLink item.
*/ */
public EForm() { public ExternalLink() {
this(BASE_DATA_OBJECT_TYPE); this(BASE_DATA_OBJECT_TYPE);
try { try {
setContentType(ContentType.findByAssociatedObjectType(BASE_DATA_OBJECT_TYPE)); setContentType(ContentType.findByAssociatedObjectType(BASE_DATA_OBJECT_TYPE));
} catch (DataObjectNotFoundException ex) { } catch (DataObjectNotFoundException ex) {
throw new UncheckedWrapperException("EForm type not registered", ex); throw new UncheckedWrapperException("ExternalLink type not registered", ex);
} }
} }
/** /**
* Creates an eForm object for an item in the database. * Creates an ExternalLink object for an item in the database.
* *
* @param id The id of the eForm to retrieve from the database. * @param id The id of the ExternalLink to retrieve from the database.
* *
* @throws DataObjectNotFoundException * @throws DataObjectNotFoundException
*/ */
public EForm(final BigDecimal id) throws DataObjectNotFoundException { public ExternalLink(final BigDecimal id) throws DataObjectNotFoundException {
this(new OID(BASE_DATA_OBJECT_TYPE, id)); this(new OID(BASE_DATA_OBJECT_TYPE, id));
} }
/** /**
* Creates an eForm object for an item in the database. * Creates an ExternalLink object for an item in the database.
* *
* @param oid The {@link OID} of the item to retrieve from the database. * @param oid The {@link OID} of the item to retrieve from the database.
* *
* @throws DataObjectNotFoundException * @throws DataObjectNotFoundException
*/ */
public EForm(final OID oid) public ExternalLink(final OID oid)
throws DataObjectNotFoundException { throws DataObjectNotFoundException {
super(oid); super(oid);
} }
/** /**
* Wraps an {@link DataObject} into an {@code EForm} domain object. * Wraps an {@link DataObject} into an {@code ExternalLink} domain object.
* *
* @param obj * @param obj The {@link DataObject} to be wrapped.
*/ */
public EForm(final DataObject obj) { public ExternalLink(final DataObject obj) {
super(obj); super(obj);
} }
/** /**
* Creates a new domain object for an subtype of EForm. * Creates a new domain object for an subtype of ExternalLink.
* *
* @param type * @param type The subtype for witch a new domain object will be created.
*/ */
public EForm(final String type) { public ExternalLink(final String type) {
super(type); super(type);
} }
/** /**
* Retrieve the target URL for this e-Form object. * Retrieve the target URL for this ExternalLink object.
* *
* @return The URL to redirect to. * @return The URL to redirect to.
*/ */
@ -116,9 +118,9 @@ public class EForm extends ContentPage {
} }
/** /**
* Set the target URL for this e-Form object. * Set the target URL for this ExternalLink object.
* *
* @return * @param url The URL to redirect to.
*/ */
public void setURL(final String url) { public void setURL(final String url) {
set(URL, url); set(URL, url);
@ -126,9 +128,8 @@ public class EForm extends ContentPage {
/** /**
* Retrieve the description for the resource the URL is pointing to. * Retrieve the description for the resource the URL is pointing to.
*
* *
* @return Description about the URL this EForm is redirecting to. * @return Description about the URL this ExternalLink is redirecting to.
*/ */
@Override @Override
public String getDescription() { public String getDescription() {
@ -136,8 +137,10 @@ public class EForm extends ContentPage {
} }
/** /**
* Set the description for this e-Form object. * Set the description for the resource the URL is pointing to.
* *
* @param description The description about the URL this ExternalLink
* is redirecting to.
*/ */
@Override @Override
public void setDescription(final String description) { public void setDescription(final String description) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005 Red Hat Inc. All Rights Reserved. * Copyright (C) 2015 University of Bremen. All Rights Reserved.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -16,12 +16,12 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.camden.cms.contenttypes; package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.contenttypes.ContentTypeInitializer; import com.arsdigita.cms.contenttypes.ContentTypeInitializer;
/** /**
* Runtime initialization for the eForm content type, executes at each * Runtime initialization for the ExternalLink content type, executes at each
* system startup. * system startup.
* *
* Just uses the super class methods. * Just uses the super class methods.
@ -29,17 +29,17 @@ import com.arsdigita.cms.contenttypes.ContentTypeInitializer;
* This is done by runtimeRuntime startup method which runs the init() methods * This is done by runtimeRuntime startup method which runs the init() methods
* of all initializers (this one just using the parent implementation). * of all initializers (this one just using the parent implementation).
* *
* @author Alan Pevec * @author tosmers
* @version $Id: EFormInitializer.java 2570 2013-11-19 12:49:34Z jensp $ * @version $Revision: #1 $ $Date: 2015/02/22 $
*/ */
public class EFormInitializer extends ContentTypeInitializer { public class ExternalLinkInitializer extends ContentTypeInitializer {
/** /**
* Constructor, just sets the PDL manifest file and object type string. * Constructor, just sets the PDL manifest file and object type string.
*/ */
public EFormInitializer() { public ExternalLinkInitializer() {
super("ccm-lbc-eforms.pdl.mf", super("ccm-cms-types-externallink.pdl.mf",
EForm.BASE_DATA_OBJECT_TYPE); ExternalLink.BASE_DATA_OBJECT_TYPE);
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005 Red Hat Inc. All Rights Reserved. * Copyright (C) 2015 University of Bremen. All Rights Reserved.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.camden.cms.contenttypes; package com.arsdigita.cms.contenttypes;
import com.arsdigita.cms.ContentSection; import com.arsdigita.cms.ContentSection;
import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ContentType;
@ -28,48 +28,50 @@ import com.arsdigita.workflow.simple.WorkflowTemplate;
import java.io.InputStream; import java.io.InputStream;
/** /**
* Loader executes nonrecurring once at install time and loads the e-Form contenttype package * Loader executes nonrecurring once at install time and loads the
* persistently into database. * ExternalLink contenttype package persistently into database.
* *
* It uses the base class to create the database schema and the required table entries for the * It uses the base class to create the database schema and the required
* contenttype. * table entries for the contenttype.
* *
* NOTE: Configuration parameters used at load time MUST be part of Loader class and can not * NOTE: Configuration parameters used at load time MUST be part of
* delegated to a Config object (derived from AbstractConfig). They will (and can) not be persisted * Loader class and can not delegated to a Config object (derived
* into an registry object (file). * from AbstractConfig). They will (and can) not be persisted into
* an registry object (file).
* *
* @author Alan Pevec * @author tosmers
* @version $Id: EFormLoader.java 2570 2013-11-19 12:49:34Z jensp $ * @version $Revision: #1 $ $Date: 2015/02/22 $
*/ */
public class EFormLoader extends AbstractContentTypeLoader { public class ExternalLinkLoader extends AbstractContentTypeLoader {
/** /**
* Defines the xml file containing the EForm content types property definitions. * Defines the xml file containing the ExternalLink content types
* property definitions.
*/ */
private static final String[] TYPES = { private static final String[] TYPES = {
"/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/EForm.xml" "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/ExternalLink.xml"
}; };
/** /**
* Configures a special default template to register at install time. * Configures a special default template to register at install time.
*/ */
private final Parameter m_template = new ResourceParameter( private final Parameter m_template = new ResourceParameter(
"com.arsdigita.camden.cms.contenttypes.eform.defaulttemplate", "com.arsdigita.cms.contenttypes.externallink.defaulttemplate",
Parameter.REQUIRED, Parameter.REQUIRED,
"/WEB-INF/content-types/com/arsdigita/camden/cms/contenttypes/eform-item.jsp"); "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/externallink-item.jsp");
/** /**
* Constructor, just registers Loader parameter. * Constructor, just registers Loader parameter.
*/ */
public EFormLoader() { public ExternalLinkLoader() {
register(m_template); register(m_template);
} }
/** /**
* Provides the of EForm contenttype property definitions. * Provides the of ExternalLink contenttype property definitions.
* *
* The file defines the types name as displayed in content center select box and the authoring * The file defines the types name as displayed in content center
* steps. These are loaded into database. * select box and the authoring steps. These are loaded into database.
* *
* Implements the method of the parent class. * Implements the method of the parent class.
* *
@ -95,8 +97,8 @@ public class EFormLoader extends AbstractContentTypeLoader {
final WorkflowTemplate wf) { final WorkflowTemplate wf) {
super.prepareSection(section, type, ld, wf); super.prepareSection(section, type, ld, wf);
setDefaultTemplate("EFormDefaultTemplate", setDefaultTemplate("ExternalLinkDefaultTemplate",
"eform-item", "externallink-item",
(InputStream) get(m_template), (InputStream) get(m_template),
section, type, ld, wf); section, type, ld, wf);

View File

@ -0,0 +1,7 @@
# ExternalLinkResources.properties
cms.contenttypes.ui.edit=Edit
cms.contenttypes.ExternalLink.name=Name (URL):
cms.contenttypes.ExternalLink.title=Title:
cms.contenttypes.ExternalLink.location=Location (remote URL):
cms.contenttypes.ExternalLink.description=ExternalLink description:

View File

@ -0,0 +1,7 @@
# ExternalLinkResources_de.properties
cms.contenttypes.ui.edit=Bearbeiten
cms.contenttypes.ExternalLink.name=Name (URL):
cms.contenttypes.ExternalLink.title=Titel:
cms.contenttypes.ExternalLink.location=Ort (Ziel URL):
cms.contenttypes.ExternalLink.description=Beschreibung des externen Links:

View File

@ -0,0 +1,7 @@
# ExternalLinkResources_en.properties
cms.contenttypes.ui.edit=Edit
cms.contenttypes.ExternalLink.name=Name (URL):
cms.contenttypes.ExternalLink.title=Title:
cms.contenttypes.ExternalLink.location=Location (remote URL):
cms.contenttypes.ExternalLink.description=ExternalLink description:

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005 Red Hat Inc. All Rights Reserved. * Copyright (C) 2015 University of Bremen. All Rights Reserved.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -16,23 +16,27 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.camden.cms.contenttypes.ui; package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Component; import com.arsdigita.bebop.Component;
import com.arsdigita.camden.cms.contenttypes.EForm; import com.arsdigita.cms.contenttypes.ExternalLink;
import com.arsdigita.camden.cms.contenttypes.util.EFormGlobalizedMsg; import com.arsdigita.cms.contenttypes.util.ExternalLinkGlobalizationUtil;
import com.arsdigita.cms.contenttypes.ui.ExternalLinkPropertyForm;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.BasicPageForm;
import com.arsdigita.cms.ui.authoring.SimpleEditStep; import com.arsdigita.cms.ui.authoring.SimpleEditStep;
import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
import com.arsdigita.cms.util.GlobalizationUtil;
import com.arsdigita.toolbox.ui.DomainObjectPropertySheet; import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
/** /**
* Authoring step to view/edit the simple attributes of the EForm content type (and its subclasses). * Authoring step to view/edit the simple attributes of the
* ExternalLink content type (and its subclasses).
*
* @author tosmers
* @version $Revision: #1 $ $Date: 2015/02/22 $
*/ */
public class EFormPropertiesStep extends SimpleEditStep { public class ExternalLinkPropertiesStep extends SimpleEditStep {
/** /**
* The name of the editing sheet added to this step * The name of the editing sheet added to this step
@ -45,22 +49,22 @@ public class EFormPropertiesStep extends SimpleEditStep {
* @param itemModel * @param itemModel
* @param parent * @param parent
*/ */
public EFormPropertiesStep(final ItemSelectionModel itemModel, public ExternalLinkPropertiesStep(final ItemSelectionModel itemModel,
final AuthoringKitWizard parent) { final AuthoringKitWizard parent) {
super(itemModel, parent); super(itemModel, parent);
final BasicPageForm editSheet = new EFormPropertyForm(itemModel); final BasicPageForm editSheet = new ExternalLinkPropertyForm(itemModel);
add(EDIT_SHEET_NAME, add(EDIT_SHEET_NAME,
GlobalizationUtil.globalize("cms.ui.edit"), ExternalLinkGlobalizationUtil.globalize("cms.contenttypes.ui.edit"),
new WorkflowLockedComponentAccess(editSheet, itemModel), new WorkflowLockedComponentAccess(editSheet, itemModel),
editSheet.getSaveCancelSection().getCancelButton()); editSheet.getSaveCancelSection().getCancelButton());
setDisplayComponent(getEFormPropertySheet(itemModel)); setDisplayComponent(getExternalLinkPropertySheet(itemModel));
} }
/** /**
* Returns a component that displays the properties of the EForm content item specified by the * Returns a component that displays the properties of the ExternalLink
* ItemSelectionModel passed in. * content item specified by the ItemSelectionModel passed in.
* *
* @param itemModel The ItemSelectionModel to use * @param itemModel The ItemSelectionModel to use
* *
@ -70,16 +74,19 @@ public class EFormPropertiesStep extends SimpleEditStep {
* Method add deprecated, use add(GlobalizedMessage label, String attribute) instead (but * Method add deprecated, use add(GlobalizedMessage label, String attribute) instead (but
* probably Camden doesn't use globalized strings). * probably Camden doesn't use globalized strings).
*/ */
public static Component getEFormPropertySheet(final ItemSelectionModel itemModel) { public static Component getExternalLinkPropertySheet(final ItemSelectionModel itemModel) {
final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel); final DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(itemModel);
sheet.add(EFormGlobalizedMsg.getName(), EForm.NAME); sheet.add(ExternalLinkGlobalizationUtil.globalize(
sheet.add(EFormGlobalizedMsg.getTitle(), EForm.TITLE); "cms.contenttypes.ExternalLink.name"), ExternalLink.NAME);
sheet.add(EFormGlobalizedMsg.getLocation(), EForm.URL); sheet.add(ExternalLinkGlobalizationUtil.globalize(
sheet.add(EFormGlobalizedMsg.getDescription(), EForm.DESCRIPTION); "cms.contenttypes.ExternalLink.title"), ExternalLink.TITLE);
sheet.add(ExternalLinkGlobalizationUtil.globalize(
"cms.contenttypes.ExternalLink.location"), ExternalLink.URL);
sheet.add(ExternalLinkGlobalizationUtil.globalize(
"cms.contenttypes.ExternalLink.description"), ExternalLink.DESCRIPTION);
return sheet; return sheet;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2005 Red Hat Inc. All Rights Reserved. * Copyright (C) 2015 University of Bremen. All Rights Reserved.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
@ -16,7 +16,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
*/ */
package com.arsdigita.camden.cms.contenttypes.ui; package com.arsdigita.cms.contenttypes.ui;
import com.arsdigita.bebop.Label; import com.arsdigita.bebop.Label;
import com.arsdigita.bebop.PageState; import com.arsdigita.bebop.PageState;
@ -25,35 +25,41 @@ import com.arsdigita.bebop.event.FormProcessListener;
import com.arsdigita.bebop.event.FormSectionEvent; import com.arsdigita.bebop.event.FormSectionEvent;
import com.arsdigita.bebop.form.TextArea; import com.arsdigita.bebop.form.TextArea;
import com.arsdigita.bebop.form.TextField; import com.arsdigita.bebop.form.TextField;
import com.arsdigita.camden.cms.contenttypes.EForm; import com.arsdigita.cms.contenttypes.ExternalLink;
import com.arsdigita.camden.cms.contenttypes.util.EFormGlobalizedMsg; import com.arsdigita.cms.contenttypes.util.ExternalLinkGlobalizationUtil;
import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ItemSelectionModel;
import com.arsdigita.cms.ui.authoring.BasicPageForm; import com.arsdigita.cms.ui.authoring.BasicPageForm;
/** /**
* Form to edit the basic properties of an EForm. * Form to edit the basic properties of an ExternalLink.
* *
* Used by <code>EFormPropertiesStep</code> authoring kit step. * Used by <code>ExternalLinkPropertiesStep</code> authoring kit step.
* <br /> * <br />
* This form can be extended to create forms for EForm subclasses. * This form can be extended to create forms for ExternalLink subclasses.
*
* @author tosmers
* @version $Revision: #1 $ $Date: 2015/02/22 $
*/ */
public class EFormPropertyForm extends BasicPageForm public class ExternalLinkPropertyForm extends BasicPageForm
implements FormProcessListener, FormInitListener { implements FormProcessListener, FormInitListener {
/** /**
* Name of this form * Name of this form
*/ */
public static final String ID = "eform_edit"; // formerly "eFormEdit" public static final String ID = "externallinkform_edit";
// formerly "externalLinkEdit"
private TextField url; private TextField url;
private TextArea description; private TextArea description;
/** /**
* Creates a new form to edit the EForm object specified by the item selection model passed in. * Creates a new form to edit the ExternalLink object specified by the
* item selection model passed in.
* *
* @param itemModel The ItemSelectionModel to use to obtain the EForm to work on * @param itemModel The ItemSelectionModel to use to obtain the
* ExternalLink to work on
*/ */
public EFormPropertyForm(final ItemSelectionModel itemModel) { public ExternalLinkPropertyForm(final ItemSelectionModel itemModel) {
super(ID, itemModel); super(ID, itemModel);
} }
@ -64,13 +70,13 @@ public class EFormPropertyForm extends BasicPageForm
protected void addWidgets() { protected void addWidgets() {
super.addWidgets(); super.addWidgets();
add(new Label(EFormGlobalizedMsg.getLocation())); add(new Label(ExternalLinkGlobalizationUtil.globalize("cms.contenttypes.ExternalLink.location")));
url = new TextField(EForm.URL); url = new TextField(ExternalLink.URL);
url.setSize(40); url.setSize(40);
add(url); add(url);
add(new Label(EFormGlobalizedMsg.getDescription())); add(new Label(ExternalLinkGlobalizationUtil.globalize("cms.contenttypes.ExternalLink.description")));
description = new TextArea(EForm.DESCRIPTION, 5, 40, TextArea.SOFT); description = new TextArea(ExternalLink.DESCRIPTION, 5, 40, TextArea.SOFT);
add(description); add(description);
} }
@ -81,7 +87,7 @@ public class EFormPropertyForm extends BasicPageForm
*/ */
@Override @Override
public void init(final FormSectionEvent fse) { public void init(final FormSectionEvent fse) {
final EForm site = (EForm) super.initBasicWidgets(fse); final ExternalLink site = (ExternalLink) super.initBasicWidgets(fse);
final PageState state = fse.getPageState(); final PageState state = fse.getPageState();
url.setValue(state, site.getURL()); url.setValue(state, site.getURL());
@ -89,13 +95,13 @@ public class EFormPropertyForm extends BasicPageForm
} }
/** /**
* Form processing hook. Saves EForm object. * Form processing hook. Saves ExternalLink object.
* *
* @param fse * @param fse FormSectionEvent provided by caller
*/ */
@Override @Override
public void process(final FormSectionEvent fse) { public void process(final FormSectionEvent fse) {
final EForm site = (EForm) super.processBasicWidgets(fse); final ExternalLink site = (ExternalLink) super.processBasicWidgets(fse);
final PageState state = fse.getPageState(); final PageState state = fse.getPageState();
// save only if save button was pressed // save only if save button was pressed

View File

@ -0,0 +1,71 @@
/*
* Copyright (C) 2015 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.cms.contenttypes.util;
import com.arsdigita.globalization.Globalized;
import com.arsdigita.globalization.GlobalizedMessage;
/**
* Compilation of methods to simplify the handling of globalizing keys.
* Basically it adds the name of package's resource bundle files to the
* globalize methods and forwards to GlobalizedMessage, shortening the
* method invocation in the various application classes.
*
* @author tosmers
* @version $Revision: #1 $ $Date: 2015/02/22 $
*/
public class ExternalLinkGlobalizationUtil implements Globalized {
/** Name of Java resource files to handle CMS's globalisation. */
private static final String BUNDLE_NAME =
"com.arsdigita.cms.contenttypes.ExternalLinkResources";
/**
* Returns a globalized message using the package specific bundle,
* provided by BUNDLE_NAME.
* @param key
* @return
*/
public static GlobalizedMessage globalize(String key) {
return new GlobalizedMessage(key, BUNDLE_NAME);
}
/**
* Returns a globalized message object, using the package specific bundle,
* as specified by BUNDLE_NAME. Also takes in an Object[] of arguments to
* interpolate into the retrieved message using the MessageFormat class.
* @param key
* @param args
* @return
*/
public static GlobalizedMessage globalize(String key, Object[] args) {
return new GlobalizedMessage(key, BUNDLE_NAME, args);
}
/**
* Returns the name of the package specific resource bundle.
*
* @return Name of resource bundle as String
*/
public static String getBundleName() {
return BUNDLE_NAME;
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2002-2004 Red Hat Inc. All Rights Reserved. * Copyright (C) 2015 University of Bremen. All Rights Reserved.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License