/**
   * Constructor.
   *
   * @param filename the file to be generated.
   * @throws IOException
   * @throws DocletAbortException
   */
  public PackageUseWriter(
      ConfigurationImpl configuration, ClassUseMapper mapper, DocPath filename, PackageDoc pkgdoc)
      throws IOException {
    super(configuration, DocPath.forPackage(pkgdoc).resolve(filename));
    this.pkgdoc = pkgdoc;

    // by examining all classes in this package, find what packages
    // use these classes - produce a map between using package and
    // used classes.
    ClassDoc[] content = pkgdoc.allClasses();
    for (int i = 0; i < content.length; ++i) {
      ClassDoc usedClass = content[i];
      Set<ClassDoc> usingClasses = mapper.classToClass.get(usedClass.qualifiedName());
      if (usingClasses != null) {
        for (Iterator<ClassDoc> it = usingClasses.iterator(); it.hasNext(); ) {
          ClassDoc usingClass = it.next();
          PackageDoc usingPackage = usingClass.containingPackage();
          Set<ClassDoc> usedClasses = usingPackageToUsedClasses.get(usingPackage.name());
          if (usedClasses == null) {
            usedClasses = new TreeSet<ClassDoc>();
            usingPackageToUsedClasses.put(Util.getPackageName(usingPackage), usedClasses);
          }
          usedClasses.add(usedClass);
        }
      }
    }
  }
 /**
  * Get the tree link.
  *
  * @return a content tree for the tree link
  */
 protected Content getNavLinkTree() {
   Content linkContent =
       classdoc.containingPackage().isIncluded()
           ? getHyperLink(DocPath.parent.resolve(DocPaths.PACKAGE_TREE), treeLabel)
           : getHyperLink(pathToRoot.resolve(DocPaths.OVERVIEW_TREE), treeLabel);
   Content li = HtmlTree.LI(linkContent);
   return li;
 }
Пример #3
0
 /**
  * Get the name of the package, this class is in.
  *
  * @param cd ClassDoc.
  */
 public String getPkgName(ClassDoc cd) {
   String pkgName = cd.containingPackage().name();
   if (pkgName.length() > 0) {
     pkgName += ".";
     return pkgName;
   }
   return "";
 }
 /**
  * Return true if the given <code>ProgramElement</code> is inherited by the class that is being
  * documented.
  *
  * @param ped The <code>ProgramElement</code> being checked. return true if the <code>
  *     ProgramElement</code> is being inherited and false otherwise.
  */
 protected boolean isInherited(ProgramElementDoc ped) {
   if (ped.isPrivate()
       || (ped.isPackagePrivate()
           && !ped.containingPackage().equals(classdoc.containingPackage()))) {
     return false;
   }
   return true;
 }
 /**
  * Write out class use pages.
  *
  * @throws DocletAbortException
  */
 public static void generate(ConfigurationImpl configuration, ClassTree classtree) {
   ClassUseMapper mapper = new ClassUseMapper(configuration.root, classtree);
   for (ClassDoc aClass : configuration.root.classes()) {
     // If -nodeprecated option is set and the containing package is marked
     // as deprecated, do not generate the class-use page. We will still generate
     // the class-use page if the class is marked as deprecated but the containing
     // package is not since it could still be linked from that package-use page.
     if (!(configuration.nodeprecated && Util.isDeprecated(aClass.containingPackage())))
       ClassUseWriter.generate(configuration, mapper, aClass);
   }
   for (PackageDoc pkg : configuration.packages) {
     // If -nodeprecated option is set and the package is marked
     // as deprecated, do not generate the package-use page.
     if (!(configuration.nodeprecated && Util.isDeprecated(pkg)))
       PackageUseWriter.generate(configuration, mapper, pkg);
   }
 }
 void generate() {
   if (rootDoc == null || outputdir == null) {
     return;
   }
   for (PackageDoc pd : rootDoc.specifiedPackages()) {
     // If -nodeprecated option is set and the package is marked as deprecated,
     // do not convert the package files to HTML.
     if (!(configuration.nodeprecated && utils.isDeprecated(pd))) convertPackage(pd, outputdir);
   }
   for (ClassDoc cd : rootDoc.specifiedClasses()) {
     // If -nodeprecated option is set and the class is marked as deprecated
     // or the containing package is deprecated, do not convert the
     // package files to HTML.
     if (!(configuration.nodeprecated
         && (utils.isDeprecated(cd) || utils.isDeprecated(cd.containingPackage()))))
       convertClass(cd, outputdir);
   }
 }