summaryrefslogtreecommitdiffstats
path: root/scilab/modules/helptools
diff options
context:
space:
mode:
authorSylvestre Ledru <sylvestre.ledru@scilab.org>2010-02-19 10:38:24 +0100
committerSylvestre Ledru <sylvestre.ledru@scilab.org>2010-02-19 10:38:24 +0100
commit602f8540ec93df5d6e157d5c72b4e2d1d80123b0 (patch)
tree13a49995e9b15173b308dca0c09dde5f4d1db965 /scilab/modules/helptools
parent3705a7ccfa4d9e04b7dba78b6ed5c1800b06acd7 (diff)
downloadscilab-602f8540ec93df5d6e157d5c72b4e2d1d80123b0.zip
scilab-602f8540ec93df5d6e157d5c72b4e2d1d80123b0.tar.gz
Checkstyle
Diffstat (limited to 'scilab/modules/helptools')
-rw-r--r--scilab/modules/helptools/src/java/org/scilab/modules/helptools/BuildDocObject.java12
-rw-r--r--scilab/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java58
-rw-r--r--scilab/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java4
3 files changed, 47 insertions, 27 deletions
diff --git a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/BuildDocObject.java b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/BuildDocObject.java
index c22884c..b6acde0 100644
--- a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/BuildDocObject.java
+++ b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/BuildDocObject.java
@@ -48,6 +48,8 @@ public class BuildDocObject extends StyleSheet {
48 private static final String GRAPHICSIZE_EXTENSION_0 = "graphicsize.extension=0"; 48 private static final String GRAPHICSIZE_EXTENSION_0 = "graphicsize.extension=0";
49 private static final String TOC_SECTION_DEPTH_3 = "toc.section.depth=3"; 49 private static final String TOC_SECTION_DEPTH_3 = "toc.section.depth=3";
50 private static final String SECTION_AUTOLABEL_1 = "section.autolabel=1"; 50 private static final String SECTION_AUTOLABEL_1 = "section.autolabel=1";
51 private static final String USE_ID_AS_FILENAME = "use.id.as.filename=1";
52 private static final String GENERATE_TOC = "\"generate.toc= \"";
51 53
52 private String outputDirectory; 54 private String outputDirectory;
53 private String format; 55 private String format;
@@ -137,7 +139,7 @@ public class BuildDocObject extends StyleSheet {
137 139
138 /* HTML Format */ 140 /* HTML Format */
139 if (format.equalsIgnoreCase("HTML")) { 141 if (format.equalsIgnoreCase("HTML")) {
140 specificArgs.add("use.id.as.filename=1"); 142 specificArgs.add(USE_ID_AS_FILENAME);
141 specificArgs.add("html.stylesheet=html.css"); 143 specificArgs.add("html.stylesheet=html.css");
142 specificArgs.add(USE_EXTENSIONS_1); 144 specificArgs.add(USE_EXTENSIONS_1);
143 specificArgs.add(GRAPHICSIZE_EXTENSION_0); 145 specificArgs.add(GRAPHICSIZE_EXTENSION_0);
@@ -160,11 +162,11 @@ public class BuildDocObject extends StyleSheet {
160 162
161 /* CHM Format */ 163 /* CHM Format */
162 if (format.equalsIgnoreCase("CHM")) { 164 if (format.equalsIgnoreCase("CHM")) {
163 specificArgs.add("use.id.as.filename=1"); 165 specificArgs.add(USE_ID_AS_FILENAME);
164 specificArgs.add("html.stylesheet=htmlhelp.css"); 166 specificArgs.add("html.stylesheet=htmlhelp.css");
165 specificArgs.add(USE_EXTENSIONS_1); 167 specificArgs.add(USE_EXTENSIONS_1);
166 specificArgs.add(GRAPHICSIZE_EXTENSION_0); 168 specificArgs.add(GRAPHICSIZE_EXTENSION_0);
167 specificArgs.add("\"generate.toc= \""); 169 specificArgs.add(GENERATE_TOC);
168 this.styleDoc = docbookPath + "/htmlhelp/htmlhelp.xsl"; 170 this.styleDoc = docbookPath + "/htmlhelp/htmlhelp.xsl";
169 171
170 /* Copy the css file for thr HTML pages */ 172 /* Copy the css file for thr HTML pages */
@@ -186,8 +188,8 @@ public class BuildDocObject extends StyleSheet {
186 // JavaHelp 188 // JavaHelp
187 specificArgs.add(USE_EXTENSIONS_1); 189 specificArgs.add(USE_EXTENSIONS_1);
188 specificArgs.add(GRAPHICSIZE_EXTENSION_0); 190 specificArgs.add(GRAPHICSIZE_EXTENSION_0);
189 specificArgs.add("\"generate.toc= \""); 191 specificArgs.add(GENERATE_TOC);
190 specificArgs.add("use.id.as.filename=1"); 192 specificArgs.add(USE_ID_AS_FILENAME);
191 this.styleDoc = docbookPath + "/javahelp/javahelp.xsl"; 193 this.styleDoc = docbookPath + "/javahelp/javahelp.xsl";
192 } 194 }
193 this.format = format; 195 this.format = format;
diff --git a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java
index d69bc4f..06d9e45 100644
--- a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java
+++ b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/CopyConvert.java
@@ -1,6 +1,7 @@
1/* 1/*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab 2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2008 - INRIA - Hussein SHAFIE 3 * Copyright (C) 2008 - INRIA - Hussein SHAFIE
4 * Copyright (C) 2010 - DIGITEO - Sylvestre LEDRU
4 * 5 *
5 * This file must be used under the terms of the CeCILL. 6 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which 7 * This source file is licensed as described in the file COPYING, which
@@ -54,10 +55,7 @@ import net.sourceforge.jeuclid.converter.Converter;
54 55
55 56
56/** 57/**
57 * @TODO add comment 58 * Preprocess before building the documentation
58 *
59 * @param inFile
60 * @param outFile
61 */ 59 */
62public class CopyConvert extends DefaultHandler implements ErrorHandler { 60public class CopyConvert extends DefaultHandler implements ErrorHandler {
63 61
@@ -85,19 +83,35 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
85 private File ps2pdf; 83 private File ps2pdf;
86 84
87 85
88 public void setVerbose(boolean verbose){ 86 /**
89 this.verbose=verbose; 87 * Enables the verbose mode
88 *
89 * @param verbose true if enable
90 */
91 public void setVerbose(boolean verbose) {
92 this.verbose = verbose;
90 } 93 }
91 94
92 public void setPrintFormat(String printFormat){ 95 /**
93 this.printFormat=printFormat; 96 * Set the print format
97 *
98 * @param printFormat The print format
99 */
100 public void setPrintFormat(String printFormat) {
101 this.printFormat = printFormat;
94 } 102 }
95 103
96 // ----------------------------------------------------------------------- 104 // -----------------------------------------------------------------------
97 105
98 public void run(File inFile, File outFile) 106 /**
107 * Run the copy/convert process
108 *
109 * @param inFile Input file
110 * @param outFile Output file
111 */
112 public void run(File inFile, File outputFile)
99 throws SAXParseException, SAXException, IOException { 113 throws SAXParseException, SAXException, IOException {
100 outFile = outFile.getCanonicalFile(); 114 File outFile = outputFile.getCanonicalFile();
101 outDir = outFile.getParentFile(); 115 outDir = outFile.getParentFile();
102 if (!outDir.isDirectory() && !outDir.mkdirs()) { 116 if (!outDir.isDirectory() && !outDir.mkdirs()) {
103 throw new IOException("Cannot create directory '" + outDir + "'"); 117 throw new IOException("Cannot create directory '" + outDir + "'");
@@ -115,7 +129,7 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
115 parser = factory.newSAXParser(); 129 parser = factory.newSAXParser();
116 } catch (Exception e) { 130 } catch (Exception e) {
117 throw new SAXParseException( 131 throw new SAXParseException(
118 "Cannot create a properly configured SAX parser: " + Helpers.reason(e),locator); 132 "Cannot create a properly configured SAX parser: " + Helpers.reason(e), locator);
119 } 133 }
120 134
121 inScopePrefixes = new ArrayList<String[]>(); 135 inScopePrefixes = new ArrayList<String[]>();
@@ -132,10 +146,10 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
132 if (out.checkError()) { 146 if (out.checkError()) {
133 throw new IOException("Error writing '" + outFile + "'"); 147 throw new IOException("Error writing '" + outFile + "'");
134 } 148 }
135 } catch (SAXException e){ 149 } catch (SAXException e) {
136 if (locator!=null){ 150 if (locator != null) {
137 throw new SAXParseException("Cannot parse " + inFile + " " + Helpers.reason(e),locator); 151 throw new SAXParseException("Cannot parse " + inFile + " " + Helpers.reason(e), locator);
138 }else{ 152 } else {
139 throw new SAXException("Cannot parse " + inFile + " " + Helpers.reason(e)); 153 throw new SAXException("Cannot parse " + inFile + " " + Helpers.reason(e));
140 } 154 }
141 } finally { 155 } finally {
@@ -147,6 +161,11 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
147 // ContentHandler 161 // ContentHandler
148 // ----------------------------------------------------------------------- 162 // -----------------------------------------------------------------------
149 163
164 /**
165 * Set the document Locator
166 *
167 * @param locator The locator
168 */
150 public void setDocumentLocator(Locator locator) { 169 public void setDocumentLocator(Locator locator) {
151 this.locator = locator; 170 this.locator = locator;
152 } 171 }
@@ -333,8 +352,7 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
333 mainOut = null; 352 mainOut = null;
334 353
335 if (extractedFile != null) { 354 if (extractedFile != null) {
336 reportInfo("Extracted embedded graphics from '"+extractedFile+"' to '" 355 reportInfo("Extracted embedded graphics from '" + extractedFile + "' to '" + extractedFile + "'.");
337 + extractedFile + "'.");
338 356
339 String converted = copyConvertGraphics(extractedFile); 357 String converted = copyConvertGraphics(extractedFile);
340 if (converted != null) { 358 if (converted != null) {
@@ -617,10 +635,10 @@ public class CopyConvert extends DefaultHandler implements ErrorHandler {
617 private boolean convertMathML(File inFile, File outFile) { 635 private boolean convertMathML(File inFile, File outFile) {
618 MutableLayoutContext context = new LayoutContextImpl(LayoutContextImpl 636 MutableLayoutContext context = new LayoutContextImpl(LayoutContextImpl
619 .getDefaultLayoutContext()); 637 .getDefaultLayoutContext());
620 context.setParameter(Parameter.ANTIALIAS,"true"); 638 context.setParameter(Parameter.ANTIALIAS, "true");
621 // Workaround a XEP problem. FOP 1 is OK. 639 // Workaround a XEP problem. FOP 1 is OK.
622 context.setParameter(Parameter.MATHBACKGROUND,"#FFFFFF"); 640 context.setParameter(Parameter.MATHBACKGROUND, "#FFFFFF");
623 context.setParameter(Parameter.MATHSIZE,"18"); 641 context.setParameter(Parameter.MATHSIZE, "18");
624 642
625 try { 643 try {
626 Converter.getInstance().convert(inFile, outFile, "image/png", context); 644 Converter.getInstance().convert(inFile, outFile, "image/png", context);
diff --git a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java
index b598654..3ac7bf5 100644
--- a/scilab/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java
+++ b/scilab/modules/helptools/src/java/org/scilab/modules/helptools/Helpers.java
@@ -82,7 +82,7 @@ public final class Helpers {
82 } 82 }
83 83
84 public static String getTemporaryNameFo(String baseDirectory) { 84 public static String getTemporaryNameFo(String baseDirectory) {
85 return baseDirectory+"/__doc.fo"; 85 return baseDirectory + "/__doc.fo";
86 } 86 }
87 87
88 public static String getFileExtension(File file) { 88 public static String getFileExtension(File file) {
@@ -190,7 +190,7 @@ public final class Helpers {
190 */ 190 */
191 public static void deleteDirectory(File dir) { 191 public static void deleteDirectory(File dir) {
192 192
193 String files[] = dir.list(); 193 String[] files = dir.list();
194 if (files == null) { 194 if (files == null) {
195 files = new String[0]; 195 files = new String[0];
196 } 196 }