001/* 002 * $Id: TreeTableNode.java 3927 2011-02-22 16:34:11Z kleopatra $ 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 */ 021package org.jdesktop.swingx.treetable; 022 023import java.util.Enumeration; 024 025import javax.swing.tree.TreeNode; 026 027/** 028 * Defines the requirements for an object that can be used as a tree node in a 029 * {@code JXTreeTable}. 030 * 031 * @author Karl Schaefer 032 */ 033public interface TreeTableNode extends TreeNode { 034 /** 035 * Returns an enumeration this node's children. 036 * 037 * @return an enumeration of {@code TreeTableNode}s 038 */ 039 @Override 040 Enumeration<? extends TreeTableNode> children(); 041 042 /** 043 * Gets the value for this node that corresponds to a particular tabular 044 * column. 045 * 046 * @param column 047 * the column to query 048 * @return the value for the queried column 049 * @throws IndexOutOfBoundsException 050 * if {@code column} is not a valid column index 051 */ 052 Object getValueAt(int column); 053 054 /** 055 * Overridden to specify the return type. Returns the child {@code TreeNode} 056 * at index {@code childIndex}. Models that utilize this node should verify 057 * the column count before querying this node, since nodes may return 058 * differing sizes even for the same model. 059 * 060 * @param childIndex 061 * the index of the child 062 * @return the {@code TreeTableNode} corresponding to the specified index 063 */ 064 @Override 065 TreeTableNode getChildAt(int childIndex); 066 067 /** 068 * Returns the number of columns supported by this {@code TreeTableNode}. 069 * 070 * @return the number of columns this node supports 071 */ 072 int getColumnCount(); 073 074 /** 075 * Overridden to specify the return type. Returns the parent 076 * {@code TreeTableNode} of the receiver. 077 * 078 * @return the parent {@code TreeTableNode} or {@code null} if this node has 079 * no parent (such nodes are usually root nodes). 080 */ 081 @Override 082 TreeTableNode getParent(); 083 084 /** 085 * Determines whether the specified column is editable. 086 * 087 * @param column 088 * the column to query 089 * @return {@code true} if the column is editable, {@code false} otherwise 090 */ 091 boolean isEditable(int column); 092 093 /** 094 * Sets the value for the given {@code column}. 095 * 096 * @param aValue 097 * the value to set 098 * @param column 099 * the column to set the value on 100 */ 101 void setValueAt(Object aValue, int column); 102 103 /** 104 * Returns this node's user object. 105 * 106 * @return the Object stored at this node by the user 107 */ 108 Object getUserObject(); 109 110 /** 111 * Sets the user object stored in this node. 112 * 113 * @param userObject 114 * the object to store 115 */ 116 void setUserObject(Object userObject); 117}