com.sas.swing.visuals
Class DualSelector

com.sas.swing.visuals.DualSelector
All Implemented Interfaces:
ViewDefaultModel, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.swing.event.ListDataListener, javax.swing.event.ListSelectionListener

public class DualSelector
implements java.awt.event.ActionListener, javax.swing.event.ListSelectionListener, javax.swing.event.ListDataListener, ViewDefaultModel

DualSelector is a class used for manipulating items between two lists. Items are initially in one (or two) JLists and are moved within or tranferred between each of the lists. When items are moved between JLists, 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 JList.

Creation:

  1. Create a DualSelector

    DualSelector dualSelector1 = new DualSelector();

Default Size:
Required Interfaces:
DualSelector requires a model that implements the javax.swing.ListModel interface.

Events:
DualSelector fires PropertyChangeEvents whenever any of its properties change.

Notes:

See Also:
ListModel, DefaultListModel, ListModelAdapter, StaticOrderedCollectionInterface, OrderedCollectionInterface, Serialized Form

Field Summary
protected  javax.swing.JButton allLeftButton
          JButton used to transfer all items from list two to list one.
protected  javax.swing.JButton allRightButton
          JButton used to transfer all items from list one to list two.
protected  javax.swing.JButton alternatingButton
          JButton used to transfer one or more items between lists.
protected  boolean copyMode
           
protected  boolean copyModeDuplicates
           
protected  javax.swing.JButton down1Button
          JButton used to move items down in list one when reordering.
protected  javax.swing.JButton down2Button
          JButton used to move items down in list two when reordering.
protected  javax.swing.JList jList1
          ListBox for the first list.
protected  javax.swing.JList jList2
          List for the second list.
protected  javax.swing.JLabel label1
          Label for the first list.
protected  javax.swing.JLabel label2
          Label for the second list.
protected  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
           
protected  MinMaxSpacePartitioner partitioner
           
protected  javax.swing.JButton rightButton
          JButton used to transfer one or more items from the left list to the right list.
protected  javax.swing.JButton up1Button
          JButton used to move items up in list one when reordering.
protected  javax.swing.JButton up2Button
          JButton used to move items up in list two when reordering.
 
Constructor Summary
DualSelector()
          Constructs a DualSelector object.
 
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.
 java.awt.Dimension computePreferredSize()
          Computes the preferred size.
 void contentsChanged(javax.swing.event.ListDataEvent event)
          Event handler for the ListDataEvents received from the models.
 int dragOver(java.awt.Point point, int representation, int keyState, java.util.Vector data)
          Override the dragOver method of com.sas.awt.Panel.
static boolean getAlternatingButtonStyle()
          Returns the value of the alternating button style
 javax.swing.ListCellRenderer getCellRenderer()
          Returns the cell renderer.
 boolean getCopyMode()
          Returns the copy mode status.
 boolean getCopyModeDuplicates()
          Gets the status of whether to allow duplicate items when copying from a list
static int getDefaultHeight()
          Returns the default height in pixels
static int getDefaultWidth()
          Returns the default width in pixels
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
          Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about a DualSelector.
 javax.swing.ListCellRenderer getList1CellRenderer()
          Returns the cell renderer for list 1.
 int getList1Count()
          Returns the number of items in list 1.
 com.sas.collection.StaticOrderedCollectionInterface getList1Items()
          Returns a copy of the items in list 1.
 java.lang.String getList1Label()
          Returns the value of list 1's label.
 int getList1MaximumCount()
          Returns the value of the list1MaximumCount property.
 javax.swing.ListCellRenderer getList2CellRenderer()
          Returns the cell renderer for list 2.
 int getList2Count()
          Returns the number of items in list 2.
 com.sas.collection.StaticOrderedCollectionInterface getList2Items()
          Returns a copy of the items in list 2.
 java.lang.String getList2Label()
          Returns the value of list 2's label.
 int getList2MaximumCount()
          Returns the value of the list2MaximumCount property.
 javax.swing.ListModel getList2Model()
          Returns the ListModel for list 2.
 java.awt.Dimension getMinimumSize()
          Returns the minimum size.
 javax.swing.ListModel getModel()
          Returns the ListModel for list 1.
 java.awt.Dimension getPreferredSize()
          Returns the preferred size.
 java.util.Vector getRequiredInterfaces()
          Returns the required interfaces Vector for this component.
 void intervalAdded(javax.swing.event.ListDataEvent event)
          Event handler for the ListDataEvents received from the models.
 void intervalRemoved(javax.swing.event.ListDataEvent event)
          Event handler for the ListDataEvents received from the models.
 boolean isDefaultModelAttached()
          Returns true if the default model is being used, false otherwise.
 boolean isDynamic()
          Returns the value of the dynamic property.
 boolean isList1ControlsVisible()
          Returns the value of the list1ControlsVisible property.
 boolean isList2ControlsVisible()
          Returns the value of the list2ControlsVisible property.
 boolean isModelEventsIgnored()
          Returns the value of the modelEventsIgnored property.
 boolean isTransferAllControlsVisible()
          Returns the value of the transferAllControlsVisible property.
 void moveList1ItemDown()
          Moves the selected item(s) in list 1 down one position.
 void moveList1ItemUp()
          Moves the selected item(s) in list 1 up one position.
 void moveList2ItemDown()
          Moves the selected item(s) in list 2 down one position.
 void moveList2ItemUp()
          Moves the selected item(s) in list 2 up one position.
