public class SourceList extends Object
SourceList
are pictured below:
![]() |
![]() |
Focusable SourceList | Non-focusable SourceList |
SourceList
with one item:
SourceListModel model = new SourceListModel(); SourceListCategory category = new SourceListCategory("Category"); model.addCategory(category); model.addItemToCategory(new SourceListItem("Item"), category); SourceList sourceList = new SourceList(model);
To install a selection listener on the SourceList
, add a
SourceListSelectionListener
.
setSourceListContextMenuProvider(SourceListContextMenuProvider)
with an implementation
of SourceListContextMenuProvider
.Constructor and Description |
---|
SourceList()
Creates a
SourceList with an empty SourceListModel . |
SourceList(SourceListModel model)
Creates a
SourceList with the given SourceListModel . |
Modifier and Type | Method and Description |
---|---|
void |
addSourceListClickListener(SourceListClickListener listener)
Adds the
SourceListClickListener to the list of listeners. |
void |
addSourceListSelectionListener(SourceListSelectionListener listener)
Adds the
SourceListSelectionListener to the list of listeners. |
void |
clearSelection()
Clears the current selection, if there is one.
|
void |
dispose()
Uninstalls any listeners that this
SourceList installed on creation, thereby allowing
it to be garbage collected. |
SourceListColorScheme |
getColorScheme()
Gets the
SourceListColorScheme that this SourceList uses. |
JComponent |
getComponent()
Gets the user interface component representing this
SourceList . |
SourceListModel |
getModel()
Gets the
SourceListModel backing this SourceList . |
SourceListItem |
getSelectedItem()
Gets the selected
SourceListItem . |
void |
installSourceListControlBar(SourceListControlBar sourceListControlBar)
Installs the given
SourceListControlBar at the base of this SourceList . |
boolean |
isSourceListControlBarInstalled()
True if there is a
SourceListControlBar installed on this SourceList . |
void |
removeSourceListClickListener(SourceListClickListener listener)
Removes the
SourceListClickListener to the list of listeners. |
void |
removeSourceListSelectionListener(SourceListSelectionListener listener)
Removes the
SourceListSelectionListener from the list of listeners. |
void |
scrollItemToVisible(SourceListItem item)
Scrolls the given
SourceListItem to be visible. |
void |
setColorScheme(SourceListColorScheme colorScheme)
Sets the
SourceListColorScheme that this SourceList uses. |
void |
setExpanded(SourceListCategory category,
boolean expanded)
Sets the expanded state of the given
SourceListCategory . |
void |
setExpanded(SourceListItem item,
boolean expanded)
Sets the expanded state of the given
SourceListItem . |
void |
setFocusable(boolean focusable)
Sets whether this
SourceList can have focus. |
void |
setSelectedItem(SourceListItem item)
Selects the given
SourceListItem in the list. |
void |
setSourceListContextMenuProvider(SourceListContextMenuProvider contextMenuProvider)
Sets the
SourceListContextMenuProvider to use for this SourceList . |
void |
setToolTipProvider(SourceListToolTipProvider toolTipProvider)
Sets the
SourceListToolTipProvider to use. |
void |
setTransferHandler(TransferHandler transferHandler)
Set's the
TransferHandler that this SourceList should use
during drag and drop operations. |
void |
useIAppStyleScrollBars()
Installs iApp style scroll bars on this
SourceList . |
public SourceList()
SourceList
with an empty SourceListModel
.public SourceList(SourceListModel model)
SourceList
with the given SourceListModel
.model
- the SourceListModel
to use.public void installSourceListControlBar(SourceListControlBar sourceListControlBar)
SourceListControlBar
at the base of this SourceList
. This
method can be called only once, and should generally be called during creation of the
SourceList
.sourceListControlBar
- the SourceListControlBar
to add.IllegalStateException
- if a SourceListControlBar
has already been installed
on this SourceList
.IllegalArgumentException
- if the SourceListControlBar
is null.public boolean isSourceListControlBarInstalled()
SourceListControlBar
installed on this SourceList
.SourceListControlBar
installed on this SourceList
.public void setSourceListContextMenuProvider(SourceListContextMenuProvider contextMenuProvider)
SourceListContextMenuProvider
to use for this SourceList
.contextMenuProvider
- the SourceListContextMenuProvider
to use for this
SourceList
.IllegalArgumentException
- if the SourceListContextMenuProvider
is null.public void dispose()
SourceList
installed on creation, thereby allowing
it to be garbage collected.public SourceListItem getSelectedItem()
SourceListItem
.SourceListItem
.public void setSelectedItem(SourceListItem item)
SourceListItem
in the list.item
- the item to select.IllegalArgumentException
- if the given item is not in the list.public void clearSelection()
public void setFocusable(boolean focusable)
SourceList
can have focus. When focusable and this
SourceList
has focus, the keyboard can be used for navigation.focusable
- true if this SourceList
should be focusable.public void useIAppStyleScrollBars()
SourceList
.public SourceListColorScheme getColorScheme()
SourceListColorScheme
that this SourceList
uses.SourceListColorScheme
that this SourceList
uses.public void setColorScheme(SourceListColorScheme colorScheme)
SourceListColorScheme
that this SourceList
uses.colorScheme
- the SourceListColorScheme
that this SourceList
uses.public void setTransferHandler(TransferHandler transferHandler)
TransferHandler
that this SourceList
should use
during drag and drop operations. If the given handler not null, then
dragging will be turned on for the SourceList
. If the handler is
null, then dragging will be turned off.transferHandler
- the TransferHandler
for this
SourceList
. Can be null.public void scrollItemToVisible(SourceListItem item)
SourceListItem
to be visible.item
- the SourceListItem
to scroll to visible.public void setExpanded(SourceListCategory category, boolean expanded)
SourceListCategory
.category
- the category to set the expanded state on.expanded
- true if the given category should be expanded, false if it should be
collapsed.IllegalArgumentException
- if the given SourceListCategory
is not part of the
associated SourceListModel
.public void setExpanded(SourceListItem item, boolean expanded)
SourceListItem
.item
- the item to set the expanded state on.expanded
- true if the given item should be expanded, false if it should be
collapsed.IllegalArgumentException
- if the given SourceListItem
is not part of the
associated SourceListModel
.public JComponent getComponent()
SourceList
. The returned
JComponent
should be added to a container that will be displayed.SourceList
.public SourceListModel getModel()
SourceListModel
backing this SourceList
.SourceListModel
backing this SourceList
.public void setToolTipProvider(SourceListToolTipProvider toolTipProvider)
SourceListToolTipProvider
to use.toolTipProvider
- the {@code SourceListToolTipProvider to use.public void addSourceListClickListener(SourceListClickListener listener)
SourceListClickListener
to the list of listeners.listener
- the SourceListClickListener
to add.public void removeSourceListClickListener(SourceListClickListener listener)
SourceListClickListener
to the list of listeners.listener
- the SourceListClickListener
to remove.public void addSourceListSelectionListener(SourceListSelectionListener listener)
SourceListSelectionListener
to the list of listeners.listener
- the SourceListSelectionListener
to add.public void removeSourceListSelectionListener(SourceListSelectionListener listener)
SourceListSelectionListener
from the list of listeners.listener
- the SourceListSelectionListener
to remove.