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 EPSheetObjectBonobo extends BaseElementProcessor { 37 private String _object_bound; 38 private Offsets _object_offset; 39 private Anchors _object_anchor_type; 40 private NumericResult _direction; 41 private static final String _object_bound_attribute = "ObjectBound"; 42 private static final String _object_offset_attribute = "ObjectOffset"; 43 private static final String _object_anchor_type_attribute = 44 "ObjectAnchorType"; 45 private static final String _direction_attribute = "Direction"; 46 private static final Validator _direction_validator = new Validator() { 47 public IOException validate(final Number number) { 48 return Direction.isValid(number.intValue()) ? null 49 : new IOException ("\"" + number + "\" is not a legal value"); 50 } 51 }; 52 53 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 68 public String getObjectBound() throws IOException { 69 if (_object_bound == null) { 70 _object_bound = getValue(_object_bound_attribute); 71 if (_object_bound == null) { 72 throw new IOException ( 73 "missing " + _object_bound_attribute + " attribute"); 74 } 75 } 76 return _object_bound; 77 } 78 79 83 public Offsets getOffsets() throws IOException { 84 if (_object_offset == null) { 85 _object_offset = new Offsets(getValue(_object_offset_attribute)); 86 } 87 return _object_offset; 88 } 89 90 94 public Anchors getAnchors() throws IOException { 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 106 public int getDirection() throws IOException { 107 if (_direction == null) { 108 _direction = NumericConverter.extractInteger( 109 getValue(_direction_attribute), _direction_validator); 110 } 111 return _direction.intValue(); 112 } 113 } | Popular Tags |