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    
015    package org.apache.tapestry.contrib.table.model.simple;
016    
017    import org.apache.tapestry.IRender;
018    import org.apache.tapestry.IRequestCycle;
019    import org.apache.tapestry.contrib.table.model.ITableColumn;
020    import org.apache.tapestry.contrib.table.model.ITableModelSource;
021    import org.apache.tapestry.contrib.table.model.ITableRendererSource;
022    import org.apache.tapestry.contrib.table.model.common.ComponentTableRendererSource;
023    import org.apache.tapestry.util.ComponentAddress;
024    
025    /**
026     * This is a simple implementation of
027     * {@link org.apache.tapestry.contrib.table.model.ITableRendererSource} that
028     * returns a standard renderer of a column header.
029     * <p>
030     * This implementation requires that the column passed is of type
031     * SimpleTableColumn
032     * 
033     * @see org.apache.tapestry.contrib.table.model.common.AbstractTableColumn
034     * @author mindbridge
035     * @since 2.3
036     */
037    public class SimpleTableColumnFormRendererSource implements
038            ITableRendererSource
039    {
040    
041        private static final long serialVersionUID = 1L;
042    
043        /**
044         * @see org.apache.tapestry.contrib.table.model.ITableRendererSource#getRenderer(IRequestCycle,
045         *      ITableModelSource, ITableColumn, Object)
046         */
047        public IRender getRenderer(IRequestCycle objCycle,
048                ITableModelSource objSource, ITableColumn objColumn, Object objRow)
049        {
050            ComponentAddress objAddress = new ComponentAddress(objSource
051                    .getNamespace(), "SimpleTableColumnPage",
052                    "tableColumnFormComponent");
053            ComponentTableRendererSource objComponentRenderer = new ComponentTableRendererSource(
054                    objAddress);
055    
056            return objComponentRenderer.getRenderer(objCycle, objSource, objColumn,
057                    objRow);
058        }
059    }