From 7f29160f7204ff71f68e8a070168ed606bf4f146 Mon Sep 17 00:00:00 2001 From: Gavin Cornwell Date: Mon, 4 Sep 2006 14:34:59 +0000 Subject: [PATCH] Fix to handle edit properties failure when the uifacets aspect has been applied to a content type git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3679 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/messages/webclient.properties | 1 + .../renderer/ImagePickerRadioRenderer.java | 51 ++++++++++++------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/config/alfresco/messages/webclient.properties b/config/alfresco/messages/webclient.properties index c5b85bbb7c..9429e47a81 100644 --- a/config/alfresco/messages/webclient.properties +++ b/config/alfresco/messages/webclient.properties @@ -40,6 +40,7 @@ warning_inline=This is only recommended for HTML or plain text documents. categories_description=This view allows you to browse and modify the categories hiearchy. new_category_description=Enter information about the new Category then click Create Category. status_message_default=No messages. +no_icons_found=No icons found # UI Component messages yes=Yes diff --git a/source/java/org/alfresco/web/ui/common/renderer/ImagePickerRadioRenderer.java b/source/java/org/alfresco/web/ui/common/renderer/ImagePickerRadioRenderer.java index e3212a7212..68fc6bb62f 100644 --- a/source/java/org/alfresco/web/ui/common/renderer/ImagePickerRadioRenderer.java +++ b/source/java/org/alfresco/web/ui/common/renderer/ImagePickerRadioRenderer.java @@ -25,6 +25,7 @@ import javax.faces.component.UIComponent; import javax.faces.component.UIInput; import javax.faces.context.FacesContext; import javax.faces.context.ResponseWriter; +import javax.faces.el.PropertyNotFoundException; import org.alfresco.config.Config; import org.alfresco.config.ConfigElement; @@ -162,34 +163,46 @@ public class ImagePickerRadioRenderer extends BaseRenderer } else { - // get the child components - for (Iterator i = imagePicker.getChildren().iterator(); i.hasNext(); /**/) + try { - UIComponent child = (UIComponent)i.next(); - if (child instanceof UIListItems) + // get the child components + for (Iterator i = imagePicker.getChildren().iterator(); i.hasNext(); /**/) { - // get the value of the list items component and iterate - // through it's collection - Object listItems = ((UIListItems)child).getValue(); - if (listItems instanceof Collection) + UIComponent child = (UIComponent)i.next(); + if (child instanceof UIListItems) { - Iterator iter = ((Collection)listItems).iterator(); - while (iter.hasNext()) + // get the value of the list items component and iterate + // through it's collection + Object listItems = ((UIListItems)child).getValue(); + if (listItems instanceof Collection) { - UIListItem item = (UIListItem)iter.next(); - if (item.isRendered()) + Iterator iter = ((Collection)listItems).iterator(); + while (iter.hasNext()) { - renderItem(context, out, imagePicker, item, onclick); + UIListItem item = (UIListItem)iter.next(); + if (item.isRendered()) + { + renderItem(context, out, imagePicker, item, onclick); + } } } } + else if (child instanceof UIListItem && child.isRendered() == true) + { + // found a valid UIListItem child to render + UIListItem item = (UIListItem)child; + renderItem(context, out, imagePicker, item, onclick); + } } - else if (child instanceof UIListItem && child.isRendered() == true) - { - // found a valid UIListItem child to render - UIListItem item = (UIListItem)child; - renderItem(context, out, imagePicker, item, onclick); - } + } + catch (PropertyNotFoundException pnfe) + { + // handle the scenario where the bean does not have the + // method specified in the value binding expression + if (logger.isWarnEnabled()) + logger.warn("Failed to retrieve icons: " + pnfe.toString()); + + out.write(Application.getMessage(context, "no_icons_found")); } }