[jboss-cvs]	jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action ...
    Christian Bauer 
    christian at hibernate.org
       
    Mon Sep  3 06:36:34 EDT 2007
    
    
  
  User: cbauer  
  Date: 07/09/03 06:36:34
  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/core/action  
                        Breadcrumb.java NodeHome.java
  Log:
  Breadcrumb always visible
  
  Revision  Changes    Path
  1.2       +14 -12    jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Breadcrumb.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: Breadcrumb.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Breadcrumb.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- Breadcrumb.java	25 Aug 2007 17:59:24 -0000	1.1
  +++ Breadcrumb.java	3 Sep 2007 10:36:34 -0000	1.2
  @@ -16,24 +16,26 @@
   @Scope(ScopeType.PAGE)
   public class Breadcrumb implements Serializable {
   
  -    @In
  -    Node currentNode;
  +    @In(required = false)
  +    Node currentLocation;
   
       @Factory(value = "breadcrumb", autoCreate = true)
       public List<Node> unwrap() {
           // TODO: Maybe a nested set query would be more efficient?
  -        List<Node> currentDirectoryPath = new ArrayList<Node>();
  -        addDirectoryToPath(currentDirectoryPath, currentNode);
  -        Collections.reverse(currentDirectoryPath);
  -        return currentDirectoryPath;
  +        List<Node> currentPath = new ArrayList<Node>();
  +        if (currentLocation == null) return currentPath;
  +        addToPath(currentPath, currentLocation);
  +        Collections.reverse(currentPath);
  +        return currentPath;
       }
   
  -    protected void addDirectoryToPath(List<Node> path, Node currentNode) {
  -        if (Identity.instance().hasPermission("Node", "read", currentNode) &&
  -            !currentNode.getId().equals( ((Directory) Component.getInstance("wikiRoot")).getId() ) )
  -            path.add(currentNode);
  -        if (currentNode.getParent() != null ) {
  -            addDirectoryToPath(path, currentNode.getParent());
  +    protected void addToPath(List<Node> path, Node currentLocation) {
  +        if (Identity.instance().hasPermission("Node", "read", currentLocation) &&
  +            currentLocation.getId() != null &&
  +            !currentLocation.getId().equals( ((Directory) Component.getInstance("wikiRoot")).getId() ) )
  +            path.add(currentLocation);
  +        if (currentLocation.getParent() != null ) {
  +            addToPath(path, currentLocation.getParent());
           }
       }
   
  
  
  
  1.25      +3 -0      jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: NodeHome.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -b -r1.24 -r1.25
  --- NodeHome.java	29 Aug 2007 00:29:23 -0000	1.24
  +++ NodeHome.java	3 Sep 2007 10:36:34 -0000	1.25
  @@ -95,6 +95,9 @@
           // Outject current node (required for polymorphic UI, e.g. access level dropdown boxes)
           Contexts.getPageContext().set("currentNode", getInstance());
   
  +        // Outjects current node or parent directory, e.g. for breadcrumb rendering
  +        Contexts.getPageContext().set("currentLocation", !isManaged() ? getParentDirectory() : getInstance());
  +
           return null;
       }
   
  
  
  
    
    
More information about the jboss-cvs-commits
mailing list