From 5ccdb3bab5c9238908da363c79acf199f1fb0e47 Mon Sep 17 00:00:00 2001 From: pb Date: Wed, 3 Jul 2013 15:17:29 +0000 Subject: [PATCH] Erste Verbesserungen der Lokalisierung ImageStep. git-svn-id: https://svn.libreccm.org/ccm/trunk@2243 8810af33-2d31-482b-a856-94f89814c4df --- .../ImageStepResources.properties | 2 + .../ImageStepResources_de.properties | 6 +- .../ImageStepResources_en.properties | 2 + .../imagestep/ImagePropertyRenderer.java | 3 +- .../ui/ImageComponentAttachListener.java | 12 ++++ .../cms/contentassets/ui/ImageStep.java | 7 +- .../contentassets/ui/ImageStepDisplay.java | 5 +- .../util/ImageStepGlobalizationUtil.java | 71 +++++++++++++++++++ .../com/arsdigita/cms/CMSResources.properties | 17 ++--- .../arsdigita/cms/CMSResources_de.properties | 17 ++--- .../cms/CMSResources_en_GB.properties | 9 +-- .../arsdigita/cms/CMSResources_fr.properties | 17 ++--- .../com/arsdigita/cms/ui/ImageBrowser.java | 16 ++++- .../com/arsdigita/cms/ui/ImageChooser.java | 9 ++- .../cms/ui/ImageLibraryComponent.java | 18 +++-- .../com/arsdigita/cms/ui/ImageSelectPage.java | 27 ++++--- .../cms/ui/ImageUploadComponent.java | 12 +++- .../src/com/arsdigita/cms/ui/ImagesPane.java | 32 ++++++--- 18 files changed, 216 insertions(+), 66 deletions(-) create mode 100644 ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/util/ImageStepGlobalizationUtil.java diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources.properties b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources.properties index aa3cf0ed3..9de7873b1 100755 --- a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources.properties +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources.properties @@ -1,2 +1,4 @@ com.arsdigita.cms.contentassets.image_step_label=Add Images com.arsdigita.cms.contentassets.image_step_description=Add Images +cms.contentassets.ui.image_step.add_image=Add Image +cms.contentassets.ui.image_step.no_image_attached=This item does not have any associated images. diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_de.properties b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_de.properties index 5c9d59a8b..93fe60727 100644 --- a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_de.properties +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_de.properties @@ -1,2 +1,4 @@ -com.arsdigita.cms.contentassets.image_step_label=Bild hinzuf\u00FCgen -com.arsdigita.cms.contentassets.image_step_description=Bild hinzuf\u00FCgen +com.arsdigita.cms.contentassets.image_step_label=Bild hinzuf\u00fcgen +com.arsdigita.cms.contentassets.image_step_description=Bild hinzuf\u00fcgen +cms.contentassets.ui.image_step.add_image=Bild hinzuf\u00fcgen +cms.contentassets.ui.image_step.no_image_attached=Diesem Dokument ist noch kein Bild zugeordnet. diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_en.properties b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_en.properties index aa3cf0ed3..9de7873b1 100755 --- a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_en.properties +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ImageStepResources_en.properties @@ -1,2 +1,4 @@ com.arsdigita.cms.contentassets.image_step_label=Add Images com.arsdigita.cms.contentassets.image_step_description=Add Images +cms.contentassets.ui.image_step.add_image=Add Image +cms.contentassets.ui.image_step.no_image_attached=This item does not have any associated images. diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/imagestep/ImagePropertyRenderer.java b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/imagestep/ImagePropertyRenderer.java index d4b4bacbb..7618830d7 100755 --- a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/imagestep/ImagePropertyRenderer.java +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/imagestep/ImagePropertyRenderer.java @@ -36,8 +36,9 @@ import com.arsdigita.xml.Element; * DataCollectionDefinition. */ public class ImagePropertyRenderer implements DataCollectionPropertyRenderer { + public static final String XML_NS = - "http://ccm.redhat.com/london/image_attachments"; + "http://ccm.redhat.com/london/image_attachments"; /** * Called from DataCollectionRenderer for every returned item. This method diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java index 2ce871111..ccf20f4e5 100644 --- a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageComponentAttachListener.java @@ -42,12 +42,24 @@ public class ImageComponentAttachListener extends ImageComponentAbstractListener private static final Logger s_log = Logger.getLogger( ImageComponentAttachListener.class); + /** + * Constructor. + * @param imageComponent + * @param imageStep + */ public ImageComponentAttachListener(MapComponentSelectionModel imageComponent, ImageStep imageStep) { super(imageComponent); m_imageStep = imageStep; } + /** + * + * @param event + * @param ps + * @param component + * @param image + */ @Override protected void processImage(FormSectionEvent event, PageState ps, diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java index c9001e917..cf47477e0 100755 --- a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStep.java @@ -28,6 +28,7 @@ import com.arsdigita.bebop.parameters.ParameterModel; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contentassets.ItemImageAttachment; +import com.arsdigita.cms.contentassets.util.ImageStepGlobalizationUtil; import com.arsdigita.cms.ui.ImageComponent; import com.arsdigita.cms.ui.SecurityPropertyEditor; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; @@ -45,6 +46,7 @@ import org.apache.log4j.Logger; * @author Sören Bernstein (quasimodo) */ public class ImageStep extends SecurityPropertyEditor { + private static final Logger s_log = Logger.getLogger(ImageStep.class); private final ItemSelectionModel m_itemSelection; @@ -70,7 +72,10 @@ public class ImageStep extends SecurityPropertyEditor { m_add = new ImageStepEdit( this ); WorkflowLockedComponentAccess addCA = new WorkflowLockedComponentAccess( m_add, m_itemSelection ); - addComponent( "add", "Add Image", addCA ); + addComponent( "add", + ImageStepGlobalizationUtil.globalize( + "cms.contentassets.ui.image_step.add_image"), + addCA ); m_display = new ImageStepDisplay( this ); setDisplayComponent(m_display); diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java index a7fdcd958..f1a2ce885 100755 --- a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/ui/ImageStepDisplay.java @@ -34,6 +34,7 @@ import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ReusableImageAsset; import com.arsdigita.cms.contentassets.ItemImageAttachment; +import com.arsdigita.cms.contentassets.util.ImageStepGlobalizationUtil; import com.arsdigita.cms.ui.ImageDisplay; import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.persistence.DataCollection; @@ -62,8 +63,8 @@ public class ImageStepDisplay extends SimpleContainer { m_imageStep = step; - Label mainLabel = new Label - ("This item does not have any associated images."); + Label mainLabel = new Label(ImageStepGlobalizationUtil.globalize( + "cms.contentassets.ui.image_step.no_image_attached")); mainLabel.setFontWeight(Label.ITALIC); List imageList = new List( new ImageListModelBuilder() ) { diff --git a/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/util/ImageStepGlobalizationUtil.java b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/util/ImageStepGlobalizationUtil.java new file mode 100644 index 000000000..da8e8dcbc --- /dev/null +++ b/ccm-cms-assets-imagestep/src/com/arsdigita/cms/contentassets/util/ImageStepGlobalizationUtil.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2013 Peter Boy, 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.contentassets.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 pb + */ +public class ImageStepGlobalizationUtil implements Globalized { + + /** Name of Java resource files to handle RelatedLink's globalisation. */ + final public static String BUNDLE_NAME = + "com.arsdigita.cms.contentassets.ImageStepResources"; + + /** Name of Java resource files to handle CMS globalisation. */ + final public static String ALTERNATE_BUNDLE_NAME = + "com.arsdigita.cms.CMSResources"; + + /** + * Returns a globalized message using the appropriate bundle. + * If the key string contains the modules name image_step the package + * specific bundle is used, otherwise the CMS ResourceBundle. + */ + public static GlobalizedMessage globalize(String key) { + if (key.indexOf(".image_step.") > 0) { + return new GlobalizedMessage(key, BUNDLE_NAME); + } else { + return new GlobalizedMessage(key, ALTERNATE_BUNDLE_NAME); + } + } + + /** + * Returns a globalized message object, using the approprate bundle, + * takeing in an Object[] of arguments to interpolate into the retrieved + * message using the MessageFormat class. + * If the key string contains the modules name image_Step the package + * specific bundle is used, otherwise the CMS ResourceBundle. + */ + public static GlobalizedMessage globalize(String key, Object[] args) { + if (key.indexOf(".image_step.") > 0) { + return new GlobalizedMessage(key, BUNDLE_NAME, args); + } else { + return new GlobalizedMessage(key, ALTERNATE_BUNDLE_NAME, args); + } + } + +} diff --git a/ccm-cms/src/com/arsdigita/cms/CMSResources.properties b/ccm-cms/src/com/arsdigita/cms/CMSResources.properties index 467e95008..9338b4aec 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSResources.properties +++ b/ccm-cms/src/com/arsdigita/cms/CMSResources.properties @@ -6,9 +6,9 @@ cms.cannot_create_xml_document=Cannot create XML document cms.cant_promote_folders=Can't promote folders cms.classnotfoundexception=ClassNotFoundException: cms.illegalaccessexception=IllegalAccessException: -cms.image.erroneous_jpeg_marker_length=Erroneous JPEG marker length -cms.image.expected_soi_marker_first=Expected SOI marker first -cms.image.not_a_jpeg_file=Not a JPEG file +cms.contentasset.image.erroneous_jpeg_marker_length=Erroneous JPEG marker length +cms.contentasset.image.expected_soi_marker_first=Expected SOI marker first +cms.contentasset.image.not_a_jpeg_file=Not a JPEG file cms.instantiationexception=Instantiation Exception: cms.nosuchmethodexception=No-Such-Method Exception: cms.templates=Templates @@ -38,7 +38,7 @@ cms.contenttypes.ui.lead=Description: cms.contenttypes.ui.name=Name (URL stub): cms.contenttypes.ui.summary=Description: cms.contenttypes.ui.title=Title: -cms.contenttypes.ui.view_image=view image +cms.contentasset.image.ui.view_image=view image # Package com.arsdigita.cms.dispatcher @@ -986,15 +986,14 @@ cms.ui.item_search.flat.filter.submit=Filter cms.ui.item_search.selected=Selected content item (id) cms.ui.item_search.create=Create new cms.ui.item_search.create.folder_select=Select folder -cms.ui.image_library=Image Library -cms.ui.image_upload=Upload Image -cms.ui.images=Images +cms.contentasset.image.ui.image_library=Image Library +cms.contentasset.image.ui.upload_button=Upload Image +cms.contentasset.image.ui.images=Images cms.ui.search.create.select_close=Select item and close cms.ui.search.create.select_edit=Select item and edit cms.ui.clear=Clear cms.ui.item_search.create.folder_missing=No folder selected -cms.ui.images_links= cms.ui.contentcenter.mainpage.search=Search cms.ui.contentcenter.mainpage.taskssections=Tasks/Sections cms.ui.contentcenter.section=Section @@ -1036,3 +1035,5 @@ cms.contenttyes.link.ui.button_save=Save cms.contenttyes.link.ui.button_reset=Reset cms.contenttyes.link.ui.button_cancel=Cancel cms.contenttyes.link.ui.table_no_entries=There are no links for this content item +cms.contentasset.image.ui.caption=Caption +cms.contentasset.image.ui.use_context=Use Context diff --git a/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties b/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties index ed1a7e519..b0a90e5a6 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties +++ b/ccm-cms/src/com/arsdigita/cms/CMSResources_de.properties @@ -6,9 +6,9 @@ cms.cannot_create_xml_document=Kann XML Dokument nicht erstellen cms.cant_promote_folders=Can't promote folders cms.classnotfoundexception=ClassNotFoundException: cms.illegalaccessexception=IllegalAccessException: -cms.image.erroneous_jpeg_marker_length=Fehlerhafte L\u00e4nge des JPEG marker -cms.image.expected_soi_marker_first=Zuerst den SOI marker erwartet -cms.image.not_a_jpeg_file=Keine JPEG Datei +cms.contentasset.image.erroneous_jpeg_marker_length=Fehlerhafte L\u00e4nge des JPEG marker +cms.contentasset.image.expected_soi_marker_first=Zuerst den SOI marker erwartet +cms.contentasset.image.not_a_jpeg_file=Keine JPEG Datei cms.instantiationexception=Ausnahmebedinung bei Instantiierung: cms.nosuchmethodexception=NoSuchMethodException: cms.templates=Vorlagen @@ -38,7 +38,7 @@ cms.contenttypes.ui.lead=Beschreibung (Lead Text): cms.contenttypes.ui.name=Name (als Teil-URL): cms.contenttypes.ui.summary=Beschreibung: cms.contenttypes.ui.title=Titel: -cms.contenttypes.ui.view_image=Bild anzeigen +cms.contentasset.image.ui.view_image=Bild anzeigen # Package com.arsdigita.cms.dispatcher # ===================================== @@ -978,16 +978,15 @@ cms.ui.item_search.flat.filter.submit=Filtern cms.ui.item_search.selected=Ausgew\u00e4hltes Content Item (ID) cms.ui.item_search.create=Neu anlegen cms.ui.item_search.create.folder_select=Ordner ausw\u00e4hlen -cms.ui.image_library=Bilderauswahl -cms.ui.image_upload=Bild hochladen -cms.ui.images=Bilder +cms.contentasset.image.ui.image_library=Bilderauswahl +cms.contentasset.image.ui.upload_button=Bild hochladen +cms.contentasset.image.ui.images=Bilder cms.ui.search.create.select_close=Item ausw\u00e4hlen und schlie\u00dfen cms.ui.search.create.select_edit=Item ausw\u00e4hlen und weiter bearbeiten cms.ui.clear=Zur\u00fccksetzen cms.ui.type.minimum_number_of_values_bigger_than_maximum_number_of_values=Maximaler Wert kleiner als minimaler Wert cms.ui.type.minimummaximum_number_of_values_cannot_be_negative=Keine negativen Werte erlaubt cms.ui.item_search.create.folder_missing=kein Ordner ausgew\u00e4hlt -cms.ui.images_links= cms.ui.contentcenter.mainpage.search=Suche cms.ui.contentcenter.mainpage.taskssections=Aufgaben/Content Sections cms.ui.contentcenter.section=Content Section @@ -1031,3 +1030,5 @@ cms.contenttyes.link.ui.button_save=Sichern cms.contenttyes.link.ui.button_reset=Zur\u00fccksetzen cms.contenttyes.link.ui.button_cancel=Abbruch cms.contenttyes.link.ui.table_no_entries=Es sind noch keine Links zugeordnet. +cms.contentasset.image.ui.caption=Bildunterschrift +cms.contentasset.image.ui.use_context=Kontext diff --git a/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties b/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties index 33793a169..aac7158dc 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties +++ b/ccm-cms/src/com/arsdigita/cms/CMSResources_en_GB.properties @@ -33,15 +33,14 @@ cms.ui.item_search.flat.filter.submit=Filter cms.ui.item_search.selected=Selected content item (id) cms.ui.item_search.create=Create new cms.ui.item_search.create.folder_select=Select folder -cms.ui.image_library=Image Library -cms.ui.image_upload=Upload Image -cms.ui.images=Images +cms.contentasset.image.ui.image_library=Image Library +cms.contentasset.image.ui.upload_button=Upload Image +cms.contentasset.image.ui.images=Images cms.ui.search.create.select_close=Select item and close cms.ui.search.create.select_edit=Select item and edit cms.ui.clear=Clear cms.ui.item_search.create.folder_missing=No folder selected -cms.ui.images_links= cms.ui.contentcenter.mainpage.search=Search cms.ui.contentcenter.mainpage.taskssections=Tasks/Sections cms.ui.contentcenter.section=Section @@ -84,3 +83,5 @@ cms.contenttyes.link.ui.button_save=Save cms.contenttyes.link.ui.button_reset=Reset cms.contenttyes.link.ui.button_cancel=Cancel cms.contenttyes.link.ui.table_no_entries=There are no links for this content item +cms.contentasset.image.ui.caption=Caption +cms.contentasset.image.ui.use_context=Use Context diff --git a/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties b/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties index c8eefcba2..592f247fe 100755 --- a/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties +++ b/ccm-cms/src/com/arsdigita/cms/CMSResources_fr.properties @@ -6,9 +6,9 @@ cms.cannot_create_xml_document=Erreur : impossible de cr\u00e9er un document XML cms.cant_promote_folders=Impossible de remonter le r\u00e9pertoire cms.classnotfoundexception=Erreur : classe introuvable cms.illegalaccessexception=Erreur : acc\u00e8s interdit -cms.image.erroneous_jpeg_marker_length=Extension JPEG erronn\u00e9e -cms.image.expected_soi_marker_first=N\u00e9c\u00e9ssite le marqueur SOI en premier -cms.image.not_a_jpeg_file=Ceci n'est pas un fichier JPEG +cms.contentasset.image.erroneous_jpeg_marker_length=Extension JPEG erronn\u00e9e +cms.contentasset.image.expected_soi_marker_first=N\u00e9c\u00e9ssite le marqueur SOI en premier +cms.contentasset.image.not_a_jpeg_file=Ceci n'est pas un fichier JPEG cms.instantiationexception=Erreur : instanciation impossible cms.nosuchmethodexception=Erreur : pas de m\u00e9thode trouv\u00e9e cms.templates=Gabarits @@ -24,7 +24,7 @@ cms.contenttypes.ui.name=Nom (URL) cms.contenttypes.ui.summary=R\u00e9sum\u00e9 cms.contenttypes.ui.summary=R\u00e9sum\u00e9 cms.contenttypes.ui.title=Titre de la page -cms.contenttypes.ui.view_image=voir l'image +cms.contentasset.image.ui.view_image=voir l'image # Package com.arsdigita.cms.dispatcher # ===================================== @@ -506,15 +506,14 @@ cms.ui.item_search.flat.filter.submit=Filter cms.ui.item_search.selected=Selected content item (id) cms.ui.item_search.create=Cr\u00e9er cms.ui.item_search.create.folder_select=Select folder -cms.ui.image_library=Image Library -cms.ui.image_upload=Upload Image -cms.ui.images=Images +cms.contentasset.image.ui.image_library=Image Library +cms.contentasset.image.ui.upload_button=Upload Image +cms.contentasset.image.ui.images=Images cms.ui.search.create.select_close=Select item and close cms.ui.search.create.select_edit=Select item and edit cms.ui.clear= cms.ui.item_search.create.folder_missing=No folder selected -cms.ui.images_links= cms.ui.contentcenter.mainpage.search= cms.ui.contentcenter.mainpage.taskssections= cms.ui.contentcenter.section= @@ -558,3 +557,5 @@ cms.contenttyes.link.ui.button_save=Save cms.contenttyes.link.ui.button_reset=Reset cms.contenttyes.link.ui.button_cancel=Cancel cms.contenttyes.link.ui.table_no_entries=There are no links for this content item +cms.contentasset.image.ui.caption=Caption +cms.contentasset.image.ui.use_context=Use Context diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java b/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java index 01b28c61d..962c6d45b 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ImageBrowser.java @@ -241,8 +241,12 @@ public class ImageBrowser extends Table { SecurityManager sm = CMS.getSecurityManager(state); if (sm.canAccess(state.getRequest(), SecurityManager.DELETE_IMAGES)) { try { - ImageAsset asset = (ImageAsset) DomainObjectFactory.newInstance(new OID(ImageAsset.BASE_DATA_OBJECT_TYPE, (BigDecimal) key)); -//XXX Find a new way to figure out, if this image is used by any CI so we can decide if it can be deleted + ImageAsset asset = (ImageAsset) DomainObjectFactory + .newInstance(new + OID(ImageAsset.BASE_DATA_OBJECT_TYPE, + (BigDecimal) key)); +//XXX Find a new way to figure out, if this image is used by any CI so we can +// decide if it can be deleted // if (!GenericArticleImageAssociation.imageHasAssociation(asset)) { // canDelete = true; // } @@ -254,7 +258,13 @@ public class ImageBrowser extends Table { // can delete image because it's not in use if (canDelete) { - return super.getComponent(table, state, value, isSelected, key, row, column); + return super.getComponent(table, + state, + value, + isSelected, + key, + row, + column); } } return new Label(""); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ImageChooser.java b/ccm-cms/src/com/arsdigita/cms/ui/ImageChooser.java index d7a83bfe9..6084f12fd 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/ImageChooser.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ImageChooser.java @@ -71,7 +71,8 @@ public class ImageChooser extends BoxPanel { m_keyword = new StringParameter(KEYWORD); m_sel = new ParameterSingleSelectionModel(m_keyword); m_form = new ImageKeywordForm(m_sel); - DefaultImageBrowserModelBuilder modelBuilder = new DefaultImageBrowserModelBuilder(m_sel, context); + DefaultImageBrowserModelBuilder modelBuilder = new + DefaultImageBrowserModelBuilder(m_sel, context); m_browser = new ImageBrowser(modelBuilder, mode); modelBuilder.setImageBrowser(m_browser); @@ -221,8 +222,10 @@ public class ImageChooser extends BoxPanel { final TextField keyword = new TextField(WORD); add(keyword); m_saveCancel = new SaveCancelSection(); - m_saveCancel.getSaveButton().setButtonLabel(GlobalizationUtil.globalize("cms.ui.search")); - m_saveCancel.getCancelButton().setButtonLabel(GlobalizationUtil.globalize("cms.ui.clear")); + m_saveCancel.getSaveButton() + .setButtonLabel(GlobalizationUtil.globalize("cms.ui.search")); + m_saveCancel.getCancelButton() + .setButtonLabel(GlobalizationUtil.globalize("cms.ui.clear")); add(m_saveCancel); addProcessListener(this); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java b/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java index 2b490ca7f..de98e0078 100644 --- a/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ImageLibraryComponent.java @@ -21,6 +21,7 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.cms.ContentItem; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.ReusableImageAsset; +import com.arsdigita.cms.util.GlobalizationUtil; import com.arsdigita.domain.DataObjectNotFoundException; import java.math.BigDecimal; @@ -28,8 +29,8 @@ import java.math.BigDecimal; * An image library component. * * This component can be used in different places to add an image library - * in a convinient way. This class uses a listener class which should be extended - * from {@link ImageComponentAbstractListener}. + * in a convinient way. This class uses a listener class which should be + * extended from {@link ImageComponentAbstractListener}. * * @author unknown * @author Sören Bernstein (quasimodo) @@ -96,7 +97,8 @@ public class ImageLibraryComponent extends SimpleContainer implements ImageCompo // Show additional fields only in default mode a.k.a. ATTACH_IMAGE like // in image-step if (m_mode == ImageComponent.ATTACH_IMAGE) { - m_form.add(new Label("Caption")); + m_form.add(new Label(GlobalizationUtil + .globalize("cms.contentasset.image.ui.caption"))); m_caption.addValidationListener(new NotNullValidationListener()); m_caption.setSize(40); m_form.add(m_caption); @@ -113,7 +115,8 @@ public class ImageLibraryComponent extends SimpleContainer implements ImageCompo * m_form.add(m_description); m_form.add(new Label("Title")); * m_form.add(m_title); } */ - m_form.add(new Label("Use Context")); + m_form.add(new Label(GlobalizationUtil + .globalize("cms.contentasset.image.ui.use_context"))); m_useContext.setSize(40); m_form.add(m_useContext); } @@ -126,7 +129,8 @@ public class ImageLibraryComponent extends SimpleContainer implements ImageCompo m_saveCancel = new SaveCancelSection(); m_saveCancel.getSaveButton().setOnClick("selectImage(this)"); m_saveCancel.getCancelButton().setOnClick("selectImage(this)"); - if (m_mode == ImageComponent.SELECT_IMAGE || m_mode == ImageComponent.ATTACH_IMAGE) { + if (m_mode == ImageComponent.SELECT_IMAGE + || m_mode == ImageComponent.ATTACH_IMAGE) { m_form.add(m_saveCancel); } } @@ -178,7 +182,9 @@ public class ImageLibraryComponent extends SimpleContainer implements ImageCompo public void addUploadLink(final ActionListener actionListener) { // Add action link to image upload component if (m_mode != ImageComponent.DISPLAY_ONLY) { - final ActionLink upload = new ActionLink("Upload new image"); + final ActionLink upload = new ActionLink(new + Label(GlobalizationUtil.globalize( + "cms.ui.authoring.upload_a_new_image") )); upload.addActionListener(actionListener); add(upload, ColumnPanel.FULL_WIDTH); } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java b/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java index 3493f824b..94acb0753 100644 --- a/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ImageSelectPage.java @@ -46,7 +46,10 @@ public class ImageSelectPage extends CMSPage { public static final String RESULT = "result"; public ImageSelectPage() { - super(GlobalizationUtil.globalize("cms.ui.image_select.page_title").localize().toString(), new SimpleContainer()); + super(GlobalizationUtil.globalize( + "cms.ui.image_select.page_title") + .localize().toString(), + new SimpleContainer()); setClassAttr("cms-admin"); @@ -60,13 +63,15 @@ public class ImageSelectPage extends CMSPage { m_imageComponent = new MapComponentSelectionModel(componentModel, new HashMap()); - m_selectListener = new ImageComponentSelectListener(m_imageComponent, getResultComponent()); + m_selectListener = new ImageComponentSelectListener(m_imageComponent, + getResultComponent()); m_tabbedPane = createTabbedPane(); m_tabbedPane.setIdAttr("page-body"); add(m_tabbedPane); - // ActionListener to change the image component state param to the right value + // ActionListener to change the image component state param to the + // right value addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { @@ -93,10 +98,12 @@ public class ImageSelectPage extends CMSPage { */ protected ImageLibraryComponent getImageLibraryPane() { if (m_imageLibrary == null) { - m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE, this); + m_imageLibrary = new ImageLibraryComponent(ImageComponent.SELECT_IMAGE, + this); m_imageLibrary.getForm().addInitListener(m_selectListener); m_imageLibrary.getForm().addProcessListener(m_selectListener); - m_imageComponent.getComponentsMap().put(ImageComponent.LIBRARY, m_imageLibrary); + m_imageComponent.getComponentsMap().put(ImageComponent.LIBRARY, + m_imageLibrary); } return m_imageLibrary; } @@ -112,7 +119,8 @@ public class ImageSelectPage extends CMSPage { m_imageUpload = new ImageUploadComponent(ImageComponent.SELECT_IMAGE); m_imageUpload.getForm().addInitListener(m_selectListener); m_imageUpload.getForm().addProcessListener(m_selectListener); - m_imageComponent.getComponentsMap().put(ImageComponent.UPLOAD, m_imageUpload); + m_imageComponent.getComponentsMap().put(ImageComponent.UPLOAD, + m_imageUpload); } return m_imageUpload; } @@ -151,9 +159,12 @@ public class ImageSelectPage extends CMSPage { * @param tabName The name of the tab if it's added * @param comp The component to add to the pane */ - protected void addToPane(final TabbedPane pane, final String tabName, final Component comp) { + protected void addToPane(final TabbedPane pane, + final String tabName, + final Component comp) { if (comp != null) { - pane.addTab(GlobalizationUtil.globalize("cms.ui.image_" + tabName).localize().toString(), comp); + pane.addTab(GlobalizationUtil.globalize("cms.ui.image_" + tabName) + .localize().toString(), comp); } } } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java b/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java index f7fa8163b..7bdb67ca8 100644 --- a/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ImageUploadComponent.java @@ -17,6 +17,8 @@ import com.arsdigita.bebop.parameters.NotNullValidationListener; import com.arsdigita.bebop.parameters.StringLengthValidationListener; import com.arsdigita.cms.ImageAsset; import com.arsdigita.cms.ReusableImageAsset; +import com.arsdigita.cms.util.GlobalizationUtil; + import java.io.File; import java.io.IOException; @@ -57,7 +59,9 @@ public class ImageUploadComponent extends Form implements ImageComponent { m_mode = mode; setEncType("multipart/form-data"); // Ignoring deprecated constructor. - m_imageFile = new FileUploadSection("Image Type", "image", ImageAsset.MIME_JPEG); + m_imageFile = new FileUploadSection("Image Type", + "image", + ImageAsset.MIME_JPEG); m_imageFile.getFileUploadWidget().addValidationListener(new NotNullValidationListener()); add(m_imageFile, ColumnPanel.FULL_WIDTH); @@ -69,7 +73,8 @@ public class ImageUploadComponent extends Form implements ImageComponent { // add widget only if we are in attach mode if (m_mode == ImageComponent.ATTACH_IMAGE) { - add(new Label("Caption")); + add(new Label(GlobalizationUtil + .globalize("cms.contentasset.image.ui.caption"))); m_caption.addValidationListener(new NotNullValidationListener()); m_caption.addValidationListener(new StringLengthValidationListener(40)); m_caption.setSize(40); @@ -94,7 +99,8 @@ public class ImageUploadComponent extends Form implements ImageComponent { // // } - add(new Label("Use Context")); + add(new Label(GlobalizationUtil + .globalize("cms.contentasset.image.ui.use_context"))); m_useContext.setSize(40); add(m_useContext); } diff --git a/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java b/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java index b5660d0e6..aaf31e6e9 100644 --- a/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/ImagesPane.java @@ -74,29 +74,35 @@ public class ImagesPane extends LayoutPanel implements Resettable { m_imageComponentKey = new StringParameter("imageComponent"); - final ParameterSingleSelectionModel componentModel = new ParameterSingleSelectionModel(m_imageComponentKey); - m_imageComponent = new MapComponentSelectionModel(componentModel, new HashMap()); + final ParameterSingleSelectionModel componentModel = new + ParameterSingleSelectionModel(m_imageComponentKey); + m_imageComponent = new MapComponentSelectionModel(componentModel, + new HashMap()); final Map selectors = m_imageComponent.getComponentsMap(); m_adminListener = new ImageComponentAdminListener(m_imageComponent, this); // Image library component - final ImageLibraryComponent library = new ImageLibraryComponent(ImageComponent.ADMIN_IMAGES); + final ImageLibraryComponent library = new + ImageLibraryComponent(ImageComponent.ADMIN_IMAGES); library.getForm().addInitListener(m_adminListener); library.getForm().addProcessListener(m_adminListener); selectors.put(ImageComponent.LIBRARY, library); m_bodySegments.put(ImageComponent.LIBRARY, m_body.addSegment( - new Label(GlobalizationUtil.globalize("cms.ui.image_library")), + new Label(GlobalizationUtil.globalize( + "cms.contentasset.image.ui.image_library")), library)); // Image upload component - final ImageUploadComponent upload = new ImageUploadComponent(ImageComponent.ADMIN_IMAGES); + final ImageUploadComponent upload = new + ImageUploadComponent(ImageComponent.ADMIN_IMAGES); upload.getForm().addInitListener(m_adminListener); upload.getForm().addSubmissionListener(m_adminListener); upload.getForm().addProcessListener(m_adminListener); selectors.put(ImageComponent.UPLOAD, upload); m_bodySegments.put(ImageComponent.UPLOAD, m_body.addSegment( - new Label(GlobalizationUtil.globalize("cms.ui.image_upload")), + new Label(GlobalizationUtil.globalize( + "cms.contentasset.image.ui.upload_button")), upload)); } @@ -109,7 +115,8 @@ public class ImagesPane extends LayoutPanel implements Resettable { while (keys.hasNext()) { String key = keys.next(); - page.setVisibleDefault(m_bodySegments.get(key), m_model.getDefaultSelection().equals(key)); + page.setVisibleDefault(m_bodySegments.get(key), + m_model.getDefaultSelection().equals(key)); } page.addComponentStateParam(this, m_imageComponentKey); @@ -154,8 +161,12 @@ public class ImagesPane extends LayoutPanel implements Resettable { } } - private class ResettableParameterSingleSelectionModel extends ParameterSingleSelectionModel - implements Resettable { + /** + * + */ + private class ResettableParameterSingleSelectionModel + extends ParameterSingleSelectionModel + implements Resettable { private String defaultKey; @@ -182,6 +193,9 @@ public class ImagesPane extends LayoutPanel implements Resettable { } } + /** + * + */ private class ImageAdminListModel implements ListModel { private ArrayList m_keys;