[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/faqBrowser ...

Christian Bauer christian at hibernate.org
Thu Jan 17 06:58:22 EST 2008


  User: cbauer  
  Date: 08/01/17 06:58:22

  Modified:    examples/wiki/src/main/org/jboss/seam/wiki/plugin/faqBrowser 
                        FaqBrowser.java
  Log:
  Fixes for faq browser
  
  Revision  Changes    Path
  1.2       +12 -8     jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/faqBrowser/FaqBrowser.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: FaqBrowser.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/faqBrowser/FaqBrowser.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -b -r1.1 -r1.2
  --- FaqBrowser.java	16 Jan 2008 01:40:43 -0000	1.1
  +++ FaqBrowser.java	17 Jan 2008 11:58:21 -0000	1.2
  @@ -38,18 +38,22 @@
       @In
       WikiDirectory currentDirectory;
   
  -    NestedSetNodeWrapper<WikiDirectory> root;
  +    NestedSetNodeWrapper<WikiDirectory> tree;
   
  -    public NestedSetNodeWrapper<WikiDirectory> getRoot() {
  -        if (root == null) loadRoot();
  -        return root;
  +    public NestedSetNodeWrapper<WikiDirectory> getTree() {
  +        if (tree == null) loadTree();
  +        return tree;
       }
   
  -    public void loadRoot() {
  +    public void loadTree() {
           log.debug("loading faq root, starting search for parent default file with macro in directory: " + currentDirectory);
           WikiDirectory faqRoot = faqBrowserDAO.findFaqRootDir(currentDirectory);
           if (faqRoot != null) {
  -            root = wikiNodeDAO.findWikiDirectoryTree(faqRoot, 99l, 1l, false);
  +            log.debug("found faq root: " + faqRoot);
  +            tree = wikiNodeDAO.findWikiDirectoryTree(faqRoot, 99l, 1l, false);
  +        } else {
  +            log.debug("couldn't find faq tree root by searching the directory tree upwards, assuming that the current dir is the root");
  +            tree = wikiNodeDAO.findWikiDirectoryTree(currentDirectory, 99l, 1l, false);
           }
       }
   
  @@ -94,8 +98,8 @@
   
       @RequestParameter("category")
       public void selectCategory(String requestParam) {
  -        if (requestParam != null && requestParam.length() > 0 && getRoot() != null) {
  -            WikiDirectory category = wikiNodeDAO.findWikiDirectoryInArea(getRoot().getWrappedNode().getAreaNumber(), requestParam);
  +        if (requestParam != null && requestParam.length() > 0) {
  +            WikiDirectory category = wikiNodeDAO.findWikiDirectoryInArea(getTree().getWrappedNode().getAreaNumber(), requestParam);
               if (category != null) {
                   selectedDir = new NestedSetNodeWrapper<WikiDirectory>(category);
                   showQuestions();
  
  
  



More information about the jboss-cvs-commits mailing list