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 EPButton extends BaseElementProcessor 36 { 37 private String _label; 38 private String _object_bound; 39 private Offsets _object_offset; 40 private Anchors _object_anchor_type; 41 private NumericResult _direction; 42 private static final String _label_attribute = "Label"; 43 private static final String _object_bound_attribute = "ObjectBound"; 44 private static final String _object_offset_attribute = "ObjectOffset"; 45 private static final String _object_anchor_type_attribute = 46 "ObjectAnchorType"; 47 private static final String _direction_attribute = "Direction"; 48 private static final Validator _direction_validator = 49 new Validator() 50 { 51 public IOException validate(final Number number) { 52 return Direction.isValid(number.intValue()) ? null 53 : new IOException ("\"" + number + "\" is not a legal value"); 54 } 55 }; 56 57 60 public EPButton() { 61 super(null); 62 _label = null; 63 _object_bound = null; 64 _object_offset = null; 65 _object_anchor_type = null; 66 _direction = null; 67 } 68 69 74 public String getLabel() throws IOException { 75 if (_label == null) { 76 _label = getValue(_label_attribute); 77 if (_label == null) { 78 throw new IOException ("missing " + _label_attribute 79 + " attribute"); 80 } 81 } 82 return _label; 83 } 84 85 90 public String getObjectBound() throws IOException { 91 if (_object_bound == null) { 92 _object_bound = getValue(_object_bound_attribute); 93 if (_object_bound == null) { 94 throw new IOException ("missing " + _object_bound_attribute 95 + " attribute"); 96 } 97 } 98 return _object_bound; 99 } 100 101 106 107 public Offsets getOffsets() throws IOException { 108 if (_object_offset == null) { 109 _object_offset = new Offsets(getValue(_object_offset_attribute)); 110 } 111 return _object_offset; 112 } 113 114 119 public Anchors getAnchors() throws IOException { 120 if (_object_anchor_type == null) { 121 _object_anchor_type = 122 new Anchors(getValue(_object_anchor_type_attribute)); 123 } 124 return _object_anchor_type; 125 } 126 127 132 public int getDirection() throws IOException { 133 if (_direction == null) { 134 _direction = NumericConverter.extractInteger( 135 getValue(_direction_attribute), _direction_validator); 136 } 137 return _direction.intValue(); 138 } 139 } | Popular Tags |