KickJava   Java API By Example, From Geeks To Geeks.

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


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

35 public class EPFrame extends BaseElementProcessor {
36     private String JavaDoc _label;
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 _label_attribute = "Label";
42     private static final String JavaDoc _object_bound_attribute = "ObjectBound";
43     private static final String JavaDoc _object_offset_attribute = "ObjectOffset";
44     private static final String JavaDoc _object_anchor_type_attribute =
45         "ObjectAnchorType";
46     private static final String JavaDoc _direction_attribute = "Direction";
47     private static final Validator _direction_validator = new Validator() {
48         public IOException JavaDoc validate(final Number JavaDoc number) {
49             return Direction.isValid(number.intValue()) ? null
50                 : new IOException JavaDoc("\"" + number + "\" is not a legal value");
51         }
52     };
53
54     /**
55      * constructor
56      */

57     public EPFrame() {
58         super(null);
59         _label = null;
60         _object_bound = null;
61         _object_offset = null;
62         _object_anchor_type = null;
63         _direction = null;
64     }
65
66     /**
67      * @return label
68      * @exception IOException
69      */

70     public String JavaDoc getLabel() throws IOException JavaDoc {
71         if (_label == null) {
72             _label = getValue(_label_attribute);
73             if (_label == null) {
74                 throw new IOException JavaDoc(
75                     "missing " + _label_attribute + " attribute");
76             }
77         }
78         return _label;
79     }
80
81     /**
82      * @return object_bound
83      * @exception IOException
84      */

85     public String JavaDoc getObjectBound() throws IOException JavaDoc {
86         if (_object_bound == null) {
87             _object_bound = getValue(_object_bound_attribute);
88             if (_object_bound == null) {
89                 throw new IOException JavaDoc(
90                     "missing " + _object_bound_attribute + " attribute");
91             }
92         }
93         return _object_bound;
94     }
95
96     /**
97      * @return offsets
98      * @exception IOException
99      */

100     public Offsets getOffsets() throws IOException JavaDoc {
101         if (_object_offset == null) {
102             _object_offset = new Offsets(getValue(_object_offset_attribute));
103         }
104         return _object_offset;
105     }
106
107     /**
108      * @return anchors
109      * @exception IOException
110      */

111     public Anchors getAnchors() throws IOException JavaDoc {
112         if (_object_anchor_type == null) {
113             _object_anchor_type =
114                 new Anchors(getValue(_object_anchor_type_attribute));
115         }
116         return _object_anchor_type;
117     }
118
119     /**
120      * @return direction as a public member of Direction
121      * @exception IOException
122      */

123     public int getDirection() throws IOException JavaDoc {
124         if (_direction == null) {
125             _direction =
126                 NumericConverter.extractInteger(
127                     getValue(_direction_attribute),
128                     _direction_validator);
129         }
130         return _direction.intValue();
131     }
132 } // end public class EPFrame
133
Popular Tags