com.sas.swing.visuals.dualselector
Class DualTreeSelector

com.sas.swing.visuals.dualselector.DualTreeSelector
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.TreeSelectionListener

public class DualTreeSelector
implements javax.swing.event.TreeSelectionListener, ViewDefaultModel

DualTreeSelector implements a dual selector with two trees.

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.TreeCellRenderer cellRenderer
          the cell renderer class for the tree cells
protected  javax.swing.tree.DefaultMutableTreeNode rootNode
          a tree node representing the root of the trees
protected  javax.swing.JTree sourceJTree
          the source JTree component
protected  javax.swing.JTree targetJTree
          the target JTree component
 
Fields inherited from class com.sas.swing.visuals.dualselector.BaseDualSelector
allLeftButton, allRightButton, ALTERNATING_MULTIPLE_BUTTON, ALTERNATING_SINGLE_BUTTON, alternatingMultipleButton, alternatingMultipleButtonStyle, alternatingSingleButton, alternatingSingleButtonStyle, buttonContainer, clearSelection, 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
DualTreeSelector()
          Constructs a DualTreeSelector object.
 
Method Summary
protected  void addListeners()
          Adds a tree selection listener to each tree component.
 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.tree.TreeCellRenderer getTargetCellRenderer()
          Returns the cell renderer for the target component.
 javax.swing.tree.TreeModel 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 isParentNodesOnlyMoveable()
          Returns true if the parent node only is to be moved.
 boolean isSourceRootVisible()
          Returns true if the root node of the source tree is displayed.
 boolean isTargetRootVisible()
          Returns true if the root node of the target 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 setParentNodesOnlyMoveable(boolean parentNodes)
          Defines whether to move all parent nodes or parent nodes and children.
 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 setSourceTargetNode(java.lang.Object sourceTargetNode)
          Allows specification of a target tree node that accepts nodes from the source tree.
 void setTargetCellRenderer(javax.swing.tree.TreeCellRenderer newValue)
          Sets the cell renderer for the target component.
 void setTargetModel(javax.swing.tree.TreeModel treeModel)
          Sets the TreeModel for the target component.
 void setTargetRootVisible(boolean visible)
          Determines whether or not the root node from the target tree is visible.
 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

cellRenderer

protected javax.swing.tree.TreeCellRenderer cellRenderer
the cell renderer class for the tree cells


sourceJTree

protected javax.swing.JTree sourceJTree
the source JTree component


targetJTree

protected javax.swing.JTree targetJTree
the target JTree component


rootNode

protected javax.swing.tree.DefaultMutableTreeNode rootNode
a tree node representing the root of the trees

Constructor Detail

DualTreeSelector

public DualTreeSelector()
Constructs a DualTreeSelector object.

Method Detail

addListeners

protected void addListeners()
Adds a tree selection listener to each tree component.

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.tree.TreeCellRenderer 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.tree.TreeCellRenderer)

setTargetCellRenderer

public void setTargetCellRenderer(javax.swing.tree.TreeCellRenderer 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)

setTargetRootVisible

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

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

isTargetRootVisible

public boolean isTargetRootVisible()
Returns true if the root node of the target tree is displayed.

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

setParentNodesOnlyMoveable

public void setParentNodesOnlyMoveable(boolean parentNodes)
Defines whether to move all parent nodes or parent nodes and children.

Parameters:
parentNodes - true if the parent node only is to be moved
See Also:
isParentNodesOnlyMoveable()

isParentNodesOnlyMoveable

public boolean isParentNodesOnlyMoveable()
Returns true if the parent node only is to be moved.

Returns:
true if the parent node only is to be moved
See Also:
setParentNodesOnlyMoveable(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)

setSourceTargetNode

public void setSourceTargetNode(java.lang.Object sourceTargetNode)
Allows specification of a target tree node that accepts nodes from the source tree. Calling this method also sets setCopyModeEnabled(true) and setParentNodesMoveable(false). Setting this option keeps the target node from being removed when nodes are moved back to the source side.

Parameters:
sourceTargetNode -

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)

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()

getTargetModel

public javax.swing.tree.TreeModel 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.tree.TreeModel)

setTargetModel

public void setTargetModel(javax.swing.tree.TreeModel treeModel)
                    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



Copyright © 2009 SAS Institute Inc. All Rights Reserved.