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 35 public class EPFrame extends BaseElementProcessor { 36 private String _label; 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 _label_attribute = "Label"; 42 private static final String _object_bound_attribute = "ObjectBound"; 43 private static final String _object_offset_attribute = "ObjectOffset"; 44 private static final String _object_anchor_type_attribute = 45 "ObjectAnchorType"; 46 private static final String _direction_attribute = "Direction"; 47 private static final Validator _direction_validator = new Validator() { 48 public IOException validate(final Number number) { 49 return Direction.isValid(number.intValue()) ? null 50 : new IOException ("\"" + number + "\" is not a legal value"); 51 } 52 }; 53 54 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 70 public String getLabel() throws IOException { 71 if (_label == null) { 72 _label = getValue(_label_attribute); 73 if (_label == null) { 74 throw new IOException ( 75 "missing " + _label_attribute + " attribute"); 76 } 77 } 78 return _label; 79 } 80 81 85 public String getObjectBound() throws IOException { 86 if (_object_bound == null) { 87 _object_bound = getValue(_object_bound_attribute); 88 if (_object_bound == null) { 89 throw new IOException ( 90 "missing " + _object_bound_attribute + " attribute"); 91 } 92 } 93 return _object_bound; 94 } 95 96 100 public Offsets getOffsets() throws IOException { 101 if (_object_offset == null) { 102 _object_offset = new Offsets(getValue(_object_offset_attribute)); 103 } 104 return _object_offset; 105 } 106 107 111 public Anchors getAnchors() throws IOException { 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 123 public int getDirection() throws IOException { 124 if (_direction == null) { 125 _direction = 126 NumericConverter.extractInteger( 127 getValue(_direction_attribute), 128 _direction_validator); 129 } 130 return _direction.intValue(); 131 } 132 } | Popular Tags |