1 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 ; 24 25 36 public class EPCellComment 37 extends BaseElementProcessor 38 { 39 private String _author; 40 private String _text; 41 private String _object_bound; 42 private Offsets _object_offset; 43 private Anchors _object_anchor_type; 44 private NumericResult _direction; 45 private static final String _author_attribute = "Author"; 46 private static final String _text_attribute = "Text"; 47 private static final String _object_bound_attribute = "ObjectBound"; 48 private static final String _object_offset_attribute = "ObjectOffset"; 49 private static final String _object_anchor_type_attribute = 50 "ObjectAnchorType"; 51 private static final String _direction_attribute = "Direction"; 52 private static final Validator _direction_validator = new Validator() { 53 public IOException validate(final Number number) { 54 return Direction.isValid(number.intValue()) ? null 55 : new IOException ("\"" + number + "\" is not a legal value"); 56 } 57 }; 58 59 62 public EPCellComment() { 63 super(null); 64 _author = null; 65 _text = null; 66 _object_bound = null; 67 _object_offset = null; 68 _object_anchor_type = null; 69 _direction = null; 70 } 71 72 77 78 public String getAuthor() throws IOException { 79 if (_author == null) { 80 _author = getValue(_author_attribute); 81 if (_author == null) { 82 throw new IOException ("missing " + _author_attribute 83 + " attribute"); 84 } 85 } 86 return _author; 87 } 88 89 94 public String getText() throws IOException { 95 if (_text == null) { 96 _text = getValue(_text_attribute); 97 if (_text == null) { 98 throw new IOException ("missing " + _text_attribute 99 + " attribute"); 100 } 101 } 102 return _text; 103 } 104 105 110 public String getObjectBound() throws IOException { 111 if (_object_bound == null) { 112 _object_bound = getValue(_object_bound_attribute); 113 if (_object_bound == null) { 114 throw new IOException ("missing " + _object_bound_attribute 115 + " attribute"); 116 } 117 } 118 return _object_bound; 119 } 120 121 126 public Offsets getOffsets() throws IOException { 127 if (_object_offset == null) { 128 _object_offset = new Offsets(getValue(_object_offset_attribute)); 129 } 130 return _object_offset; 131 } 132 133 138 public Anchors getAnchors() throws IOException { 139 if (_object_anchor_type == null) { 140 _object_anchor_type = 141 new Anchors(getValue(_object_anchor_type_attribute)); 142 } 143 return _object_anchor_type; 144 } 145 146 151 public int getDirection() throws IOException { 152 if (_direction == null) { 153 _direction = NumericConverter.extractInteger( 154 getValue(_direction_attribute), _direction_validator); 155 } 156 return _direction.intValue(); 157 } 158 } | Popular Tags |