KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > elementprocessor > impl > poi > hssf > elements > EPConstr


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements;
18
19 import org.apache.cocoon.components.elementprocessor.types.NumericConverter;
20 import org.apache.cocoon.components.elementprocessor.types.NumericResult;
21 import org.apache.cocoon.components.elementprocessor.types.Validator;
22
23 import java.io.IOException JavaDoc;
24
25 /**
26  * No-op implementation of ElementProcessor to handle the "Constr" tag
27  *
28  * This element contains several attributes and no content or other
29  * elements.
30  *
31  * This element is not used in HSSFSerializer 1.0
32  *
33  * @author Marc Johnson (marc_johnson27591@hotmail.com)
34  * @version CVS $Id: EPConstr.java 30932 2004-07-29 17:35:38Z vgritsenko $
35  */

36 public class EPConstr extends BaseElementProcessor {
37     private NumericResult _lcol;
38     private NumericResult _lrow;
39     private NumericResult _rcol;
40     private NumericResult _rrow;
41     private NumericResult _cols;
42     private NumericResult _rows;
43     private NumericResult _type;
44     private static final String JavaDoc _lcol_attribute = "Lcol";
45     private static final String JavaDoc _lrow_attribute = "Lrow";
46     private static final String JavaDoc _rcol_attribute = "Rcol";
47     private static final String JavaDoc _rrow_attribute = "Rrow";
48     private static final String JavaDoc _cols_attribute = "Cols";
49     private static final String JavaDoc _rows_attribute = "Rows";
50     private static final String JavaDoc _type_attribute = "Type";
51     private static final Validator _type_validator = new Validator() {
52         public IOException JavaDoc validate(final Number JavaDoc number) {
53             return ConstraintType.isValid(number.intValue()) ? null
54                 : new IOException JavaDoc("\"" + number + "\" is not a legal value");
55         }
56     };
57
58     /**
59      * constructor
60      */

61     public EPConstr() {
62         super(null);
63         _lcol = null;
64         _lrow = null;
65         _rcol = null;
66         _rrow = null;
67         _cols = null;
68         _rows = null;
69         _type = null;
70     }
71
72     /**
73      * @return lcol
74      * @exception IOException
75      */

76     public int getLcol() throws IOException JavaDoc {
77         if (_lcol == null) {
78             _lcol = NumericConverter.extractNonNegativeInteger(
79                     getValue(_lcol_attribute));
80         }
81         return _lcol.intValue();
82     }
83
84     /**
85      * @return lrow
86      * @exception IOException
87      */

88     public int getLrow() throws IOException JavaDoc {
89         if (_lrow == null) {
90             _lrow = NumericConverter.extractNonNegativeInteger(
91                     getValue(_lrow_attribute));
92         }
93         return _lrow.intValue();
94     }
95
96     /**
97      * @return rcol
98      * @exception IOException
99      */

100     public int getRcol() throws IOException JavaDoc {
101         if (_rcol == null) {
102             _rcol = NumericConverter.extractNonNegativeInteger(
103                     getValue(_rcol_attribute));
104         }
105         return _rcol.intValue();
106     }
107
108     /**
109      * @return rrow
110      * @exception IOException
111      */

112     public int getRrow() throws IOException JavaDoc {
113         if (_rrow == null) {
114             _rrow = NumericConverter.extractNonNegativeInteger(
115                     getValue(_rrow_attribute));
116         }
117         return _rrow.intValue();
118     }
119
120     /**
121      * @return cols
122      * @exception IOException
123      */

124     public int getCols() throws IOException JavaDoc {
125         if (_cols == null) {
126             _cols = NumericConverter.extractPositiveInteger(
127                     getValue(_cols_attribute));
128         }
129         return _cols.intValue();
130     }
131
132     /**
133      * @return rows
134      * @exception IOException
135      */

136     public int getRows() throws IOException JavaDoc {
137         if (_rows == null) {
138             _rows = NumericConverter.extractPositiveInteger(
139                     getValue(_rows_attribute));
140         }
141         return _rows.intValue();
142     }
143
144     /**
145      * @return type
146      * @exception IOException
147      */

148     public int getType() throws IOException JavaDoc {
149         if (_type == null) {
150             _type = NumericConverter.extractInteger(
151                     getValue(_type_attribute), _type_validator);
152         }
153         return _type.intValue();
154     }
155 } // end public class EPConstr
156
Popular Tags