예제 #1
0
파일: APIGen.java 프로젝트: rssh/termware2
 private void buildListOfAllPatterns(Domain domain, String prefix, int level)
     throws TermWareException {
   SortedSet directSystemNames = domain.getNamesOfSystems();
   Iterator systemsIterator = directSystemNames.iterator();
   while (systemsIterator.hasNext()) {
     String name = (String) systemsIterator.next();
     TermSystem system = domain.resolveSystem(name);
     SortedSet<String> names = system.getPatternNames();
     Iterator namesIterator = names.iterator();
     while (namesIterator.hasNext()) {
       String patternName = (String) namesIterator.next();
       if (!allPatterns_.containsKey(patternName)) {
         HashSet indexEntries = new HashSet();
         allPatterns_.put(patternName, indexEntries);
       }
       HashSet systemsSet = (HashSet) allPatterns_.get(patternName);
       systemsSet.add(new APIGen.PatternIndexEntry(prefix, domain, name, level));
     }
   }
   SortedSet domainsSet = domain.getNamesOfDirectSubdomains();
   Iterator domainsIterator = domainsSet.iterator();
   while (domainsIterator.hasNext()) {
     String subdomainName = (String) domainsIterator.next();
     Domain subdomain = domain.getDirectSubdomain(subdomainName);
     buildListOfAllPatterns(subdomain, prefix + subdomainName + "/", level + 1);
   }
 }
예제 #2
0
파일: APIGen.java 프로젝트: rssh/termware2
  private void generateSystemPages(Domain domain, String prefix, int level)
      throws IOException, TermWareException {
    SortedSet directSystemNames = domain.getNamesOfSystems();
    Iterator systemsIterator = directSystemNames.iterator();
    while (systemsIterator.hasNext()) {
      String name = (String) systemsIterator.next();
      PrintStream out = openPrintStream(prefix + name, "all-patterns.html");
      printHeader(out, "patterns for " + name);
      out.println("<BODY BGCOLOR=\"white\">");
      out.println("<TABLE BORDER=\"0\" WIDTH=\"100%\">");
      out.println("<TR>");
      out.println("<TD NOWRAP><FONT size=\"+1\">");
      out.println("Patterns");
      out.println("</FONT></TD>");
      out.println("</TR></TABLE>");
      out.println("<TABLE BORDER=\"0\" WIDTH=\"100%\">");
      out.println("<TR><TD NOWRAP><P>");
      out.println("<FONT>");

      TermSystem system = domain.resolveSystem(name);
      SortedSet names = system.getPatternNames();
      Iterator namesIterator = names.iterator();
      while (namesIterator.hasNext()) {
        String patternName = (String) namesIterator.next();
        String uri = prefix + name + "/index.html#" + patternName;
        out.print("<A href=\"../");
        for (int i = 0; i < level; ++i) {
          out.print("../");
        }
        out.print(uri + "\" TARGET=\"transformerFrame\" >");
        out.print(patternName);
        out.println("</A>");
        out.println("<BR>");
      }
      out.println("</FONT>");
      out.println("</TD>");
      out.println("</TR>");
      out.println("</TABLE>");
      out.println("<P>&nbsp;</BODY></HTML>");
      out.close();
      out = openPrintStream(prefix + name, "index.html");
      TermSystem ts = domain.resolveSystem(name);
      printSystemIndexPage(out, prefix + name, ts);
      out.close();
    }
    SortedSet domainsSet = domain.getNamesOfDirectSubdomains();
    Iterator domainsIterator = domainsSet.iterator();
    while (domainsIterator.hasNext()) {
      String subdomainName = (String) domainsIterator.next();
      Domain subdomain = domain.getDirectSubdomain(subdomainName);
      generateSystemPages(subdomain, prefix + subdomainName + "/", level + 1);
    }
  }
예제 #3
0
파일: APIGen.java 프로젝트: rssh/termware2
 private void printSystemIndexPage(PrintStream out, String systemName, TermSystem ts)
     throws IOException, TermWareException {
   printHeader(out, systemName);
   out.println("<BODY BGCOLOR=\"white\">");
   SortedSet patternNames = ts.getPatternNames();
   Iterator patternsIterator = patternNames.iterator();
   while (patternsIterator.hasNext()) {
     String patternName = (String) patternsIterator.next();
     out.println("<HR><A NAME=\"" + patternName + "\"><!-- --></A>");
     out.println("<FONT +1>" + patternName + "</FONT><BR>");
     out.println("<ul>");
     Iterator it = ts.getStrategy().getStar().iterator(patternName);
     HashSet sourceOnlyRules = new HashSet();
     while (it.hasNext()) {
       ITermTransformer tr = (ITermTransformer) it.next();
       String description = tr.getDescription();
       if (description.length() == 0) {
         sourceOnlyRules.add(tr);
       } else {
         out.println("<li>");
         out.print(description);
         out.println("</li>");
       }
     }
     if (!sourceOnlyRules.isEmpty()) {
       Iterator sourceOnlyIterator = sourceOnlyRules.iterator();
       while (sourceOnlyIterator.hasNext()) {
         ITermTransformer tr = (ITermTransformer) sourceOnlyIterator.next();
         out.println("<li><code>");
         out.println(tr.getSource());
         out.println("</code></li>");
       }
     }
     out.println("</ul>");
   }
   out.println("</BODY></HTML>");
 }