001    /*
002     * $Id: DefaultMutableTreeTableNode.java 3233 2009-01-30 15:13:10Z kschaefe $
003     *
004     * Copyright 2004 Sun Microsystems, Inc., 4150 Network Circle,
005     * Santa Clara, California 95054, U.S.A. All rights reserved.
006     *
007     * This library is free software; you can redistribute it and/or
008     * modify it under the terms of the GNU Lesser General Public
009     * License as published by the Free Software Foundation; either
010     * version 2.1 of the License, or (at your option) any later version.
011     * 
012     * This library is distributed in the hope that it will be useful,
013     * but WITHOUT ANY WARRANTY; without even the implied warranty of
014     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
015     * Lesser General Public License for more details.
016     * 
017     * You should have received a copy of the GNU Lesser General Public
018     * License along with this library; if not, write to the Free Software
019     * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
020     */
021    package org.jdesktop.swingx.treetable;
022    
023    /**
024     * A default implementation of an {@code AbstractMutableTreeTableNode} that
025     * returns {@code getUserObject().toString()} for all value queries. This
026     * implementation is designed mainly for testing. It is NOT recommended to use
027     * this implementation. Any user that needs to create {@code TreeTableNode}s
028     * should consider directly extending {@code AbstractMutableTreeTableNode} or
029     * directly implementing the interface.
030     * 
031     * @author Karl Schaefer
032     */
033    public class DefaultMutableTreeTableNode extends AbstractMutableTreeTableNode {
034        
035        /**
036         * 
037         */
038        public DefaultMutableTreeTableNode() {
039            super();
040        }
041    
042        /**
043         * @param userObject
044         */
045        public DefaultMutableTreeTableNode(Object userObject) {
046            super(userObject);
047        }
048    
049        /**
050         * @param userObject
051         * @param allowsChildren
052         */
053        public DefaultMutableTreeTableNode(Object userObject, boolean allowsChildren) {
054            super(userObject, allowsChildren);
055        }
056    
057        /**
058         * {@inheritDoc}
059         */
060        public Object getValueAt(int column) {
061            return getUserObject();
062        }
063    
064        /**
065         * {@inheritDoc}
066         */
067        public int getColumnCount() {
068            return 1;
069        }
070    
071        /**
072         * {@inheritDoc}
073         */
074        @Override
075        public boolean isEditable(int column) {
076            return true;
077        }
078    
079        /**
080         * {@inheritDoc}
081         */
082        @Override
083        public void setValueAt(Object aValue, int column) {
084            setUserObject(aValue);
085        }
086    }