protected  void moveListItem(javax.swing.ListModel listModel, boolean moveItemUp)
          Moves the selected item(s) in list either up or down one position.
protected  void paintComponent(java.awt.Graphics g)
          Paints the background of the DualSelector if it's opaque
 void refresh()
          Signals the DualSelector selector to refresh its data from its models.
 void refresh(javax.swing.ListModel listModel)
          Signals the DualSelector selector to refresh its data from the specified model.
static void setAlternatingButtonStyle(boolean style)
          Sets whether left and right is controlled by and alternating button or individual buttons.
 void setBackground(java.awt.Color color)
          Overrides setBackground in java.awt.Component.
 void setCellRenderer(javax.swing.ListCellRenderer newValue)
          Sets the cell renderer.
 void setCopyModeDuplicatesEnabled(boolean duplicates)
          Sets whether to allow duplicate items when copying from a list.
 void setCopyModeEnabled(boolean mode)
          Sets the copy mode status.
static void setDefaultHeight(int newValue)
          Sets the default height in pixels
 void setDefaultValues()
          Creates the components and sets the default values for the DualSelector.
static void setDefaultWidth(int newValue)
          Sets the default width in pixels.
 void setDynamic(boolean newValue)
          Sets the value of the dynamic property.
 void setEnabled(boolean e)
          Set the DualSelector enabled.
 void setFont(java.awt.Font font)
          Overrides super.setFont.
 void setForeground(java.awt.Color color)
          Overrides setForeground in java.awt.Component.
 void setList1CellRenderer(javax.swing.ListCellRenderer newValue)
          Sets the cell renderer for list 1.
 void setList1ControlsVisible(boolean newValue)
          Sets the value of the list1ControlsVisible property.
 void setList1Label(java.lang.String newValue)
          Sets the value of list 1's label.
 void setList1MaximumCount(int newValue)
          Sets the value of the list1MaximumCount property.
 void setList2CellRenderer(javax.swing.ListCellRenderer newValue)
          Sets the cell renderer for list 2.
 void setList2ControlsVisible(boolean newValue)
          Sets the value of the list2ControlsVisible property.
 void setList2Label(java.lang.String newValue)
          Set the value of list 2's label.
 void setList2MaximumCount(int newValue)
          Sets the value of the list2MaximumCount property.
 void setList2Model(javax.swing.ListModel listModel)
          Sets the ListModel for list 2.
 void setModel(javax.swing.ListModel listModel)
          Sets the ListModel for list 1.
 void setModelEventsIgnored(boolean newValue)
          Sets the value of the modelEventsIgnored property.
 void setToolTipText(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(javax.swing.ListModel fromList, javax.swing.ListModel toList)
          Transfers all of the items from fromList to toList.
 void transferAllList1Items()
          Transfer all items from list 1 to list 2.
 void transferAllList2Items()
          Transfer all items from list 2 to list 1.
 void transferList1Items()
          Transfer all the selected items from list 1 to list 2.
 void transferList2Items()
          Transfer all the selected items from list 2 to list 1.
protected  void transferListItems(javax.swing.ListModel fromList, javax.swing.ListModel toList)
          Transfer all selected items from fromList to toList.
 void valueChanged(javax.swing.event.ListSelectionEvent ie)
          Event handler for the ListSelectionEvent's received.
 

Field Detail

mainPanel

protected javax.swing.JPanel mainPanel

partitioner

protected MinMaxSpacePartitioner partitioner

copyMode

protected boolean copyMode

copyModeDuplicates

protected boolean copyModeDuplicates

label1

protected javax.swing.JLabel label1
Label for the first list.


label2

protected javax.swing.JLabel label2
Label for the second list.


jList1

protected javax.swing.JList jList1
ListBox for the first list.


jList2

protected javax.swing.JList jList2
List for the second list.


alternatingButton

protected javax.swing.JButton alternatingButton
JButton used to transfer one or more items between lists.


leftButton

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


rightButton

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


allRightButton

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


allLeftButton

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


down1Button

protected javax.swing.JButton down1Button
JButton used to move items down in list one when reordering.


down2Button

protected javax.swing.JButton down2Button
JButton used to move items down in list two when reordering.


up1Button

protected javax.swing.JButton up1Button
JButton used to move items up in list one when reordering.


up2Button

protected javax.swing.JButton up2Button
JButton used to move items up in list two when reordering.

Constructor Detail

DualSelector

public DualSelector()
Constructs a DualSelector object.

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 DualSelector.

Returns:
the ExtendedBeanInfo for this class

getDefaultWidth

public static int getDefaultWidth()
Returns the default width in pixels

Returns:
the default width in pixels

setDefaultWidth

public static void setDefaultWidth(int newValue)
Sets the default width in pixels.

Parameters:
newValue - the new default width in pixels

getDefaultHeight

public static int getDefaultHeight()
Returns the default height in pixels

Returns:
the default height in pixels

setDefaultHeight

public static void setDefaultHeight(int newValue)
Sets the default height in pixels

Parameters:
newValue - the default height in pixels

setAlternatingButtonStyle

public static void setAlternatingButtonStyle(boolean style)
Sets whether left and right is controlled by and alternating button or individual buttons.

Parameters:
style - the alternating button style value
See Also:
getAlternatingButtonStyle()

getAlternatingButtonStyle

public static boolean getAlternatingButtonStyle()
Returns the value of the alternating button style

Returns:
the value of the alternating button style
See Also:
setAlternatingButtonStyle(boolean)

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

getCopyMode

public boolean getCopyMode()
Returns the copy mode status.

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

setCopyModeDuplicatesEnabled

public void setCopyModeDuplicatesEnabled(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:
getCopyModeDuplicates()

getCopyModeDuplicates

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

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

getCellRenderer

public javax.swing.ListCellRenderer getCellRenderer()
Returns the cell renderer. The cell renderer is used for both JLists to transform the data prior to it being displayed

Returns:
the cell renderer
See Also:
setCellRenderer(javax.swing.ListCellRenderer)

setCellRenderer

public void setCellRenderer(javax.swing.ListCellRenderer newValue)
Sets the cell renderer. The same cell renderer is used for both JLists when set with this method.

Parameters:
newValue - the new value for the cell renderer property
See Also:
getCellRenderer()

isDynamic

public boolean isDynamic()
Returns the value of the dynamic property. If the DualSelector is dynamic, then any changes in the DualSelector will also be made in the models if both of the models are instances of javax.swing.DefaultListModel or com.sas.swing.models.ListmOdelAdapter with a com.sas.collection.OrderedCollectionInterface as it's model. Otherwise, copies of the models will be made and only these copies will be modified.

Returns:
true if the DualSelector is dynamic, false otherwise.
See Also:
setDynamic(boolean)

setDynamic

public void setDynamic(boolean newValue)
Sets the value of the dynamic property. If the DualSelector is dynamic, then any changes in the DualSelector will also be made in the models if both of the models are instances of javax.swing.DefaultListModel or com.sas.swing.models.ListmOdelAdapter with a com.sas.collection.OrderedCollectionInterface as it's model. Otherwise, copies of the models will be made and only these copies will be modified.

Parameters:
dynamic - the new value of the dynamic property
Throws:
java.lang.IllegalStateException - if dynamic is set to true and the models do not support OrderedCollectionInterface
See Also:
isDynamic()

isList1ControlsVisible

public boolean isList1ControlsVisible()
Returns the value of the list1ControlsVisible property. The list1ControlsVisible property controls whether the buttons that allow list 1 to be reordered are visible beneath the ListBox that displays the items of list 1.

Returns:
true if the controls for list 1 are visible, false otherwise.
See Also:
setList1ControlsVisible(boolean)

setList1ControlsVisible

public void setList1ControlsVisible(boolean newValue)
Sets the value of the list1ControlsVisible property. The list1ControlsVisible property controls whether the buttons that allow list 1 to be reordered are visible beneath the ListBox that displays the items of list 1.

Parameters:
newValue - the new value of the list1ControlsVisible property
See Also:
isList1ControlsVisible()

getList1Count

public int getList1Count()
Returns the number of items in list 1.

Returns:
the number of items in list 1.

getList1CellRenderer

public javax.swing.ListCellRenderer getList1CellRenderer()
Returns the cell renderer for list 1. The cell renderer controls how the items in list 1 are displayed.

Returns:
cell renderer for list 1
See Also:
setList1CellRenderer(javax.swing.ListCellRenderer)

setList1CellRenderer

public void setList1CellRenderer(javax.swing.ListCellRenderer newValue)
Sets the cell renderer for list 1. The cell renderer controls how the items in list 1 are displayed.

Parameters:
newValue - the new value for the list 1 cell renderer
See Also:
getList1CellRenderer()

getList1Items

public com.sas.collection.StaticOrderedCollectionInterface getList1Items()
Returns a copy of the items in list 1.

Returns:
a copy of the items in list 1

getList1Label

public java.lang.String getList1Label()
Returns the value of list 1's label.

Returns:
the value of list 1's label
See Also:
setList1Label(java.lang.String)

setList1Label

public void setList1Label(java.lang.String newValue)
Sets the value of list 1's label.

Parameters:
newValue - the new value of list 1's label
See Also:
getList1Label()

getList1MaximumCount

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

Returns:
the maximum number of allowed items for list 1
See Also:
setList1MaximumCount(int)

setList1MaximumCount

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

Parameters:
newValue - the new value of the list1MaximumCount property.
Throws:
java.lang.IllegalStateException - if newValue != -1 and newValue < getList1Count()
See Also:
getList1MaximumCount()

isList2ControlsVisible

public boolean isList2ControlsVisible()
Returns the value of the list2ControlsVisible property. The list2ControlsVisible property controls whether the buttons that allow list 2 to be reordered are visible beneath the ListBox that displays the items of list 2.

Returns:
true if the controls for list 2 are visible, false otherwise.
See Also:
setList2ControlsVisible(boolean)

setList2ControlsVisible

public void setList2ControlsVisible(boolean newValue)
Sets the value of the list2ControlsVisible property. The list2ControlsVisible property controls whether the buttons that allow list 2 to be reordered are visible beneath the ListBox that displays the items of list 2.

Parameters:
newValue - the new value of the list2ControlsVisible property
See Also:
getList2Count()

getList2Count

public int getList2Count()
Returns the number of items in list 2.

Returns:
the number of items in list 2.

getList2CellRenderer

public javax.swing.ListCellRenderer getList2CellRenderer()
Returns the cell renderer for list 2. The cell renderer controls how the items in list 2 are displayed.

Returns:
the cell renderer for list 2
See Also:
setList2CellRenderer(javax.swing.ListCellRenderer)

setList2CellRenderer

public void setList2CellRenderer(javax.swing.ListCellRenderer newValue)
Sets the cell renderer for list 2. The cell renderer controls how the items in list 2 are displayed.

Parameters:
newValue - the new value for the list 2 cell renderer
See Also:
getList1CellRenderer()

getList2Items

public com.sas.collection.StaticOrderedCollectionInterface getList2Items()
Returns a copy of the items in list 2.

Returns:
a copy of the items in list 2

getList2Label

public java.lang.String getList2Label()
Returns the value of list 2's label.

Returns:
the value of list 2's label
See Also:
setList2Label(java.lang.String)

setList2Label

public void setList2Label(java.lang.String newValue)
Set the value of list 2's label.

Parameters:
newValue - the new value of list 2's label
See Also:
getList2Label()

getList2MaximumCount

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

Returns:
the maximum number of allowed items for list 2
Throws:
java.lang.IllegalStateException - if newValue != -1 and newValue < getList2Count()
See Also:
setList2MaximumCount(int)

setList2MaximumCount

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

Parameters:
newValue - the new value of the list2MaximumCount property
See Also:
getList2MaximumCount()

setEnabled

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

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

isModelEventsIgnored

public boolean isModelEventsIgnored()
Returns the value of the modelEventsIgnored property. This is an expert property which signals the DualSelector to either respond to ContentsChangedEvent events from its models or to ignore them. This property is only checked when the dynamic property is false.

Returns:
true if the DualSelector ignores events from its models, false otherwise
See Also:
setModelEventsIgnored(boolean)

setModelEventsIgnored

public void setModelEventsIgnored(boolean newValue)
Sets the value of the modelEventsIgnored property. This is an expert property which signals the DualSelector to either respond to ContentsChangedEvent events from its models or to ignore them. This property is only checked when the dynamic property is true.

Parameters:
newValue - the new value of the modelEventsIgnored attribute.
See Also:
isModelEventsIgnored()

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 list 1 to list 2 and from list 2 to list 1 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 list 1 to list 2 and from list 2 to list 1 are visible or hidden.

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

setToolTipText

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

Overrides:
setToolTipText in class javax.swing.JComponent
Parameters:
text - the string to display; if the text is null, the tool tip is turned off for this component

moveListItem

protected void moveListItem(javax.swing.ListModel listModel,
                            boolean moveItemUp)
Moves the selected item(s) in list either up or down one position. If the destination of an item is outside of the bounds of list, then the selected item is not moved. This method is called by moveList1ItemUp, moveList1ItemDown, moveList2ItemUp and moveList2ItemDown. Subclasses should override this method to modify behavior.

Parameters:
list - the list of which to move the item(s)
moveItemUp - true to move the item(s) up, false to move the item(s) down
See Also:
moveList1ItemUp(), moveList1ItemDown(), moveList2ItemUp(), moveList2ItemDown()

moveList1ItemUp

public void moveList1ItemUp()
Moves the selected item(s) in list 1 up one position. If the destination is less than 0, the selected item is not moved. This method is called in response to the list 1 up button being pressed. This method calls moveListItem(list1, true). Subclasses should override moveListItem to modify behavior.

See Also:
moveListItem(javax.swing.ListModel, boolean)

moveList1ItemDown

public void moveList1ItemDown()
Moves the selected item(s) in list 1 down one position. If the destination is greater than list 1's count - 1, the selected item is not moved. This method is called in response to the list 1 down button being pressed. This method calls moveListItem(list1, false). Subclasses should override moveListItem to modify behavior.

See Also:
moveListItem(javax.swing.ListModel, boolean)

moveList2ItemUp

public void moveList2ItemUp()
Moves the selected item(s) in list 2 up one position. If the destination is less than 0, the selected item is not moved. This method is called in response to the list 2 up button being pressed. This method calls moveListItem(list2, true). Subclasses should override moveListItem to modify behavior.

See Also:
moveListItem(javax.swing.ListModel, boolean)

moveList2ItemDown

public void moveList2ItemDown()
Moves the selected item(s) in list 2 down one position. If the destination is greater than list 2's count - 1, the selected item is not moved. This method is called in response to the list 2 down button being pressed. This method calls moveListItem(list2, false). Subclasses should override moveListItem to modify behavior.

See Also:
moveListItem(javax.swing.ListModel, boolean)

transferAllItems

protected void transferAllItems(javax.swing.ListModel fromList,
                                javax.swing.ListModel toList)
Transfers all of the items from fromList to toList. No items are transferred if the maximum count for toList will be exceeded as a result of the transfer. After the transfer fromList will be empty and toList will contain the items that were in fromList and toList prior to the transfer. This method is called by transferAllList1Items and transferAllList2Items. Subclasses should override this method to modify behavior.

Parameters:
fromList - the list to move all items from
toList - the list to move all items to
See Also:
transferAllList1Items(), transferAllList2Items()

transferAllList1Items

public void transferAllList1Items()
Transfer all items from list 1 to list 2. This method is called in response to the top transfer all button being pressed. No items are transfered if the maximum count for list 2 will be exceeded as a result of the transfer. This method calls transferAllItems(list1, list2). Subclasses should override transferAllItems to modify behavior.

See Also:
transferAllItems(javax.swing.ListModel, javax.swing.ListModel)

transferListItems

protected void transferListItems(javax.swing.ListModel fromList,
                                 javax.swing.ListModel toList)
Transfer all selected items from fromList to toList. This method is called in response to the transfer items button being pressed. No items are transfered if the maximum count for toList will be exceeded as a result of the transfer. This method is called by transferList1Items and transferList2Items. Subclasses should override this method to modify behavior.

Parameters:
fromList - the list that the items are being transferred from
toList - the list that the items are being transferred to
See Also:
transferList1Items(), transferList2Items()

transferList1Items

public void transferList1Items()
Transfer all the selected items from list 1 to list 2. This method is called in response to the transfer items button being pressed. No items are transfered if the maximum count for list 2 will be exceeded as a result of the transfer. This method calls transferListItems(list1, list2). Subclasses should override transferListItems to modify behavior.

See Also:
transferListItems(javax.swing.ListModel, javax.swing.ListModel)

transferAllList2Items

public void transferAllList2Items()
Transfer all items from list 2 to list 1. This method is called in response to the top transfer all button being pressed. No items are transfered if the maximum count for list 1 will be exceeded as a result of the transfer. This methods calls transferAllItems(list2, list1). Subclasses should override transferAllItems to modify behavior.

See Also:
transferAllItems(javax.swing.ListModel, javax.swing.ListModel)

transferList2Items

public void transferList2Items()
Transfer all the selected items from list 2 to list 1. This method is called in response to the transfer items button being pressed. No items are transfered if the maximum count for list 1 will be exceeded as a result of the transfer. This method calls transferList2Items(list2, list1). Subclasses should override transferListItems to modify behavior.


computePreferredSize

public java.awt.Dimension computePreferredSize()
Computes the preferred size. The preferred size is returned as the default width and height.

Returns:
the preferred size in pixels
See Also:
getDefaultWidth(), getDefaultHeight()

dragOver

public int dragOver(java.awt.Point point,
                    int representation,
                    int keyState,
                    java.util.Vector data)
Override the dragOver method of com.sas.awt.Panel. Do not allow Viewers and Components to be dropped on the DualSelector. If anything else is dragged onto the DualSelector, let the container handle it.

See Also:
DesignTimeDropTargetInterface.dragOver(java.awt.Point, int, int, java.util.Vector)

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the preferred size. The preferred size is the same as the minimum size (calls getMinimumSize()).

Overrides:
getPreferredSize in class javax.swing.JComponent
Returns:
the preferred size in pixels

getMinimumSize

public java.awt.Dimension getMinimumSize()
Returns the minimum size. The minimum size is the same as the preferred size (calls getPreferredSize()).

Overrides:
getMinimumSize in class javax.swing.JComponent
Returns:
the minimum size in pixels

getRequiredInterfaces

public java.util.Vector getRequiredInterfaces()
Returns the required interfaces Vector for this component.

Returns:
the required interfaces Vector for this component.
See Also:
ViewInterface.getRequiredInterfaces()

refresh

public void refresh()
Signals the DualSelector selector to refresh its data from its models.


refresh

public void refresh(javax.swing.ListModel listModel)
Signals the DualSelector selector to refresh its data from the specified model. This model must be one of the attached models.

Parameters:
listModel - the current model refresh to refresh from

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

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.

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

setDefaultValues

public void setDefaultValues()
Creates the components and sets the default values for the DualSelector. This is a framework method and is not intended to be called by a user.


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

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.

contentsChanged

public void contentsChanged(javax.swing.event.ListDataEvent event)
Event handler for the ListDataEvents received from the models. Refreshes the models.

Specified by:
contentsChanged in interface javax.swing.event.ListDataListener
Parameters:
event - the event to handle

intervalAdded

public void intervalAdded(javax.swing.event.ListDataEvent event)
Event handler for the ListDataEvents received from the models.

Specified by:
intervalAdded in interface javax.swing.event.ListDataListener
Parameters:
event - the event to handle

intervalRemoved

public void intervalRemoved(javax.swing.event.ListDataEvent event)
Event handler for the ListDataEvents received from the models.

Specified by:
intervalRemoved in interface javax.swing.event.ListDataListener
Parameters:
event - 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

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

getModel

public javax.swing.ListModel getModel()
Returns the ListModel for list 1. The ListModel for list 2 can be obtained by calling getList2Model.

Returns:
the ListModel for list 2
See Also:
setModel(javax.swing.ListModel)

setModel

public void setModel(javax.swing.ListModel listModel)
Sets the ListModel for list 1. The ListModel for list 2 can be set by calling setList2Model.

Parameters:
listModel - the ListModel to set for list 1
See Also:
setList2Model(javax.swing.ListModel)

getList2Model

public javax.swing.ListModel getList2Model()
Returns the ListModel for list 2. The ListModel for list 1 can be obtained by calling getModel.

Returns:
the ListModel for list 2
See Also:
setList2Model(javax.swing.ListModel)

setList2Model

public void setList2Model(javax.swing.ListModel listModel)
Sets the ListModel for list 2. The ListModel for list 1 can be set by calling setModel.

Parameters:
listModel - the ListModel to set for list 2
See Also:
setModel(javax.swing.ListModel)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.