1 16 package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements; 17 18 import org.apache.cocoon.components.elementprocessor.types.Attribute; 19 import org.apache.cocoon.components.elementprocessor.ElementProcessor; 20 import org.apache.cocoon.components.elementprocessor.types.NumericConverter; 21 import org.apache.cocoon.components.elementprocessor.types.NumericResult; 22 23 import java.io.IOException ; 24 25 34 public class EPCols extends BaseElementProcessor { 35 private NumericResult _default_size_pts; 36 private boolean _default_size_pts_fetched; 37 private static final String _default_size_pts_attribute = "DefaultSizePts"; 38 39 static final String DEFAULT_SIZE_PTS = "40.0"; 41 42 45 public EPCols() { 46 super(null); 47 _default_size_pts = null; 48 _default_size_pts_fetched = false; 49 } 50 51 57 public double getDefaultSizePts() 58 throws IOException , NullPointerException { 59 if (!_default_size_pts_fetched) { 60 String value = getValue(_default_size_pts_attribute); 61 62 if (value == null || value.trim().equals("")) { 63 value = DEFAULT_SIZE_PTS; 64 } 65 _default_size_pts = NumericConverter.extractDouble(value); 66 _default_size_pts_fetched = true; 67 } 68 return _default_size_pts.doubleValue(); 69 } 70 71 78 public void initialize( 79 final Attribute[] attributes, 80 final ElementProcessor parent) 81 throws IOException { 82 super.initialize(attributes, parent); 83 getSheet().setDefaultColumnWidth(getDefaultSizePts()); 84 } 85 } | Popular Tags |