KickJava   Java API By Example, From Geeks To Geeks.

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


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
20
21 import org.apache.cocoon.components.elementprocessor.types.NumericConverter;
22 import org.apache.cocoon.components.elementprocessor.types.NumericResult;
23
24 import java.io.IOException JavaDoc;
25
26 /**
27  * No-op implementation of ElementProcessor to handle the "bottom" tag
28  *
29  * This element has two attributes: Points and PrefUnit
30  *
31  * This element is not used in HSSFSerializer 1.0
32  *
33  * @author Marc Johnson (marc_johnson27591@hotmail.com)
34  * @version CVS $Id: EP_Bottom.java 30932 2004-07-29 17:35:38Z vgritsenko $
35  */

36 public class EP_Bottom extends BaseElementProcessor {
37     private static final String JavaDoc _points_attribute = "Points";
38     private static final String JavaDoc _pref_unit_attribute = "PrefUnit";
39     private NumericResult _points;
40     private NumericResult _pref_unit;
41
42     /**
43      * constructor
44      */

45
46     public EP_Bottom() {
47         super(null);
48         _points = null;
49         _pref_unit = null;
50     }
51
52     /**
53      * @return points
54      *
55      * @exception IOException
56      */

57
58     double getPoints() throws IOException JavaDoc {
59         if (_points == null) {
60             _points =
61                 NumericConverter.extractDouble(getValue(_points_attribute));
62         }
63         return _points.doubleValue();
64     }
65
66     /**
67      * @return print unit (always one of the values in PrintUnits)
68      *
69      * @exception IOException
70      */

71
72     int getPrefUnit() throws IOException JavaDoc {
73         if (_pref_unit == null) {
74             _pref_unit =
75                 PrintUnits.extractPrintUnits(getValue(_pref_unit_attribute));
76         }
77         return _pref_unit.intValue();
78     }
79 } // end public class EP_Bottom
80
Popular Tags