|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.visuals.DualSelector
public class DualSelector
DualSelector is a class used for manipulating items between two lists. Items
are initially in one (or two) ListBoxes and are moved within or tranferred
between each of the Listboxes. When items are moved between Listboxes, 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 Listbox.
Creation:
DualSelector dualSelector1 = new DualSelector();
dualSelector1.initialize();
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 com.sas.collection.OrderedCollectionInterface. If both do not
support this interface 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 ContentsChangedEvent, its respective
list is updated with the new contents.
StaticOrderedCollectionInterface
,
OrderedCollectionInterface
,
TransformInterface
,
Serialized FormField Summary | |
---|---|
protected PushButton |
allLeftButton
PushButton used to transfer all items from list two to list one. |
protected PushButton |
allRightButton
PushButton used to transfer all items from list one to list two. |
protected PushButton |
alternatingButton
PushButton used to transfer one or more items between lists. |
protected PushButton |
down1Button
PushButton used to move items down in list one when reordering. |
protected PushButton |
down2Button
PushButton used to move items down in list two when reordering. |
protected Label |
label1
Label for the first list. |
protected Label |
label2
Label for the second list. |
protected ListBox |
listBox1
ListBox for the first list. |
protected ListBox |
listBox2
ListBox for the second list. |
protected PushButton |
up1Button
PushButton used to move items up in list one when reordering. |
protected PushButton |
up2Button
PushButton 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. |
void |
attachModel(com.sas.ModelInterface mi)
Attaches a model supporting the required interface to a DualSelector. |
java.awt.Dimension |
computePreferredSize()
Computes the preferred size. |
void |
contentsChanged(com.sas.collection.ContentsChangedEvent event)
Event handler for the ContentsChangedEvents received from the models. |
void |
detachModel(com.sas.ModelInterface mi)
Detaches an attached model. |
int |
dragOver(java.awt.Point point,
int representation,
int keyState,
java.util.Vector data)
Override the dragOver method of com.sas.awt.Panel. |
static int |
getDefaultHeight()
Returns the default height in pixels |
static int |
getDefaultWidth()
Returns the default width in pixels |
com.sas.util.transforms.TransformInterface |
getDisplayTransform()
Returns the display transform. |
static com.sas.beans.ExtendedBeanInfo |
getExtendedBeanInfo()
Returns information used by the com.sas.beans.Introspector to augment the automatically introspected information about a DualSelector. |
int |
getList1Count()
Returns the number of items in list 1. |
com.sas.util.transforms.TransformInterface |
getList1DisplayTransform()
Returns the display transform for 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. |
int |
getList2Count()
Returns the number of items in list 2. |
com.sas.util.transforms.TransformInterface |
getList2DisplayTransform()
Returns the display transform for 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. |
com.sas.ModelInterface |
getList2ModelInterface()
Returns the ModelInterface for list 2. |
java.awt.Dimension |
getMinimumSize()
Returns the minimum size. |
java.util.Vector |
getRequiredInterfaces()
Returns the required interfaces Vector for this component. |
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 |
itemStateChanged(java.awt.event.ItemEvent ie)
Event handler for the ItemEvent's received. |
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(com.sas.collection.OrderedCollectionInterface list,
boolean moveItemUp)
Moves the selected item or items in list either up or down one position. |
void |
refresh()
Signals the DualSelector selector to refresh its data from its models. |
void |
refresh(com.sas.ModelInterface mi)
Signals the DualSelector selector to refresh its data from the specified model. |
void |
setBackground(java.awt.Color color)
Overrides setBackground in java.awt.Component. |
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 |
setDisplayTransform(com.sas.util.transforms.TransformInterface newValue)
Sets the display transform. |
void |
setDynamic(boolean newValue)
Sets the value of the dynamic property. |
void |
setFont(java.awt.Font font)
Overrides super.setFont. |
void |
setForeground(java.awt.Color color)
Overrides setForeground in java.awt.Component. |
void |
setList1ControlsVisible(boolean newValue)
Sets the value of the list1ControlsVisible property. |
void |
setList1DisplayTransform(com.sas.util.transforms.TransformInterface newValue)
Sets the display transform for list 1. |
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 |
setList2ControlsVisible(boolean newValue)
Sets the value of the list2ControlsVisible property. |
void |
setList2DisplayTransform(com.sas.util.transforms.TransformInterface newValue)
Sets the display transform for list 2. |
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 |
setList2ModelInterface(com.sas.ModelInterface mi)
Sets the ModelInterface for list 2. |
void |
setModelEventsIgnored(boolean newValue)
Sets the value of the modelEventsIgnored property. |
void |
setModelInterface(com.sas.ModelInterface mi)
Sets the models interface for list 1. |
void |
setTransferAllControlsVisible(boolean newValue)
Sets the value of the transferAllControlsVisible property. |
protected void |
transferAllItems(com.sas.collection.OrderedCollectionInterface fromList,
com.sas.collection.OrderedCollectionInterface 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(com.sas.collection.OrderedCollectionInterface fromList,
com.sas.collection.OrderedCollectionInterface toList)
Transfer all selected items from fromList to toList. |
Methods inherited from class com.sas.awt.Panel |
---|
remove, remove, removeAll |
Methods inherited from interface com.sas.awt.ContainerInterface |
---|
getComponents, getLayout, invalidate, setLayout, validate |
Field Detail |
---|
protected Label label1
protected Label label2
protected ListBox listBox1
protected ListBox listBox2
protected PushButton alternatingButton
protected PushButton allRightButton
protected PushButton allLeftButton
protected PushButton down1Button
protected PushButton down2Button
protected PushButton up1Button
protected PushButton 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 com.sas.util.transforms.TransformInterface getDisplayTransform()
setDisplayTransform(com.sas.util.transforms.TransformInterface)
public void setDisplayTransform(com.sas.util.transforms.TransformInterface newValue)
newValue
- the new value for the display transform propertygetDisplayTransform()
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 com.sas.util.transforms.TransformInterface getList1DisplayTransform()
setList1DisplayTransform(com.sas.util.transforms.TransformInterface)
public void setList1DisplayTransform(com.sas.util.transforms.TransformInterface newValue)
newValue
- the new value for the list 1 display transformgetList1DisplayTransform()
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 com.sas.util.transforms.TransformInterface getList2DisplayTransform()
setList2DisplayTransform(com.sas.util.transforms.TransformInterface)
public void setList2DisplayTransform(com.sas.util.transforms.TransformInterface newValue)
newValue
- the new value for the list 2 display transformgetList1DisplayTransform()
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 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()
protected void moveListItem(com.sas.collection.OrderedCollectionInterface list, boolean moveItemUp)
list
- the list of which to move the item or itemsmoveItemUp
- true to move the item(s) up, false to move the item(s) downmoveList1ItemUp()
,
moveList1ItemDown()
,
moveList2ItemUp()
,
moveList2ItemDown()
public void moveList1ItemUp()
moveListItem(com.sas.collection.OrderedCollectionInterface, boolean)
public void moveList1ItemDown()
moveListItem(com.sas.collection.OrderedCollectionInterface, boolean)
public void moveList2ItemUp()
moveListItem(com.sas.collection.OrderedCollectionInterface, boolean)
public void moveList2ItemDown()
moveListItem(com.sas.collection.OrderedCollectionInterface, boolean)
protected void transferAllItems(com.sas.collection.OrderedCollectionInterface fromList, com.sas.collection.OrderedCollectionInterface toList)
fromList
- the list to move all items fromtoList
- the list to move all items totransferAllList1Items()
,
transferAllList2Items()
public void transferAllList1Items()
transferAllItems(com.sas.collection.OrderedCollectionInterface, com.sas.collection.OrderedCollectionInterface)
protected void transferListItems(com.sas.collection.OrderedCollectionInterface fromList, com.sas.collection.OrderedCollectionInterface 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(com.sas.collection.OrderedCollectionInterface, com.sas.collection.OrderedCollectionInterface)
public void transferAllList2Items()
transferAllItems(com.sas.collection.OrderedCollectionInterface, com.sas.collection.OrderedCollectionInterface)
public void transferList2Items()
public void attachModel(com.sas.ModelInterface mi)
The current required interfaces are
com.sas.collection.StaticOrderedCollectionInterface
or
com.sas.collection.OrderedCollectionInterface
attachModel
in interface com.sas.ViewInterface
attachModel
in class PanelVisualComponent
mi
- the object to set as the model.detachModel(com.sas.ModelInterface)
public java.awt.Dimension computePreferredSize()
computePreferredSize
in interface VisualInterface
computePreferredSize
in class PanelVisualComponent
getDefaultWidth()
,
getDefaultHeight()
public void detachModel(com.sas.ModelInterface mi)
detachModel
in interface com.sas.ViewInterface
detachModel
in class PanelVisualComponent
model
- the object to detach as the model.attachModel(com.sas.ModelInterface)
public int dragOver(java.awt.Point point, int representation, int keyState, java.util.Vector data)
dragOver
in interface ContainerInterface
dragOver
in interface com.sas.DesignTimeDropTargetInterface
dragOver
in class PanelContainerComponent
point
- The x/y coordinates of the mouse cursor inside the component.representation
- One of com.sas.DesignTimeDropResult.{representationComponent,representationModel,representationAttribute,representationViewer}keyState
- Unused.data
- A Vector containing information about the drag.
DesignTimeDropTargetInterface.dragOver(java.awt.Point, int, int, java.util.Vector)
public java.awt.Dimension getMinimumSize()
getMinimumSize
in interface VisualInterface
getMinimumSize
in class PanelVisualComponent
VisualInterface.getMinimumSize()
public java.util.Vector getRequiredInterfaces()
getRequiredInterfaces
in interface com.sas.ViewInterface
getRequiredInterfaces
in class PanelVisualComponent
ViewInterface.getRequiredInterfaces()
public void refresh()
public void refresh(com.sas.ModelInterface mi)
refresh
in interface com.sas.ViewInterface
refresh
in class PanelVisualComponent
mi
- the current model refresh to refresh fromViewInterface.refresh(com.sas.ModelInterface)
public void setBackground(java.awt.Color color)
setBackground
in class java.awt.Component
color
- the new color for the backgroundpublic void setDefaultValues()
setDefaultValues
in interface ContainerInterface
setDefaultValues
in interface VisualInterface
setDefaultValues
in interface com.sas.ComponentInterface
setDefaultValues
in class CompositePanel
ContainerInterface.setDefaultValues()
public void setFont(java.awt.Font font)
setFont
in interface VisualInterface
setFont
in class PanelVisualComponent
font
- the new fontVisualInterface.setFont(java.awt.Font)
public void setForeground(java.awt.Color color)
setForeground
in class java.awt.Component
color
- the new color for the foregroundpublic void setModelInterface(com.sas.ModelInterface mi)
setModelInterface
in interface com.sas.ViewInterface
setModelInterface
in class PanelVisualComponent
mi
- the model interface to set on list 1setList2ModelInterface(com.sas.ModelInterface)
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- the action event.public void contentsChanged(com.sas.collection.ContentsChangedEvent event)
contentsChanged
in interface com.sas.collection.ContentsChangedListener
event
- the event to handlepublic void itemStateChanged(java.awt.event.ItemEvent ie)
itemStateChanged
in interface java.awt.event.ItemListener
ie
- the event to handlepublic com.sas.ModelInterface getList2ModelInterface()
setList2ModelInterface(com.sas.ModelInterface)
public void setList2ModelInterface(com.sas.ModelInterface mi)
mi
- the ModelInterface to set for list 2setModelInterface(com.sas.ModelInterface)
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |