summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Dougherty <ddougherty@google.com>2013-09-13 19:42:44 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-09-13 19:42:44 -0700
commit8bdc633e4747daed2c3d016d3baa35b76dc05ad4 (patch)
treea705ec0f16e2f9a2214840fc7a3411eaba0d44e4
parent3be5aed8a823e2f5d3456f445b158ab2aa99228b (diff)
parent8c33a22b7fa09f1bfcb4661caf52a16d1bd8b030 (diff)
downloaddoclava-kitkat-cts-release.tar.gz
am 8c33a22b: am aba01a72: Merge "Snip empty group nodes from samples_navtree_data so they don\'t show up in TOC." into jb-mr2-docsandroid-cts-4.4_r4android-4.4_r1.2.0.1android-4.4_r1.2android-4.4_r1.1.0.1android-4.4_r1.1android-4.4_r1.0.1android-4.4_r1android-4.4_r0.9android-4.4_r0.8kitkat-releasekitkat-cts-release
* commit '8c33a22b7fa09f1bfcb4661caf52a16d1bd8b030': Snip empty group nodes from samples_navtree_data so they don't show up in TOC.
-rw-r--r--src/com/google/doclava/SampleCode.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/src/com/google/doclava/SampleCode.java b/src/com/google/doclava/SampleCode.java
index 466d247..141e2b5 100644
--- a/src/com/google/doclava/SampleCode.java
+++ b/src/com/google/doclava/SampleCode.java
@@ -340,7 +340,7 @@ public class SampleCode {
}
/**
- * Render a SC node to a navtree js file.
+ * Render a SC node tree to a navtree js file.
*/
public static void writeSamplesNavTree(List<Node> tnode, List<Node> groupnodes) {
@@ -350,6 +350,12 @@ public class SampleCode {
for (int i = 0; i < tnode.size(); i++) {
groupnodes = appendNodeGroups(tnode.get(i), groupnodes);
}
+ for (int n = 0; n < groupnodes.size(); n++) {
+ if (groupnodes.get(n).getChildren() == null) {
+ groupnodes.remove(n);
+ n--;
+ }
+ }
node.setChildren(groupnodes);
}
@@ -370,22 +376,23 @@ public class SampleCode {
}
/**
- * Iterate the list of projects and sort them by their groups. Samples the reference
- * a valid sample group tag are added to a list for that group. Samples declare a
- * sample.group tag in their _index.jd files.
+ * For a given project root node, get the group and then iterate the list of valid
+ * groups looking for a match. If found, append the project to that group node.
+ * Samples the reference a valid sample group tag are added to a list for that
+ * group. Samples declare a sample.group tag in their _index.jd files.
*/
private static List<Node> appendNodeGroups(Node gNode, List<Node> groupnodes) {
List<Node> mgrouplist = new ArrayList<Node>();
- final int N = groupnodes.size();
- for (int i = 0; i < N; i++) {
+ for (int i = 0; i < groupnodes.size(); i++) {
if (groupnodes.get(i).getLabel().equals(gNode.getGroup())) {
if (groupnodes.get(i).getChildren() == null) {
+ mgrouplist.add(gNode);
groupnodes.get(i).setChildren(mgrouplist);
+ } else {
+ groupnodes.get(i).getChildren().add(gNode);
}
- mgrouplist.add(gNode);
- //System.out.println("Added " + gNode.getLabel() + " to group " + group);
break;
- } //?? no match
+ }
}
return groupnodes;
}