public class JXList
extends javax.swing.JList
Modifier and Type | Class and Description |
---|---|
class |
JXList.DelegatingRenderer
A decorator for the original ListCellRenderer.
|
protected static class |
JXList.ListAdapter
A component adapter targeted at a JXList.
|
javax.swing.JList.AccessibleJList, javax.swing.JList.DropLocation
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
protected CompoundHighlighter |
compoundHighlighter
The pipeline holding the highlighters.
|
protected ComponentAdapter |
dataAdapter
The ComponentAdapter for model data access.
|
static java.lang.String |
EXECUTE_BUTTON_ACTIONCOMMAND |
protected FilterPipeline |
filters
The pipeline holding the filters.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
JXList()
Constructs a
JXList with an empty model and filters disabled. |
JXList(boolean filterEnabled)
Constructs a
JXList with an empty model and
filterEnabled property. |
JXList(javax.swing.ListModel dataModel)
Constructs a
JXList that displays the elements in the
specified, non-null model and filters disabled. |
JXList(javax.swing.ListModel dataModel,
boolean filterEnabled)
Constructs a
JXList with the specified model and
filterEnabled property. |
JXList(java.lang.Object[] listData)
Constructs a
JXList that displays the elements in
the specified array and filters disabled. |
JXList(java.lang.Object[] listData,
boolean filterEnabled)
Constructs a
JXList that displays the elements in
the specified array and filterEnabled property. |
JXList(java.util.Vector<?> listData)
Constructs a
JXList that displays the elements in
the specified Vector and filtes disabled. |
JXList(java.util.Vector<?> listData,
boolean filterEnabled)
Constructs a
JXList that displays the elements in
the specified Vector and filtersEnabled property. |
Modifier and Type | Method and Description |
---|---|
void |
addHighlighter(Highlighter highlighter)
Appends a
Highlighter to the end of the list of used
Highlighter s. |
int |
convertIndexToModel(int viewIndex)
Convert row index from view coordinates to model coordinates accounting
for the presence of sorters and filters.
|
int |
convertIndexToView(int modelIndex)
Convert index from model coordinates to view coordinates accounting
for the presence of sorters and filters.
|
protected javax.swing.ListCellRenderer |
createDefaultCellRenderer()
Creates and returns the default cell renderer to use.
|
protected javax.swing.event.ChangeListener |
createHighlighterChangeListener()
Creates and returns the ChangeListener observing Highlighters.
|
protected ListRolloverController<JXList> |
createLinkController() |
protected PipelineListener |
createPipelineListener()
creates the listener for changes in filters.
|
protected RolloverProducer |
createRolloverProducer()
creates and returns the RolloverProducer to use with this tree.
|
protected void |
doFind() |
javax.swing.ListCellRenderer |
getCellRenderer() |
java.util.Comparator |
getComparator() |
protected ComponentAdapter |
getComponentAdapter() |
protected ComponentAdapter |
getComponentAdapter(int index)
Convenience to access a configured ComponentAdapter.
|
protected CompoundHighlighter |
getCompoundHighlighter()
Returns the CompoundHighlighter assigned to the table, null if none.
|
java.lang.Object |
getElementAt(int viewIndex)
returns the element at the given index.
|
int |
getElementCount()
Returns the number of elements in this list in view
coordinates.
|
protected PipelineListener |
getFilterPipelineListener()
returns the listener for changes in filters.
|
FilterPipeline |
getFilters() |
protected javax.swing.event.ChangeListener |
getHighlighterChangeListener()
Returns the
ChangeListener to use with highlighters. |
Highlighter[] |
getHighlighters()
Returns the
Highlighter s used by this table. |
protected ListRolloverController<JXList> |
getLinkController() |
Searchable |
getSearchable() |
protected SelectionMapper |
getSelectionMapper()
widened access for testing...
|
protected SortController |
getSortController()
returns the currently active SortController.
|
SortOrder |
getSortOrder()
Returns the SortOrder.
|
java.lang.String |
getStringAt(int row)
Returns the string representation of the cell value at the given position.
|
javax.swing.ListCellRenderer |
getWrappedCellRenderer()
Returns the renderer installed by client code or the default if none has
been set.
|
javax.swing.ListModel |
getWrappedModel()
returns the underlying model.
|
boolean |
isFilterEnabled() |
boolean |
isRolloverEnabled()
returns the rolloverEnabled property.
|
void |
removeHighlighter(Highlighter highlighter)
Removes the given Highlighter.
|
void |
resetSortOrder()
Removes the interactive sorter.
|
void |
setCellRenderer(javax.swing.ListCellRenderer renderer) |
void |
setComparator(java.util.Comparator comparator)
Sets the comparator used.
|
void |
setFilterEnabled(boolean enabled)
Enables/disables filtering support.
|
void |
setFilters(FilterPipeline pipeline)
Sets the FilterPipeline for filtering the items of this list, maybe null
to remove all previously applied filters.
|
void |
setHighlighters(Highlighter... highlighters)
Sets the
Highlighter s to the table, replacing any old settings. |
void |
setModel(javax.swing.ListModel model)
Sets the underlying data model.
|
void |
setRolloverEnabled(boolean rolloverEnabled)
Property to enable/disable rollover support.
|
void |
setSearchable(Searchable searchable)
sets the Searchable for this editor.
|
void |
setSelectionModel(javax.swing.ListSelectionModel newModel)
Overridden to update selectionMapper
|
void |
setSortOrder(SortOrder sortOrder)
Sorts the list using SortOrder.
|
void |
toggleSortOrder()
Toggles the sort order of the items.
|
protected void |
updateHighlighterUI()
Updates highlighter after
updateUI changes. |
protected void |
updateOnFilterContentChanged()
method called on change notification from filterpipeline.
|
protected void |
updateSortAfterComparatorChange()
Updates sort after comparator has changed.
|
void |
updateUI() |
addListSelectionListener, addSelectionInterval, clearSelection, createSelectionModel, ensureIndexIsVisible, fireSelectionValueChanged, getAccessibleContext, getAnchorSelectionIndex, getCellBounds, getDragEnabled, getDropLocation, getDropMode, getFirstVisibleIndex, getFixedCellHeight, getFixedCellWidth, getLastVisibleIndex, getLayoutOrientation, getLeadSelectionIndex, getListSelectionListeners, getMaxSelectionIndex, getMinSelectionIndex, getModel, getNextMatch, getPreferredScrollableViewportSize, getPrototypeCellValue, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedIndex, getSelectedIndices, getSelectedValue, getSelectedValues, getSelectedValuesList, getSelectionBackground, getSelectionForeground, getSelectionMode, getSelectionModel, getToolTipText, getUI, getUIClassID, getValueIsAdjusting, getVisibleRowCount, indexToLocation, isSelectedIndex, isSelectionEmpty, locationToIndex, paramString, removeListSelectionListener, removeSelectionInterval, setDragEnabled, setDropMode, setFixedCellHeight, setFixedCellWidth, setLayoutOrientation, setListData, setListData, setPrototypeCellValue, setSelectedIndex, setSelectedIndices, setSelectedValue, setSelectionBackground, setSelectionForeground, setSelectionInterval, setSelectionMode, setUI, setValueIsAdjusting, setVisibleRowCount
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final java.lang.String EXECUTE_BUTTON_ACTIONCOMMAND
protected FilterPipeline filters
protected CompoundHighlighter compoundHighlighter
protected ComponentAdapter dataAdapter
public JXList()
JXList
with an empty model and filters disabled.public JXList(javax.swing.ListModel dataModel)
JXList
that displays the elements in the
specified, non-null
model and filters disabled.dataModel
- the data model for this listjava.lang.IllegalArgumentException
- if dataModel
is null
public JXList(java.lang.Object[] listData)
JXList
that displays the elements in
the specified array and filters disabled.listData
- the array of Objects to be loaded into the data modeljava.lang.IllegalArgumentException
- if listData
is null
public JXList(java.util.Vector<?> listData)
JXList
that displays the elements in
the specified Vector
and filtes disabled.listData
- the Vector
to be loaded into the
data modeljava.lang.IllegalArgumentException
- if listData
is null
public JXList(boolean filterEnabled)
JXList
with an empty model and
filterEnabled property.filterEnabled
- boolean
to determine if
filtering/sorting is enabledpublic JXList(javax.swing.ListModel dataModel, boolean filterEnabled)
JXList
with the specified model and
filterEnabled property.dataModel
- the data model for this listfilterEnabled
- boolean
to determine if
filtering/sorting is enabledjava.lang.IllegalArgumentException
- if dataModel
is null
public JXList(java.lang.Object[] listData, boolean filterEnabled)
JXList
that displays the elements in
the specified array and filterEnabled property.listData
- the array of Objects to be loaded into the data modelfilterEnabled
- boolean
to determine if filtering/sorting
is enabledjava.lang.IllegalArgumentException
- if listData
is null
public JXList(java.util.Vector<?> listData, boolean filterEnabled)
JXList
that displays the elements in
the specified Vector
and filtersEnabled property.listData
- the Vector
to be loaded into the
data modelfilterEnabled
- boolean
to determine if filtering/sorting
is enabledjava.lang.IllegalArgumentException
- if listData
is null
protected void doFind()
public Searchable getSearchable()
public void setSearchable(Searchable searchable)
searchable
- public void setRolloverEnabled(boolean rolloverEnabled)
rolloverEnabled
- protected ListRolloverController<JXList> getLinkController()
protected ListRolloverController<JXList> createLinkController()
protected RolloverProducer createRolloverProducer()
RolloverProducer
to use with this treepublic boolean isRolloverEnabled()
public void resetSortOrder()
public void toggleSortOrder()
The exact behaviour is defined by the SortController's toggleSortOrder implementation. Typically a unsorted column is sorted in ascending order, a sorted column's order is reversed.
PENDING: where to get the comparator from?
public void setSortOrder(SortOrder sortOrder)
sortOrder
- the sort order to use. If null or SortOrder.UNSORTED,
this method has the same effect as resetSortOrder();public SortOrder getSortOrder()
public java.util.Comparator getComparator()
setComparator(Comparator)
public void setComparator(java.util.Comparator comparator)
comparator
- the comparator to use.protected void updateSortAfterComparatorChange()
protected SortController getSortController()
SortController
may be nullpublic java.lang.Object getElementAt(int viewIndex)
viewIndex
- the index in view coordinatesjava.lang.IndexOutOfBoundsException
- if viewIndex < 0 or viewIndex >=
getElementCount()public int getElementCount()
public int convertIndexToModel(int viewIndex)
viewIndex
- index in view coordinatesjava.lang.IndexOutOfBoundsException
- if viewIndex < 0 or viewIndex >= getElementCount()public int convertIndexToView(int modelIndex)
modelIndex
- index in model coordinatespublic javax.swing.ListModel getWrappedModel()
public void setFilterEnabled(boolean enabled)
enabled
- java.lang.IllegalStateException
- if trying to disable again.public boolean isFilterEnabled()
setFilterEnabled(boolean)
public void setSelectionModel(javax.swing.ListSelectionModel newModel)
setSelectionModel
in class javax.swing.JList
public void setModel(javax.swing.ListModel model)
setModel
in class javax.swing.JList
model
- the data model for this list.protected SelectionMapper getSelectionMapper()
public FilterPipeline getFilters()
FilterPipeline
assigned to this list, or
null if !isFiltersEnabled().public void setFilters(FilterPipeline pipeline)
pipeline
- the FilterPipeline
to use, null removes
all filters.java.lang.IllegalStateException
- if !isFilterEnabled()protected PipelineListener getFilterPipelineListener()
protected PipelineListener createPipelineListener()
protected void updateOnFilterContentChanged()
protected ComponentAdapter getComponentAdapter()
protected ComponentAdapter getComponentAdapter(int index)
index
- the row index in view coordinates, must be valid.public void setHighlighters(Highlighter... highlighters)
Highlighter
s to the table, replacing any old settings.
None of the given Highlighters must be null.This is a bound property.
Note: as of version #1.257 the null constraint is enforced strictly. To remove all highlighters use this method without param.
highlighters
- zero or more not null highlighters to use for renderer decoration.java.lang.NullPointerException
- if array is null or array contains null values.getHighlighters()
,
addHighlighter(Highlighter)
,
removeHighlighter(Highlighter)
public Highlighter[] getHighlighters()
Highlighter
s used by this table.
Maybe empty, but guarantees to be never null.setHighlighters(Highlighter[])
public void addHighlighter(Highlighter highlighter)
Highlighter
to the end of the list of used
Highlighter
s. The argument must not be null.
highlighter
- the Highlighter
to add, must not be null.java.lang.NullPointerException
- if Highlighter
is null.removeHighlighter(Highlighter)
,
setHighlighters(Highlighter[])
public void removeHighlighter(Highlighter highlighter)
Does nothing if the Highlighter is not contained.
highlighter
- the Highlighter to remove.addHighlighter(Highlighter)
,
setHighlighters(Highlighter...)
protected CompoundHighlighter getCompoundHighlighter()
#setCompoundHighlighter(CompoundHighlighter)
protected javax.swing.event.ChangeListener getHighlighterChangeListener()
ChangeListener
to use with highlighters. Lazily
creates the listener.not-null
protected javax.swing.event.ChangeListener createHighlighterChangeListener()
Here: repaints the table on receiving a stateChanged.
public java.lang.String getStringAt(int row)
row
- the row index of the cell in view coordinatesprotected javax.swing.ListCellRenderer createDefaultCellRenderer()
DefaultListRenderer
.public javax.swing.ListCellRenderer getCellRenderer()
Overridden to return the delegating renderer which is wrapped around the original to support highlighting. The returned renderer is of type DelegatingRenderer and guaranteed to not-null
getCellRenderer
in class javax.swing.JList
setCellRenderer(ListCellRenderer)
,
JXList.DelegatingRenderer
public javax.swing.ListCellRenderer getWrappedCellRenderer()
setCellRenderer(ListCellRenderer)
public void setCellRenderer(javax.swing.ListCellRenderer renderer)
Overridden to wrap the given renderer in a DelegatingRenderer to support highlighting.
Note: the wrapping implies that the renderer returned from the getCellRenderer
is not the renderer as given here, but the wrapper. To access the original,
use getWrappedCellRenderer
.
setCellRenderer
in class javax.swing.JList
getWrappedCellRenderer()
,
getCellRenderer()
public void updateUI()
updateUI
in class javax.swing.JList
protected void updateHighlighterUI()
updateUI
changes.UIDependent