com.sas.swing.visuals.dualselector
Class BaseDualSelector

com.sas.swing.visuals.dualselector.BaseDualSelector
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
DualListSelector, DualTreeSelector, TreeListSelector

public abstract class BaseDualSelector
implements java.awt.event.ActionListener, javax.accessibility.Accessible

BaseDualSelector is a class used for manipulating items between two components. Items are initially in one (or two) of the components and are moved within or tranferred between each of the components. When items are moved, either all of the items can be moved at once, or only selected items can be moved. Furthermore, restrictions can be placed on the number of items that are allowed in each component.
Events:
BaseDualSelector fires PropertyChangeEvents whenever any of its properties change.

Since:
3.1
See Also:
Serialized Form

Field Summary
 javax.swing.JButton allLeftButton
          JButton used to transfer all items from list two to list one.
 javax.swing.JButton allRightButton
          JButton used to transfer all items from list one to list two.
static java.lang.String ALTERNATING_MULTIPLE_BUTTON
          Constant for specifying the JButton used to transfer all items between lists.
static java.lang.String ALTERNATING_SINGLE_BUTTON
          Constant for specifying the JButton used to transfer one or more items between lists.
 javax.swing.JButton alternatingMultipleButton
          JButton used to transfer all items between lists.
protected  boolean alternatingMultipleButtonStyle
          determines if the double arrow buttons are displayed separately or as one alternating button
 javax.swing.JButton alternatingSingleButton
          JButton used to transfer one or more items between lists.
protected  boolean alternatingSingleButtonStyle
          determines if the single arrow buttons are displayed separately or as one alternating button
protected  javax.swing.JPanel buttonContainer
          a container holding the move left/right buttons
protected  boolean clearSelection
          determines whether to clear the selections
protected  boolean copyModeDuplicatesAllowed
          determines whether items can be copied over to the target more than once
protected  boolean copyModeEnabled
          determines whether the selector is in copy mode
protected  boolean designTime
          determines if the component is in design mode
protected  boolean direction
          the current direction the arrows should be pointing
protected  javax.swing.Icon doubleLeftArrow
          the visual for the left double arrow
protected  javax.swing.Icon doubleRightArrow
          the visual for the right double arrow
protected  boolean dragAndDropEnabled
          determines whether drag and drop is allowed
protected  java.awt.Component dragGestureInitiator
          the component where a drag starts
protected  boolean initialized
          determines whether the dualselector is initialized
protected static boolean LEFT
          represents the arrows pointing to the left
protected  javax.swing.Icon leftArrow
          the visual for the left arrow
 javax.swing.JButton leftButton
          JButton used to transfer one or more items from the right list to the left list.
protected  javax.swing.JPanel mainPanel
          the main panel component
static int MIDDLE_BOTTOM
           
protected  javax.swing.JPanel middleContainer
           
protected  ProportionalSpacePartitioner partitioner
          the space partitioner between the components
static java.lang.String RB_KEY
          the resource key
protected static boolean RIGHT
          represents the arrows pointing to the right
protected  javax.swing.Icon rightArrow
          the visual for the right arrow
 javax.swing.JButton rightButton
          JButton used to transfer one or more items from the left list to the right list.
protected  java.util.List selectedItems
          a List of the selected items
