01 
02 /*
03  *  JavaDoq 1.0 - DOCUment JAVA In Source
04  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.javadoq.com>
05  *  
06  *  This program is free software: you can redistribute it and/or modify
07  *  it under the terms of the GNU Affero General Public License as published by
08  *  the Free Software Foundation, either version 3 of the License, or
09  *  (at your option) any later version.
10  *  
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU Affero General Public License for more details.
15  *  
16  *  You should have received a copy of the GNU Affero General Public License
17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 package com.javadoq.html;
21 
22 import java.io.File;
23 import java.util.ArrayList;
24 import java.util.Collections;
25 import java.util.List;
26 
27 import com.javadoq.JavaDoq;
28 import com.javadoq.JavaPackage;
29 
30 /**
31  * <p>Creates "packages.html" file.</p>
32  * <p>Note that a transformer of this type needs to close to close its target HTML file.</p>
33  * 
34  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.javadoq.com" target="_blank">http://www.javadoq.com</a>
35  */
36 public class DoqHTMLPackages extends DoqHTMLBody
37 {
38     /**
39      * <p>Constructs a {@link DoqHTMLPackages} transformer.</p>
40      * <p>This constructor invokes its super constructor to create and open the target file
41      * and HTML body.</p>
42      * @param jdoq The {@link JavaDoq} environment for the transformer.
43      * @since 1.0
44      */
45     public DoqHTMLPackages(JavaDoq jdoq) {
46         super(jdoq, jdoq.dst + File.separator + "packages.html", jdoq.title);
47         writeLine("<font size=\"+1\"><a href=\"overview.html\" target=\"source-frame\">" + jdoq.title + "</a></font>");
48         writeLine("<br><a href=\"allfiles.html\" target=\"package-frame\">All Files</a>");
49         writeLine("<br><font size=\"+1\">Packages</font>");
50         List<String> list = new ArrayList<String>(jdoq.packages.keySet());
51         Collections.sort(list);
52         for (String text : list) {
53             JavaPackage pkg = jdoq.packages.get(text);
54             writeFrameItem(pkg.getLink(), "package-frame", pkg.title());
55         }
56     }
57 }