|
CubeTwister 2.0alpha142 2012-02-11 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
ch.randelshofer.gui.table.TreeNodeTableModel
public class TreeNodeTableModel
Wraps a TreeNode of a MutableTreeModel into a MutableTableModel.
| Field Summary | |
|---|---|
protected MutableTreeModel |
treeModel
|
protected javax.swing.tree.DefaultMutableTreeNode |
treeNode
|
| Fields inherited from class javax.swing.table.AbstractTableModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
TreeNodeTableModel()
Creates new TreeNodeTableModel. |
|
TreeNodeTableModel(MutableTreeModel m,
javax.swing.tree.DefaultMutableTreeNode n)
Creates new TreeNodeTableModel. |
|
| Method Summary | |
|---|---|
void |
createRow(int row,
java.lang.Object type)
Invoke this to create a new row into the table. |
java.awt.datatransfer.Transferable |
exportRowTransferable(int[] rows)
Creates a Transferable to use as the source for a data transfer of the specified elements. |
int |
getColumnCount()
Returns the number of columns in the model. |
java.lang.Object |
getCreatableRowType(int row)
Returns the default type of elements that can be created at the specified index of the list. |
java.lang.Object[] |
getCreatableRowTypes(int row)
Returns the types of children that may be created at this row. |
javax.swing.tree.DefaultMutableTreeNode |
getRow(int row)
|
javax.swing.Action[] |
getRowActions(int[] rows)
Gets actions for the indicated row. |
int |
getRowCount()
Returns the number of rows in the model. |
java.lang.Object |
getValueAt(int row,
int column)
Returns the value for the cell at columnIndex and rowIndex. |
int |
importRowTransferable(java.awt.datatransfer.Transferable t,
int action,
int row,
boolean asChild)
Causes a transfer to the model from a clipboard or a DND drop operation. |
boolean |
isCellEditable(int row,
int column)
Returns true if the cell at rowIndex and columnIndex is editable. |
boolean |
isRowAddable(int row)
Returns true if a row can be added. |
boolean |
isRowImportable(java.awt.datatransfer.DataFlavor[] transferFlavors,
int action,
int row,
boolean asChild)
Indicates whether the model would accept an import of the given set of data flavors prior to actually attempting to import it. |
boolean |
isRowRemovable(int row)
Returns wether the specified row may be removed. |
void |
removeRow(int row)
Remove a row from the table. |
void |
setModel(MutableTreeModel treeModel,
javax.swing.tree.DefaultMutableTreeNode treeNode)
Sets the model. |
void |
treeNodesChanged(javax.swing.event.TreeModelEvent e)
Invoked after a node (or a set of siblings) has changed in some way. |
void |
treeNodesInserted(javax.swing.event.TreeModelEvent e)
Invoked after nodes have been inserted into the tree. |
void |
treeNodesRemoved(javax.swing.event.TreeModelEvent e)
Invoked after nodes have been removed from the tree. |
void |
treeStructureChanged(javax.swing.event.TreeModelEvent e)
Invoked after the tree has drastically changed structure from a given node down. |
| Methods inherited from class javax.swing.table.AbstractTableModel |
|---|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, removeTableModelListener, setValueAt |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.swing.table.TableModel |
|---|
addTableModelListener, getColumnClass, getColumnName, removeTableModelListener, setValueAt |
| Field Detail |
|---|
protected MutableTreeModel treeModel
protected javax.swing.tree.DefaultMutableTreeNode treeNode
| Constructor Detail |
|---|
public TreeNodeTableModel()
public TreeNodeTableModel(MutableTreeModel m,
javax.swing.tree.DefaultMutableTreeNode n)
| Method Detail |
|---|
public void setModel(MutableTreeModel treeModel,
javax.swing.tree.DefaultMutableTreeNode treeNode)
public javax.swing.tree.DefaultMutableTreeNode getRow(int row)
public java.lang.Object getValueAt(int row,
int column)
getValueAt in interface javax.swing.table.TableModelrow - the row whose value is to be looked upcolumn - the column whose value is to be looked up
public int getRowCount()
getRowCount in interface javax.swing.table.TableModelgetColumnCount()public int getColumnCount()
getColumnCount in interface javax.swing.table.TableModelgetRowCount()public javax.swing.Action[] getRowActions(int[] rows)
getRowActions in interface MutableTableModelrows - The rows.
public void createRow(int row,
java.lang.Object type)
createRow in interface MutableTableModelrow - index of the new row.type - element type to be inserted.
java.lang.IllegalStateException - if the row may not be inserted.
public boolean isCellEditable(int row,
int column)
isCellEditable in interface MutableTableModelisCellEditable in interface javax.swing.table.TableModelisCellEditable in class javax.swing.table.AbstractTableModelrow - the row whose value is to be looked upcolumn - the column whose value is to be looked up
AbstractTableModel.setValueAt(java.lang.Object, int, int)public void removeRow(int row)
removeRow in interface MutableTableModelrow - index of the row.
java.lang.IllegalStateException - if the row may not be removed.MutableTableModel.isRowRemovable(int)public boolean isRowRemovable(int row)
isRowRemovable in interface MutableTableModelrow - index of the row.MutableTableModel.removeRow(int)public void treeStructureChanged(javax.swing.event.TreeModelEvent e)
Invoked after the tree has drastically changed structure from a given node down. If the path returned by e.getPath() is of length one and the first element does not identify the current root node the first element should become the new root of the tree.
e.path() holds the path to the node.
e.childIndices() returns null.
treeStructureChanged in interface javax.swing.event.TreeModelListenerpublic void treeNodesInserted(javax.swing.event.TreeModelEvent e)
Invoked after nodes have been inserted into the tree.
e.path() returns the parent of the new nodes
e.childIndices() returns the indices of the new nodes in ascending order.
treeNodesInserted in interface javax.swing.event.TreeModelListenerpublic void treeNodesRemoved(javax.swing.event.TreeModelEvent e)
Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree, this method may only be invoked once for the root of the removed subtree, not once for each individual set of siblings removed.
e.path() returns the former parent of the deleted nodes.
e.childIndices() returns the indices the nodes had before they were deleted in ascending order.
treeNodesRemoved in interface javax.swing.event.TreeModelListenerpublic void treeNodesChanged(javax.swing.event.TreeModelEvent e)
Invoked after a node (or a set of siblings) has changed in some way. The node(s) have not changed locations in the tree or altered their children arrays, but other attributes have changed and may affect presentation. Example: the name of a file has changed, but it is in the same location in the file system.
To indicate the root has changed, childIndices and children will be null.
e.path() returns the path the parent of the changed node(s).
e.childIndices() returns the index(es) of the changed node(s).
treeNodesChanged in interface javax.swing.event.TreeModelListenerpublic java.lang.Object[] getCreatableRowTypes(int row)
getCreatableRowTypes in interface MutableTableModelrow - a row.
public java.lang.Object getCreatableRowType(int row)
MutableTableModel
getCreatableRowType in interface MutableTableModelrow - The insertion point. 0 <= index <= getRowCount()
public java.awt.datatransfer.Transferable exportRowTransferable(int[] rows)
exportRowTransferable in interface MutableTableModelrows - Row indices.
public boolean isRowImportable(java.awt.datatransfer.DataFlavor[] transferFlavors,
int action,
int row,
boolean asChild)
isRowImportable in interface MutableTableModeltransferFlavors - the data formats availableaction - The action DnDConstants.ACTION_COPY, .ACTION_MOVE or
.ACTION_LINK.row - The insertion point. 0 <= row <= getRowCount()asChild - Indicates that the item is to be imported as a child
of the list item rather than as an individual element
/ of the list.
DnDConstants
public int importRowTransferable(java.awt.datatransfer.Transferable t,
int action,
int row,
boolean asChild)
throws java.awt.datatransfer.UnsupportedFlavorException,
java.io.IOException
importRowTransferable in interface MutableTableModelt - The transfer data.action - The action DnDConstants.ACTION_COPY, .ACTION_MOVE or
.ACTION_LINK.row - The insertion point. 0 <= row <= getRowCount()asChild - Indicates that the item is to be imported as a child
of the list item rather than as an individual element
of the list.
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOExceptionpublic boolean isRowAddable(int row)
MutableTableModel
isRowAddable in interface MutableTableModelrow - index of the element. 0 <= index <= getSize()
|
(c) Werner Randelshofer. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||