private Map<String, String> createNameIdMap(Map<String, Object> categorized) { Map<String, String> map = new HashMap<>(); for (Iterator<String> iter = categorized.keySet().iterator(); iter.hasNext();) { String key = iter.next(); Object value = categorized.get(key); ITocContribution toc; if (value instanceof TocCategory) { TocCategory category = (TocCategory)value; toc = category.get(0); } else { toc = (ITocContribution)value; } map.put(key, toc.getToc().getLabel()); } return map; }
for (int i=0;i<ordered.length;++i) { try { Toc toc = (Toc)ordered[i].getToc(); orderedTocs.add(toc); tocsById.put(ordered[i].getId(), toc);
for (int i=0;i<srcContributions.length;++i) { process(srcContributions[i]); IUAElement[] children = srcContributions[i].getToc().getChildren(); for (int j=0;j<children.length;++j) { parent.insertBefore((UAElement)children[j], anchor);
private void process(ITocContribution contribution) { if (processedContributions == null) { processedContributions = new HashSet<>(); } // don't process the same one twice if (!processedContributions.contains(contribution)) { if (processor == null) { processor = new DocumentProcessor(); } if (handlers == null) { DocumentReader reader = new DocumentReader(); handlers = new ProcessorHandler[] { new NormalizeHandler(), new LinkHandler(), new AnchorHandler(), new IncludeHandler(reader, contribution.getLocale()), new ExtensionHandler(reader, contribution.getLocale()), }; } processor.setHandlers(handlers); processor.process((Toc)contribution.getToc(), contribution.getId()); processedContributions.add(contribution); } }
contribution.setLocale(contrib[j].getLocale()); contribution.setPrimary(contrib[j].isPrimary()); IToc toc = contrib[j].getToc(); Toc t = toc instanceof Toc ? (Toc)toc : (Toc)UAElementFactory.newElement(toc); t.setLinkTo(contrib[j].getLinkTo());