AbstractCellRendererpublic abstract class AbstractCellRenderer extends Object implements CellRendererthis is the base class that most renderers will be derived from.
It allows setting the alignment. Subclasses should set there actuall
content by implementing getCellValue |
Fields Summary |
---|
protected String | _alignmentused for horizontal cell alignmnet |
Methods Summary |
---|
public java.lang.String | getAlignment()
return _alignment;
| protected abstract java.lang.String | getCellValue(org.apache.struts2.components.table.WebTable table, java.lang.Object data, int row, int col)this is the method that subclasses need to implement to set their value.
they should not override renderCell unless they want to change the alignmnent
renderering
| protected boolean | isAligned()
return _alignment != null;
| public java.lang.String | renderCell(org.apache.struts2.components.table.WebTable table, java.lang.Object data, int row, int col)implememnts CellRenderer renderCell. It sets the alignment. gets the actual
data from getCellValue
if (isAligned()) {
StringBuffer buf = new StringBuffer(256);
buf.append("<div align='").append(_alignment).append("'>");
buf.append(getCellValue(table, data, row, col));
buf.append("</div>");
return buf.toString();
}
return getCellValue(table, data, row, col);
| public void | setAlignment(java.lang.String alignment)
_alignment = alignment;
|
|