001// Copyright 2004, 2005 The Apache Software Foundation 002// 003// Licensed under the Apache License, Version 2.0 (the "License"); 004// you may not use this file except in compliance with the License. 005// You may obtain a copy of the License at 006// 007// http://www.apache.org/licenses/LICENSE-2.0 008// 009// Unless required by applicable law or agreed to in writing, software 010// distributed under the License is distributed on an "AS IS" BASIS, 011// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012// See the License for the specific language governing permissions and 013// limitations under the License. 014 015package org.apache.tapestry.contrib.table.model.simple; 016 017import org.apache.tapestry.IRender; 018import org.apache.tapestry.IRequestCycle; 019import org.apache.tapestry.contrib.table.model.ITableColumn; 020import org.apache.tapestry.contrib.table.model.ITableModelSource; 021import org.apache.tapestry.contrib.table.model.ITableRendererSource; 022import org.apache.tapestry.contrib.table.model.common.ComponentTableRendererSource; 023import org.apache.tapestry.util.ComponentAddress; 024 025/** 026 * This is a simple implementation of 027 * {@link org.apache.tapestry.contrib.table.model.ITableRendererSource} 028 * that returns a standard renderer of a column header. <p> 029 * 030 * This implementation requires that the column passed is of type SimpleTableColumn 031 * 032 * @see org.apache.tapestry.contrib.table.model.common.AbstractTableColumn 033 * @author mindbridge 034 * @since 2.3 035 */ 036public class SimpleTableColumnRendererSource implements ITableRendererSource 037{ 038 private static final long serialVersionUID = 1L; 039 040 public SimpleTableColumnRendererSource() 041 { 042 } 043 044 /** 045 * @see org.apache.tapestry.contrib.table.model.ITableRendererSource#getRenderer(IRequestCycle, ITableModelSource, ITableColumn, Object) 046 */ 047 public IRender getRenderer( 048 IRequestCycle objCycle, 049 ITableModelSource objSource, 050 ITableColumn objColumn, 051 Object objRow) 052 { 053 ComponentAddress objAddress = 054 new ComponentAddress( 055 objSource.getNamespace(), 056 "SimpleTableColumnPage", 057 "tableColumnComponent"); 058 ComponentTableRendererSource objComponentRenderer = 059 new ComponentTableRendererSource(objAddress); 060 061 return objComponentRenderer.getRenderer( 062 objCycle, 063 objSource, 064 objColumn, 065 objRow); 066 } 067}