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.Validator; 21 22 import java.io.IOException ; 23 24 32 public class StyleOrientation { 33 private int _alignment; 34 private static final int _horiz = 1; 35 private static final int _vert_horiz_text = 2; 36 private static final int _vert_vert_text = 4; 37 private static final int _vert_vert_text2 = 8; 38 private static final Validator _validator = new Validator() { 39 public IOException validate(final Number number) { 40 int value = number.intValue(); 41 42 return (value >= 0 && value <= 15) ? null 43 : new IOException ("\"" + number + "\" is out of range"); 44 } 45 }; 46 47 52 public StyleOrientation(final String value) throws IOException { 53 _alignment = 54 NumericConverter.extractInteger(value, _validator).intValue(); 55 } 56 57 60 public boolean isHoriz() { 61 return (_alignment & _horiz) == _horiz; 62 } 63 64 67 public boolean isVertHorizText() { 68 return (_alignment & _vert_horiz_text) == _vert_horiz_text; 69 } 70 71 74 public boolean isVertVertText() { 75 return (_alignment & _vert_vert_text) == _vert_vert_text; 76 } 77 78 81 public boolean isVertVertText2() { 82 return (_alignment & _vert_vert_text2) == _vert_vert_text2; 83 } 84 } | Popular Tags |