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 EPRev_Diagonal 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 EPRev_Diagonal() { 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 = 66 NumericConverter.extractInteger( 67 getValue(_style_attribute), 68 _style_validator); 69 } 70 return _style.intValue(); 71 } 72 73 77 public ColorCode getColor() throws IOException { 78 if (!_color_fetched) { 79 String colorString = getValue(_color_attribute); 80 if (colorString != null) { 81 _color = new ColorCode(colorString); 82 } 83 _color_fetched = true; 84 } 85 return _color; 86 } 87 } | Popular Tags |