1 17 18 19 20 package org.apache.fop.layoutmgr.table; 21 22 import org.apache.fop.fo.Constants; 23 import org.apache.fop.fo.properties.CommonBorderPaddingBackground; 24 import org.apache.fop.fo.properties.CommonBorderPaddingBackground.BorderInfo; 25 26 30 public abstract class CollapsingBorderModel { 31 32 33 protected static final int BEFORE = CommonBorderPaddingBackground.BEFORE; 34 35 protected static final int AFTER = CommonBorderPaddingBackground.AFTER; 36 37 protected static final int START = CommonBorderPaddingBackground.START; 38 39 protected static final int END = CommonBorderPaddingBackground.END; 40 41 42 public static final int VERTICAL_START_END_OF_TABLE = 1; 43 44 45 47 49 51 53 private static CollapsingBorderModel collapse = null; 55 private static CollapsingBorderModel collapseWithPrecedence = null; 56 57 61 public static CollapsingBorderModel getBorderModelFor(int borderCollapse) { 62 switch (borderCollapse) { 63 case Constants.EN_COLLAPSE: 64 if (collapse == null) { 65 collapse = new CollapsingBorderModelEyeCatching(); 66 } 67 return collapse; 68 case Constants.EN_COLLAPSE_WITH_PRECEDENCE: 69 if (collapseWithPrecedence == null) { 70 } 72 return collapseWithPrecedence; 73 default: 74 throw new IllegalArgumentException ("Illegal border-collapse mode."); 75 } 76 } 77 78 82 public static int getOtherSide(int side) { 83 switch (side) { 84 case CommonBorderPaddingBackground.BEFORE: 85 return CommonBorderPaddingBackground.AFTER; 86 case CommonBorderPaddingBackground.AFTER: 87 return CommonBorderPaddingBackground.BEFORE; 88 case CommonBorderPaddingBackground.START: 89 return CommonBorderPaddingBackground.END; 90 case CommonBorderPaddingBackground.END: 91 return CommonBorderPaddingBackground.START; 92 default: 93 throw new IllegalArgumentException ("Illegal parameter: side"); 94 } 95 } 96 97 101 protected boolean isVerticalRelation(int side) { 102 return (side == CommonBorderPaddingBackground.BEFORE 103 || side == CommonBorderPaddingBackground.AFTER); 104 } 105 106 107 112 public int getPreferenceValue(int style) { 113 switch (style) { 114 case Constants.EN_DOUBLE: return 0; 115 case Constants.EN_SOLID: return -1; 116 case Constants.EN_DASHED: return -2; 117 case Constants.EN_DOTTED: return -3; 118 case Constants.EN_RIDGE: return -4; 119 case Constants.EN_OUTSET: return -5; 120 case Constants.EN_GROOVE: return -6; 121 case Constants.EN_INSET: return -7; 122 default: throw new IllegalStateException ("Illegal border style: " + style); 123 } 124 } 125 126 132 public abstract BorderInfo determineWinner( 133 GridUnit current, GridUnit neighbour, int side, int flags); 134 135 } 136 | Popular Tags |