68 private final Element element; |
68 private final Element element; |
69 private final Contents contents; |
69 private final Contents contents; |
70 private final DocPath path; |
70 private final DocPath path; |
71 private final DocPath pathToRoot; |
71 private final DocPath pathToRoot; |
72 private final Links links; |
72 private final Links links; |
73 private final HtmlTree fixedNavDiv; |
|
74 private final PageMode documentedPage; |
73 private final PageMode documentedPage; |
75 private Content navLinkModule; |
74 private Content navLinkModule; |
76 private Content navLinkPackage; |
75 private Content navLinkPackage; |
77 private Content navLinkClass; |
76 private Content navLinkClass; |
78 private MemberSummaryBuilder memberSummaryBuilder; |
77 private MemberSummaryBuilder memberSummaryBuilder; |
131 * Creates a {@code Navigation} object for a specific file, to be written in a specific HTML |
127 * Creates a {@code Navigation} object for a specific file, to be written in a specific HTML |
132 * version. |
128 * version. |
133 * |
129 * |
134 * @param element element being documented. null if its not an element documentation page |
130 * @param element element being documented. null if its not an element documentation page |
135 * @param configuration the configuration object |
131 * @param configuration the configuration object |
136 * @param fixedNavDiv the fixed navigation for the header navigation |
|
137 * @param page the kind of page being documented |
132 * @param page the kind of page being documented |
138 * @param path the DocPath object |
133 * @param path the DocPath object |
139 */ |
134 */ |
140 public Navigation(Element element, HtmlConfiguration configuration, HtmlTree fixedNavDiv, |
135 public Navigation(Element element, HtmlConfiguration configuration, PageMode page, DocPath path) { |
141 PageMode page, DocPath path) { |
|
142 this.configuration = configuration; |
136 this.configuration = configuration; |
143 this.element = element; |
137 this.element = element; |
144 this.fixedNavDiv = fixedNavDiv; |
|
145 this.contents = configuration.contents; |
138 this.contents = configuration.contents; |
146 this.documentedPage = page; |
139 this.documentedPage = page; |
147 this.path = path; |
140 this.path = path; |
148 this.pathToRoot = path.parent().invert(); |
141 this.pathToRoot = path.parent().invert(); |
149 this.links = new Links(path); |
142 this.links = new Links(path); |
939 searchDiv.add(inputText); |
932 searchDiv.add(inputText); |
940 searchDiv.add(inputReset); |
933 searchDiv.add(inputReset); |
941 tree.add(searchDiv); |
934 tree.add(searchDiv); |
942 } |
935 } |
943 |
936 |
944 private void addFixedNavScript(Content tree) { |
|
945 tree.add(FIXED_NAV_SCRIPT.asContent()); |
|
946 } |
|
947 |
|
948 /** |
937 /** |
949 * Get the navigation content. |
938 * Get the navigation content. |
950 * |
939 * |
951 * @param top true if the top navigation bar is to be printed |
940 * @param top true if the top navigation bar is to be printed |
952 * @return the navigation contents |
941 * @return the navigation contents |
953 */ |
942 */ |
954 public Content getContent(boolean top) { |
943 public Content getContent(boolean top) { |
955 Content contentTree = new ContentBuilder(); |
944 if (configuration.nonavbar) { |
956 if (!configuration.nonavbar) { |
945 return new ContentBuilder(); |
957 Deque<Content> queue; |
946 } |
958 Content tree = HtmlTree.NAV(); |
947 Deque<Content> queue; |
959 HtmlTree navDiv = new HtmlTree(HtmlTag.DIV); |
948 Content tree = HtmlTree.NAV(); |
960 if (top) { |
949 HtmlTree navDiv = new HtmlTree(HtmlTag.DIV); |
961 queue = topBottomNavContents.get(Position.TOP); |
950 if (top) { |
962 fixedNavDiv.add(Position.TOP.startOfNav()); |
951 queue = topBottomNavContents.get(Position.TOP); |
963 navDiv.setStyle(HtmlStyle.topNav); |
952 tree.add(Position.TOP.startOfNav()); |
964 } else { |
953 navDiv.setStyle(HtmlStyle.topNav); |
965 queue = topBottomNavContents.get(Position.BOTTOM); |
954 } else { |
966 tree.add(Position.BOTTOM.startOfNav()); |
955 queue = topBottomNavContents.get(Position.BOTTOM); |
967 navDiv.setStyle(HtmlStyle.bottomNav); |
956 tree.add(Position.BOTTOM.startOfNav()); |
968 } |
957 navDiv.setStyle(HtmlStyle.bottomNav); |
969 navDiv.add(queue.poll()); |
958 } |
970 HtmlTree skipLinkDiv = HtmlTree.DIV(HtmlStyle.skipNav, queue.poll()); |
959 navDiv.add(queue.poll()); |
971 navDiv.add(skipLinkDiv); |
960 HtmlTree skipLinkDiv = HtmlTree.DIV(HtmlStyle.skipNav, queue.poll()); |
972 navDiv.add(queue.poll()); |
961 navDiv.add(skipLinkDiv); |
973 HtmlTree navList = new HtmlTree(HtmlTag.UL); |
962 navDiv.add(queue.poll()); |
974 navList.setStyle(HtmlStyle.navList); |
963 HtmlTree navList = new HtmlTree(HtmlTag.UL); |
975 navList.put(HtmlAttr.TITLE, rowListTitle); |
964 navList.setStyle(HtmlStyle.navList); |
976 fixedNavDiv.setStyle(HtmlStyle.fixedNav); |
965 navList.put(HtmlAttr.TITLE, rowListTitle); |
977 addMainNavLinks(navList); |
966 addMainNavLinks(navList); |
978 navDiv.add(navList); |
967 navDiv.add(navList); |
979 Content aboutDiv = HtmlTree.DIV(HtmlStyle.aboutLanguage, top ? userHeader : userFooter); |
968 Content aboutDiv = HtmlTree.DIV(HtmlStyle.aboutLanguage, top ? userHeader : userFooter); |
980 navDiv.add(aboutDiv); |
969 navDiv.add(aboutDiv); |
981 if (top) { |
970 tree.add(navDiv); |
982 fixedNavDiv.add(navDiv); |
971 HtmlTree subDiv = new HtmlTree(HtmlTag.DIV); |
983 } else { |
972 subDiv.setStyle(HtmlStyle.subNav); |
984 tree.add(navDiv); |
973 HtmlTree div = new HtmlTree(HtmlTag.DIV); |
985 } |
974 // Add the summary links if present. |
986 HtmlTree subDiv = new HtmlTree(HtmlTag.DIV); |
975 HtmlTree ulNavSummary = new HtmlTree(HtmlTag.UL); |
987 subDiv.setStyle(HtmlStyle.subNav); |
976 ulNavSummary.setStyle(HtmlStyle.subNavList); |
988 HtmlTree div = new HtmlTree(HtmlTag.DIV); |
977 addSummaryLinks(ulNavSummary); |
989 // Add the summary links if present. |
978 div.add(ulNavSummary); |
990 HtmlTree ulNavSummary = new HtmlTree(HtmlTag.UL); |
979 // Add the detail links if present. |
991 ulNavSummary.setStyle(HtmlStyle.subNavList); |
980 HtmlTree ulNavDetail = new HtmlTree(HtmlTag.UL); |
992 addSummaryLinks(ulNavSummary); |
981 ulNavDetail.setStyle(HtmlStyle.subNavList); |
993 div.add(ulNavSummary); |
982 addDetailLinks(ulNavDetail); |
994 // Add the detail links if present. |
983 div.add(ulNavDetail); |
995 HtmlTree ulNavDetail = new HtmlTree(HtmlTag.UL); |
984 subDiv.add(div); |
996 ulNavDetail.setStyle(HtmlStyle.subNavList); |
985 if (top && configuration.createindex) { |
997 addDetailLinks(ulNavDetail); |
986 addSearch(subDiv); |
998 div.add(ulNavDetail); |
987 } |
999 subDiv.add(div); |
988 tree.add(subDiv); |
1000 if (top && configuration.createindex) { |
989 if (top) { |
1001 addSearch(subDiv); |
990 tree.add(Position.TOP.endOfNav()); |
1002 } |
991 tree.add(HtmlTree.DIV(HtmlStyle.skipNav, queue.poll())); |
1003 if (top) { |
992 } else { |
1004 fixedNavDiv.add(subDiv); |
993 tree.add(queue.poll()); |
1005 fixedNavDiv.add(queue.poll()); |
994 tree.add(Position.BOTTOM.endOfNav()); |
1006 fixedNavDiv.add(Position.TOP.endOfNav()); |
995 } |
1007 tree.add(fixedNavDiv); |
996 return tree; |
1008 HtmlTree paddingDiv = HtmlTree.DIV(HtmlStyle.navPadding, Entity.NO_BREAK_SPACE); |
|
1009 tree.add(paddingDiv); |
|
1010 addFixedNavScript(tree); |
|
1011 } else { |
|
1012 tree.add(subDiv); |
|
1013 tree.add(queue.poll()); |
|
1014 tree.add(Position.BOTTOM.endOfNav()); |
|
1015 } |
|
1016 return tree; |
|
1017 } |
|
1018 return contentTree; |
|
1019 } |
997 } |
1020 } |
998 } |