com.sas.swing.visuals.dualselector
Class TreeListSelector

com.sas.swing.visuals.dualselector.TreeListSelector
All Implemented Interfaces:
ViewDefaultModel, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ListSelectionListener, javax.swing.event.TreeSelectionListener

public class TreeListSelector
implements javax.swing.event.TreeSelectionListener, javax.swing.event.ListSelectionListener, ViewDefaultModel

TreeListSelector class is an implementation that has a JTree and a JList component.

Visit the AppDev Studio Developer's Site to access step-by-step examples, white papers and additional usage information at http://support.sas.com/rnd/appdev/.

Examples for this class may be found on the Examples Site.


Since:
3.1
See Also:
Serialized Form

Field Summary
protected  javax.swing.tree.DefaultMutableTreeNode rootNode
          a tree node used as the root of the JTree component
protected  javax.swing.JTree sourceJTree
          the JTree component
protected  javax.swing.JList targetJList
          the JList component
 
Fields inherited from class com.sas.swing.visuals.dualselector.BaseDualSelector
allLeftButton, allRightButton, ALTERNATING_MULTIPLE_BUTTON, ALTERNATING_SINGLE_BUTTON, alternatingMultipleButton, alternatingMultipleButtonStyle, alternatingSingleButton, alternatingSingleButtonStyle, buttonContainer, copyModeDuplicatesAllowed, copyModeEnabled, designTime, direction, doubleLeftArrow, doubleRightArrow, dragAndDropEnabled, dragGestureInitiator, initialized, LEFT, leftArrow, leftButton, mainPanel, MIDDLE_BOTTOM, middleContainer, partitioner, RIGHT, rightArrow, rightButton, selectedItems, sourceAdapter, sourceBottomButtonContainer, sourceContainer, sourceFocusListener, sourceLabel, sourceMouseListener, sourceTopButtonContainer, targetAdapter, targetContainer, targetControlsVisible, targetDownButton, targetFocusListener, targetLabel, targetMaximumCount, targetMouseListener, targetUpButton, TOP_RIGHT, transferAllControlsVisible
 
Constructor Summary
TreeListSelector()
          Constructs a TreeListSelector object.
 
Method Summary
protected  void addListeners()
          Adds tree and list selection listeners.
 javax.swing.tree.TreeModel getModel()
          Returns the TreeModel for the source component.
 javax.swing.tree.TreeCellRenderer getSourceCellRenderer()
          Returns the cell renderer for the source component.
 javax.swing.ListCellRenderer getTargetCellRenderer()
          Returns the cell renderer for the target component.
 javax.swing.ListModel getTargetModel()
          Returns the TreeModel for the target component.
 boolean isDefaultModelAttached()
          Returns true if the default model is being used, false otherwise.
 boolean isParentNodesMoveable()
          Returns the true if the parent nodes are moveable.
 boolean isParentsOrChildrenMoveable()
          Returns true if the parent nodes are to be moved and false if only the children nodes are to be moved.
 boolean isSourceRootVisible()
          Returns true if the root node of the source tree is displayed.
 void setModel(javax.swing.tree.TreeModel treeModel)
          Sets the TreeModel for the source component.
 void setParentNodesMoveable(boolean moveable)
          Determines whether the parent nodes, in the tree, can be moved to the list portion.
 void setParentOrChildrenMoveable(boolean nodes)
          Defines whether to move only parent nodes from the tree of move only children nodes.
 void setSourceCellRenderer(javax.swing.tree.TreeCellRenderer newValue)
          Sets the cell renderer for the source component.
 void setSourceRootVisible(boolean visible)
          Determines whether or not the root node from the source tree is visible.
 void setTargetCellRenderer(javax.swing.ListCellRenderer newValue)
          Sets the cell renderer for the target component.
 void setTargetModel(javax.swing.ListModel listModel)
          Sets the TreeModel for the target component.
 void valueChanged(javax.swing.event.ListSelectionEvent ie)
          Event handler for the ListSelectionEvent's received.
 void valueChanged(javax.swing.event.TreeSelectionEvent ie)
          Event handler for the TreeSelectionEvent's received.
 
Methods inherited from class com.sas.swing.visuals.dualselector.BaseDualSelector
actionPerformed, areValuesEqual, canTransferAllSourceItems, canTransferAllTargetItems, canTransferSelectedSourceItems, canTransferSelectedTargetItems, canTransferSourceItems, canTransferTargetItems, createSourceLabel, createTargetLabel, ensureButtonsEnabled, getAlternatingButtonIcon, getAlternatingMultipleButtonStyle, getAlternatingSingleButtonStyle, getCopyModeDuplicatesAllowed, getExtendedBeanInfo, getSourceBottomActionButtonContainer, getSourceComponent, getSourceLabel, getSourceLabelComponent, getSourceMouseListener, getSourceTopActionButtonContainer, getTargetComponent, getTargetLabel, getTargetLabelComponent, getTargetMaximumCount, getTargetMouseListener, initializeBaseDualSelector, initializeSize, isCopyModeEnabled, isDesignTime, isDragAndDropEnabled, isGroupDirectionalButtonsTogether, isInSourceModel, isInTargetModel, isTargetControlsVisible, isTransferAllControlsVisible, moveTargetItem, paintComponent, setAlternatingMultipleButtonIcons, setAlternatingMultipleButtonStyle, setAlternatingSingleButtonIcons, setAlternatingSingleButtonStyle, setBackground, setCopyModeDuplicatesAllowed, setCopyModeEnabled, setDesignTime, setDragAndDropEnabled, setEnabled, setFont, setForeground, setGroupDirectionalButtonsTogether, setSourceLabel, setSourceMouseListener, setTargetButtonsLocation, setTargetControlsVisible, setTargetLabel, setTargetMaximumCount, setTargetMouseListener, setToolTipText, setTransferAllControlsVisible, transferAllItems, transferAllSourceItems, transferAllTargetItems, transferItems, transferItems, transferSourceItems, transferTargetItems, transferToSourceModel, transferToTargetModel
 

