diff --git a/ccm-cms-types-externallink/pdl/com/arsdigita/cms/contenttypes/ExternalLink.pdl b/ccm-cms-types-externallink/pdl/com/arsdigita/cms/contenttypes/ExternalLink.pdl index 933368d09..05a4364a2 100644 --- a/ccm-cms-types-externallink/pdl/com/arsdigita/cms/contenttypes/ExternalLink.pdl +++ b/ccm-cms-types-externallink/pdl/com/arsdigita/cms/contenttypes/ExternalLink.pdl @@ -15,7 +15,7 @@ // License along with this library; if not, write to the Free Software // 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; import com.arsdigita.cms.ContentPage; diff --git a/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/ExternalLink.xml b/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/ExternalLink.xml index cdc377dbc..de167c7c0 100644 --- a/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/ExternalLink.xml +++ b/ccm-cms-types-externallink/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/ExternalLink.xml @@ -1,5 +1,7 @@ - + EFormPropertiesStep authoring kit step. + * Used by ExternalLinkPropertiesStep authoring kit step. *
- * 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 { /** * 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 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); } @@ -64,13 +70,13 @@ public class EFormPropertyForm extends BasicPageForm protected void addWidgets() { super.addWidgets(); - add(new Label(EFormGlobalizedMsg.getLocation())); - url = new TextField(EForm.URL); + add(new Label(ExternalLinkGlobalizationUtil.globalize("cms.contenttypes.ExternalLink.location"))); + url = new TextField(ExternalLink.URL); url.setSize(40); add(url); - add(new Label(EFormGlobalizedMsg.getDescription())); - description = new TextArea(EForm.DESCRIPTION, 5, 40, TextArea.SOFT); + add(new Label(ExternalLinkGlobalizationUtil.globalize("cms.contenttypes.ExternalLink.description"))); + description = new TextArea(ExternalLink.DESCRIPTION, 5, 40, TextArea.SOFT); add(description); } @@ -81,7 +87,7 @@ public class EFormPropertyForm extends BasicPageForm */ @Override 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(); 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 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(); // save only if save button was pressed diff --git a/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/util/ExternalLinkGlobalizationUtil.java b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/util/ExternalLinkGlobalizationUtil.java new file mode 100644 index 000000000..1024cd94f --- /dev/null +++ b/ccm-cms-types-externallink/src/com/arsdigita/cms/contenttypes/util/ExternalLinkGlobalizationUtil.java @@ -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; + } + +} \ No newline at end of file diff --git a/ccm-portlet-bookmarks/src/com/arsdigita/portlet/bookmarks/util/GlobalizationUtil.java b/ccm-portlet-bookmarks/src/com/arsdigita/portlet/bookmarks/util/GlobalizationUtil.java index 3a1fa906c..d1f4a6632 100644 --- a/ccm-portlet-bookmarks/src/com/arsdigita/portlet/bookmarks/util/GlobalizationUtil.java +++ b/ccm-portlet-bookmarks/src/com/arsdigita/portlet/bookmarks/util/GlobalizationUtil.java @@ -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 * modify it under the terms of the GNU Lesser General Public License