You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2007/10/13 01:39:24 UTC
svn commit: r584329 - in
/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc:
GenerateHTMLDoc.java GenerateHTMLIndex.java JSDocTask.java
Author: vsiveton
Date: Fri Oct 12 16:39:16 2007
New Revision: 584329
URL: http://svn.apache.org/viewvc?rev=584329&view=rev
Log:
o applied Maven Code Style
o no code changed
Modified:
maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/GenerateHTMLDoc.java
maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/GenerateHTMLIndex.java
maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/JSDocTask.java
Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/GenerateHTMLDoc.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/GenerateHTMLDoc.java?rev=584329&r1=584328&r2=584329&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/GenerateHTMLDoc.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/GenerateHTMLDoc.java Fri Oct 12 16:39:16 2007
@@ -1,3 +1,5 @@
+package org.apache.maven.jxr.js.doc;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,8 +17,6 @@
* limitations under the License.
*/
-package org.apache.maven.jxr.js.doc;
-
import org.apache.log4j.Logger;
import java.io.BufferedReader;
@@ -31,139 +31,196 @@
*
* @version $Id: $
*/
-public class GenerateHTMLDoc {
+public class GenerateHTMLDoc
+{
/** Logger for this class */
private static final Logger log = Logger.getLogger( GenerateHTMLDoc.class );
private static FileOutputStream fos;
+
private static BufferedReader br;
- private static String LINE_SEPARATOR = String.valueOf((char) 13) + String.valueOf((char) 10);
+
+ private static String LINE_SEPARATOR = String.valueOf( (char) 13 ) + String.valueOf( (char) 10 );
+
private static String stringReader;
+
private static int functionCount = 0;
+
private static String functionName = "";
+
private static boolean parameterList = false;
+
private static boolean useList = false;
+
private boolean summary = true;
+
private boolean description = true;
- public GenerateHTMLDoc(File fis, String destDir) {
+ public GenerateHTMLDoc( File fis, String destDir )
+ {
String nomeArquivo = fis.getName();
- try {
- fos = new FileOutputStream(destDir + nomeArquivo.substring(0, nomeArquivo.indexOf(".")) + ".htm");
- br = new BufferedReader(new FileReader(fis));
+ try
+ {
+ fos = new FileOutputStream( destDir + nomeArquivo.substring( 0, nomeArquivo.indexOf( "." ) ) + ".htm" );
+ br = new BufferedReader( new FileReader( fis ) );
- } catch (FileNotFoundException fnfe) {
+ }
+ catch ( FileNotFoundException fnfe )
+ {
log.error( "FileNotFoundException: " + fnfe.getMessage(), fnfe );
}
- try {
- fos.write(("<html>" + LINE_SEPARATOR).getBytes());
- fos.write(("<head>" + LINE_SEPARATOR).getBytes());
- fos.write(("<style type='text/css'>" + LINE_SEPARATOR).getBytes());
- fos.write((".TableHeadingColor { background: #CCCCFF } /* Dark mauve */" + LINE_SEPARATOR).getBytes());
- fos.write((".NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */" + LINE_SEPARATOR).getBytes());
- fos.write(("</style>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TABLE WIDTH='100%'><TR><TD WIDTH='100%' CLASS='NavBarCell1'><H1>Javascript code documentation</H1></TD></TR></TABLE>" + LINE_SEPARATOR).getBytes());
- fos.write(("<title>Javascript code documentation</title>" + LINE_SEPARATOR).getBytes());
- fos.write(("</head>" + LINE_SEPARATOR).getBytes());
- fos.write(("<body>" + LINE_SEPARATOR).getBytes());
- fos.write(("<H2>Filename: " + nomeArquivo + "</H2>" + LINE_SEPARATOR).getBytes());
- fos.write(("<br>" + LINE_SEPARATOR).getBytes());
- fos.write(("<br>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TABLE BORDER='1' CELLPADDING='3' CELLSPACING='0' WIDTH='100%'>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TR CLASS='TableHeadingColor'>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TD ALIGN='left' colspan='2'><FONT SIZE='+2'>" + LINE_SEPARATOR).getBytes());
- fos.write(("<B>Function Summary</B></FONT></TD>" + LINE_SEPARATOR).getBytes());
- fos.write(("</TR>" + LINE_SEPARATOR).getBytes());
- while (br.ready()) {
+ try
+ {
+ fos.write( ( "<html>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<head>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<style type='text/css'>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( ".TableHeadingColor { background: #CCCCFF } /* Dark mauve */" + LINE_SEPARATOR )
+ .getBytes() );
+ fos.write( ( ".NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "</style>" + LINE_SEPARATOR ).getBytes() );
+ fos
+ .write( ( "<TABLE WIDTH='100%'><TR><TD WIDTH='100%' CLASS='NavBarCell1'><H1>Javascript code documentation</H1></TD></TR></TABLE>" + LINE_SEPARATOR )
+ .getBytes() );
+ fos.write( ( "<title>Javascript code documentation</title>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "</head>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<body>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<H2>Filename: " + nomeArquivo + "</H2>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<br>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<br>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<TABLE BORDER='1' CELLPADDING='3' CELLSPACING='0' WIDTH='100%'>" + LINE_SEPARATOR )
+ .getBytes() );
+ fos.write( ( "<TR CLASS='TableHeadingColor'>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<TD ALIGN='left' colspan='2'><FONT SIZE='+2'>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<B>Function Summary</B></FONT></TD>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "</TR>" + LINE_SEPARATOR ).getBytes() );
+ while ( br.ready() )
+ {
stringReader = br.readLine();
- while (summary && null != stringReader && stringReader.indexOf("summary") == -1) {
+ while ( summary && null != stringReader && stringReader.indexOf( "summary" ) == -1 )
+ {
stringReader = br.readLine();
}
summary = false;
- if (null != stringReader && stringReader.indexOf("/**") != -1) {
- fos.write(("<TR>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TD WIDTH='30%' BGCOLOR='#f3f3f3'><font face='Verdana'><b><span id='Function" + functionCount + "'></b></font></span></TD>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TD WIDTH='70%'>" + LINE_SEPARATOR).getBytes());
+ if ( null != stringReader && stringReader.indexOf( "/**" ) != -1 )
+ {
+ fos.write( ( "<TR>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<TD WIDTH='30%' BGCOLOR='#f3f3f3'><font face='Verdana'><b><span id='Function"
+ + functionCount + "'></b></font></span></TD>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<TD WIDTH='70%'>" + LINE_SEPARATOR ).getBytes() );
stringReader = br.readLine();
- while (null != stringReader && stringReader.indexOf("*/") == -1) {
+ while ( null != stringReader && stringReader.indexOf( "*/" ) == -1 )
+ {
- if (stringReader.indexOf("* @") != -1) {
- if ((stringReader.indexOf("author") == -1)) {
- if (stringReader.indexOf("param") != -1) {
- if (parameterList == false) {
+ if ( stringReader.indexOf( "* @" ) != -1 )
+ {
+ if ( ( stringReader.indexOf( "author" ) == -1 ) )
+ {
+ if ( stringReader.indexOf( "param" ) != -1 )
+ {
+ if ( parameterList == false )
+ {
parameterList = true;
- fos.write("<font size='-1' face='Verdana'><b>Parameters: </b></font>".getBytes());
- fos.write("<BR>".getBytes());
+ fos.write( "<font size='-1' face='Verdana'><b>Parameters: </b></font>"
+ .getBytes() );
+ fos.write( "<BR>".getBytes() );
}
- fos.write(" ".getBytes());
- fos.write((stringReader.substring(stringReader.indexOf("* @param") + 9) + LINE_SEPARATOR).getBytes());
- } else if (stringReader.indexOf("use") != -1) {
- if (useList == false) {
+ fos.write( " ".getBytes() );
+ fos
+ .write( ( stringReader.substring( stringReader.indexOf( "* @param" ) + 9 ) + LINE_SEPARATOR )
+ .getBytes() );
+ }
+ else if ( stringReader.indexOf( "use" ) != -1 )
+ {
+ if ( useList == false )
+ {
useList = true;
- fos.write("<font size='-1' face='Verdana'><b>Uso: </b></font>".getBytes());
- fos.write("<BR>".getBytes());
+ fos.write( "<font size='-1' face='Verdana'><b>Uso: </b></font>".getBytes() );
+ fos.write( "<BR>".getBytes() );
}
- fos.write(" ".getBytes());
- fos.write((stringReader.substring(stringReader.indexOf("* @use") + 7) + LINE_SEPARATOR).getBytes());
- } else if (stringReader.indexOf("return") != -1) {
- fos.write("<font size='-1' face='Verdana'><b>Return type: </b></font>".getBytes());
- fos.write((stringReader.substring(stringReader.indexOf("* @return") + 10) + LINE_SEPARATOR).getBytes());
+ fos.write( " ".getBytes() );
+ fos
+ .write( ( stringReader.substring( stringReader.indexOf( "* @use" ) + 7 ) + LINE_SEPARATOR )
+ .getBytes() );
}
- fos.write("<BR>".getBytes());
+ else if ( stringReader.indexOf( "return" ) != -1 )
+ {
+ fos.write( "<font size='-1' face='Verdana'><b>Return type: </b></font>".getBytes() );
+ fos
+ .write( ( stringReader.substring( stringReader.indexOf( "* @return" ) + 10 ) + LINE_SEPARATOR )
+ .getBytes() );
+ }
+ fos.write( "<BR>".getBytes() );
}
- } else {
- if (description) {
+ }
+ else
+ {
+ if ( description )
+ {
description = false;
- fos.write("<font size='-1' face='Verdana'><b>Description: </b></font>".getBytes());
- } else
- fos.write(" ".getBytes());
- fos.write((stringReader.substring(stringReader.indexOf("*") + 1) + LINE_SEPARATOR).getBytes());
- fos.write("<BR>".getBytes());
+ fos.write( "<font size='-1' face='Verdana'><b>Description: </b></font>".getBytes() );
+ }
+ else
+ fos.write( " ".getBytes() );
+ fos.write( ( stringReader.substring( stringReader.indexOf( "*" ) + 1 ) + LINE_SEPARATOR )
+ .getBytes() );
+ fos.write( "<BR>".getBytes() );
}
stringReader = br.readLine();
}
description = true;
parameterList = false;
useList = false;
- while (null != stringReader && stringReader.indexOf("function") == -1) {
+ while ( null != stringReader && stringReader.indexOf( "function" ) == -1 )
+ {
stringReader = br.readLine();
}
- if (stringReader.indexOf("function") != -1) {
- if (stringReader.indexOf("{") != -1) {
- functionName = stringReader.substring(stringReader.indexOf("function") + 9, stringReader.indexOf("{"));
- } else {
- functionName = stringReader.substring(stringReader.indexOf("function") + 9);
+ if ( stringReader.indexOf( "function" ) != -1 )
+ {
+ if ( stringReader.indexOf( "{" ) != -1 )
+ {
+ functionName = stringReader.substring( stringReader.indexOf( "function" ) + 9, stringReader
+ .indexOf( "{" ) );
+ }
+ else
+ {
+ functionName = stringReader.substring( stringReader.indexOf( "function" ) + 9 );
}
}
- fos.write(("</TD>" + LINE_SEPARATOR).getBytes());
- fos.write(("<script>document.all.Function" + functionCount + ".innerText = '" + functionName + "'; </script>" + LINE_SEPARATOR).getBytes());
+ fos.write( ( "</TD>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<script>document.all.Function" + functionCount + ".innerText = '" + functionName
+ + "'; </script>" + LINE_SEPARATOR ).getBytes() );
functionCount++;
- fos.write(("</TR>" + LINE_SEPARATOR).getBytes());
+ fos.write( ( "</TR>" + LINE_SEPARATOR ).getBytes() );
}
}
- fos.write(("</TABLE>" + LINE_SEPARATOR).getBytes());
- fos.write("</br>".getBytes());
- fos.write(("<a href='javascript:history.back()'><font size='+1'>Back</font></a>" + LINE_SEPARATOR).getBytes());
- fos.write("</body>".getBytes());
- fos.write("</html>".getBytes());
+ fos.write( ( "</TABLE>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( "</br>".getBytes() );
+ fos.write( ( "<a href='javascript:history.back()'><font size='+1'>Back</font></a>" + LINE_SEPARATOR )
+ .getBytes() );
+ fos.write( "</body>".getBytes() );
+ fos.write( "</html>".getBytes() );
- } catch (IOException ioe) {
+ }
+ catch ( IOException ioe )
+ {
log.error( "IOException: " + ioe.getMessage(), ioe );
}
if ( log.isInfoEnabled() )
{
- log.info( "Html generated with success!");
+ log.info( "Html generated with success!" );
}
}
- public static void main(String args[]) throws Exception{
+ public static void main( String args[] )
+ throws Exception
+ {
- GenerateHTMLDoc main1 = new GenerateHTMLDoc(new File(args[0]), args[1]);
+ GenerateHTMLDoc main1 = new GenerateHTMLDoc( new File( args[0] ), args[1] );
}
}
Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/GenerateHTMLIndex.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/GenerateHTMLIndex.java?rev=584329&r1=584328&r2=584329&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/GenerateHTMLIndex.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/GenerateHTMLIndex.java Fri Oct 12 16:39:16 2007
@@ -1,3 +1,5 @@
+package org.apache.maven.jxr.js.doc;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,8 +17,6 @@
* limitations under the License.
*/
-package org.apache.maven.jxr.js.doc;
-
import org.apache.log4j.Logger;
import org.apache.tools.ant.BuildException;
@@ -36,112 +36,150 @@
*
* @version $Id: $
*/
-public class GenerateHTMLIndex {
+public class GenerateHTMLIndex
+{
/** Logger for this class */
private static final Logger log = Logger.getLogger( GenerateHTMLIndex.class );
private static File file = null;
+
private static FileInputStream fis;
+
private static FileOutputStream fos;
+
private static BufferedReader br;
+
private static String stringReader;
- private static String LINE_SEPARATOR = String.valueOf((char) 13) + String.valueOf((char) 10);
+
+ private static String LINE_SEPARATOR = String.valueOf( (char) 13 ) + String.valueOf( (char) 10 );
+
private static Vector v = new Vector();
+
private static GenerateHTMLDoc docGenerator;
- public GenerateHTMLIndex(String jSDir, String destDir) {
+ public GenerateHTMLIndex( String jSDir, String destDir )
+ {
- if (jSDir == null) {
- throw new BuildException("jSDir attribute can't be empty");
- }
- if (destDir == null) {
- throw new BuildException("destDir can't be empty");
+ if ( jSDir == null )
+ {
+ throw new BuildException( "jSDir attribute can't be empty" );
+ }
+ if ( destDir == null )
+ {
+ throw new BuildException( "destDir can't be empty" );
}
- if (!"/".equals(jSDir.substring(jSDir.length() - 1))) {
+ if ( !"/".equals( jSDir.substring( jSDir.length() - 1 ) ) )
+ {
jSDir = jSDir + "/";
}
- if (!"/".equals(destDir.substring(destDir.length() - 1))) {
+ if ( !"/".equals( destDir.substring( destDir.length() - 1 ) ) )
+ {
destDir = destDir + "/";
}
- file = new File(jSDir);
+ file = new File( jSDir );
- if (!file.isDirectory()) {
- throw new BuildException("destDir has to be a directory");
+ if ( !file.isDirectory() )
+ {
+ throw new BuildException( "destDir has to be a directory" );
}
- collectFiles(file, v);
+ collectFiles( file, v );
- try {
- fos = new FileOutputStream(destDir + "index.htm");
+ try
+ {
+ fos = new FileOutputStream( destDir + "index.htm" );
- } catch (FileNotFoundException fnfe) {
- try {
- file = new File(destDir);
+ }
+ catch ( FileNotFoundException fnfe )
+ {
+ try
+ {
+ file = new File( destDir );
file.mkdir();
- fos = new FileOutputStream(destDir + "index.htm");
- } catch (FileNotFoundException e) {
+ fos = new FileOutputStream( destDir + "index.htm" );
+ }
+ catch ( FileNotFoundException e )
+ {
log.error( "FileNotFoundException: " + e.getMessage(), e );
}
}
- try {
- fos.write(("<html>" + LINE_SEPARATOR).getBytes());
- fos.write(("<head>" + LINE_SEPARATOR).getBytes());
- fos.write(("<style type='text/css'>" + LINE_SEPARATOR).getBytes());
- fos.write((".TableHeadingColor { background: #CCCCFF } /* Dark mauve */" + LINE_SEPARATOR).getBytes());
- fos.write((".NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */" + LINE_SEPARATOR).getBytes());
- fos.write(("</style>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TABLE WIDTH='100%'><TR><TD WIDTH='100%' CLASS='NavBarCell1'><H1>JavaScript Code Documentation</H1></TD></TR></TABLE>" + LINE_SEPARATOR).getBytes());
- fos.write(("<title>JavaScript Code Documentation</title>" + LINE_SEPARATOR).getBytes());
- fos.write(("</head>" + LINE_SEPARATOR).getBytes());
- fos.write(("<body>" + LINE_SEPARATOR).getBytes());
- fos.write(("<H2>Index</H2>" + LINE_SEPARATOR).getBytes());
- fos.write(("<br>" + LINE_SEPARATOR).getBytes());
- fos.write(("<br>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TABLE BORDER='1' CELLPADDING='3' CELLSPACING='0' WIDTH='100%'>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TR CLASS='TableHeadingColor'>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TD ALIGN='left'><FONT SIZE='+2' WIDTH='30%'>" + LINE_SEPARATOR).getBytes());
- fos.write(("<B>Filename</B></FONT></TD>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TD ALIGN='left'><FONT SIZE='+2' WIDTH='70%'>" + LINE_SEPARATOR).getBytes());
- fos.write(("<B>Summary</B></FONT></TD>" + LINE_SEPARATOR).getBytes());
- fos.write(("</TR>" + LINE_SEPARATOR).getBytes());
-
- for (int i = 0; i < v.size(); i++) {
- file = (File) v.get(i);
- docGenerator = new GenerateHTMLDoc(file, destDir);
+ try
+ {
+ fos.write( ( "<html>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<head>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<style type='text/css'>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( ".TableHeadingColor { background: #CCCCFF } /* Dark mauve */" + LINE_SEPARATOR )
+ .getBytes() );
+ fos.write( ( ".NavBarCell1 { background-color:#EEEEFF;}/* Light mauve */" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "</style>" + LINE_SEPARATOR ).getBytes() );
+ fos
+ .write( ( "<TABLE WIDTH='100%'><TR><TD WIDTH='100%' CLASS='NavBarCell1'><H1>JavaScript Code Documentation</H1></TD></TR></TABLE>" + LINE_SEPARATOR )
+ .getBytes() );
+ fos.write( ( "<title>JavaScript Code Documentation</title>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "</head>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<body>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<H2>Index</H2>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<br>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<br>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<TABLE BORDER='1' CELLPADDING='3' CELLSPACING='0' WIDTH='100%'>" + LINE_SEPARATOR )
+ .getBytes() );
+ fos.write( ( "<TR CLASS='TableHeadingColor'>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<TD ALIGN='left'><FONT SIZE='+2' WIDTH='30%'>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<B>Filename</B></FONT></TD>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<TD ALIGN='left'><FONT SIZE='+2' WIDTH='70%'>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<B>Summary</B></FONT></TD>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "</TR>" + LINE_SEPARATOR ).getBytes() );
+
+ for ( int i = 0; i < v.size(); i++ )
+ {
+ file = (File) v.get( i );
+ docGenerator = new GenerateHTMLDoc( file, destDir );
}
if ( log.isInfoEnabled() )
{
- log.info( "Number of .js files: " + v.size());
+ log.info( "Number of .js files: " + v.size() );
}
- for (int i = 0; i < v.size(); i++) {
+ for ( int i = 0; i < v.size(); i++ )
+ {
if ( log.isInfoEnabled() )
{
- log.info( "file: " + file.getName());
+ log.info( "file: " + file.getName() );
}
- file = (File) v.get(i);
+ file = (File) v.get( i );
- fos.write(("<TR>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TD WIDTH='30%' BGCOLOR='#f3f3f3'><font face='Verdana'><b><a href='" + file.getName().substring(0, file.getName().indexOf(".")) + ".htm" + "'>" + file.getName() + "</a></b></font></TD>" + LINE_SEPARATOR).getBytes());
- fos.write(("<TD WIDTH='70%'>" + LINE_SEPARATOR).getBytes());
+ fos.write( ( "<TR>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<TD WIDTH='30%' BGCOLOR='#f3f3f3'><font face='Verdana'><b><a href='"
+ + file.getName().substring( 0, file.getName().indexOf( "." ) ) + ".htm" + "'>" + file.getName()
+ + "</a></b></font></TD>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "<TD WIDTH='70%'>" + LINE_SEPARATOR ).getBytes() );
- try {
- fis = new FileInputStream(file);
- br = new BufferedReader(new InputStreamReader(fis));
+ try
+ {
+ fis = new FileInputStream( file );
+ br = new BufferedReader( new InputStreamReader( fis ) );
- while (br.ready()) {
+ while ( br.ready() )
+ {
stringReader = br.readLine();
- if (null != stringReader && stringReader.indexOf("/**") != -1) {
+ if ( null != stringReader && stringReader.indexOf( "/**" ) != -1 )
+ {
stringReader = br.readLine();
- while (null != stringReader && stringReader.indexOf("*/") == -1) {
- if (stringReader.indexOf("* @") != -1) {
- if (stringReader.indexOf("summary") != -1) {
-
- fos.write((stringReader.substring(stringReader.indexOf("* @summary") + 11) + LINE_SEPARATOR).getBytes());
- fos.write("<BR>".getBytes());
+ while ( null != stringReader && stringReader.indexOf( "*/" ) == -1 )
+ {
+ if ( stringReader.indexOf( "* @" ) != -1 )
+ {
+ if ( stringReader.indexOf( "summary" ) != -1 )
+ {
+
+ fos
+ .write( ( stringReader
+ .substring( stringReader.indexOf( "* @summary" ) + 11 ) + LINE_SEPARATOR )
+ .getBytes() );
+ fos.write( "<BR>".getBytes() );
}
}
stringReader = br.readLine();
@@ -149,37 +187,46 @@
}
}
- } catch (FileNotFoundException fnfe) {
+ }
+ catch ( FileNotFoundException fnfe )
+ {
log.error( "FileNotFoundException: " + fnfe.getMessage(), fnfe );
}
- fos.write(("</TD>" + LINE_SEPARATOR).getBytes());
- fos.write(("</TR>" + LINE_SEPARATOR).getBytes());
+ fos.write( ( "</TD>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( ( "</TR>" + LINE_SEPARATOR ).getBytes() );
}
- fos.write(("</TABLE>" + LINE_SEPARATOR).getBytes());
- fos.write("</body>".getBytes());
- fos.write("</html>".getBytes());
+ fos.write( ( "</TABLE>" + LINE_SEPARATOR ).getBytes() );
+ fos.write( "</body>".getBytes() );
+ fos.write( "</html>".getBytes() );
- } catch (IOException ioe) {
+ }
+ catch ( IOException ioe )
+ {
log.error( "IOException: " + ioe.getMessage(), ioe );
}
}
- private void collectFiles(File baseDir, Vector fileVector) {
+ private void collectFiles( File baseDir, Vector fileVector )
+ {
File[] fileList = baseDir.listFiles();
- for (int i = 0; i < fileList.length; i++) {
- if (fileList[i].isDirectory()){
- collectFiles(fileList[i], fileVector);
+ for ( int i = 0; i < fileList.length; i++ )
+ {
+ if ( fileList[i].isDirectory() )
+ {
+ collectFiles( fileList[i], fileVector );
}
- else if (fileList[i].getName().indexOf(".js") != -1) {
- v.addElement(fileList[i]);
+ else if ( fileList[i].getName().indexOf( ".js" ) != -1 )
+ {
+ v.addElement( fileList[i] );
}
}
}
- public static void main(String[] args) {
- GenerateHTMLIndex index = new GenerateHTMLIndex(args[0], args[1]);
+ public static void main( String[] args )
+ {
+ GenerateHTMLIndex index = new GenerateHTMLIndex( args[0], args[1] );
}
}
Modified: maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/JSDocTask.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/JSDocTask.java?rev=584329&r1=584328&r2=584329&view=diff
==============================================================================
--- maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/JSDocTask.java (original)
+++ maven/sandbox/trunk/jxr/maven-jxr/maven-jxr-js/src/main/java/org/apache/maven/jxr/js/doc/JSDocTask.java Fri Oct 12 16:39:16 2007
@@ -1,3 +1,5 @@
+package org.apache.maven.jxr.js.doc;
+
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -15,8 +17,6 @@
* limitations under the License.
*/
-package org.apache.maven.jxr.js.doc;
-
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
@@ -25,17 +25,23 @@
*
* @version $Id: $
*/
-public class JSDocTask extends Task {
+public class JSDocTask
+ extends Task
+{
private String jSDir;
+
private String destDir;
+
private GenerateHTMLIndex index;
/**
* @see Task#execute()
*/
- public void execute() throws BuildException {
- index = new GenerateHTMLIndex(jSDir, destDir);
+ public void execute()
+ throws BuildException
+ {
+ index = new GenerateHTMLIndex( jSDir, destDir );
}
/**
@@ -43,7 +49,8 @@
*
* @param destDir The destDir to set
*/
- public void setDestDir(String destDir) {
+ public void setDestDir( String destDir )
+ {
this.destDir = destDir;
}
@@ -52,7 +59,8 @@
*
* @param jSDir The jSDir to set
*/
- public void setJSDir(String jSDir) {
+ public void setJSDir( String jSDir )
+ {
this.jSDir = jSDir;
}
}