1 17 18 19 20 package org.apache.fop.render.txt.border; 21 22 import org.apache.fop.fo.Constants; 23 import org.apache.fop.render.txt.TXTState; 24 25 28 public class BorderManager { 29 30 31 private AbstractBorderElement[][] borderInfo; 32 33 34 private int width; 35 36 37 private int height; 38 39 40 private int startX; 41 42 43 private int startY; 44 45 46 private TXTState state; 47 48 56 public BorderManager(int pageWidth, int pageHeight, TXTState state) { 57 this.state = state; 58 borderInfo = new AbstractBorderElement[pageHeight][pageWidth]; 59 } 60 61 70 public void addBorderElement(int x, int y, int style, int type) { 71 AbstractBorderElement be = null; 72 73 if (style == Constants.EN_SOLID || style == Constants.EN_DOUBLE) { 74 be = new SolidAndDoubleBorderElement(style, type); 75 } else if (style == Constants.EN_DOTTED) { 76 be = new DottedBorderElement(); 77 } else if (style == Constants.EN_DASHED) { 78 be = new DashedBorderElement(type); 79 } else { 80 return; 81 } 82 be.transformElement(state); 83 84 if (borderInfo[y][x] != null) { 85 borderInfo[y][x] = borderInfo[y][x].merge(be); 86 } else { 87 borderInfo[y][x] = be; 88 } 89 } 90 91 98 public Character getCharacter(int x, int y) { 99 Character c = null; 100 if (borderInfo[y][x] != null) { 101 c = new Character (borderInfo[y][x].convert2Char()); 102 } 103 return c; 104 } 105 106 109 public int getWidth() { 110 return width; 111 } 112 113 117 public void setWidth(int width) { 118 this.width = width; 119 } 120 121 124 public int getHeight() { 125 return height; 126 } 127 128 132 public void setHeight(int height) { 133 this.height = height; 134 } 135 136 139 public int getStartX() { 140 return startX; 141 } 142 143 147 public void setStartX(int startX) { 148 this.startX = startX; 149 } 150 151 154 public int getStartY() { 155 return startY; 156 } 157 158 162 public void setStartY(int startY) { 163 this.startY = startY; 164 } 165 } 166 | Popular Tags |