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 EPCheckbox extends BaseElementProcessor { 37 private String _input; 38 private NumericResult _value; 39 private String _object_bound; 40 private Offsets _object_offset; 41 private Anchors _object_anchor_type; 42 private NumericResult _direction; 43 private static final String _input_attribute = "Input"; 44 private static final String _value_attribute = "Value"; 45 private static final String _object_bound_attribute = "ObjectBound"; 46 private static final String _object_offset_attribute = "ObjectOffset"; 47 private static final String _object_anchor_type_attribute = 48 "ObjectAnchorType"; 49 private static final String _direction_attribute = "Direction"; 50 private static final Validator _direction_validator = new Validator() { 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 EPCheckbox() { 61 super(null); 62 _input = null; 63 _value = null; 64 _object_bound = null; 65 _object_offset = null; 66 _object_anchor_type = null; 67 _direction = null; 68 } 69 70 74 public String getInput() throws IOException { 75 if (_input == null) { 76 _input = getValue(_input_attribute); 77 if (_input == null) { 78 throw new IOException ("missing " + _input_attribute 79 + " attribute"); 80 } 81 } 82 return _input; 83 } 84 85 89 public int getValue() throws IOException { 90 if (_value == null) { 91 _value = 92 NumericConverter.extractInteger(getValue(_value_attribute)); 93 } 94 return _value.intValue(); 95 } 96 97 101 public String getObjectBound() throws IOException { 102 if (_object_bound == null) { 103 _object_bound = getValue(_object_bound_attribute); 104 if (_object_bound == null) { 105 throw new IOException ( 106 "missing " + _object_bound_attribute + " attribute"); 107 } 108 } 109 return _object_bound; 110 } 111 112 116 public Offsets getOffsets() throws IOException { 117 if (_object_offset == null) { 118 _object_offset = new Offsets(getValue(_object_offset_attribute)); 119 } 120 return _object_offset; 121 } 122 123 127 public Anchors getAnchors() throws IOException { 128 if (_object_anchor_type == null) { 129 _object_anchor_type = 130 new Anchors(getValue(_object_anchor_type_attribute)); 131 } 132 return _object_anchor_type; 133 } 134 135 139 public int getDirection() throws IOException { 140 if (_direction == null) { 141 _direction = 142 NumericConverter.extractInteger( 143 getValue(_direction_attribute), 144 _direction_validator); 145 } 146 return _direction.intValue(); 147 } 148 } | Popular Tags |