You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jo...@apache.org on 2003/07/05 16:33:17 UTC
cvs commit: cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements EPMerge.java
joerg 2003/07/05 07:33:17
Modified: src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements
EPMerge.java
Log:
clean up
line endings fixed
Revision Changes Path
1.2 +1 -136 cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPMerge.java
Index: EPMerge.java
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements/EPMerge.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EPMerge.java 2 Jul 2003 12:49:49 -0000 1.1
+++ EPMerge.java 5 Jul 2003 14:33:17 -0000 1.2
@@ -1,136 +1 @@
-/*
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
- used to endorse or promote products derived from this software without
- prior written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- Stefano Mazzocchi <st...@apache.org>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
-*/
-
-package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
-
-
-
-import org.apache.cocoon.components.elementprocessor.types.Attribute;
-import org.apache.cocoon.components.elementprocessor.ElementProcessor;
-import org.apache.poi.hssf.util.RangeAddress;
-import org.apache.poi.hssf.util.Region;
-import java.io.IOException;
-
-/**
- * No-op implementation of ElementProcessor to handle the "Merge" tag
- *
- * This element is a container of other elements and has several
- * attributes
- *
- *
- * @author Danny Mui (danny@muibros.com)
- */
-public class EPMerge extends BaseElementProcessor
-{
- private boolean _invalid = false;
- private String _cellRange;
-
- /**
- * constructor
- */
- public EPMerge()
- {
- super(null);
- _cellRange = null;
- }
-
-
- /**
- * Override of Initialize() implementation
- *
- * @param attributes the array of Attribute instances; may be
- * empty, will never be null
- * @param parent the parent ElementProcessor; may be null
- *
- * @exception IOException if anything is wrong
- */
- public void initialize(final Attribute [] attributes,
- final ElementProcessor parent)
- throws IOException
- {
- super.initialize(attributes, parent);
-
- }
-
- public String getCellRange(){
- if (this._cellRange == null) {
- //pulls in the content
- _cellRange = this.getData();
- }
-
- return this._cellRange;
- }
-
- /**
- * Setup the merged regions
- *
- * @exception IOException
- */
- public void endProcessing()
- throws IOException
- {
- RangeAddress rangeAddress = new RangeAddress(getCellRange());
- Sheet sheet = this.getSheet();
-
- //subtracting one since rangeaddress starts at 1,1 where rows/cols start at 0,0
- short fromCol = (short)(rangeAddress.getXPosition(rangeAddress.getFromCell())-1);
- int fromRow = (rangeAddress.getYPosition(rangeAddress.getFromCell())-1);
- short toCol = (short)(rangeAddress.getXPosition(rangeAddress.getToCell())-1);
- int toRow = rangeAddress.getYPosition(rangeAddress.getToCell())-1;
-
- getLogger().debug("Merging Range: Row ("+fromRow+") Col ("+fromCol+") to Row("+toRow+") Col("+toCol+")");
-
- Region region = new Region(fromRow, fromCol, toRow, toCol);
- sheet.addMergedRegion(region);
-
- }
-
-} // end public class EPMerge
+/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation and was originally created by
Stefano Mazzocchi <st...@apache.org>. For more information on the Apache
Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
import org.apache.cocoon.components.elementprocessor.ElementProcessor;
import org.apache.cocoon.components.elementprocessor.types.Attribute;
import org.apache.poi.hssf.util.RangeAddress;
import org.apache.poi.hssf.util.Region;
import java.io.IOException;
/**
* No-op implementation of ElementProcessor to handle the "Merge" tag
*
* This element is a container of other elements and has several
* attributes
*
*
* @author Danny Mui (danny@muibros.com)
*/
public class EPMerge extends BaseElementProcessor {
private String _cellRange;
/**
* constructor
*/
public EPMerge() {
super(null);
_cellRange = null;
}
/**
* Override of Initialize() implementation
*
* @param attributes the array of Attribute instances; may be
* empty, will never be null
* @param parent the parent ElementProcessor; may be null
*
* @exception IOException if anything is wrong
*/
public void initialize(final Attribute[] attributes, final ElementProcessor parent)
throws IOException {
super.initialize(attributes, parent);
}
public String getCellRange() {
if (this._cellRange == null) {
//pulls in the content
_cellRange = this.getData();
}
return this._cellRange;
}
/**
* Setup the merged regions
*
* @exception IOException
*/
public void endProcessing() throws IOException {
RangeAddress rangeAddress = new RangeAddress(getCellRange());
Sheet sheet = this.getSheet();
//subtracting one since rangeaddress starts at 1,1 where rows/cols start at 0,0
short fromCol = (short) (rangeAddress.getXPosition(rangeAddress.getFromCell()) - 1);
int fromRow = (rangeAddress.getYPosition(rangeAddress.getFromCell()) - 1);
short toCol = (short) (rangeAddress.getXPosition(rangeAddress.getToCell()) - 1);
int toRow = rangeAddress.getYPosition(rangeAddress.getToCell()) - 1;
getLogger().debug("Merging Range: Row (" + fromRow + ") Col (" + fromCol
+ ") to Row(" + toRow + ") Col(" + toCol + ")");
Region region = new Region(fromRow, fromCol, toRow, toCol);
sheet.addMergedRegion(region);
}
} // end public class EPMerge
\ No newline at end of file
Re: dos2unix (Was: cvs commit: cocoon-2.1/.../poi/hssf/elements EPMerge.java)
Posted by Joerg Heinicke <jo...@gmx.de>.
David Crossley wrote:
> David Crossley wrote:
>
>>joerg@apache.org wrote:
>>
>>>joerg 2003/07/05 07:33:17
>>>
>>> Modified: src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements
>>> EPMerge.java
>>> Log:
>>> clean up
>>> line endings fixed
>>
>>The email diff showed something strange with the line endings after
>>your "fix". What tool did you use to do that? Anyway it did not work.
>>I use 'dos2unix' on a Linux platform.
>
>
> By the way, i reverted the changes and fixed the line endings again.
> However your log message also says "clean up" ... i cannot see what
> else was changed, so such revisions were lost.
>
> --David
Hmm, sorry, I "found" the file, because Eclipse gave me a warning in the
package explorer although the poi block was already "clean". Opening the
file after every line there was an empty line. I did a code formatting,
which seemed to fix the line endings, but I guess I should have done an
explicit converting (normally I use UltraEdit for this).
The clean up was an unused variable, that also caused the warning.
Sorry for breaking the file even more and thanks for the fixing :)
Joerg
Re: dos2unix (Was: cvs commit: cocoon-2.1/.../poi/hssf/elements
EPMerge.java)
Posted by David Crossley <cr...@indexgeo.com.au>.
David Crossley wrote:
> joerg@apache.org wrote:
> > joerg 2003/07/05 07:33:17
> >
> > Modified: src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements
> > EPMerge.java
> > Log:
> > clean up
> > line endings fixed
>
> The email diff showed something strange with the line endings after
> your "fix". What tool did you use to do that? Anyway it did not work.
> I use 'dos2unix' on a Linux platform.
By the way, i reverted the changes and fixed the line endings again.
However your log message also says "clean up" ... i cannot see what
else was changed, so such revisions were lost.
--David
dos2unix (Was: cvs commit: cocoon-2.1/.../poi/hssf/elements
EPMerge.java)
Posted by David Crossley <cr...@indexgeo.com.au>.
joerg@apache.org wrote:
> joerg 2003/07/05 07:33:17
>
> Modified: src/blocks/poi/java/org/apache/cocoon/components/elementprocessor/impl/poi/hssf/elements
> EPMerge.java
> Log:
> clean up
> line endings fixed
The email diff showed something strange with the line endings after
your "fix". What tool did you use to do that? Anyway it did not work.
I use 'dos2unix' on a Linux platform.
--David