|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.springframework.richclient.components.ShuttleList
public class ShuttleList
Custom panel that presents a "shuttle" list pair. One list is the "source" and the second list holds the "chosen" values from the source list. Buttons between the lists are used to move entries back and forth. By default, only the chosen list is displayed along with an Edit button. Pressing the edit button exposes the source list and the movement buttons.
This component essentially provides an alternate UI for a JList. It uses the same type of model and selection list. The selection is rendered as two lists instead of one list with highlighted entries. Those elements in the model that are not selected are shown in the source list and those that are selected are shown in the chosen list.
Normal selection model listeners are used to report changes to interested objects.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
ShuttleList()
Simple constructor. |
|
ShuttleList(boolean showEditButton)
|
Method Summary | |
---|---|
void |
addListSelectionListener(ListSelectionListener listener)
Adds a listener to the list that's notified each time a change to the selection occurs. |
protected JPanel |
buildButtonPanel()
Construct the control button panel. |
protected JComponent |
buildComponent()
Build our component panel. |
void |
clearSelection()
Clear the selection. |
ListCellRenderer |
getCellRenderer()
Returns the object that renders the list items. |
ListModel |
getModel()
Returns the data model. |
Object[] |
getSelectedValues()
Returns an array of the values for the selected cells. |
ListSelectionModel |
getSelectionModel()
Returns the value of the current selection model. |
protected int |
indexOf(Object o)
Get the index of a given object in the underlying data model. |
protected void |
moveAllLeftToRight()
Move all the source items to the chosen side. |
protected void |
moveAllRightToLeft()
Move all the chosen items back to the source side. |
protected void |
moveLeftToRight()
Move the selected items in the source list to the chosen list. |
protected void |
moveRightToLeft()
Move the selected items in the chosen list to the source list. |
void |
removeListSelectionListener(ListSelectionListener listener)
Removes a listener from the list that's notified each time a change to the selection occurs. |
void |
setCellRenderer(ListCellRenderer cellRenderer)
Sets the delegate that's used to paint each cell in the list. |
void |
setComparator(Comparator comparator)
Set the comparator to use for comparing list elements. |
void |
setEditIcon(Icon editIcon,
String text)
Set the icon to use on the edit button. |
void |
setEnabled(boolean enabled)
|
void |
setListLabels(String chosenLabel,
String sourceLabel)
Add labels on top of the 2 lists. |
void |
setModel(ListModel model)
Sets the model that represents the contents or "value" of the list and clears the list selection. |
void |
setSelectedIndices(int[] indices)
Selects a set of cells. |
void |
setVisibleRowCount(int visibleRowCount)
Sets the preferred number of rows in the list that can be displayed without a scrollbar. |
void |
togglePanels()
Toggle the panel visibility. |
protected void |
update()
Update the two lists based on the current selection indices. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ShuttleList()
public ShuttleList(boolean showEditButton)
Method Detail |
---|
public ListCellRenderer getCellRenderer()
ListCellRenderer
setCellRenderer(javax.swing.ListCellRenderer)
public void setCellRenderer(ListCellRenderer cellRenderer)
The default value of this property is provided by the ListUI delegate, i.e. by the look and feel implementation.
cellRenderer
- the ListCellRenderer
that paints list
cellsgetCellRenderer()
public ListModel getModel()
ListModel
that provides the displayed list of
itemspublic void setModel(ListModel model)
model
- the ListModel
that provides the list of items
for display
IllegalArgumentException
- if model
is
null
public void setVisibleRowCount(int visibleRowCount)
visibleRowCount
- an integer specifying the preferred number of
visible rowspublic void setComparator(Comparator comparator)
comparator
- to usepublic void setEditIcon(Icon editIcon, String text)
editIcon
- Icon to use on edit buttonpublic void setListLabels(String chosenLabel, String sourceLabel)
chosenLabel
- sourceLabel
- protected JComponent buildComponent()
protected JPanel buildButtonPanel()
public void togglePanels()
protected void moveLeftToRight()
protected void moveAllLeftToRight()
protected void moveRightToLeft()
protected void moveAllRightToLeft()
protected int indexOf(Object o)
o
- Object to locate
protected void update()
public ListSelectionModel getSelectionModel()
ListSelectionModel
that implements list
selectionspublic void addListSelectionListener(ListSelectionListener listener)
listener
- the ListSelectionListener
to addpublic void removeListSelectionListener(ListSelectionListener listener)
listener
- the ListSelectionListener
to removepublic void clearSelection()
public void setSelectedIndices(int[] indices)
indices
- an array of the indices of the cells to selectpublic Object[] getSelectedValues()
public void setEnabled(boolean enabled)
setEnabled
in class JComponent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |