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.Collections;
24 import java.util.Comparator;
25 import java.util.List;
26 
27 import com.javadoq.JavaDoq;
28 import com.javadoq.SourceFile;
29 
30 /**
31  * <p>Creates "allfiles.html" file.</p>
32  * <p>Note that a transformer of this type needs to close to close its opened 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 DoqHTMLAllFiles extends DoqHTMLBody
37 {
38     /**
39      * <p>Constructs a {@link DoqHTMLAllFiles} 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 DoqHTMLAllFiles(JavaDoq jdoq) {
46         super(jdoq, jdoq.dst + File.separator + "allfiles.html", "All Files");
47         writeLine("<font size=\"+1\">All Files</font>");
48 
49         List<SourceFile> list = jdoq.getAllFiles();
50         Collections.sort(list, new Comparator<SourceFile>() {
51             public int compare(SourceFile o1, SourceFile o2) {
52                 return o1.name.compareTo(o2.name);
53             }
54         });
55         for (SourceFile f : list) {
56             writeFrameItem(f.getLink(), "source-frame", f.name);
57         }
58     }
59 }