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 EPDiagonal extends BaseElementProcessor { 37 private NumericResult _style; 38 private boolean _color_fetched; 39 private ColorCode _color; 40 private static final String _style_attribute = "Style"; 41 private static final String _color_attribute = "Color"; 42 private static final Validator _style_validator = new Validator() { 43 public IOException validate(final Number number) { 44 return BorderStyle.isValid(number.intValue()) ? null 45 : new IOException ("\"" + number + "\" is not a legal value"); 46 } 47 }; 48 49 52 public EPDiagonal() { 53 super(null); 54 _style = null; 55 _color = null; 56 _color_fetched = false; 57 } 58 59 63 public int getStyle() throws IOException { 64 if (_style == null) { 65 _style = NumericConverter.extractInteger( 66 getValue(_style_attribute), _style_validator); 67 } 68 return _style.intValue(); 69 } 70 71 75 public ColorCode getColor() throws IOException { 76 if (!_color_fetched) { 77 String colorString = getValue(_color_attribute); 78 if (colorString != null) { 79 _color = new ColorCode(colorString); 80 } 81 _color_fetched = true; 82 } 83 return _color; 84 } 85 } | Popular Tags |