diff --git a/source/java/org/alfresco/web/bean/categories/CategoriesDialog.java b/source/java/org/alfresco/web/bean/categories/CategoriesDialog.java index cb8e831005..f3b12b4d44 100644 --- a/source/java/org/alfresco/web/bean/categories/CategoriesDialog.java +++ b/source/java/org/alfresco/web/bean/categories/CategoriesDialog.java @@ -459,6 +459,12 @@ public class CategoriesDialog extends BaseDialogBean implements IContextListener this.setCurrentCategory(ref); } + /** + * If category.equals(handler.label) then the breadcrumb reverts one step back + * (needed for deleting) + * Else current breadcrumb is updated accordingly to the current category + * (needed for editing) + */ protected void removeFromBreadcrumb(String category) { // remove this node from the breadcrumb if required @@ -477,6 +483,12 @@ public class CategoriesDialog extends BaseDialogBean implements IContextListener this.setCurrentCategory(handler.nodeRef); } } + else + { + handler=new CategoryBreadcrumbHandler (getCategory().getNodeRef(), Repository.getNameForNode(getNodeService(), getCategory().getNodeRef())); + location.set(location.size() - 1, handler); + this.setCurrentCategory(handler.nodeRef); + } } @Override diff --git a/source/java/org/alfresco/web/bean/categories/EditCategoryDialog.java b/source/java/org/alfresco/web/bean/categories/EditCategoryDialog.java index 3002ba1c2c..3d99468614 100644 --- a/source/java/org/alfresco/web/bean/categories/EditCategoryDialog.java +++ b/source/java/org/alfresco/web/bean/categories/EditCategoryDialog.java @@ -98,6 +98,17 @@ public class EditCategoryDialog extends BaseDialogBean setActionCategory(category); } + @Override + protected String doPostCommitProcessing(FacesContext context, String outcome) + { + // add the category to the request object so it gets picked up by + // category dialog, this will allow it to be edited in the breadcrumb + context.getExternalContext().getRequestMap().put( + CategoriesDialog.KEY_CATEGORY, this.category.getName()); + + return outcome; + } + public String getName() { return name; @@ -277,17 +288,11 @@ public class EditCategoryDialog extends BaseDialogBean } // edit the node in the breadcrumb if required + CategoriesDialog categoriesDialog = new CategoriesDialog(); List location = getLocation(); - IBreadcrumbHandler handler = location.get(location.size() - 1); - - // see if the current breadcrumb location is our node - if (nodeRef.equals(((IRepoBreadcrumbHandler) handler).getNodeRef())) - { - // and update with the modified node details - CategoriesDialog categoriesDialog = new CategoriesDialog(); - IBreadcrumbHandler newHandler = categoriesDialog.new CategoryBreadcrumbHandler(nodeRef, Repository.getNameForNode(getNodeService(), nodeRef)); - location.set(location.size() - 1, newHandler); - } + IBreadcrumbHandler handler = categoriesDialog.new CategoryBreadcrumbHandler(nodeRef, Repository.getNameForNode(getNodeService(), nodeRef)); + location.set(location.size() - 1, handler); + setCategory(new Node(nodeRef)); } catch (Throwable err) {