com.fg.ftree
Interface FTreeCellGUI

All Superinterfaces:
FActionConstants
All Known Implementing Classes:
DefaultFTreeCellGUI

public interface FTreeCellGUI
extends FActionConstants

Interface defines GUI functionality of the FTree component. FTree obtains cell controls (renderer and editor) for a tree node in the following way: at first it obtains a key by calling {getCellControlKey(FTree, Object) method of the object which implements FTreeCellGUI interface. Then it attempts to find required renderer-editor pair in an internal Map with the obtained key. If renderer-editor pair found then FTree component uses them, oterwise it calls createCellControl(FTree, Object, boolean) method twice (once for renderer and once for editor) and puts obtained renderer-editor pair in the internal Map under the previously obtained key. The FTreeCellGUI implementation can return different types of components for renderer and editor or two components of the same type. The type of keys is not restricted, but in practice it is convenient to use special objects, which contain Class objects as fields and define "equals()" and "hashCode()" methods. The introduced approach allows to have many different types of renderers and editors and share renderer and editor instances among multiple nodes.

Version:
1.0
Author:
Felix Golubov
See Also:
DefaultFTreeCellGUI, FTree

Field Summary
 
Fields inherited from interface com.fg.ftree.FActionConstants
CHANGE_EXPANSION, DROP_SELECTION, EDIT_CELL, NO_ACTION, SELECT_NODE
 
Method Summary
 int cellClicked(FTree tree, java.lang.Object node, javax.swing.JComponent c, int x, int y, java.util.List targetList)
           
 javax.swing.JComponent createCellControl(FTree tree, java.lang.Object node, boolean isEditor)
           
 java.lang.Object getCellControlKey(FTree tree, java.lang.Object node)
           
 java.awt.Color getFolderBarColor(FTree tree, java.lang.Object node)
           
 java.awt.Color getFolderColor(FTree tree, java.lang.Object node)
           
 int getRowHeight(FTree tree, java.lang.Object node)
           
 boolean isNodeSelectionAllowed(FTree tree, java.lang.Object node)
           
 void updateCellControl(FTree tree, java.lang.Object node, javax.swing.JComponent c, boolean isEditor, boolean selected)
           
 void updateNode(FTree tree, java.lang.Object node, javax.swing.JComponent c, boolean directStopEditing)
           
 

Method Detail

getRowHeight

public int getRowHeight(FTree tree,
                        java.lang.Object node)

getFolderColor

public java.awt.Color getFolderColor(FTree tree,
                                     java.lang.Object node)

getFolderBarColor

public java.awt.Color getFolderBarColor(FTree tree,
                                        java.lang.Object node)

getCellControlKey

public java.lang.Object getCellControlKey(FTree tree,
                                          java.lang.Object node)

createCellControl

public javax.swing.JComponent createCellControl(FTree tree,
                                                java.lang.Object node,
                                                boolean isEditor)

updateCellControl

public void updateCellControl(FTree tree,
                              java.lang.Object node,
                              javax.swing.JComponent c,
                              boolean isEditor,
                              boolean selected)

updateNode

public void updateNode(FTree tree,
                       java.lang.Object node,
                       javax.swing.JComponent c,
                       boolean directStopEditing)

cellClicked

public int cellClicked(FTree tree,
                       java.lang.Object node,
                       javax.swing.JComponent c,
                       int x,
                       int y,
                       java.util.List targetList)

isNodeSelectionAllowed

public boolean isNodeSelectionAllowed(FTree tree,
                                      java.lang.Object node)