protected  DualSelectorInterface sourceAdapter
          the class that wraps the actual Java component (e.g.
protected  javax.swing.JPanel sourceBottomButtonContainer
          a container, at the bottom of the source container, that allows users to place their own components
protected  javax.swing.JPanel sourceContainer
          a container holding the source component
protected  java.awt.event.FocusListener sourceFocusListener
           
protected  javax.swing.JLabel sourceLabel
          Label for the source component.
protected  java.awt.event.MouseListener sourceMouseListener
          the mouse listener object for the source component
protected  javax.swing.JPanel sourceTopButtonContainer
          a container, at the top of the source container, that allows users to place their own components
protected  DualSelectorInterface targetAdapter
          the class that wraps the actual Java component (e.g.
protected  javax.swing.JPanel targetContainer
          a container holding the target component
protected  boolean targetControlsVisible
          determines whether the up/down arrows, on the target component, are visible
 javax.swing.JButton targetDownButton
          JButton used to move items down in list two when reordering.
protected  java.awt.event.FocusListener targetFocusListener
           
protected  javax.swing.JLabel targetLabel
          Label for the target component.
protected  int targetMaximumCount
          the maximum number of items that can be shown in the target component
protected  java.awt.event.MouseListener targetMouseListener
          the mouse listener object for the target component
 javax.swing.JButton targetUpButton
          JButton used to move items up in list two when reordering.
static int TOP_RIGHT
           
protected  boolean transferAllControlsVisible
          determines whether the double arrow controls are visible
 
Constructor Summary
BaseDualSelector()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Called whenever one of the buttons has been clicked and performs an action based on whichever button was clicked.
protected  void addListeners()
          Sets up the various button action listeners and key adapters.
protected  boolean areValuesEqual(java.lang.Object o1, java.lang.Object o2)
           
 boolean canTransferAllSourceItems()
          Returns true if the items are allowed to be transfered to the target.
 boolean canTransferAllTargetItems()
          Returns true if the target items can be moved.
 boolean canTransferSelectedSourceItems()
          Returns true if the selected source items are allowed to be transfered to the target.
 boolean canTransferSelectedTargetItems()
          Returns true if the selected target items are allowed to be transfered to the source.
 boolean canTransferSourceItems(java.util.List items)
          Returns true if the items in the list are allowed to be transfered to the target.
 boolean canTransferTargetItems(java.util.List items)
          Returns true if the items in the list are allowed to be transfered to the source.
 javax.swing.JLabel createSourceLabel()
          Creates the component to be used as the source label.
 javax.swing.JLabel createTargetLabel()
          Creates the component to be used as the target label.
protected  void ensureButtonsEnabled()
          Changes the status of the left/right and up/down buttons based on selections and arrow direction.
protected  javax.swing.Icon getAlternatingButtonIcon(java.lang.String buttonConstant, boolean direction)
          This method is intended for use by subclasses of BaseDualSelector.
 boolean getAlternatingMultipleButtonStyle()
          Returns the value of the move all items alternating button style
 boolean getAlternatingSingleButtonStyle()
          Returns the value of the alternating selected items button style
 boolean getCopyModeDuplicatesAllowed()
          Gets the status of whether to allow duplicate items when copying from a list
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
          Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about a BaseDualSelector.
 javax.swing.JPanel getSourceBottomActionButtonContainer()
          Returns a container that can be used to add a button or some other action component.
 javax.swing.JComponent getSourceComponent()
          Returns the actual source component.
 java.lang.String getSourceLabel()
          Returns the value of the source component label.
 javax.swing.JComponent getSourceLabelComponent()
          Returns the source label component.
 java.awt.event.MouseListener getSourceMouseListener()
          Returns the source mouse listener.
 javax.swing.JPanel getSourceTopActionButtonContainer()
          Returns a container that can be used to add a button or some other action component.
 javax.swing.JComponent getTargetComponent()
          Returns the actual target component.
 java.lang.String getTargetLabel()
          Returns the value of the target component label.
 javax.swing.JComponent getTargetLabelComponent()
          Returns the target label component.
 int getTargetMaximumCount()
          Returns the value of the targetMaximumCount property.
 java.awt.event.MouseListener getTargetMouseListener()
          Returns the target mouse listener
protected  void initializeBaseDualSelector()
          Builds the dual selector components.
protected  void initializeSize()
           
 boolean isCopyModeEnabled()
          Returns the copy mode status.
protected  boolean isDesignTime()
          Returns current setting of the designTime attribute
 boolean isDragAndDropEnabled()
          Returns whether drag and drop is enabled.
 boolean isGroupDirectionalButtonsTogether()
          Returns a value indicating whether the directional buttons (source to target, target to source buttons) are grouped together in the layout
 boolean isInSourceModel(java.lang.Object item)
          Returns true if the object is in the source model.
 boolean isInTargetModel(java.lang.Object item)
          Returns true if the object is in the target model.
 boolean isTargetControlsVisible()
          Returns the value of the targetControlsVisible property.
 boolean isTransferAllControlsVisible()
          Returns the value of the transferAllControlsVisible property.
protected  void moveTargetItem(boolean moveItemUp)
          Moves the selected item(s) in the target component either up or down one position.
protected  void paintComponent(java.awt.Graphics g)
          Paints the background of the DualSelector if it's opaque
 void setAlternatingMultipleButtonIcons(javax.swing.Icon rightIcon, javax.swing.Icon leftIcon)
          Sets the icons for the alternating multiple button.
 void setAlternatingMultipleButtonStyle(boolean style)
          Sets whether move all items left and right movement is controlled by an alternating button or individual buttons.
 void setAlternatingSingleButtonIcons(javax.swing.Icon rightIcon, javax.swing.Icon leftIcon)
          Sets the icons for the alternating single button.
 void setAlternatingSingleButtonStyle(boolean style)
          Sets whether selected items left and right movement is controlled by an alternating button or individual buttons.
 void setBackground(java.awt.Color color)
          Overrides setBackground in java.awt.Component.
 void setCopyModeDuplicatesAllowed(boolean duplicates)
          Sets whether to allow duplicate items when copying from a list.
 void setCopyModeEnabled(boolean mode)
          Sets the copy mode status.
protected  void setDesignTime(boolean newValue)
          Allows setting of the designTime attribute.
 void setDragAndDropEnabled(boolean enabled)
          Sets whether the ability to drag and drop items between components is enabled.
 void setEnabled(boolean e)
          Set the BaseDualSelector enabled.
 void setFont(java.awt.Font font)
          Overrides super.setFont.
 void setForeground(java.awt.Color color)
          Overrides setForeground in java.awt.Component.
 void setGroupDirectionalButtonsTogether(boolean grouping)
          Determines how the single and multiple buttons are layed out in the container.
 void setSourceLabel(java.lang.String newValue)
          Sets the value of the source component label.
 void setSourceMouseListener(java.awt.event.MouseListener mouseListener)
          Sets the source mouse listener.
 void setTargetButtonsLocation(int location)
           
 void setTargetControlsVisible(boolean newValue)
          Sets the value of the targetControlsVisible property.
 void setTargetLabel(java.lang.String newValue)
          Set the value of the target component label.
 void setTargetMaximumCount(int newValue)
          Sets the value of the targetMaximumCount property.
 void setTargetMouseListener(java.awt.event.MouseListener mouseListener)
          Sets the target mouse listener.
 void setToolTipText(javax.swing.JComponent component, java.lang.String text)
          Registers the text to display in a tool tip.
 void setTransferAllControlsVisible(boolean newValue)
          Sets the value of the transferAllControlsVisible property.
protected  void transferAllItems(DualSelectorInterface fromAdapter, DualSelectorInterface toAdapter)
          Transfers all of the items from fromAdapter to toAdapter.
 void transferAllSourceItems()
          Transfer all items from the source component to the target component.
 void transferAllTargetItems()
          Transfer all items from the target component to the source component.
protected  void transferItems(DualSelectorInterface fromAdapter, DualSelectorInterface toAdapter)
          Transfer all selected items from fromAdapter to toAdapter.
protected  void transferItems(DualSelectorInterface fromAdapter, DualSelectorInterface toAdapter, java.util.List passedItems)
          Transfer all selected items from fromAdapter to toAdapter.
 void transferSourceItems()
          Transfer all the selected items from the source component to the target component.
 void transferTargetItems()
          Transfer all the selected items from the target component to the source component.
 void transferToSourceModel(java.lang.Object[] objectArray)
          Transfer the array of items from the target component to the source component.
 void transferToTargetModel(java.lang.Object[] objectArray)
          Transfer the array of items from the source component to the target component.
 

Field Detail

initialized

protected boolean initialized
determines whether the dualselector is initialized


targetControlsVisible

protected boolean targetControlsVisible
determines whether the up/down arrows, on the target component, are visible


transferAllControlsVisible

protected boolean transferAllControlsVisible
determines whether the double arrow controls are visible


alternatingSingleButtonStyle

protected boolean alternatingSingleButtonStyle
determines if the single arrow buttons are displayed separately or as one alternating button


alternatingMultipleButtonStyle

protected boolean alternatingMultipleButtonStyle
determines if the double arrow buttons are displayed separately or as one alternating button


clearSelection

protected boolean clearSelection
determines whether to clear the selections


copyModeEnabled

protected boolean copyModeEnabled
determines whether the selector is in copy mode


copyModeDuplicatesAllowed

protected boolean copyModeDuplicatesAllowed
determines whether items can be copied over to the target more than once


dragAndDropEnabled

protected boolean dragAndDropEnabled
determines whether drag and drop is allowed


dragGestureInitiator

protected java.awt.Component dragGestureInitiator
the component where a drag starts


targetMaximumCount

protected int targetMaximumCount
the maximum number of items that can be shown in the target component


mainPanel

protected javax.swing.JPanel mainPanel
the main panel component


sourceContainer

protected javax.swing.JPanel sourceContainer
a container holding the source component


targetContainer

protected javax.swing.JPanel targetContainer
a container holding the target component


buttonContainer

protected javax.swing.JPanel buttonContainer
a container holding the move left/right buttons


middleContainer

protected javax.swing.JPanel middleContainer

partitioner

protected ProportionalSpacePartitioner partitioner
the space partitioner between the components


sourceMouseListener

protected java.awt.event.MouseListener sourceMouseListener
the mouse listener object for the source component


targetMouseListener

protected java.awt.event.MouseListener targetMouseListener
the mouse listener object for the target component


sourceLabel

protected javax.swing.JLabel sourceLabel
Label for the source component.


targetLabel

protected javax.swing.JLabel targetLabel
Label for the target component.


alternatingSingleButton

public javax.swing.JButton alternatingSingleButton
JButton used to transfer one or more items between lists.


ALTERNATING_SINGLE_BUTTON

public static final java.lang.String ALTERNATING_SINGLE_BUTTON
Constant for specifying the JButton used to transfer one or more items between lists.

See Also:
Constant Field Values

leftButton

public javax.swing.JButton leftButton
JButton used to transfer one or more items from the right list to the left list.


rightButton

public javax.swing.JButton rightButton
JButton used to transfer one or more items from the left list to the right list.


alternatingMultipleButton

public javax.swing.JButton alternatingMultipleButton
JButton used to transfer all items between lists.


ALTERNATING_MULTIPLE_BUTTON

public static final java.lang.String ALTERNATING_MULTIPLE_BUTTON
Constant for specifying the JButton used to transfer all items between lists.

See Also:
Constant Field Values

allRightButton

public javax.swing.JButton allRightButton
JButton used to transfer all items from list one to list two.


allLeftButton

public javax.swing.JButton allLeftButton
JButton used to transfer all items from list two to list one.


targetDownButton

public javax.swing.JButton targetDownButton
JButton used to move items down in list two when reordering.


targetUpButton

public javax.swing.JButton targetUpButton
JButton used to move items up in list two when reordering.


sourceAdapter

protected DualSelectorInterface sourceAdapter
the class that wraps the actual Java component (e.g. JTable or JTree) for the source side


targetAdapter

protected DualSelectorInterface targetAdapter
the class that wraps the actual Java component (e.g. JTable or JTree) for the target side


sourceTopButtonContainer

protected javax.swing.JPanel sourceTopButtonContainer
a container, at the top of the source container, that allows users to place their own components


sourceBottomButtonContainer

protected javax.swing.JPanel sourceBottomButtonContainer
a container, at the bottom of the source container, that allows users to place their own components


selectedItems

protected java.util.List selectedItems
a List of the selected items


direction

protected transient boolean direction
the current direction the arrows should be pointing


leftArrow

protected transient javax.swing.Icon leftArrow
the visual for the left arrow


rightArrow

protected transient javax.swing.Icon rightArrow
the visual for the right arrow


doubleLeftArrow

protected transient javax.swing.Icon doubleLeftArrow
the visual for the left double arrow


doubleRightArrow

protected transient javax.swing.Icon doubleRightArrow
the visual for the right double arrow


RIGHT

protected static final boolean RIGHT
represents the arrows pointing to the right

See Also:
Constant Field Values

LEFT

protected static final boolean LEFT
represents the arrows pointing to the left

See Also:
Constant Field Values

designTime

protected boolean designTime
determines if the component is in design mode


TOP_RIGHT

public static final int TOP_RIGHT
See Also:
Constant Field Values

MIDDLE_BOTTOM

public static final int MIDDLE_BOTTOM
See Also:
Constant Field Values

sourceFocusListener

protected java.awt.event.FocusListener sourceFocusListener

targetFocusListener

protected java.awt.event.FocusListener targetFocusListener

RB_KEY

public static final java.lang.String RB_KEY
the resource key

See Also:
Constant Field Values
Constructor Detail

BaseDualSelector

public BaseDualSelector()
Method Detail

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about a BaseDualSelector.

Returns:
the ExtendedBeanInfo for this class

setDesignTime

protected void setDesignTime(boolean newValue)
Allows setting of the designTime attribute.

Parameters:
newValue - true = in design mode, false = in run mode
See Also:
isDesignTime()

isDesignTime

protected boolean isDesignTime()
Returns current setting of the designTime attribute

Returns:
true = in design mode, false = in run mode
See Also:
setDesignTime(boolean)

setAlternatingSingleButtonStyle

public void setAlternatingSingleButtonStyle(boolean style)
Sets whether selected items left and right movement is controlled by an alternating button or individual buttons.

Parameters:
style - the alternating selected items button style value
See Also:
getAlternatingSingleButtonStyle()

getAlternatingSingleButtonStyle

public boolean getAlternatingSingleButtonStyle()
Returns the value of the alternating selected items button style

Returns:
the value of the alternating selected items button style
See Also:
setAlternatingSingleButtonStyle(boolean)

setAlternatingMultipleButtonStyle

public void setAlternatingMultipleButtonStyle(boolean style)
Sets whether move all items left and right movement is controlled by an alternating button or individual buttons.

Parameters:
style - the move all items alternating button style value
See Also:
getAlternatingMultipleButtonStyle()

getAlternatingMultipleButtonStyle

public boolean getAlternatingMultipleButtonStyle()
Returns the value of the move all items alternating button style

Returns:
the value of the move all items alternating button style
See Also:
setAlternatingMultipleButtonStyle(boolean)

setDragAndDropEnabled

public void setDragAndDropEnabled(boolean enabled)
Sets whether the ability to drag and drop items between components is enabled. The default is to allow drag and drop.

Parameters:
enabled - whether to allow drag and drop value
See Also:
isDragAndDropEnabled()

isDragAndDropEnabled

public boolean isDragAndDropEnabled()
Returns whether drag and drop is enabled.

Returns:
whather drag and drop is enabled
See Also:
setDragAndDropEnabled(boolean)

isInTargetModel

public boolean isInTargetModel(java.lang.Object item)
Returns true if the object is in the target model.

Parameters:
item - the object to be checked.
Returns:
true if the object is in the target model.

isInSourceModel

public boolean isInSourceModel(java.lang.Object item)
Returns true if the object is in the source model.

Parameters:
item - the object to be checked.
Returns:
true if the object is in the source model.

getSourceTopActionButtonContainer

public javax.swing.JPanel getSourceTopActionButtonContainer()
Returns a container that can be used to add a button or some other action component. This container is placed between the label and the component container.

Returns:
the container

getSourceBottomActionButtonContainer

public javax.swing.JPanel getSourceBottomActionButtonContainer()
Returns a container that can be used to add a button or some other action component. This container is placed below the component container.

Returns:
the container

getSourceComponent

public javax.swing.JComponent getSourceComponent()
Returns the actual source component.

Returns:
component The source component.

getTargetComponent

public javax.swing.JComponent getTargetComponent()
Returns the actual target component.

Returns:
component The target component.

setCopyModeEnabled

public void setCopyModeEnabled(boolean mode)
Sets the copy mode status. Setting it to true means the list items will be copied instead of moved. Setting this property also defines the left list as the source list and the right list as the target list.

Parameters:
mode - The copy mode status
See Also:
isCopyModeEnabled()

isCopyModeEnabled

public boolean isCopyModeEnabled()
Returns the copy mode status.

Returns:
the copy mode status
See Also:
setCopyModeEnabled(boolean)

setCopyModeDuplicatesAllowed

public void setCopyModeDuplicatesAllowed(boolean duplicates)
Sets whether to allow duplicate items when copying from a list. The default is true

Parameters:
duplicates - The status of allowing duplicates
See Also:
getCopyModeDuplicatesAllowed()

getCopyModeDuplicatesAllowed

public boolean getCopyModeDuplicatesAllowed()
Gets the status of whether to allow duplicate items when copying from a list

Returns:
the duplicate status
See Also:
setCopyModeDuplicatesAllowed(boolean)

getSourceLabelComponent

public javax.swing.JComponent getSourceLabelComponent()
Returns the source label component. Allows user to set various label properties.

Returns:
the label component

getTargetLabelComponent

public javax.swing.JComponent getTargetLabelComponent()
Returns the target label component. Allows user to set various label properties.

Returns:
the label component

getSourceLabel

public java.lang.String getSourceLabel()
Returns the value of the source component label.

Returns:
the value of the source component label
See Also:
setSourceLabel(java.lang.String)

setSourceLabel

public void setSourceLabel(java.lang.String newValue)
Sets the value of the source component label.

Parameters:
newValue - the new value of the source component label
See Also:
getSourceLabel()

isTargetControlsVisible

public boolean isTargetControlsVisible()
Returns the value of the targetControlsVisible property. The targetControlsVisible property controls whether the buttons that allow the target component to be reordered are visible beneath the ListBox that displays the items of the target component.

Returns:
true if the controls for the target component are visible, false otherwise.
See Also:
setTargetControlsVisible(boolean), DualSelectorUpDownInterface

setTargetControlsVisible

public void setTargetControlsVisible(boolean newValue)
Sets the value of the targetControlsVisible property. The targetControlsVisible property controls whether the buttons that allow the target component to be reordered are visible beneath the ListBox that displays the items of the target component.

Parameters:
newValue - the new value of the targetControlsVisible property
See Also:
DualSelectorUpDownInterface

getTargetLabel

public java.lang.String getTargetLabel()
Returns the value of the target component label.

Returns:
the value of the target component label
See Also:
setTargetLabel(java.lang.String)

setTargetLabel

public void setTargetLabel(java.lang.String newValue)
Set the value of the target component label.

Parameters:
newValue - the new value of the target component label
See Also:
getTargetLabel()

getTargetMaximumCount

public int getTargetMaximumCount()
Returns the value of the targetMaximumCount property. The targetMaximumCount property controls the number of items that are allowed to either exist or be moved into the target component. A value of -1 indicates that an unlimited number of items is allowed in the target component.

Returns:
the maximum number of allowed items for the target component
Throws:
java.lang.IllegalStateException - if newValue != -1 and newValue < getTargetCount()
See Also:
setTargetMaximumCount(int)

setTargetMaximumCount

public void setTargetMaximumCount(int newValue)
Sets the value of the targetMaximumCount property. The targetMaximumCount property controls the number of items that are allowed to either exist or be moved into the target component. A value of -1 indicates that an unlimited number of items is allowed in the target component.

Parameters:
newValue - the new value of the targetMaximumCount property
See Also:
getTargetMaximumCount()

setEnabled

public void setEnabled(boolean e)
Set the BaseDualSelector enabled.

Overrides:
setEnabled in class javax.swing.JComponent
Parameters:
e - true to enable the BaseDualSelector; false to disable it

isTransferAllControlsVisible

public boolean isTransferAllControlsVisible()
Returns the value of the transferAllControlsVisible property. The transferAllControlsVisible property controls whether the two buttons that allow all items to be moved from the source component to the target component and from the target component to the source component are visible or hidden.

Returns:
true if the buttons which move all items are visible, false otherwise
See Also:
setTransferAllControlsVisible(boolean)

setTransferAllControlsVisible

public void setTransferAllControlsVisible(boolean newValue)
Sets the value of the transferAllControlsVisible property. The transferAllControlsVisible property controls whether the two buttons that allow all items to be moved from the source component to the target component and from the target component to the source component are visible or hidden.

Parameters:
newValue - the new value of the transferAllControlsVisible property
See Also:
isTransferAllControlsVisible()

setToolTipText

public void setToolTipText(javax.swing.JComponent component,
                           java.lang.String text)
Registers the text to display in a tool tip. The text displays when the cursor lingers over the BaseDualSelector for a set time period.

Parameters:
component - the component for which tool tip text is being changed
text - the string to display; if the text is null, the tool tip is turned off for this component

setSourceMouseListener

public void setSourceMouseListener(java.awt.event.MouseListener mouseListener)
Sets the source mouse listener.

Parameters:
mouseListener - the source mouse listener
See Also:
getSourceMouseListener()

setTargetMouseListener

public void setTargetMouseListener(java.awt.event.MouseListener mouseListener)
Sets the target mouse listener.

Parameters:
mouseListener - the target mouse listener
See Also:
getTargetMouseListener()

getSourceMouseListener

public java.awt.event.MouseListener getSourceMouseListener()
Returns the source mouse listener.

Returns:
source mouse listener
See Also:
setSourceMouseListener(MouseListener)

getTargetMouseListener

public java.awt.event.MouseListener getTargetMouseListener()
Returns the target mouse listener

Returns:
target mouse listener
See Also:
setTargetMouseListener(MouseListener)

moveTargetItem

protected void moveTargetItem(boolean moveItemUp)
Moves the selected item(s) in the target component either up or down one position. If the destination of an item is outside of the bounds of the component, then the selected item is not moved. Subclasses should override this method to modify behavior.

Parameters:
moveItemUp - true to move the item(s) up, false to move the item(s) down

transferAllItems

protected void transferAllItems(DualSelectorInterface fromAdapter,
                                DualSelectorInterface toAdapter)
Transfers all of the items from fromAdapter to toAdapter. No items are transferred if the maximum count for toAdapter will be exceeded as a result of the transfer. After the transfer fromAdapter will be empty and toAdapter will contain the items that were in fromAdapter and toAdapter prior to the transfer. This method is called by transferAllSourceItems and transferAllTargetItems. Subclasses should override this method to modify behavior.

Parameters:
fromAdapter - the adapter to move all items from
toAdapter - the adapter to move all items to
See Also:
transferAllSourceItems(), transferAllTargetItems()

transferAllSourceItems

public void transferAllSourceItems()
Transfer all items from the source component to the target component. This method is called in response to the top transfer all button being pressed. No items are transfered if the maximum count for the target component will be exceeded as a result of the transfer. This method calls transferAllItems(sourceAdapter, targetAdapter). Subclasses should override transferAllItems to modify behavior.

See Also:
transferAllItems(com.sas.swing.visuals.dualselector.DualSelectorInterface, com.sas.swing.visuals.dualselector.DualSelectorInterface)

transferItems

protected void transferItems(DualSelectorInterface fromAdapter,
                             DualSelectorInterface toAdapter)
Transfer all selected items from fromAdapter to toAdapter. This method is called in response to the transfer items button being pressed. No items are transfered if the maximum count for toAdapter will be exceeded as a result of the transfer. This method is called by transferSourceItems and transferTargetItems. Subclasses should override this method to modify behavior.

Parameters:
fromAdapter - the adapter that the items are being transferred from
toAdapter - the adapter that the items are being transferred to
See Also:
transferSourceItems(), transferTargetItems()

transferItems

protected void transferItems(DualSelectorInterface fromAdapter,
                             DualSelectorInterface toAdapter,
                             java.util.List passedItems)
Transfer all selected items from fromAdapter to toAdapter. This method is called in response to the transfer items button being pressed. No items are transfered if the maximum count for toAdapter will be exceeded as a result of the transfer. This method is called by transferSourceItems and transferTargetItems. Subclasses should override this method to modify behavior.

Parameters:
fromAdapter - the adapter that the items are being transferred from
toAdapter - the adapter that the items are being transferred to
passedItems - a collection of items programatically selected
See Also:
transferSourceItems(), transferTargetItems()

areValuesEqual

protected boolean areValuesEqual(java.lang.Object o1,
                                 java.lang.Object o2)

transferSourceItems

public void transferSourceItems()
Transfer all the selected items from the source component to the target component. This method is called in response to the transfer items button being pressed. No items are transfered if the maximum count for the target component will be exceeded as a result of the transfer. This method calls transferItems(sourceAdapter, targetAdapter). Subclasses should override transferItems to modify behavior.

See Also:
transferItems(com.sas.swing.visuals.dualselector.DualSelectorInterface, com.sas.swing.visuals.dualselector.DualSelectorInterface)

transferAllTargetItems

public void transferAllTargetItems()
Transfer all items from the target component to the source component. This method is called in response to the top transfer all button being pressed. No items are transfered if the maximum count for the source component will be exceeded as a result of the transfer. This methods calls transferAllItems(targetAdapter, sourceAdapter). Subclasses should override transferAllItems to modify behavior.

See Also:
transferAllItems(com.sas.swing.visuals.dualselector.DualSelectorInterface, com.sas.swing.visuals.dualselector.DualSelectorInterface)

transferTargetItems

public void transferTargetItems()
Transfer all the selected items from the target component to the source component. This method is called in response to the transfer items button being pressed. No items are transfered if the maximum count for the source component will be exceeded as a result of the transfer. This method calls transferTargetItems(targetAdapter, sourceAdapter). Subclasses should override transferItems to modify behavior.


transferToTargetModel

public void transferToTargetModel(java.lang.Object[] objectArray)
Transfer the array of items from the source component to the target component. Any item not in the source component will not be added to the target component.

Parameters:
objectArray - the array of objects to transfer

transferToSourceModel

public void transferToSourceModel(java.lang.Object[] objectArray)
Transfer the array of items from the target component to the source component. Any item not in the target component will not be added to the source component.

Parameters:
objectArray - the array of objects to transfer

canTransferSelectedSourceItems

public boolean canTransferSelectedSourceItems()
Returns true if the selected source items are allowed to be transfered to the target. Subclasses can override this method to provide custom transfer control.

Returns:
true if the selected source items are allowed to be moved, false otherwise

canTransferSelectedTargetItems

public boolean canTransferSelectedTargetItems()
Returns true if the selected target items are allowed to be transfered to the source. Subclasses can override this method to provide custom transfer control.

Returns:
true if the selected target items are allowed to be moved, false otherwise

canTransferAllSourceItems

public boolean canTransferAllSourceItems()
Returns true if the items are allowed to be transfered to the target. Subclasses can override this method to provide custom transfer control.

Returns:
true if the items are allowed to be moved, false otherwise

canTransferAllTargetItems

public boolean canTransferAllTargetItems()
Returns true if the target items can be moved. Subclasses can override this method to provide custom transfer control.

Returns:
true if the items are allowed to be moved, false otherwise

canTransferSourceItems

public boolean canTransferSourceItems(java.util.List items)
Returns true if the items in the list are allowed to be transfered to the target. Subclasses can override this method to provide custom transfer control.

Parameters:
items - a list of items in the source model that are being queried whether they can be transferred
Returns:
true if the items in the list are allowed to be moved, false otherwise

canTransferTargetItems

public boolean canTransferTargetItems(java.util.List items)
Returns true if the items in the list are allowed to be transfered to the source. Subclasses can override this method to provide custom transfer control.

Parameters:
items - a list of items in the target model that are being queried whether they can be transferred
Returns:
true if the items in the list are allowed to be moved, false otherwise

ensureButtonsEnabled

protected void ensureButtonsEnabled()
Changes the status of the left/right and up/down buttons based on selections and arrow direction.


initializeBaseDualSelector

protected void initializeBaseDualSelector()
Builds the dual selector components.


initializeSize

protected void initializeSize()

addListeners

protected void addListeners()
Sets up the various button action listeners and key adapters.


paintComponent

protected void paintComponent(java.awt.Graphics g)
Paints the background of the DualSelector if it's opaque

Overrides:
paintComponent in class javax.swing.JComponent
Parameters:
g - the Graphics object used to paint

createSourceLabel

public javax.swing.JLabel createSourceLabel()
Creates the component to be used as the source label.

Returns:
component to be used as the source label

createTargetLabel

public javax.swing.JLabel createTargetLabel()
Creates the component to be used as the target label.

Returns:
component to be used as the target label

setBackground

public void setBackground(java.awt.Color color)
Overrides setBackground in java.awt.Component. This is overridden to get notification of a color change and to filter it to the contained components. This is applied to already initialized components.

Overrides:
setBackground in class javax.swing.JComponent
Parameters:
color - the new color for the background

setFont

public void setFont(java.awt.Font font)
Overrides super.setFont. This is overridden to notify children that the font has changed so that they can draw themselves using the correct font. This will be removed whenever the JDK bug is fixed.

Overrides:
setFont in class javax.swing.JComponent
Parameters:
font - the new font

setForeground

public void setForeground(java.awt.Color color)
Overrides setForeground in java.awt.Component. This is overridden to get notification of a color change and to filter it to the contained components.

Overrides:
setForeground in class javax.swing.JComponent
Parameters:
color - the new color for the foreground

setTargetButtonsLocation

public void setTargetButtonsLocation(int location)

isGroupDirectionalButtonsTogether

public boolean isGroupDirectionalButtonsTogether()
Returns a value indicating whether the directional buttons (source to target, target to source buttons) are grouped together in the layout

Returns:
boolean indicating whether the directional buttons are grouped together in the button container

setGroupDirectionalButtonsTogether

public void setGroupDirectionalButtonsTogether(boolean grouping)
Determines how the single and multiple buttons are layed out in the container. The default value is false which will result in the buttons being grouped vertically as follows:
  • rightButton (move one or more items from source to target)
  • leftButton (move single item from target to source)
  • allRightButton (move one or more items from source to target)
  • allLeftButton (move all items from target to source) If set to true, the directional buttons will be grouped together vertically as follows :
  • rightButton (move one or more items from source to target)
  • allRightButton (move all items from source to target)
  • leftButton (move one or more items from target to source)
  • allLeftButton (move all items from target to source) Setting the value to true will only be honored if setAlternatingSingleButtonStyle(boolean style) is set to false and setAlternatingMultipleButtonStyle(boolean style) is set to false.

    Parameters:
    grouping - if set to true, will result in directional(source to target, target to source) buttons grouped together in container

  • getAlternatingButtonIcon

    protected javax.swing.Icon getAlternatingButtonIcon(java.lang.String buttonConstant,
                                                        boolean direction)
    This method is intended for use by subclasses of BaseDualSelector. Returns the icons for the alternating button.

    Parameters:
    buttonConstant - constant for specifying either the alternatingSingleButton or the alternatingMultipleButton.Valid values are:
  • ALTERNATING_SINGLE_BUTTON
  • ALTERNATING_MULTIPLE_BUTTON
    direction - current direction the arrows should be pointing
    Throws:
    java.lang.IllegalArgumentException - if buttonConstant is not one of the values listed above

  • setAlternatingSingleButtonIcons

    public void setAlternatingSingleButtonIcons(javax.swing.Icon rightIcon,
                                                javax.swing.Icon leftIcon)
    Sets the icons for the alternating single button.

    Parameters:
    rightIcon - the Icon to be displayed when moving item from source to target
    leftIcon - the Icon to be displayed when moving item from target to source

    setAlternatingMultipleButtonIcons

    public void setAlternatingMultipleButtonIcons(javax.swing.Icon rightIcon,
                                                  javax.swing.Icon leftIcon)
    Sets the icons for the alternating multiple button.

    Parameters:
    rightIcon - the Icon to be displayed when moving item from source to target
    leftIcon - the Icon to be displayed when moving item from target to source

    actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent e)
    Called whenever one of the buttons has been clicked and performs an action based on whichever button was clicked.

    Specified by:
    actionPerformed in interface java.awt.event.ActionListener
    Parameters:
    e - the action event.



    Copyright © 2009 SAS Institute Inc. All Rights Reserved.