|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.swing.visuals.dualselector.BaseDualSelector
public abstract class BaseDualSelector
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.
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 |
---|
protected boolean initialized
protected boolean targetControlsVisible
protected boolean transferAllControlsVisible
protected boolean alternatingSingleButtonStyle
protected boolean alternatingMultipleButtonStyle
protected boolean clearSelection
protected boolean copyModeEnabled
protected boolean copyModeDuplicatesAllowed
protected boolean dragAndDropEnabled
protected java.awt.Component dragGestureInitiator
protected int targetMaximumCount
protected javax.swing.JPanel mainPanel
protected javax.swing.JPanel sourceContainer
protected javax.swing.JPanel targetContainer
protected javax.swing.JPanel buttonContainer
protected javax.swing.JPanel middleContainer
protected ProportionalSpacePartitioner partitioner
protected java.awt.event.MouseListener sourceMouseListener
protected java.awt.event.MouseListener targetMouseListener
protected javax.swing.JLabel sourceLabel
protected javax.swing.JLabel targetLabel
public javax.swing.JButton alternatingSingleButton
public static final java.lang.String ALTERNATING_SINGLE_BUTTON
public javax.swing.JButton leftButton
public javax.swing.JButton rightButton
public javax.swing.JButton alternatingMultipleButton
public static final java.lang.String ALTERNATING_MULTIPLE_BUTTON
public javax.swing.JButton allRightButton
public javax.swing.JButton allLeftButton
public javax.swing.JButton targetDownButton
public javax.swing.JButton targetUpButton
protected DualSelectorInterface sourceAdapter
protected DualSelectorInterface targetAdapter
protected javax.swing.JPanel sourceTopButtonContainer
protected javax.swing.JPanel sourceBottomButtonContainer
protected java.util.List selectedItems
protected transient boolean direction
protected transient javax.swing.Icon leftArrow
protected transient javax.swing.Icon rightArrow
protected transient javax.swing.Icon doubleLeftArrow
protected transient javax.swing.Icon doubleRightArrow
protected static final boolean RIGHT
protected static final boolean LEFT
protected boolean designTime
public static final int TOP_RIGHT
public static final int MIDDLE_BOTTOM
protected java.awt.event.FocusListener sourceFocusListener
protected java.awt.event.FocusListener targetFocusListener
public static final java.lang.String RB_KEY
Constructor Detail |
---|
public BaseDualSelector()
Method Detail |
---|
public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
protected void setDesignTime(boolean newValue)
newValue
- true = in design mode, false = in run modeisDesignTime()
protected boolean isDesignTime()
setDesignTime(boolean)
public void setAlternatingSingleButtonStyle(boolean style)
style
- the alternating selected items button style valuegetAlternatingSingleButtonStyle()
public boolean getAlternatingSingleButtonStyle()
setAlternatingSingleButtonStyle(boolean)
public void setAlternatingMultipleButtonStyle(boolean style)
style
- the move all items alternating button style valuegetAlternatingMultipleButtonStyle()
public boolean getAlternatingMultipleButtonStyle()
setAlternatingMultipleButtonStyle(boolean)
public void setDragAndDropEnabled(boolean enabled)
enabled
- whether to allow drag and drop valueisDragAndDropEnabled()
public boolean isDragAndDropEnabled()
setDragAndDropEnabled(boolean)
public boolean isInTargetModel(java.lang.Object item)
item
- the object to be checked.
public boolean isInSourceModel(java.lang.Object item)
item
- the object to be checked.
public javax.swing.JPanel getSourceTopActionButtonContainer()
public javax.swing.JPanel getSourceBottomActionButtonContainer()
public javax.swing.JComponent getSourceComponent()
public javax.swing.JComponent getTargetComponent()
public void setCopyModeEnabled(boolean mode)
mode
- The copy mode statusisCopyModeEnabled()
public boolean isCopyModeEnabled()
setCopyModeEnabled(boolean)
public void setCopyModeDuplicatesAllowed(boolean duplicates)
duplicates
- The status of allowing duplicatesgetCopyModeDuplicatesAllowed()
public boolean getCopyModeDuplicatesAllowed()
setCopyModeDuplicatesAllowed(boolean)
public javax.swing.JComponent getSourceLabelComponent()
public javax.swing.JComponent getTargetLabelComponent()
public java.lang.String getSourceLabel()
setSourceLabel(java.lang.String)
public void setSourceLabel(java.lang.String newValue)
newValue
- the new value of the source component labelgetSourceLabel()
public boolean isTargetControlsVisible()
true
if the controls for the target component are visible,
false
otherwise.setTargetControlsVisible(boolean)
,
DualSelectorUpDownInterface
public void setTargetControlsVisible(boolean newValue)
newValue
- the new value of the targetControlsVisible propertyDualSelectorUpDownInterface
public java.lang.String getTargetLabel()
setTargetLabel(java.lang.String)
public void setTargetLabel(java.lang.String newValue)
newValue
- the new value of the target component labelgetTargetLabel()
public int getTargetMaximumCount()
java.lang.IllegalStateException
- if newValue != -1 and
newValue < getTargetCount()setTargetMaximumCount(int)
public void setTargetMaximumCount(int newValue)
newValue
- the new value of the targetMaximumCount propertygetTargetMaximumCount()
public void setEnabled(boolean e)
setEnabled
in class javax.swing.JComponent
e
- true to enable the BaseDualSelector; false to disable itpublic 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(javax.swing.JComponent component, java.lang.String text)
component
- the component for which tool tip text is being changedtext
- the string to display; if the text is null,
the tool tip is turned off for this componentpublic void setSourceMouseListener(java.awt.event.MouseListener mouseListener)
mouseListener
- the source mouse listenergetSourceMouseListener()
public void setTargetMouseListener(java.awt.event.MouseListener mouseListener)
mouseListener
- the target mouse listenergetTargetMouseListener()
public java.awt.event.MouseListener getSourceMouseListener()
setSourceMouseListener(MouseListener)
public java.awt.event.MouseListener getTargetMouseListener()
setTargetMouseListener(MouseListener)
protected void moveTargetItem(boolean moveItemUp)
moveItemUp
- true to move the item(s) up, false to move the item(s) downprotected void transferAllItems(DualSelectorInterface fromAdapter, DualSelectorInterface toAdapter)
fromAdapter
- the adapter to move all items fromtoAdapter
- the adapter to move all items totransferAllSourceItems()
,
transferAllTargetItems()
public void transferAllSourceItems()
transferAllItems(com.sas.swing.visuals.dualselector.DualSelectorInterface, com.sas.swing.visuals.dualselector.DualSelectorInterface)
protected void transferItems(DualSelectorInterface fromAdapter, DualSelectorInterface toAdapter)
fromAdapter
- the adapter that the items are being transferred fromtoAdapter
- the adapter that the items are being transferred totransferSourceItems()
,
transferTargetItems()
protected void transferItems(DualSelectorInterface fromAdapter, DualSelectorInterface toAdapter, java.util.List passedItems)
fromAdapter
- the adapter that the items are being transferred fromtoAdapter
- the adapter that the items are being transferred topassedItems
- a collection of items programatically selectedtransferSourceItems()
,
transferTargetItems()
protected boolean areValuesEqual(java.lang.Object o1, java.lang.Object o2)
public void transferSourceItems()
transferItems(com.sas.swing.visuals.dualselector.DualSelectorInterface, com.sas.swing.visuals.dualselector.DualSelectorInterface)
public void transferAllTargetItems()
transferAllItems(com.sas.swing.visuals.dualselector.DualSelectorInterface, com.sas.swing.visuals.dualselector.DualSelectorInterface)
public void transferTargetItems()
public void transferToTargetModel(java.lang.Object[] objectArray)
objectArray
- the array of objects to transferpublic void transferToSourceModel(java.lang.Object[] objectArray)
objectArray
- the array of objects to transferpublic boolean canTransferSelectedSourceItems()
public boolean canTransferSelectedTargetItems()
public boolean canTransferAllSourceItems()
public boolean canTransferAllTargetItems()
public boolean canTransferSourceItems(java.util.List items)
items
- a list of items in the source model that are being queried whether they can be transferred
public boolean canTransferTargetItems(java.util.List items)
items
- a list of items in the target model that are being queried whether they can be transferred
protected void ensureButtonsEnabled()
protected void initializeBaseDualSelector()
protected void initializeSize()
protected void addListeners()
protected void paintComponent(java.awt.Graphics g)
paintComponent
in class javax.swing.JComponent
g
- the Graphics object used to paintpublic javax.swing.JLabel createSourceLabel()
public javax.swing.JLabel createTargetLabel()
public void setBackground(java.awt.Color color)
setBackground
in class javax.swing.JComponent
color
- the new color for the backgroundpublic 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 setTargetButtonsLocation(int location)
public boolean isGroupDirectionalButtonsTogether()
public void setGroupDirectionalButtonsTogether(boolean grouping)
setAlternatingSingleButtonStyle(boolean style)
is set to false and setAlternatingMultipleButtonStyle(boolean style)
is set to false.
grouping
- if set to true, will result in directional(source to target, target to source) buttons grouped together in containerprotected javax.swing.Icon getAlternatingButtonIcon(java.lang.String buttonConstant, boolean direction)
buttonConstant
- constant for specifying either the alternatingSingleButton or
the alternatingMultipleButton.Valid values are:
direction
- current direction the arrows should be pointing
java.lang.IllegalArgumentException
- if buttonConstant is not one of the values listed abovepublic void setAlternatingSingleButtonIcons(javax.swing.Icon rightIcon, javax.swing.Icon leftIcon)
rightIcon
- the Icon to be displayed when moving item from source to targetleftIcon
- the Icon to be displayed when moving item from target to sourcepublic void setAlternatingMultipleButtonIcons(javax.swing.Icon rightIcon, javax.swing.Icon leftIcon)
rightIcon
- the Icon to be displayed when moving item from source to targetleftIcon
- the Icon to be displayed when moving item from target to sourcepublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- the action event.
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |