cleanup
authorAndreas Müller <a.mueller@bgbm.org>
Mon, 30 Aug 2021 18:20:34 +0000 (20:20 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Mon, 30 Aug 2021 18:20:34 +0000 (20:20 +0200)
cdmlib-print/src/main/java/eu/etaxonomy/cdm/print/out/odf/OdfOutputModule.java
cdmlib-print/src/main/java/eu/etaxonomy/cdm/print/out/odf/StylesFactory.java

index 4fafce1cb0f99edd5ff94242bc72aeb181b20e8c..b58f20cea322b7ccdefa1e83d762ccb3e516d3ff 100644 (file)
@@ -1,6 +1,11 @@
 /**
- * 
- */
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
 package eu.etaxonomy.cdm.print.out.odf;
 
 import java.io.File;
@@ -16,66 +21,59 @@ import eu.etaxonomy.cdm.print.Transformator;
 import eu.etaxonomy.cdm.print.out.PublishOutputModuleBase;
 
 /**
- * This output module will transform the given document into <a href="http://www.oasis-open.org/committees/office/">ODF</a> format for further editing in 
+ * This output module will transform the given document into <a href="http://www.oasis-open.org/committees/office/">ODF</a> format for further editing in
  * <a href="http://www.openoffice.org/">OpenOffice</a> or any other tool that understands ODF.
- * 
+ *
  * @author n.hoffmann
  * @since Apr 20, 2010
- * @version 1.0
  */
 public class OdfOutputModule extends PublishOutputModuleBase {
        private static final Logger logger = Logger
                .getLogger(OdfOutputModule.class);
-       
+
        public static String STYLESHEET_RESOURCE_DEFAULT = "/stylesheets/odf/cdmToOdfText.xsl";
-       
+
        private DocumentCreator documentCreator;
        private Transformator transformator;
-       
+
        public OdfOutputModule() {
                InputStream xslt = getXsltInputStream();
                documentCreator = new DocumentCreator();
                try {
-                       transformator = new Transformator(xslt);        
-               } 
+                       transformator = new Transformator(xslt);
+               }
                catch (XSLTransformException e) {
                        logger.error("XSLTransformException while creating ODF output module", e);
                }
        }
-       
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.printpublisher.out.IPublishOutputModule#output(org.jdom.Document, java.io.File)
-        */
-       public void output(Document document, File exportFolder, IProgressMonitor progressMonitor) {
-               
+       @Override
+    public void output(Document document, File exportFolder, IProgressMonitor progressMonitor) {
+
                super.output(document, exportFolder, progressMonitor);
-               
+
                Document transformedDocument;
                String filePath = getFilePath(exportFolder);
-                       
+
                try{
                        transformedDocument = transformator.transform(document);
-                               
+
                        OdfTextDocument odfTextDocument = documentCreator.create(transformedDocument);
-                                                       
+
                        odfTextDocument.save(filePath);
                        logger.warn("ODF output written to disk: " + filePath);
                }catch(Exception e){
                        throw new RuntimeException(e);
                }
        }
-       
-       /*
-        * (non-Javadoc)
-        * @see eu.etaxonomy.printpublisher.out.IPublishOutputModule#getOutputFileSuffix()
-        */
-       public String getOutputFileSuffix() {
+
+       @Override
+    public String getOutputFileSuffix() {
                return "odf";
        }
-       
+
        @Override
        protected InputStream getDefaultXsltInputStream() {
                return OdfOutputModule.class.getResourceAsStream(STYLESHEET_RESOURCE_DEFAULT);
        }
-}
+}
\ No newline at end of file
index e1f3568714cead93f339ae4e0f041e9ea55bf205..eff6342f5de8178e573a0b1f17b91183df819aa6 100644 (file)
@@ -1,12 +1,11 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
-
 package eu.etaxonomy.cdm.print.out.odf;
 
 import org.apache.log4j.Logger;
@@ -24,12 +23,11 @@ import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle;
 /**
  * @author n.hoffmann
  * @since Apr 29, 2010
- * @version 1.0
  */
 public class StylesFactory implements IStyleNames{
        @SuppressWarnings("unused")
        private static final Logger logger = Logger.getLogger(StylesFactory.class);
-       
+
        OdfOfficeStyles officeStyles;
        OdfDefaultStyle defaultStyle;
        StyleParagraphPropertiesElement paragraphProperties;
@@ -42,12 +40,12 @@ public class StylesFactory implements IStyleNames{
                this.officeStyles = outputDocument.getOrCreateDocumentStyles();
                init();
        }
-       
+
        private void init() {
                createDefaultStyles();
-               
+
                createHeadings();
-               
+
        }
 
        public void createDefaultStyles(){
@@ -56,10 +54,10 @@ public class StylesFactory implements IStyleNames{
                        OdfStyleFamily.Paragraph);
                setFontSize(defaultStyle, "10pt");
        }
-       
+
        private void createHeadings(){
                OdfStyle style;
-               
+
                style = officeStyles.newStyle(HEADING_ACCEPTED_TAXON,
                                OdfStyleFamily.Paragraph);
                style.setStyleDisplayNameAttribute("Accepted Taxon Heading");
@@ -67,7 +65,7 @@ public class StylesFactory implements IStyleNames{
                style.setProperty(StyleParagraphPropertiesElement.MarginBottom, "0.25cm");
                setFontWeight(style, "bold");
                setFontSize(style, "20pt");
-               
+
                style = officeStyles.newStyle(HEADING_FEATURE,
                                OdfStyleFamily.Paragraph);
                style.setStyleDisplayNameAttribute("Feature Heading");
@@ -76,7 +74,7 @@ public class StylesFactory implements IStyleNames{
                setFontWeight(style, "bold");
                setFontSize(style, "14pt");
        }
-       
+
 //     @Deprecated // testing
 //     void addOfficeStyles() {
 //             OdfDefaultStyle defaultStyle;
@@ -150,7 +148,7 @@ public class StylesFactory implements IStyleNames{
 //             style.setProperty(OdfStyleParagraphProperties.MarginRight, "1cm");
 //             style.setProperty(OdfStyleParagraphProperties.TextIndent, "0.25cm");
 //     }
-       
+
 
        private void setFontWeight(OdfStyleBase style, String value) {
                style.setProperty(StyleTextPropertiesElement.FontWeight, value);