001/*
002 * %W% %E%
003 *
004 * Copyright 1997, 1998 Sun Microsystems, Inc. All Rights Reserved.
005 * 
006 * Redistribution and use in source and binary forms, with or
007 * without modification, are permitted provided that the following
008 * conditions are met:
009 * 
010 * - Redistributions of source code must retain the above copyright
011 *   notice, this list of conditions and the following disclaimer. 
012 *   
013 * - Redistribution in binary form must reproduce the above
014 *   copyright notice, this list of conditions and the following
015 *   disclaimer in the documentation and/or other materials
016 *   provided with the distribution. 
017 *   
018 * Neither the name of Sun Microsystems, Inc. or the names of
019 * contributors may be used to endorse or promote products derived
020 * from this software without specific prior written permission.  
021 * 
022 * This software is provided "AS IS," without a warranty of any
023 * kind. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
024 * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
025 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY
026 * EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE LIABLE FOR ANY
027 * DAMAGES OR LIABILITIES SUFFERED BY LICENSEE AS A RESULT OF OR
028 * RELATING TO USE, MODIFICATION OR DISTRIBUTION OF THIS SOFTWARE OR
029 * ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS LICENSORS BE LIABLE 
030 * FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT,   
031 * SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER  
032 * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF 
033 * THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF SUN HAS 
034 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
035 * 
036 * You acknowledge that this software is not designed, licensed or
037 * intended for use in the design, construction, operation or
038 * maintenance of any nuclear facility.
039 */
040
041package com.puppycrawl.tools.checkstyle.gui;
042
043import javax.swing.tree.TreeModel;
044
045/**
046 * TreeTableModel is the model used by a JTreeTable. It extends TreeModel
047 * to add methods for getting information about the set of columns each 
048 * node in the TreeTableModel may have. Each column, like a column in 
049 * a TableModel, has a name and a type associated with it. Each node in 
050 * the TreeTableModel can return a value for each of the columns and 
051 * set that value if isCellEditable() returns true. 
052 *
053 * <a href="http://java.sun.com/products/jfc/tsc/articles/treetable1/index.html">Original&nbsp;Source&nbsp;Location</a>
054 *
055 * @author Philip Milne 
056 * @author Scott Violet
057 */
058public interface TreeTableModel extends TreeModel
059{
060    /**
061     * @return the number of available column.
062     */
063    int getColumnCount();
064
065    /**
066     * @param column the column number
067     * @return the name for column number <code>column</code>.
068     */
069    String getColumnName(int column);
070
071    /**
072     * @param column the column number
073     * @return the type for column number <code>column</code>.
074     */
075    Class<?> getColumnClass(int column);
076
077    /**
078     * @param node the node
079     * @param column the column number
080     * @return the value to be displayed for node <code>node</code>, 
081     * at column number <code>column</code>.
082     */
083    Object getValueAt(Object node, int column);
084
085    /**
086     * Indicates whether the the value for node <code>node</code>, 
087     * at column number <code>column</code> is editable.
088     * 
089     * @param node the node.
090     * @param column the column number
091     * @return true if editable 
092     */
093    boolean isCellEditable(Object node, int column);
094
095    /**
096     * Sets the value for node <code>node</code>, 
097     * at column number <code>column</code>.
098     * 
099     * @param aValue the value to set
100     * @param node the node to set the value on
101     * @param column the column number
102     */
103    void setValueAt(Object aValue, Object node, int column);
104}