com.fg.ftreenodes
Class FToggleSwitchNode

java.lang.Object
  extended bycom.fg.ftree.FBasicNode
      extended bycom.fg.ftreenodes.FAbstractToggleNode
          extended bycom.fg.ftreenodes.FToggleNode
              extended bycom.fg.ftreenodes.FToggleDataNode
                  extended bycom.fg.ftreenodes.FToggleSwitchNode
All Implemented Interfaces:
FActionConstants, FNodeCellGUI, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

public class FToggleSwitchNode
extends FToggleDataNode

FToggleSwitchNode represents a particular kind of toggle-node which was developed as a substitution for the radio-group of toggle nodes. The FToggleSwitchNode GUI component FToggleSwitchControl allows selection of child nodes from a drop-down list, populated with child nodes labels. The FToggleSwitchNode class overrides getChildCount(), getChildAt(int), getExtraClassOrId(), getValue(), setValue(Object) and some other methods in the way that each of these methods calls respective method of the currently selected child node. Thus FToggleSwitchNode shows not its own children but childern of the currently selected child node, shows not its own value, but value of the selected child node, etc. There are following restrictions for the FToggleSwitchNode usage: Although toggle controls of the child nodes are not visible, they have to be set to radio-buttons. (See FAbstractToggleNode.setToggleRadio(boolean)). Besides, no one of the FToggleSwitchNode child nodes can be of the FToggleSwitchNode type itself. To make child selection possible, all the FToggleSwitchNode child nodes have to have different (and meaningful) labels.

Version:
2.0
Author:
Felix Golubov
See Also:
FToggleSwitchControl, FTree

Field Summary
 
Fields inherited from class com.fg.ftreenodes.FAbstractToggleNode
TOGGLE_SELECTION_CHANGED
 
Fields inherited from class com.fg.ftree.FBasicNode
ALLOWS_CHILDREN, EDITABLE
 
Fields inherited from interface com.fg.ftree.FActionConstants
CHANGE_EXPANSION, DROP_SELECTION, EDIT_CELL, NO_ACTION, SELECT_NODE
 
Constructor Summary
FToggleSwitchNode(java.lang.String labelText)
           
 
Method Summary
 javax.swing.JComponent createCellControl(FTree tree, boolean isEditor)
           
 boolean getAllowsChildren()
           
 java.lang.Object getCellControlKey(FTree tree)
           
 javax.swing.tree.TreeNode getChildAt(int index)
           
 int getChildCount()
           
 java.lang.Object getExtraClassOrId()
           
 java.awt.Image getFadedLabelImage()
           
 java.awt.Color getFolderBackground()
           
 java.awt.Color getFolderBarColor(FTree tree)
           
 java.awt.Image getLabelImage()
           
 Params getParameters()
           
 FAbstractToggleNode getSubstituteNode()
           
 java.lang.Object getValue()
           
 void setValue(java.lang.Object value)
           
 void switchBranch(FTree tree, int index)
           
 void updateCellControl(FTree tree, javax.swing.JComponent c, boolean isEditor, boolean selected)
           
 
Methods inherited from class com.fg.ftreenodes.FToggleNode
getAssociate, setAssociate
 
Methods inherited from class com.fg.ftreenodes.FAbstractToggleNode
cellClicked, getAllowsFlattening, getChildrenValidity, getFolderColor, getLabelText, getNodeValidity, getRealChildAt, getRealChildCount, getRowHeight, insert, isFolderBarDecorated, isNodeSelectionAllowed, isPathSelected, isRadioUnselectable, isToggleEnabled, isToggleRadio, isToggleSelected, isToggleVisible, remove, setAllowsFlattening, setFolderBarDecorated, setLabelText, setNodeValidity, setParameters, setRadioUnselectable, setToggleEnabled, setToggleRadio, setToggleSelected, setToggleVisible, toString, updateNode
 
Methods inherited from class com.fg.ftree.FBasicNode
add, children, getFlag, getIndex, getParent, getPath, isEditable, isLeaf, moveContentTo, remove, removeFromParent, setAllowsChildren, setBranchEditable, setEditable, setFlag, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FToggleSwitchNode

public FToggleSwitchNode(java.lang.String labelText)
Method Detail

getSubstituteNode

public FAbstractToggleNode getSubstituteNode()
Overrides:
getSubstituteNode in class FAbstractToggleNode

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface javax.swing.tree.TreeNode
Overrides:
getChildCount in class FBasicNode

getChildAt

public javax.swing.tree.TreeNode getChildAt(int index)
Specified by:
getChildAt in interface javax.swing.tree.TreeNode
Overrides:
getChildAt in class FBasicNode

getCellControlKey

public java.lang.Object getCellControlKey(FTree tree)
Specified by:
getCellControlKey in interface FNodeCellGUI
Overrides:
getCellControlKey in class FAbstractToggleNode

createCellControl

public javax.swing.JComponent createCellControl(FTree tree,
                                                boolean isEditor)
Specified by:
createCellControl in interface FNodeCellGUI
Overrides:
createCellControl in class FAbstractToggleNode

updateCellControl

public void updateCellControl(FTree tree,
                              javax.swing.JComponent c,
                              boolean isEditor,
                              boolean selected)
Specified by:
updateCellControl in interface FNodeCellGUI
Overrides:
updateCellControl in class FAbstractToggleNode

getExtraClassOrId

public java.lang.Object getExtraClassOrId()
Overrides:
getExtraClassOrId in class FToggleNode

getParameters

public Params getParameters()
Overrides:
getParameters in class FToggleNode

getValue

public java.lang.Object getValue()
Overrides:
getValue in class FToggleDataNode

setValue

public void setValue(java.lang.Object value)
Overrides:
setValue in class FToggleDataNode

getFolderBackground

public java.awt.Color getFolderBackground()
Overrides:
getFolderBackground in class FAbstractToggleNode

getFolderBarColor

public java.awt.Color getFolderBarColor(FTree tree)
Specified by:
getFolderBarColor in interface FNodeCellGUI
Overrides:
getFolderBarColor in class FAbstractToggleNode

getLabelImage

public java.awt.Image getLabelImage()
Overrides:
getLabelImage in class FAbstractToggleNode

getFadedLabelImage

public java.awt.Image getFadedLabelImage()
Overrides:
getFadedLabelImage in class FAbstractToggleNode

getAllowsChildren

public boolean getAllowsChildren()
Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode
Overrides:
getAllowsChildren in class FBasicNode

switchBranch

public void switchBranch(FTree tree,
                         int index)