1 15 package org.apache.tapestry.contrib.table.components; 16 17 import java.util.Iterator ; 18 19 import org.apache.tapestry.IRender; 20 import org.apache.tapestry.IRequestCycle; 21 import org.apache.tapestry.contrib.table.model.ITableColumn; 22 import org.apache.tapestry.contrib.table.model.ITableColumnModel; 23 24 38 public abstract class TableValues extends AbstractTableRowComponent 39 { 40 public static final String TABLE_VALUE_CSS_CLASS_SUFFIX = "ColumnValue"; 41 42 private ITableColumn m_objTableColumn; 44 45 50 public Iterator getTableColumnIterator() 51 { 52 ITableColumnModel objColumnModel = getTableModelSource().getTableModel().getColumnModel(); 53 return objColumnModel.getColumns(); 54 } 55 56 62 public ITableColumn getTableColumn() 63 { 64 return m_objTableColumn; 65 } 66 67 73 public void setTableColumn(ITableColumn tableColumn) 74 { 75 m_objTableColumn = tableColumn; 76 77 if (isParameterBound("column")) 78 setColumnParameter(tableColumn); 79 } 80 81 86 public IRender getTableValueRenderer() 87 { 88 Object objRow = getTableRowSource().getTableRow(); 89 return getTableColumn().getValueRenderer( 90 getPage().getRequestCycle(), 91 getTableModelSource(), 92 objRow); 93 } 94 95 101 public String getValueClass() 102 { 103 if (isParameterBound("class")) 104 return getCellClass(); 105 106 return getTableColumn().getColumnName() + TABLE_VALUE_CSS_CLASS_SUFFIX; 107 } 108 109 110 protected void cleanupAfterRender(IRequestCycle cycle) 111 { 112 super.cleanupAfterRender(cycle); 113 114 m_objTableColumn = null; 115 116 } 117 118 119 120 public abstract void setColumnParameter(ITableColumn column); 121 122 123 124 public abstract String getCellClass(); 125 } | Popular Tags |