KickJava   Java API By Example, From Geeks To Geeks.

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


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
27  * "SheetObjectBonobo" tag
28  *
29  * This element has a small number of Attributes and no content.
30  *
31  * This element is not used in HSSFSerializer 1.0
32  *
33  * @author Marc Johnson (marc_johnson27591@hotmail.com)
34  * @version CVS $Id: EPSheetObjectBonobo.java 30932 2004-07-29 17:35:38Z vgritsenko $
35  */

36 public class EPSheetObjectBonobo extends BaseElementProcessor {
37     private String JavaDoc _object_bound;
38     private Offsets _object_offset;
39     private Anchors _object_anchor_type;
40     private NumericResult _direction;
41     private static final String JavaDoc _object_bound_attribute = "ObjectBound";
42     private static final String JavaDoc _object_offset_attribute = "ObjectOffset";
43     private static final String JavaDoc _object_anchor_type_attribute =
44         "ObjectAnchorType";
45     private static final String JavaDoc _direction_attribute = "Direction";
46     private static final Validator _direction_validator = new Validator() {
47         public IOException JavaDoc validate(final Number JavaDoc number) {
48             return Direction.isValid(number.intValue()) ? null
49                 : new IOException JavaDoc("\"" + number + "\" is not a legal value");
50         }
51     };
52
53     /**
54      * constructor
55      */

56     public EPSheetObjectBonobo() {
57         super(null);
58         _object_bound = null;
59         _object_offset = null;
60         _object_anchor_type = null;
61         _direction = null;
62     }
63
64     /**
65      * @return object_bound
66      * @exception IOException
67      */

68     public String JavaDoc getObjectBound() throws IOException JavaDoc {
69         if (_object_bound == null) {
70             _object_bound = getValue(_object_bound_attribute);
71             if (_object_bound == null) {
72                 throw new IOException JavaDoc(
73                     "missing " + _object_bound_attribute + " attribute");
74             }
75         }
76         return _object_bound;
77     }
78
79     /**
80      * @return offsets
81      * @exception IOException
82      */

83     public Offsets getOffsets() throws IOException JavaDoc {
84         if (_object_offset == null) {
85             _object_offset = new Offsets(getValue(_object_offset_attribute));
86         }
87         return _object_offset;
88     }
89
90     /**
91      * @return anchors
92      * @exception IOException
93      */

94     public Anchors getAnchors() throws IOException JavaDoc {
95         if (_object_anchor_type == null) {
96             _object_anchor_type =
97                 new Anchors(getValue(_object_anchor_type_attribute));
98         }
99         return _object_anchor_type;
100     }
101
102     /**
103      * @return direction as a public member of Direction
104      * @exception IOException
105      */

106     public int getDirection() throws IOException JavaDoc {
107         if (_direction == null) {
108             _direction = NumericConverter.extractInteger(
109                     getValue(_direction_attribute), _direction_validator);
110         }
111         return _direction.intValue();
112     }
113 } // end public class EPSheetObjectBonobo
114
Popular Tags