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 PrintOrientation { 31 private static final String _landscape = "landscape"; 32 private static final String _portrait = "portrait"; 33 public static final int PRINT_ORIENTATION_LANDSCAPE = 0; 34 public static final int PRINT_ORIENTATION_PORTRAIT = 1; 35 private static final NumericResult _null_result = 36 new NumericResult(new IOException ("print orientation cannot be null")); 37 private static final NumericResult _landscape_result = 38 new NumericResult(new Integer (PRINT_ORIENTATION_LANDSCAPE)); 39 private static final NumericResult _portrait_result = 40 new NumericResult(new Integer (PRINT_ORIENTATION_PORTRAIT)); 41 42 private PrintOrientation() {} 43 44 50 public static NumericResult extractPrintOrientation(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(_landscape)) { 57 rval = _landscape_result; 58 } else if (input.equalsIgnoreCase(_portrait)) { 59 rval = _portrait_result; 60 } else { 61 rval = new NumericResult( new IOException ( 62 "\"" + input + "\" is not a valid print orientation")); 63 } 64 return rval; 65 } 66 } | Popular Tags |