1 2 24 25 26 27 28 29 package com.lutris.html; 30 31 32 45 public abstract class HtmlTableCell { 46 47 public static final int ALIGN_LEFT = 1; 48 public static final int ALIGN_CENTER = 2; 49 public static final int ALIGN_RIGHT = 3; 50 public static final int VALIGN_TOP = 1; 51 public static final int VALIGN_MIDDLE = 2; 52 public static final int VALIGN_BOTTOM = 3; 53 54 protected String caption; 55 protected int rowSpan = 0; 56 protected int colSpan = 0; 57 protected String tdValue = null; 58 protected String align = null; 59 protected String valign = null; 60 protected String bgColor = null; 61 protected int percentWidth = 0; 62 63 public HtmlTableCell(String tdValue) 64 { 65 this.tdValue = tdValue; 66 } 67 68 public HtmlTableCell(String tdValue, String defaultValue) 69 { 70 if (tdValue.equals("")) { 71 this.tdValue = defaultValue; 72 } else { 73 this.tdValue = tdValue; 74 } 75 } 76 77 public void setHorizontalAlignment(int alignment) 78 { 79 switch (alignment) { 80 case ALIGN_CENTER: 81 this.align = "CENTER"; 82 break; 83 case ALIGN_RIGHT: 84 this.align = "RIGHT"; 85 break; 86 default: 87 this.align = "LEFT"; 88 break; 89 } 90 } 91 92 public void setVerticalAlignment(int alignment) 93 { 94 switch (alignment) { 95 case VALIGN_TOP: 96 this.valign = "TOP"; 97 break; 98 case VALIGN_MIDDLE: 99 this.valign = "MIDDLE"; 100 break; 101 default: 102 this.valign = "BOTTOM"; 103 break; 104 } 105 } 106 107 public void setRowSpan(int rowSpan) 108 { 109 if (rowSpan > 0) 110 this.rowSpan = rowSpan; 111 } 112 113 public void setColSpan(int colSpan) 114 { 115 if (colSpan > 0) 116 this.colSpan = colSpan; 117 } 118 119 public void setValue(String tdValue) 120 { 121 this.tdValue = tdValue; 122 } 123 124 public void setBackgroundColor(String bgColor) 125 { 126 this.bgColor = bgColor; 127 } 128 129 public void setPercentWidth(int percent) 130 { 131 if (percent > 0 && percent <= 100) 132 this.percentWidth = percent; 133 } 134 } 135 | Popular Tags |