1 16 17 package org.apache.cocoon.components.elementprocessor.impl.poi.hssf.elements; 18 19 import org.apache.cocoon.components.elementprocessor.types.NumericResult; 20 21 import java.io.IOException ; 22 23 30 public class PrintOrder { 31 private static final String _right_then_down = "r_then_d"; 32 private static final String _down_then_right = "d_then_r"; 33 public static final int PRINT_ORDER_RIGHT_THEN_DOWN = 0; 34 public static final int PRINT_ORDER_DOWN_THEN_RIGHT = 1; 35 private static final NumericResult _null_result = 36 new NumericResult(new IOException ("print order cannot be null")); 37 private static final NumericResult _right_then_down_result = 38 new NumericResult(new Integer (PRINT_ORDER_RIGHT_THEN_DOWN)); 39 private static final NumericResult _down_then_right_result = 40 new NumericResult(new Integer (PRINT_ORDER_DOWN_THEN_RIGHT)); 41 42 private PrintOrder() {} 43 44 50 public static NumericResult extractPrintOrder(final String value) { 51 NumericResult rval = null; 52 String input = (value == null) ? null : value.trim(); 53 54 if (input == null) { 55 rval = _null_result; 56 } else if (input.equalsIgnoreCase(_right_then_down)) { 57 rval = _right_then_down_result; 58 } else if (input.equalsIgnoreCase(_down_then_right)) { 59 rval = _down_then_right_result; 60 } else { 61 rval = new NumericResult(new IOException ( 62 "\"" + input + "\" is not a valid print order")); 63 } 64 return rval; 65 } 66 } | Popular Tags |