001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.extensions.markup.html.repeater.tree.table;
018
019import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
020import org.apache.wicket.extensions.markup.html.repeater.tree.TableTree;
021import org.apache.wicket.model.IModel;
022
023/**
024 * @param <T>
025 *            the type of the model object
026 * @param <S>
027 *            the type of the sort property
028 * @author svenmeier
029 */
030public abstract class AbstractTreeColumn<T, S> extends AbstractColumn<T, S>
031        implements
032                ITreeColumn<T, S>
033{
034        private static final long serialVersionUID = 1L;
035
036        private TableTree<T, S> tree;
037
038        /**
039         * @param displayModel
040         *            model used to generate header text
041         */
042        public AbstractTreeColumn(IModel<String> displayModel)
043        {
044                super(displayModel);
045        }
046
047        /**
048         * @param displayModel
049         *            model used to generate header text
050         * @param sortProperty
051         *            sort property this column represents
052         */
053        public AbstractTreeColumn(IModel<String> displayModel, S sortProperty)
054        {
055                super(displayModel, sortProperty);
056        }
057
058        @Override
059        public void setTree(TableTree<T, S> tree)
060        {
061                this.tree = tree;
062        }
063
064        /**
065         * Get the containing tree.
066         * 
067         * @return tree
068         */
069        public TableTree<T, S> getTree()
070        {
071                return tree;
072        }
073}