Field Detail

sourceJTree

protected javax.swing.JTree sourceJTree
the JTree component


targetJList

protected javax.swing.JList targetJList
the JList component


rootNode

protected javax.swing.tree.DefaultMutableTreeNode rootNode
a tree node used as the root of the JTree component

Constructor Detail

TreeListSelector

public TreeListSelector()
Constructs a TreeListSelector object.

Method Detail

addListeners

protected void addListeners()
Adds tree and list selection listeners.

Overrides:
addListeners in class BaseDualSelector

getSourceCellRenderer

public javax.swing.tree.TreeCellRenderer getSourceCellRenderer()
Returns the cell renderer for the source component. The cell renderer controls how the items in the source component are displayed.

Returns:
cell renderer for the source component
See Also:
setSourceCellRenderer(javax.swing.tree.TreeCellRenderer)

setSourceCellRenderer

public void setSourceCellRenderer(javax.swing.tree.TreeCellRenderer newValue)
Sets the cell renderer for the source component. The cell renderer controls how the items in the source component are displayed.

Parameters:
newValue - the new value for the source component cell renderer
See Also:
getSourceCellRenderer()

getTargetCellRenderer

public javax.swing.ListCellRenderer getTargetCellRenderer()
Returns the cell renderer for the target component. The cell renderer controls how the items in the target component are displayed.

Returns:
the cell renderer for the target component
See Also:
setTargetCellRenderer(javax.swing.ListCellRenderer)

setTargetCellRenderer

public void setTargetCellRenderer(javax.swing.ListCellRenderer newValue)
Sets the cell renderer for the target component. The cell renderer controls how the items in the target component are displayed.

Parameters:
newValue - the new value for the target component cell renderer
See Also:
getTargetCellRenderer()

setSourceRootVisible

public void setSourceRootVisible(boolean visible)
Determines whether or not the root node from the source tree is visible.

Parameters:
visible - true if the root node of the tree is to be displayed

isSourceRootVisible

public boolean isSourceRootVisible()
Returns true if the root node of the source tree is displayed.

Returns:
true if the root node of the tree is displayed
See Also:
setSourceRootVisible(boolean)

setParentNodesMoveable

public void setParentNodesMoveable(boolean moveable)
Determines whether the parent nodes, in the tree, can be moved to the list portion.

Parameters:
moveable - Set to true if parents are allowed to be moved. False if parents cannot be moved.
See Also:
isParentNodesMoveable()

isParentNodesMoveable

public boolean isParentNodesMoveable()
Returns the true if the parent nodes are moveable. False if the parent nodes are not moveable.

Returns:
true if the parent nodes are moveable, false if the parent nodes are not moveable
See Also:
setParentNodesMoveable(boolean)

setParentOrChildrenMoveable

public void setParentOrChildrenMoveable(boolean nodes)
Defines whether to move only parent nodes from the tree of move only children nodes.

Parameters:
nodes - true if the parent nodes, false if child nodes
See Also:
isParentsOrChildrenMoveable()

isParentsOrChildrenMoveable

public boolean isParentsOrChildrenMoveable()
Returns true if the parent nodes are to be moved and false if only the children nodes are to be moved.

Returns:
true if the parent nodes are to be moved and false if only the children nodes are to be moved
See Also:
setParentOrChildrenMoveable(boolean)

getModel

public javax.swing.tree.TreeModel getModel()
Returns the TreeModel for the source component. The TreeModel for the target component can be obtained by calling getTargetModel.

Returns:
the TreeModel for the source component
See Also:
setModel(javax.swing.tree.TreeModel)

getTargetModel

public javax.swing.ListModel getTargetModel()
Returns the TreeModel for the target component. The TreeModel for the source component can be obtained by calling getModel.

Returns:
the TreeModel for the target component
See Also:
setTargetModel(javax.swing.ListModel)

setModel

public void setModel(javax.swing.tree.TreeModel treeModel)
Sets the TreeModel for the source component. The TreeModel for the target component can be set by calling setTargetModel.

Parameters:
treeModel - the TreeModel to set for the source component
See Also:
getModel()

setTargetModel

public void setTargetModel(javax.swing.ListModel listModel)
                    throws java.lang.IllegalArgumentException
Sets the TreeModel for the target component. The TreeModel for the source component can be set by calling setModel.

Parameters:
treeModel - the TreeModel to set for the target component
Throws:
java.lang.IllegalArgumentException
See Also:
getTargetModel()

isDefaultModelAttached

public boolean isDefaultModelAttached()
Returns true if the default model is being used, false otherwise.

Specified by:
isDefaultModelAttached in interface ViewDefaultModel
Returns:
true if the default model is being used, false otherwise.
See Also:
ViewDefaultModel

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent ie)
Event handler for the TreeSelectionEvent's received.

Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener
Parameters:
ie - the event to handle

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent ie)
Event handler for the ListSelectionEvent's received.

Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener
Parameters:
ie - the event to handle



Copyright © 2009 SAS Institute Inc. All Rights Reserved.