You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2011/06/08 21:56:56 UTC

svn commit: r1133537 - in /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src: main/java/org/apache/myfaces/tobago/example/demo/ main/webapp/content/ main/webapp/content/00/ main/webapp/content/01/ main/webapp/content/02/ main/webapp/content/0...

Author: lofwyr
Date: Wed Jun  8 19:56:54 2011
New Revision: 1133537

URL: http://svn.apache.org/viewvc?rev=1133537&view=rev
Log:
Restructuring the demo:
 - Using own directory for each navigation node, because some of them needs more than one file

Added:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/00/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/00/intro.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/00-intro.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01/basic.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02/sheet.xhtml   (contents, props changed)
      - copied, changed from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02-sheet.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/00/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/00/tree-editor.xhtml   (contents, props changed)
      - copied, changed from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03~00-tree-editor.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/01/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/01/treeMenu-different-types.xhtml   (contents, props changed)
      - copied, changed from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03~01-treeMenu-different-types.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/tree.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03-tree.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/04/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/04/tab.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/04-tab.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/05/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/05/toolBar.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/06/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/06/00/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/06/00/validation-severity.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/06~00-validation-severity.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/06/validation.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/06-validation.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/07/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/07/form.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/07-form.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/08/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/08/theme.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/08-theme.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/09/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/09/browser.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/09-browser.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/10/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/10/locale.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/10-locale.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/11/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/11/00/
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/11/00/flow-layout.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/11~00-flow-layout.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/11/layout.xhtml
      - copied unchanged from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/11-layout.xhtml
Removed:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02-sheet.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03~00-tree-editor.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03~01-treeMenu-different-types.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/04-tab.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/06-validation.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/06~00-validation-severity.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/07-form.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/08-theme.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/09-browser.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/10-locale.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/11-layout.xhtml
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/11~00-flow-layout.xhtml
Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java
    myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java?rev=1133537&r1=1133536&r2=1133537&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/Navigation.java Wed Jun  8 19:56:54 2011
@@ -55,22 +55,31 @@ public class Navigation {
   }
 
   protected Navigation(ServletContext servletContext) {
-
-    this(locateResourcesInWar(servletContext));
+    this(locateResourcesInWar(servletContext, "/content", new ArrayList<String>()));
   }
 
-  private static List<String> locateResourcesInWar(ServletContext servletContext) {
-    String content = "/content";
+  private static List<String> locateResourcesInWar(
+      ServletContext servletContext, String directory, List<String> result) {
 
-    Set<String> resourcePaths = servletContext.getResourcePaths(content);
-    List<String> list = new ArrayList<String>();
+    Set<String> resourcePaths = servletContext.getResourcePaths(directory);
 
     if (resourcePaths != null) {
       for (String path : resourcePaths) {
-        list.add(path);
+
+        if (path.endsWith("/.svn/")) {
+          continue;
+        }
+
+        if (path.endsWith("/")) {
+          locateResourcesInWar(servletContext, path, result);
+          continue;
+        }
+
+        result.add(path);
+
       }
     }
-    return list;
+    return result;
   }
 
   protected Navigation(List<String> list) {
@@ -190,7 +199,7 @@ public class Navigation {
     public Node(String path) {
 
       outcome = path;
-      final Pattern pattern = Pattern.compile("([\\d\\d~]*\\d\\d)-(.*)\\.(xhtml)");
+      final Pattern pattern = Pattern.compile("([\\d\\d/]*\\d\\d)/([^/]*)\\.(xhtml)");
       final Matcher matcher = pattern.matcher(path);
       matcher.find();
       branch = matcher.group(1);

Copied: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02/sheet.xhtml (from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02-sheet.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02/sheet.xhtml?p2=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02/sheet.xhtml&p1=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02-sheet.xhtml&r1=1133502&r2=1133537&rev=1133537&view=diff
==============================================================================
    (empty)

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02/sheet.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02/sheet.xhtml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/02/sheet.xhtml
------------------------------------------------------------------------------
    svn:mergeinfo = 

Copied: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/00/tree-editor.xhtml (from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03~00-tree-editor.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/00/tree-editor.xhtml?p2=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/00/tree-editor.xhtml&p1=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03%7E00-tree-editor.xhtml&r1=1133502&r2=1133537&rev=1133537&view=diff
==============================================================================
    (empty)

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/00/tree-editor.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/00/tree-editor.xhtml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Copied: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/01/treeMenu-different-types.xhtml (from r1133502, myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03~01-treeMenu-different-types.xhtml)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/01/treeMenu-different-types.xhtml?p2=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/01/treeMenu-different-types.xhtml&p1=myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03%7E01-treeMenu-different-types.xhtml&r1=1133502&r2=1133537&rev=1133537&view=diff
==============================================================================
    (empty)

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/01/treeMenu-different-types.xhtml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/03/01/treeMenu-different-types.xhtml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java?rev=1133537&r1=1133536&r2=1133537&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/test/java/org/apache/myfaces/tobago/example/demo/NavigationUnitTest.java Wed Jun  8 19:56:54 2011
@@ -29,10 +29,10 @@ public class NavigationUnitTest extends 
   @Test
   public void testFileNames() {
     List<String> list = Arrays.asList(
-        "00-test-1.xhtml",
-        "00~07-test-2.xhtml",
-        "01-test.xhtml",
-        "00~00-test-4.xhtml",
+        "00/test-1.xhtml",
+        "00/07/test-2.xhtml",
+        "01/test.xhtml",
+        "00/00/test-4.xhtml",
         "bad.xhtml",
         "00_00_bad.xhtml"
     );
@@ -46,10 +46,10 @@ public class NavigationUnitTest extends 
     Assert.assertEquals("01", n01.getBranch());
     Assert.assertEquals("test", n01.getName());
     final Navigation.Node n0000 = (Navigation.Node) n00.getChildAt(0);
-    Assert.assertEquals("00~00", n0000.getBranch());
+    Assert.assertEquals("00/00", n0000.getBranch());
     Assert.assertEquals("test-4", n0000.getName());
     final Navigation.Node n0007 = (Navigation.Node) n00.getChildAt(1);
-    Assert.assertEquals("00~07", n0007.getBranch());
+    Assert.assertEquals("00/07", n0007.getBranch());
     Assert.assertEquals("test-2", n0007.getName());
   }
 }