Updated Branches: refs/heads/master b8e15bfc3 -> 75eaf6a5e
TAP5-2137: Tree component renders empty nodes as expandable, AssertionError when expanded Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/75eaf6a5 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/75eaf6a5 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/75eaf6a5 Branch: refs/heads/master Commit: 75eaf6a5ecba47b5ba9bd498aae57c51b73facba Parents: b8e15bf Author: Howard M. Lewis Ship <[email protected]> Authored: Sat Jun 29 11:14:32 2013 -0700 Committer: Howard M. Lewis Ship <[email protected]> Committed: Sat Jun 29 11:14:32 2013 -0700 ---------------------------------------------------------------------- build.gradle | 19 ++++++++++++------- .../META-INF/modules/t5/core/tree.coffee | 17 +++++++++-------- .../resources/META-INF/assets/tapestry5/tree.css | 4 ++-- .../apache/tapestry5/integration/app1/Stuff.java | 4 ++++ .../integration/app1/StuffTreeModelAdapter.java | 7 +++++++ 5 files changed, 34 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/75eaf6a5/build.gradle ---------------------------------------------------------------------- diff --git a/build.gradle b/build.gradle index 7c70f31..417dcf4 100755 --- a/build.gradle +++ b/build.gradle @@ -34,7 +34,7 @@ project.version = tapestryVersion() def tapestryVersion() { def major = "5.4" - def minor = "-alpha-10 " + def minor = "-alpha-10" // When building on the CI server, make sure -SNAPSHOT is appended, as it is a nightly build. // When building normally, or for a release, no suffix is desired. @@ -96,7 +96,9 @@ allprojects { project { // Leave at 1.5 to make sure that IDEA doesn't break the build for non-IDEA users by inserting // @Override on implementations all over the place. - jdkName = "1.5" + languageLevel = "1.5" + // But this is what most (all?) of the devs are actually using: + jdkName = "1.7" } } @@ -320,6 +322,7 @@ task aggregateJavadoc(type: Javadoc) { task coffeeScriptDocs(type: Exec) { group "Documentation" description "Build docco documentation for all CoffeeScript sources" + dependsOn project(":tapestry-core").tasks.preprocessCoffeeScript def outputDir = file("$buildDir/documentation/coffeescript") @@ -328,16 +331,19 @@ task coffeeScriptDocs(type: Exec) { def sources = files() subprojects.each { sub -> - // When I figure out how to get the preprocessed CoffeeScript included, this can change to src/main/coffeescript - sources += sub.fileTree("src/main", { include "**/*.coffee" }) + sources += sub.fileTree("src/main/coffeescript", { include "**/*.coffee" }) } + sources += project(":tapestry-core").tasks.preprocessCoffeeScript.outputs.files.asFileTree + + logger.error "sources=$sources" + // Needs to be installed via "npm install -g docco" executable isWindows() ? "docco.cmd" : "docco" args "--output", outputDir args sources.files.sort({ a,b -> a.name.compareTo b.name }) - inputs.files sources + inputs.files { sources } outputs.dir outputDir } @@ -348,8 +354,7 @@ dependencies { } task continuousIntegration { - // Temporarily removed aggregateJavadoc as there's an issue w.r.t JDK on the CI server - dependsOn subprojects.build, subprojects.uploadPublished + dependsOn subprojects.build, aggregateJavadoc, subprojects.uploadPublished description "Task executed on Jenkins CI server after SVN commits" } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/75eaf6a5/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/tree.coffee ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/tree.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/tree.coffee index e8ef4f4..5d89663 100644 --- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/tree.coffee +++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/tree.coffee @@ -58,6 +58,8 @@ define ["./dom", "./ajax", "./zone"], node.meta LOADING, false node.meta LOADED, true + # toggles a folder in the tree between expanded and collapsed (once data for the folder + # has been loaded). toggle = (node) -> sublist = node.findParent("li").findFirst("ul") @@ -71,19 +73,18 @@ define ["./dom", "./ajax", "./zone"], sublist.show() send node, "markExpanded" + # The handler is triggered on the `<span data-node-id=''>` directly inside the `<li>`. clickHandler = -> - # First case is dynamically loaded due to user action; second case - # is rendered with overall page due to server-side expansion model. - loaded = (@meta LOADED) or (@hasClass EXPANDED) - - if (not loaded) and (not @hasClass "t-empty-node") - loadChildren this + # Ignore clicks on leaf nodes, and on folders that are known to be empty. + if (@parent().hasClass "leaf-node") or (@hasClass "empty-node") return false - unless @hasClass "leaf-node" + # If not already loaded then fire off the Ajax request to load the content. + if (@meta LOADED) or (@hasClass EXPANDED) toggle this - return false + else + loadChildren this return false http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/75eaf6a5/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tree.css ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tree.css b/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tree.css index bfe38c2..431bf75 100644 --- a/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tree.css +++ b/tapestry-core/src/main/resources/META-INF/assets/tapestry5/tree.css @@ -66,9 +66,9 @@ DIV[data-tree-node-selection-enabled] LI.leaf-node > .tree-label.selected-leaf-n background-position: -64px -16px; } -SPAN.tree-icon-empty-node { +SPAN.tree-icon.empty-node { cursor: default; - background-position: -64px 0px !important; + background-position: -32px 0px; } SPAN.tree-expanded { http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/75eaf6a5/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/Stuff.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/Stuff.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/Stuff.java index 23d7cec..05ded5a 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/Stuff.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/Stuff.java @@ -90,6 +90,10 @@ public class Stuff } ROOT.addChild(numbers); + + ROOT.addChild(new Stuff("Empty")); + // Special case: appears as a folder, even with no children: + ROOT.addChild(new Stuff("Empty Folder")); } public static TreeModel<Stuff> createTreeModel() http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/75eaf6a5/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/StuffTreeModelAdapter.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/StuffTreeModelAdapter.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/StuffTreeModelAdapter.java index e5fd893..d97364e 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/StuffTreeModelAdapter.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/StuffTreeModelAdapter.java @@ -22,6 +22,13 @@ public class StuffTreeModelAdapter implements TreeModelAdapter<Stuff> { public boolean isLeaf(Stuff value) { + // Special case: + + if (value.name.equals("Empty Folder")) + { + return false; + } + return !hasChildren(value); }
