001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017:
018: package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
019:
020: import org.apache.cocoon.components.elementprocessor.types.NumericConverter;
021: import org.apache.cocoon.components.elementprocessor.types.NumericResult;
022:
023: import java.io.IOException;
024:
025: /**
026: * No-op implementation of ElementProcessor to handle the
027: * "Selection" tag
028: *
029: * This element is a container of other elements and has four
030: * attributes that define the boundaries of the region.
031: *
032: * This element is not used in HSSFSerializer 1.0
033: *
034: * @author Marc Johnson (marc_johnson27591@hotmail.com)
035: * @version CVS $Id: EPSelection.java 433543 2006-08-22 06:22:54Z crossley $
036: */
037: public class EPSelection extends BaseElementProcessor {
038: private static final String _start_col_attribute = "startCol";
039: private static final String _start_row_attribute = "startRow";
040: private static final String _end_col_attribute = "endCol";
041: private static final String _end_row_attribute = "endRow";
042: private NumericResult _start_col;
043: private NumericResult _start_row;
044: private NumericResult _end_col;
045: private NumericResult _end_row;
046:
047: /**
048: * constructor
049: */
050: public EPSelection() {
051: super (null);
052: _start_col = null;
053: _start_row = null;
054: _end_col = null;
055: _end_row = null;
056: }
057:
058: /**
059: * @return start row
060: * @exception IOException
061: */
062: public int getStartRow() throws IOException {
063: if (_start_row == null) {
064: _start_row = NumericConverter
065: .extractNonNegativeInteger(getValue(_start_row_attribute));
066: }
067: return _start_row.intValue();
068: }
069:
070: /**
071: * @return start column
072: * @exception IOException
073: */
074: public int getStartCol() throws IOException {
075: if (_start_col == null) {
076: _start_col = NumericConverter
077: .extractNonNegativeInteger(getValue(_start_col_attribute));
078: }
079: return _start_col.intValue();
080: }
081:
082: /**
083: * @return end row
084: * @exception IOException
085: */
086: public int getEndRow() throws IOException {
087: if (_end_row == null) {
088: _end_row = NumericConverter
089: .extractNonNegativeInteger(getValue(_end_row_attribute));
090: }
091: return _end_row.intValue();
092: }
093:
094: /**
095: * @return end column
096: * @exception IOException
097: */
098: public int getEndCol() throws IOException {
099: if (_end_col == null) {
100: _end_col = NumericConverter
101: .extractNonNegativeInteger(getValue(_end_col_attribute));
102: }
103: return _end_col.intValue();
104: }
105: } // end public class EPSelection
|