|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.swing.visuals.DualSelector
public class DualSelector
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:
DualSelector dualSelector1 = new DualSelector();
false
, copies of the models' data will be
displayed. Any modifications to the data displayed in the DualSelector will
occur only on the copies of the data and not on the models' data that was
copied. Otherwise, if dynamic is set to true
then the models' data is directly
modified. In order to allow dynamic to be set to true
, both of the models must
support javax.swing.DefaultListModel or be com.sas.swing.models.ListModelAdapter with a
com.sas.collection.OrderedCollectionInterface as the model for the adapter. If both do not
support one of these models then an
IllegalStateException will be thrown when an attempt to set dynamic to true
occurs.
false
. By default modelEventsIgnored is
true
and dynamic is false
. This provides an initial
snapshot of the data contained in the two models. If modelEventsIgnored is
false
(and dynamic is false
) then
whenever either one of the models fires a ListDataEvent, its respective
JList is updated with the new contents.
ListModel
,
DefaultListModel
,
ListModelAdapter
,
StaticOrderedCollectionInterface
,
OrderedCollectionInterface
,
Serialized FormField 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 |
---|
protected javax.swing.JPanel mainPanel
protected MinMaxSpacePartitioner partitioner
protected boolean copyMode
protected boolean copyModeDuplicates
protected javax.swing.JLabel label1
protected javax.swing.JLabel label2
protected javax.swing.JList jList1
protected javax.swing.JList jList2
protected javax.swing.JButton alternatingButton
protected javax.swing.JButton leftButton
protected javax.swing.JButton rightButton
protected javax.swing.JButton allRightButton
protected javax.swing.JButton allLeftButton
protected javax.swing.JButton down1Button
protected javax.swing.JButton down2Button
protected javax.swing.JButton up1Button
protected javax.swing.JButton up2Button
Constructor Detail |
---|
public DualSelector()
Method Detail |
---|
public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
public static int getDefaultWidth()
public static void setDefaultWidth(int newValue)
newValue
- the new default width in pixelspublic static int getDefaultHeight()
public static void setDefaultHeight(int newValue)
newValue
- the default height in pixelspublic static void setAlternatingButtonStyle(boolean style)
style
- the alternating button style valuegetAlternatingButtonStyle()
public static boolean getAlternatingButtonStyle()
setAlternatingButtonStyle(boolean)
public void setCopyModeEnabled(boolean mode)
mode
- The copy mode statusgetCopyMode()
public boolean getCopyMode()
setCopyModeEnabled(boolean)
public void setCopyModeDuplicatesEnabled(boolean duplicates)
duplicates
- The status of allowing duplicatesgetCopyModeDuplicates()
public boolean getCopyModeDuplicates()
setCopyModeDuplicatesEnabled(boolean)
public javax.swing.ListCellRenderer getCellRenderer()
setCellRenderer(javax.swing.ListCellRenderer)
public void setCellRenderer(javax.swing.ListCellRenderer newValue)
newValue
- the new value for the cell renderer propertygetCellRenderer()
public boolean isDynamic()
setDynamic(boolean)
public void setDynamic(boolean newValue)
dynamic
- the new value of the dynamic property
java.lang.IllegalStateException
- if dynamic is set to true
and the
models do not support OrderedCollectionInterfaceisDynamic()
public boolean isList1ControlsVisible()
true
if the controls for list 1 are visible,
false
otherwise.setList1ControlsVisible(boolean)
public void setList1ControlsVisible(boolean newValue)
newValue
- the new value of the list1ControlsVisible propertyisList1ControlsVisible()
public int getList1Count()
public javax.swing.ListCellRenderer getList1CellRenderer()
setList1CellRenderer(javax.swing.ListCellRenderer)
public void setList1CellRenderer(javax.swing.ListCellRenderer newValue)
newValue
- the new value for the list 1 cell renderergetList1CellRenderer()
public com.sas.collection.StaticOrderedCollectionInterface getList1Items()
public java.lang.String getList1Label()
setList1Label(java.lang.String)
public void setList1Label(java.lang.String newValue)
newValue
- the new value of list 1's labelgetList1Label()
public int getList1MaximumCount()
setList1MaximumCount(int)
public void setList1MaximumCount(int newValue)
newValue
- the new value of the list1MaximumCount property.
java.lang.IllegalStateException
- if newValue != -1 and
newValue < getList1Count()getList1MaximumCount()
public boolean isList2ControlsVisible()
true
if the controls for list 2 are visible,
false
otherwise.setList2ControlsVisible(boolean)
public void setList2ControlsVisible(boolean newValue)
newValue
- the new value of the list2ControlsVisible propertygetList2Count()
public int getList2Count()
public javax.swing.ListCellRenderer getList2CellRenderer()
setList2CellRenderer(javax.swing.ListCellRenderer)
public void setList2CellRenderer(javax.swing.ListCellRenderer newValue)
newValue
- the new value for the list 2 cell renderergetList1CellRenderer()
public com.sas.collection.StaticOrderedCollectionInterface getList2Items()
public java.lang.String getList2Label()
setList2Label(java.lang.String)
public void setList2Label(java.lang.String newValue)
newValue
- the new value of list 2's labelgetList2Label()
public int getList2MaximumCount()
java.lang.IllegalStateException
- if newValue != -1 and
newValue < getList2Count()setList2MaximumCount(int)
public void setList2MaximumCount(int newValue)
newValue
- the new value of the list2MaximumCount propertygetList2MaximumCount()
public void setEnabled(boolean e)
setEnabled
in class javax.swing.JComponent
e
- true to enable the DualSelector; false to disable itpublic boolean isModelEventsIgnored()
true
if the DualSelector ignores events from its
models, false
otherwisesetModelEventsIgnored(boolean)
public void setModelEventsIgnored(boolean newValue)
true
.
newValue
- the new value of the modelEventsIgnored attribute.isModelEventsIgnored()
public boolean isTransferAllControlsVisible()
true
if the buttons which move all items are visible,
false
otherwisesetTransferAllControlsVisible(boolean)
public void setTransferAllControlsVisible(boolean newValue)
newValue
- the new value of the transferAllControlsVisible propertyisTransferAllControlsVisible()
public void setToolTipText(java.lang.String text)
setToolTipText
in class javax.swing.JComponent
text
- the string to display; if the text is null,
the tool tip is turned off for this componentprotected void moveListItem(javax.swing.ListModel listModel, boolean moveItemUp)
list
- the list of which to move the item(s)moveItemUp
- true to move the item(s) up, false to move the item(s) downmoveList1ItemUp()
,
moveList1ItemDown()
,
moveList2ItemUp()
,
moveList2ItemDown()
public void moveList1ItemUp()
moveListItem(javax.swing.ListModel, boolean)
public void moveList1ItemDown()
moveListItem(javax.swing.ListModel, boolean)
public void moveList2ItemUp()
moveListItem(javax.swing.ListModel, boolean)
public void moveList2ItemDown()
moveListItem(javax.swing.ListModel, boolean)
protected void transferAllItems(javax.swing.ListModel fromList, javax.swing.ListModel toList)
fromList
- the list to move all items fromtoList
- the list to move all items totransferAllList1Items()
,
transferAllList2Items()
public void transferAllList1Items()
transferAllItems(javax.swing.ListModel, javax.swing.ListModel)
protected void transferListItems(javax.swing.ListModel fromList, javax.swing.ListModel toList)
fromList
- the list that the items are being transferred fromtoList
- the list that the items are being transferred totransferList1Items()
,
transferList2Items()
public void transferList1Items()
transferListItems(javax.swing.ListModel, javax.swing.ListModel)
public void transferAllList2Items()
transferAllItems(javax.swing.ListModel, javax.swing.ListModel)
public void transferList2Items()
public java.awt.Dimension computePreferredSize()
getDefaultWidth()
,
getDefaultHeight()
public int dragOver(java.awt.Point point, int representation, int keyState, java.util.Vector data)
DesignTimeDropTargetInterface.dragOver(java.awt.Point, int, int, java.util.Vector)
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public java.util.Vector getRequiredInterfaces()
ViewInterface.getRequiredInterfaces()
public void refresh()
public void refresh(javax.swing.ListModel listModel)
listModel
- the current model refresh to refresh fromprotected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- the Graphics object used to paintpublic void setBackground(java.awt.Color color)
setBackground
in class javax.swing.JComponent
color
- the new color for the backgroundpublic void setDefaultValues()
public void setFont(java.awt.Font font)
setFont
in class javax.swing.JComponent
font
- the new fontpublic void setForeground(java.awt.Color color)
setForeground
in class javax.swing.JComponent
color
- the new color for the foregroundpublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- the action event.public void contentsChanged(javax.swing.event.ListDataEvent event)
contentsChanged
in interface javax.swing.event.ListDataListener
event
- the event to handlepublic void intervalAdded(javax.swing.event.ListDataEvent event)
intervalAdded
in interface javax.swing.event.ListDataListener
event
- the event to handlepublic void intervalRemoved(javax.swing.event.ListDataEvent event)
intervalRemoved
in interface javax.swing.event.ListDataListener
event
- the event to handlepublic void valueChanged(javax.swing.event.ListSelectionEvent ie)
valueChanged
in interface javax.swing.event.ListSelectionListener
ie
- the event to handlepublic boolean isDefaultModelAttached()
isDefaultModelAttached
in interface ViewDefaultModel
ViewDefaultModel
public javax.swing.ListModel getModel()
setModel(javax.swing.ListModel)
public void setModel(javax.swing.ListModel listModel)
listModel
- the ListModel to set for list 1setList2Model(javax.swing.ListModel)
public javax.swing.ListModel getList2Model()
setList2Model(javax.swing.ListModel)
public void setList2Model(javax.swing.ListModel listModel)
listModel
- the ListModel to set for list 2setModel(javax.swing.ListModel)
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |