You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by an...@apache.org on 2004/08/30 12:15:08 UTC
svn commit: rev 37191 - in cocoon/branches/BRANCH_2_1_X: . src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements
Author: antonio
Date: Mon Aug 30 03:15:06 2004
New Revision: 37191
Modified:
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPBottom.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPCell.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPFooter.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPHeader.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Draft.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Footer.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Grid.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_HCenter.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Header.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Left.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Monochrome.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Orientation.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Paper.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Right.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Top.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_VCenter.java
cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Sheet.java
cocoon/branches/BRANCH_2_1_X/status.xml
Log:
Sync POI block
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPBottom.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPBottom.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPBottom.java Mon Aug 30 03:15:06 2004
@@ -38,7 +38,7 @@
*
* @author Marc Johnson (marc_johnson27591@hotmail.com)
* @author Andrew C. Oliver (acoliver2@users.sourceforge.net)
- * @version CVS $Id: EPBottom.java,v 1.6 2004/03/05 13:02:03 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EPBottom extends BaseElementProcessor {
private NumericResult _style;
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPCell.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPCell.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPCell.java Mon Aug 30 03:15:06 2004
@@ -25,13 +25,13 @@
import org.apache.cocoon.components.elementprocessor.types.NumericConverter;
import org.apache.cocoon.components.elementprocessor.types.NumericResult;
import org.apache.cocoon.components.elementprocessor.types.Validator;
-
+import org.apache.poi.hssf.util.Region;
/**
* Implementation of ElementProcessor to handle the "Cell" tag.
* This element has several attributes and may contain other elements.
*
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EPCell.java,v 1.5 2004/03/05 13:02:03 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EPCell extends BaseElementProcessor implements LocaleAware {
@@ -129,15 +129,16 @@
* @exception IOException
* @exception NullPointerException
*/
- public int getColumns() throws IOException, NullPointerException {
- if (!_cols_fetched) {
- String valueString = getValue(_cols_attribute);
- if (valueString != null) {
- _cols = NumericConverter.extractPositiveInteger(valueString);
+ public int getColumns() throws IOException, NullPointerException {
+ if (!_cols_fetched) {
+ String valueString = getValue(_cols_attribute);
+ if (valueString != null) {
+ _cols = NumericConverter.extractPositiveInteger(valueString);
+ _cols_fetched = true;
}
- _cols_fetched = true;
+
}
- return _cols.intValue();
+ return _cols_fetched ?_cols.intValue() : -1;
}
/**
@@ -146,15 +147,16 @@
* @exception IOException
* @exception NullPointerException
*/
- public int getRows() throws IOException, NullPointerException {
- if (!_rows_fetched) {
- String valueString = getValue(_rows_attribute);
- if (valueString != null) {
- _rows = NumericConverter.extractPositiveInteger(valueString);
- }
- _rows_fetched = true;
+ public int getRows() throws IOException, NullPointerException {
+ if (!_rows_fetched) {
+ String valueString = getValue(_rows_attribute);
+ if (valueString != null) {
+ _rows = NumericConverter.extractPositiveInteger(valueString);
+ _rows_fetched = true;
+ }
+
}
- return _rows.intValue();
+ return _rows_fetched ? _rows.intValue() : -1 ;
}
/**
@@ -227,6 +229,11 @@
if (content != null && !content.trim().equals("")) {
getCell().setContent(getContent());
}
+
+ if(getColumns() != -1 && getRows() != -1) {
+ getSheet().addMergedRegion(new Region(getRow(),(short)getColumn(),getRow() + getRows() - 1,(short)(getColumn() + getColumns() - 1)));
+ }
+
}
/**
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPFooter.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPFooter.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPFooter.java Mon Aug 30 03:15:06 2004
@@ -16,16 +16,16 @@
package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
+import java.io.IOException;
+
/**
* No-op implementation of ElementProcessor to handle the "Footer" tag
*
* This element has three attributes: Left, Middle, and Top, and no
* contents.
*
- * This element is not used in HSSFSerializer 1.0
- *
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EPFooter.java,v 1.5 2004/03/05 13:02:03 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EPFooter extends BaseElementProcessor {
private String _left;
@@ -82,5 +82,13 @@
}
}
return _right;
+ }
+
+ /**
+ * Setup the text to be printed at the bottom of every page
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setFooter(getLeft(), getMiddle(), getRight());
}
} // end public class EPFooter
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPHeader.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPHeader.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPHeader.java Mon Aug 30 03:15:06 2004
@@ -16,16 +16,16 @@
package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
+import java.io.IOException;
+
/**
* No-op implementation of ElementProcessor to handle the "Header" tag
*
* This element has three attributes: Left, Middle, and Top, and no
* contents.
*
- * This element is not used in HSSFSerializer 1.0
- *
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EPHeader.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EPHeader extends BaseElementProcessor {
private String _left;
@@ -82,5 +82,13 @@
}
}
return _right;
+ }
+
+ /**
+ * Setup the text to be printed at the top of every page
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setHeader(getLeft(), getMiddle(), getRight());
}
} // end public class EPHeader
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Draft.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Draft.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Draft.java Mon Aug 30 03:15:06 2004
@@ -28,10 +28,8 @@
*
* This element has a single attribute, value, which is boolean.
*
- * This element is not used in HSSFSerializer 1.0
- *
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EP_Draft.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EP_Draft extends BaseElementProcessor {
private static final String _value_attribute = "value";
@@ -40,7 +38,6 @@
/**
* constructor
*/
-
public EP_Draft() {
super(null);
_value = null;
@@ -51,12 +48,18 @@
*
* @exception IOException if the value is malformed or missing
*/
-
public boolean getValue() throws IOException {
if (_value == null) {
- _value =
- BooleanConverter.extractBoolean(getValue(_value_attribute));
+ _value = BooleanConverter.extractBoolean(getValue(_value_attribute));
}
return _value.booleanValue();
+ }
+
+ /**
+ * Setup whether or not the worksheet is printed in draft format
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setDraft(this.getValue());
}
} // end public class EP_Draft
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Footer.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Footer.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Footer.java Mon Aug 30 03:15:06 2004
@@ -26,10 +26,8 @@
*
* This element has two attributes: Points and PrefUnit
*
- * This element is not used in HSSFSerializer 1.0
- *
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EP_Footer.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EP_Footer extends BaseElementProcessor {
private static final String _points_attribute = "Points";
@@ -55,8 +53,7 @@
double getPoints() throws IOException {
if (_points == null) {
- _points =
- NumericConverter.extractDouble(getValue(_points_attribute));
+ _points = NumericConverter.extractDouble(getValue(_points_attribute));
}
return _points.doubleValue();
}
@@ -69,9 +66,16 @@
int getPrefUnit() throws IOException {
if (_pref_unit == null) {
- _pref_unit =
- PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
+ _pref_unit = PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
}
return _pref_unit.intValue();
+ }
+
+ /**
+ * Setup the footer margin
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setFooterMargin(getPoints());
}
} // end public class EP_Footer
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Grid.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Grid.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Grid.java Mon Aug 30 03:15:06 2004
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,22 +26,21 @@
*
* This element has a single attribute, value, which is boolean.
*
- * This element is not used in HSSFSerializer 1.0
*
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EP_Grid.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @author Victor Skladovs (skladov@his.de)
+ * @version CVS $Id$
*/
public class EP_Grid extends BaseElementProcessor {
private static final String _value_attribute = "value";
- private BooleanResult _value;
+ private BooleanResult showGrid;
/**
* constructor
*/
-
public EP_Grid() {
super(null);
- _value = null;
+ showGrid = null;
}
/**
@@ -49,12 +48,19 @@
*
* @exception IOException if the value is malformed or missing
*/
-
public boolean getValue() throws IOException {
- if (_value == null) {
- _value =
- BooleanConverter.extractBoolean(getValue(_value_attribute));
+ if (showGrid == null) {
+ showGrid = BooleanConverter.extractBoolean(this.getValue(_value_attribute));
}
- return _value.booleanValue();
+ return showGrid.booleanValue();
}
+
+ /**
+ * set whether or not the grid is printed for the worksheet
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setPrintGridLines(this.getValue());
+ }
+
} // end public class EP_Grid
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_HCenter.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_HCenter.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_HCenter.java Mon Aug 30 03:15:06 2004
@@ -27,10 +27,8 @@
*
* This element has a single attribute, value, which is boolean.
*
- * This element is not used in HSSFSerializer 1.0
- *
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EP_HCenter.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EP_HCenter extends BaseElementProcessor {
private static final String _value_attribute = "value";
@@ -50,12 +48,20 @@
*
* @exception IOException if the value is malformed or missing
*/
-
public boolean getValue() throws IOException {
if (_value == null) {
- _value =
- BooleanConverter.extractBoolean(getValue(_value_attribute));
+ _value = BooleanConverter.extractBoolean(this.getValue(_value_attribute));
}
return _value.booleanValue();
}
+
+ /**
+ * Setup whether or not the worksheet content is centered (horizontally)
+ * on the page when it is printed
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setHCenter(this.getValue());
+ }
+
} // end public class EP_HCenter
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Header.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Header.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Header.java Mon Aug 30 03:15:06 2004
@@ -26,10 +26,8 @@
*
* This element has two attributes: Points and PrefUnit
*
- * This element is not used in HSSFSerializer 1.0
- *
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EP_Header.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EP_Header extends BaseElementProcessor {
private static final String _points_attribute = "Points";
@@ -55,8 +53,7 @@
double getPoints() throws IOException {
if (_points == null) {
- _points =
- NumericConverter.extractDouble(getValue(_points_attribute));
+ _points = NumericConverter.extractDouble(getValue(_points_attribute));
}
return _points.doubleValue();
}
@@ -69,9 +66,16 @@
int getPrefUnit() throws IOException {
if (_pref_unit == null) {
- _pref_unit =
- PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
+ _pref_unit = PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
}
return _pref_unit.intValue();
+ }
+
+ /**
+ * Setup the header margin
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setHeaderMargin(getPoints());
}
} // end public class EP_Header
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Left.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Left.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Left.java Mon Aug 30 03:15:06 2004
@@ -26,10 +26,8 @@
*
* This element has two attributes: Points and PrefUnit
*
- * This element is not used in HSSFSerializer 1.0
- *
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EP_Left.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EP_Left extends BaseElementProcessor {
private static final String _points_attribute = "Points";
@@ -55,8 +53,7 @@
double getPoints() throws IOException {
if (_points == null) {
- _points =
- NumericConverter.extractDouble(getValue(_points_attribute));
+ _points = NumericConverter.extractDouble(getValue(_points_attribute));
}
return _points.doubleValue();
}
@@ -69,9 +66,16 @@
int getPrefUnit() throws IOException {
if (_pref_unit == null) {
- _pref_unit =
- PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
+ _pref_unit = PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
}
return _pref_unit.intValue();
+ }
+
+ /**
+ * Setup the left margin
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setLeftMargin(getPoints());
}
} // end public class EP_Left
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Monochrome.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Monochrome.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Monochrome.java Mon Aug 30 03:15:06 2004
@@ -27,10 +27,8 @@
*
* This element has a single attribute, value, which is boolean.
*
- * This element is not used in HSSFSerializer 1.0
- *
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EP_Monochrome.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EP_Monochrome extends BaseElementProcessor {
private static final String _value_attribute = "value";
@@ -39,7 +37,6 @@
/**
* constructor
*/
-
public EP_Monochrome() {
super(null);
_value = null;
@@ -50,12 +47,18 @@
*
* @exception IOException if the value is malformed or missing
*/
-
public boolean getValue() throws IOException {
if (_value == null) {
- _value =
- BooleanConverter.extractBoolean(getValue(_value_attribute));
+ _value = BooleanConverter.extractBoolean(getValue(_value_attribute));
}
return _value.booleanValue();
+ }
+
+ /**
+ * Setup whether or not printing is in monochrome:
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setMonochrome(this.getValue());
}
} // end public class EP_Monochrome
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Orientation.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Orientation.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Orientation.java Mon Aug 30 03:15:06 2004
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,10 +27,10 @@
* This element has no attributes and contains a string describing the
* print orientation (landscape or portrait)
*
- * This element is not used in HSSFSerializer 1.0
*
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EP_Orientation.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @author Victor Skladovs (skladov@his.de)
+ * @version CVS $Id$
*/
public class EP_Orientation extends BaseElementProcessor {
private NumericResult _print_orientation;
@@ -52,8 +52,17 @@
int getPrintOrientation() throws IOException {
if (_print_orientation == null) {
_print_orientation =
- PrintOrientation.extractPrintOrientation(getData());
+ PrintOrientation.extractPrintOrientation(this.getData());
}
return _print_orientation.intValue();
}
+
+ /**
+ * Setup the orientation:
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setOrientation(getPrintOrientation() == 1 ? false : true);
+ }
+
} // end public class EP_Orientation
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Paper.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Paper.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Paper.java Mon Aug 30 03:15:06 2004
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,23 +16,62 @@
package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
+import org.apache.commons.lang.StringUtils;
+import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
+
+import java.io.IOException;
+
/**
* No-op implementation of ElementProcessor to handle the "paper" tag
*
* This element contains no other elements and has no attributes. Its
* content describes the paper to be used (e.g., A4)
*
- * This element is not used in HSSFSerializer 1.0
*
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EP_Paper.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @author Victor Skladov (skladov@his.de)
+ * @version CVS $Id$
*/
public class EP_Paper extends BaseElementProcessor {
+ private String _paper;
+
/**
* constructor
*/
public EP_Paper() {
super(null);
}
+
+ public String getPaper(){
+ if (_paper == null) {
+ _paper = StringUtils.strip(this.getData());
+ }
+ return this._paper;
+ }
+
+ /**
+ * Setup the paper size (Letter, Legal, Executive, A4, A5, A6, ).
+ * Default Letter
+ * @exception IOException
+ */
+
+ public void endProcessing() throws IOException{
+ _paper = getPaper();
+ Sheet sheet = this.getSheet();
+ short paperSize = HSSFPrintSetup.LETTER_PAPERSIZE;
+ if (StringUtils.isNotEmpty(_paper)) {
+ if ("A4".equalsIgnoreCase(_paper)) {
+ paperSize = HSSFPrintSetup.A4_PAPERSIZE;
+ } else if ("A5".equalsIgnoreCase(_paper)) {
+ paperSize = HSSFPrintSetup.A5_PAPERSIZE;
+ } else if ("Legal".equalsIgnoreCase(_paper)) {
+ paperSize = HSSFPrintSetup.LEGAL_PAPERSIZE;
+ } else if ("Executive".equalsIgnoreCase(_paper)) {
+ paperSize = HSSFPrintSetup.EXECUTIVE_PAPERSIZE;
+ }
+ }
+ sheet.setPaperSize(paperSize);
+ }
+
} // end public class EP_Paper
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Right.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Right.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Right.java Mon Aug 30 03:15:06 2004
@@ -26,10 +26,8 @@
*
* This element has two attributes: Points and PrefUnit
*
- * This element is not used in HSSFSerializer 1.0
- *
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EP_Right.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EP_Right extends BaseElementProcessor {
private static final String _points_attribute = "Points";
@@ -54,8 +52,7 @@
double getPoints() throws IOException {
if (_points == null) {
- _points =
- NumericConverter.extractDouble(getValue(_points_attribute));
+ _points = NumericConverter.extractDouble(getValue(_points_attribute));
}
return _points.doubleValue();
}
@@ -68,9 +65,16 @@
int getPrefUnit() throws IOException {
if (_pref_unit == null) {
- _pref_unit =
- PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
+ _pref_unit = PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
}
return _pref_unit.intValue();
+ }
+
+ /**
+ * Setup the right margin
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setRightMargin(getPoints());
}
} // end public class EP_Right
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Top.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Top.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_Top.java Mon Aug 30 03:15:06 2004
@@ -26,10 +26,8 @@
*
* This element has two attributes: Points and PrefUnit
*
- * This element is not used in HSSFSerializer 1.0
- *
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EP_Top.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EP_Top extends BaseElementProcessor {
private static final String _points_attribute = "Points";
@@ -53,8 +51,7 @@
*/
double getPoints() throws IOException {
if (_points == null) {
- _points =
- NumericConverter.extractDouble(getValue(_points_attribute));
+ _points = NumericConverter.extractDouble(getValue(_points_attribute));
}
return _points.doubleValue();
}
@@ -67,9 +64,16 @@
int getPrefUnit() throws IOException {
if (_pref_unit == null) {
- _pref_unit =
- PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
+ _pref_unit = PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
}
return _pref_unit.intValue();
+ }
+
+ /**
+ * Setup the top margin
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setTopMargin(getPoints());
}
} // end public class EP_Top
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_VCenter.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_VCenter.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EP_VCenter.java Mon Aug 30 03:15:06 2004
@@ -27,10 +27,8 @@
*
* This element has a single attribute, value, which is boolean.
*
- * This element is not used in HSSFSerializer 1.0
- *
* @author Marc Johnson (marc_johnson27591@hotmail.com)
- * @version CVS $Id: EP_VCenter.java,v 1.5 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @version CVS $Id$
*/
public class EP_VCenter extends BaseElementProcessor {
private static final String _value_attribute = "value";
@@ -51,9 +49,17 @@
*/
public boolean getValue() throws IOException {
if (_value == null) {
- _value =
- BooleanConverter.extractBoolean(getValue(_value_attribute));
+ _value = BooleanConverter.extractBoolean(this.getValue(_value_attribute));
}
return _value.booleanValue();
+ }
+
+ /**
+ * Setup whether or not the worksheet content is centered (vertically)
+ * on the page when it is printed
+ * @exception IOException
+ */
+ public void endProcessing() throws IOException{
+ this.getSheet().setVCenter(this.getValue());
}
} // end public class EP_VCenter
Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Sheet.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Sheet.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/Sheet.java Mon Aug 30 03:15:06 2004
@@ -1,12 +1,12 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,6 +26,8 @@
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
+import org.apache.poi.hssf.usermodel.HSSFFooter;
+import org.apache.poi.hssf.usermodel.HSSFHeader;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.util.HSSFColor;
@@ -36,7 +38,7 @@
*
* @author Marc Johnson (marc_johnson27591@hotmail.com)
* @author Andrew C. Oliver (acoliver2@users.sourceforge.net)
- * @version CVS $Id: Sheet.java,v 1.8 2004/03/05 13:02:04 bdelacretaz Exp $
+ * @version CVS $Id$
*/
// package scope
@@ -186,11 +188,6 @@
HSSFCellStyle addStyleRegion(Region region) {
HSSFCellStyle style = _workbook.createStyle();
- /*
- * getLogger().debug("region = "+ region.getRowFrom() +
- * ","+region.getColumnFrom()+
- * ","+region.getRowTo()+","+region.getColumnTo());
- */
regions.put(region, style);
return style;
}
@@ -205,14 +202,10 @@
Iterator iregions = regions.keySet().iterator();
while (iregions.hasNext()) {
Region region = ((Region)iregions.next());
- // if (col == 1)
- // getLogger().debug("breakpoint support");
if (region.contains(row, col)) {
- //getLogger().debug("Returning style for " + row +"," + col);
return (HSSFCellStyle)regions.get(region);
}
}
- //getLogger().debug("returning null for "+row+","+col);
return null;
}
@@ -254,18 +247,13 @@
Iterator iregions = regions.keySet().iterator();
while (iregions.hasNext()) {
Region region = ((Region)iregions.next());
- //getLogger().debug("fixing region
- // "+region.getRowFrom()+","+region.getColumnFrom()+"-"+
- // region.getRowTo()+","+region.getColumnTo());
- for (int rownum = region.getRowFrom();
- rownum < region.getRowTo() + 1; rownum++) {
+ for (int rownum = region.getRowFrom(); rownum < region.getRowTo() + 1; rownum++) {
HSSFRow row = _sheet.getRow(rownum);
for (short colnum = region.getColumnFrom();
colnum < region.getColumnTo() + 1; colnum++) {
HSSFCellStyle style = (HSSFCellStyle)regions.get(region);
if (!isBlank(style)) {
- //don't waste time with huge blocks of blankly styled
- // cells
+ //don't waste time with huge blocks of blankly styled cells
if (row == null) {
if (rownum > Short.MAX_VALUE) {
rownum = Short.MAX_VALUE;
@@ -274,8 +262,6 @@
}
HSSFCell cell = row.getCell(colnum);
if (cell == null) {
- //getLogger().debug("creating blank cell at
- // "+rownum + "," +colnum);
cell = row.createCell(colnum);
cell.setCellType(HSSFCell.CELL_TYPE_BLANK);
cell.setCellStyle(
@@ -303,6 +289,126 @@
return true;
}
return false;
+ }
+
+ /**
+ * Set the paper size.
+ * @param paperSize the paper size.
+ */
+
+ void setPaperSize(short paperSize) {
+ _sheet.getPrintSetup().setPaperSize(paperSize);
+ }
+
+ /**
+ * Set whether to print in landscape
+ * @param ls landscape
+ */
+
+ void setOrientation(boolean ls) {
+ _sheet.getPrintSetup().setLandscape(ls);
+ }
+
+ /**
+ * Set whether or not the grid is printed for the worksheet
+ * @param gridLines boolean to turn on or off the printing of
+ * gridlines
+ */
+
+ void setPrintGridLines(boolean gridLines) {
+ _sheet.setPrintGridlines(gridLines);
+ }
+
+ /**
+ * Set whether or not the worksheet content is centered (horizontally)
+ * on the page when it is printed
+ */
+ void setHCenter(boolean hCenter) {
+ _sheet.setHorizontallyCenter(hCenter);
+ }
+
+ /**
+ * Setwhether or not the worksheet content is centered (vertically)
+ * on the page when it is printed
+ */
+ void setVCenter(boolean vCenter) {
+ _sheet.setVerticallyCenter(vCenter);
+ }
+
+ /**
+ * Setup whether or not printing is in monochrome (no color)
+ */
+ void setMonochrome(boolean noColor) {
+ _sheet.getPrintSetup().setNoColor(noColor);
+ }
+
+ /**
+ * Setup whether or not the worksheet is printed in draft format
+ */
+ void setDraft(boolean draftMode) {
+ _sheet.getPrintSetup().setDraft(draftMode);
+ }
+
+ /**
+ * Set text to be printed at the top of every page
+ */
+ void setHeader(String left, String middle, String right) {
+ HSSFHeader header = _sheet.getHeader();
+ header.setLeft(left);
+ header.setCenter(middle);
+ header.setRight(right);
+ }
+
+ /**
+ * Set text to be printed at the bottom of every page
+ */
+ void setFooter(String left, String middle, String right) {
+ HSSFFooter footer = _sheet.getFooter();
+ footer.setLeft(left);
+ footer.setCenter(middle);
+ footer.setRight(right);
+ }
+
+ /**
+ * Set the top margin of the page
+ */
+ void setTopMargin(double points) {
+ _sheet.setMargin(HSSFSheet.TopMargin, points);
+ }
+
+ /**
+ * Set the left margin of the page
+ */
+ void setLeftMargin(double points) {
+ _sheet.setMargin(HSSFSheet.LeftMargin, points);
+ }
+
+ /**
+ * Set the right margin of the page
+ */
+ void setRightMargin(double points) {
+ _sheet.setMargin(HSSFSheet.RightMargin, points);
+ }
+
+ /**
+ * Set the bottom margin of the page
+ */
+ void setBottomMargin(double points) {
+ _sheet.setMargin(HSSFSheet.BottomMargin, points);
+ }
+
+ /**
+ * Set the header margin of the page
+ */
+ void setHeaderMargin(double points) {
+ _sheet.getPrintSetup().setHeaderMargin(points);
+ }
+
+ /**
+ * Set the header margin of the page
+ */
+ void setFooterMargin(double points) {
+ _sheet.getPrintSetup().setFooterMargin(points);
}
} // end package scope class Sheet
Modified: cocoon/branches/BRANCH_2_1_X/status.xml
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Mon Aug 30 03:15:06 2004
@@ -238,8 +238,8 @@
</action>
<action dev="UH" type="add">
Enhanced JMS support by adding a JMSConnectionManager component to the JMS block.
- This component replaces the JMSConnection component which only supported
- publish/subscribe messaging and which mixed some concerns. Two abstract classes:
+ This component replaces the JMSConnection component which only supported
+ publish/subscribe messaging and which mixed some concerns. Two abstract classes:
AbstractMessageListener and AbstractMessagePublisher should be used as basis for
custom publish/subscribe components.
</action>
@@ -272,6 +272,18 @@
<action dev="VG" type="add">
Portal block: Added ManagedCocoonPortlet, to be used together with
CocoonServlet or CocoonPortlet.
+ </action>
+ <action dev="TC" type="add" fixes-bug="28015" due-to="Frank Taffelt" due-to-email="frank.taffelt@interface-business.de">
+ POI block: cell spanning.
+ </action>
+ <action dev="AG" type="fix" fixes-bug="23002">
+ POI block: processing of tags "vcenter", "hcenter", "monochrome", "draft",
+ "Header", "Footer" in "gmr:PrintInformation". Initial support for
+ "Margins" ("top", "bottom", "left", "right", "header", "footer").
+ </action>
+ <action dev="AG" type="fix" fixes-bug="23002" due-to="Viktor Skladovs" due-to-email="skladov@his.de">
+ POI block: processing of tags "grid", "orientation and "paper" in
+ "gmr:PrintInformation".
</action>
<action dev="VG" type="update">
ResourceReader can now take configuration elements, parameters