Class JXList
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JList
-
- org.jdesktop.swingx.JXList
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
,javax.swing.Scrollable
public class JXList extends javax.swing.JList
JXList. Enabled Rollover/LinkModel handling. Enabled Highlighter support. Added experimental support for filtering/sorting. This feature is disabled by default because it has side-effects which might break "normal" expectations when using a JList: if enabled all row coordinates (including those returned by the selection) are in view coordinates. Furthermore, the model returned from getModel() is a wrapper around the actual data.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
JXList.DelegatingRenderer
A decorator for the original ListCellRenderer.protected static class
JXList.ListAdapter
A component adapter targeted at a JXList.-
Nested classes/interfaces inherited from class javax.swing.JList
javax.swing.JList.AccessibleJList, javax.swing.JList.DropLocation
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field 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.-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
-
Constructor Summary
Constructors Constructor Description JXList()
Constructs aJXList
with an empty model and filters disabled.JXList(boolean filterEnabled)
Constructs aJXList
with an empty model and filterEnabled property.JXList(java.lang.Object[] listData)
Constructs aJXList
that displays the elements in the specified array and filters disabled.JXList(java.lang.Object[] listData, boolean filterEnabled)
Constructs aJXList
that displays the elements in the specified array and filterEnabled property.JXList(java.util.Vector<?> listData)
Constructs aJXList
that displays the elements in the specifiedVector
and filtes disabled.JXList(java.util.Vector<?> listData, boolean filterEnabled)
Constructs aJXList
that displays the elements in the specifiedVector
and filtersEnabled property.JXList(javax.swing.ListModel dataModel)
Constructs aJXList
that displays the elements in the specified, non-null
model and filters disabled.JXList(javax.swing.ListModel dataModel, boolean filterEnabled)
Constructs aJXList
with the specified model and filterEnabled property.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addHighlighter(Highlighter highlighter)
Appends aHighlighter
to the end of the list of usedHighlighter
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 theChangeListener
to use with highlighters.Highlighter[]
getHighlighters()
Returns theHighlighter
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 theHighlighter
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 selectionMappervoid
setSortOrder(SortOrder sortOrder)
Sorts the list using SortOrder.void
toggleSortOrder()
Toggles the sort order of the items.protected void
updateHighlighterUI()
Updates highlighter afterupdateUI
changes.protected void
updateOnFilterContentChanged()
method called on change notification from filterpipeline.protected void
updateSortAfterComparatorChange()
Updates sort after comparator has changed.void
updateUI()
-
Methods inherited from class javax.swing.JList
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
-
Methods inherited from class javax.swing.JComponent
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, hide, 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
-
Methods inherited from class java.awt.Container
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
-
Methods inherited from class java.awt.Component
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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Field Detail
-
EXECUTE_BUTTON_ACTIONCOMMAND
public static final java.lang.String EXECUTE_BUTTON_ACTIONCOMMAND
- See Also:
- Constant Field Values
-
filters
protected FilterPipeline filters
The pipeline holding the filters.
-
compoundHighlighter
protected CompoundHighlighter compoundHighlighter
The pipeline holding the highlighters.
-
dataAdapter
protected ComponentAdapter dataAdapter
The ComponentAdapter for model data access.
-
-
Constructor Detail
-
JXList
public JXList()
Constructs aJXList
with an empty model and filters disabled.
-
JXList
public JXList(javax.swing.ListModel dataModel)
Constructs aJXList
that displays the elements in the specified, non-null
model and filters disabled.- Parameters:
dataModel
- the data model for this list- Throws:
java.lang.IllegalArgumentException
- ifdataModel
isnull
-
JXList
public JXList(java.lang.Object[] listData)
Constructs aJXList
that displays the elements in the specified array and filters disabled.- Parameters:
listData
- the array of Objects to be loaded into the data model- Throws:
java.lang.IllegalArgumentException
- iflistData
isnull
-
JXList
public JXList(java.util.Vector<?> listData)
Constructs aJXList
that displays the elements in the specifiedVector
and filtes disabled.- Parameters:
listData
- theVector
to be loaded into the data model- Throws:
java.lang.IllegalArgumentException
- iflistData
isnull
-
JXList
public JXList(boolean filterEnabled)
Constructs aJXList
with an empty model and filterEnabled property.- Parameters:
filterEnabled
-boolean
to determine if filtering/sorting is enabled
-
JXList
public JXList(javax.swing.ListModel dataModel, boolean filterEnabled)
Constructs aJXList
with the specified model and filterEnabled property.- Parameters:
dataModel
- the data model for this listfilterEnabled
-boolean
to determine if filtering/sorting is enabled- Throws:
java.lang.IllegalArgumentException
- ifdataModel
isnull
-
JXList
public JXList(java.lang.Object[] listData, boolean filterEnabled)
Constructs aJXList
that displays the elements in the specified array and filterEnabled property.- Parameters:
listData
- the array of Objects to be loaded into the data modelfilterEnabled
-boolean
to determine if filtering/sorting is enabled- Throws:
java.lang.IllegalArgumentException
- iflistData
isnull
-
JXList
public JXList(java.util.Vector<?> listData, boolean filterEnabled)
Constructs aJXList
that displays the elements in the specifiedVector
and filtersEnabled property.- Parameters:
listData
- theVector
to be loaded into the data modelfilterEnabled
-boolean
to determine if filtering/sorting is enabled- Throws:
java.lang.IllegalArgumentException
- iflistData
isnull
-
-
Method Detail
-
doFind
protected void doFind()
-
getSearchable
public Searchable getSearchable()
- Returns:
- a not-null Searchable for this editor.
-
setSearchable
public void setSearchable(Searchable searchable)
sets the Searchable for this editor. If null, a default searchable will be used.- Parameters:
searchable
-
-
setRolloverEnabled
public void setRolloverEnabled(boolean rolloverEnabled)
Property to enable/disable rollover support. This can be enabled to show "live" rollover behaviour, f.i. the cursor over LinkModel cells. Default is disabled.- Parameters:
rolloverEnabled
-
-
getLinkController
protected ListRolloverController<JXList> getLinkController()
-
createLinkController
protected ListRolloverController<JXList> createLinkController()
-
createRolloverProducer
protected RolloverProducer createRolloverProducer()
creates and returns the RolloverProducer to use with this tree.- Returns:
RolloverProducer
to use with this tree
-
isRolloverEnabled
public boolean isRolloverEnabled()
returns the rolloverEnabled property. TODO: why doesn't this just return rolloverEnabled???- Returns:
- true if rollover is enabled
-
resetSortOrder
public void resetSortOrder()
Removes the interactive sorter.
-
toggleSortOrder
public void toggleSortOrder()
Toggles the sort order of the items.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?
-
setSortOrder
public void setSortOrder(SortOrder sortOrder)
Sorts the list using SortOrder. Respects the JXList's sortable and comparator properties: routes the comparator to the SortController and does nothing if !isFilterEnabled().- Parameters:
sortOrder
- the sort order to use. If null or SortOrder.UNSORTED, this method has the same effect as resetSortOrder();
-
getSortOrder
public SortOrder getSortOrder()
Returns the SortOrder.- Returns:
- the interactive sorter's SortOrder or SortOrder.UNSORTED
-
getComparator
public java.util.Comparator getComparator()
- Returns:
- the comparator used.
- See Also:
setComparator(Comparator)
-
setComparator
public void setComparator(java.util.Comparator comparator)
Sets the comparator used. As a side-effect, the current sort might be updated. The exact behaviour is defined in #updateSortAfterComparatorChange.- Parameters:
comparator
- the comparator to use.
-
updateSortAfterComparatorChange
protected void updateSortAfterComparatorChange()
Updates sort after comparator has changed. Here: sets the current sortOrder with the new comparator.
-
getSortController
protected SortController getSortController()
returns the currently active SortController. Will be null if !isFilterEnabled().- Returns:
- the currently active
SortController
may be null
-
getElementAt
public java.lang.Object getElementAt(int viewIndex)
returns the element at the given index. The index is in view coordinates which might differ from model coordinates if filtering is enabled and filters/sorters are active.- Parameters:
viewIndex
- the index in view coordinates- Returns:
- the element at the index
- Throws:
java.lang.IndexOutOfBoundsException
- if viewIndex < 0 or viewIndex >= getElementCount()
-
getElementCount
public int getElementCount()
Returns the number of elements in this list in view coordinates. If filters are active this number might be less than the number of elements in the underlying model.- Returns:
- number of elements in this list in view coordinates
-
convertIndexToModel
public int convertIndexToModel(int viewIndex)
Convert row index from view coordinates to model coordinates accounting for the presence of sorters and filters.- Parameters:
viewIndex
- index in view coordinates- Returns:
- index in model coordinates
- Throws:
java.lang.IndexOutOfBoundsException
- if viewIndex < 0 or viewIndex >= getElementCount()
-
convertIndexToView
public int convertIndexToView(int modelIndex)
Convert index from model coordinates to view coordinates accounting for the presence of sorters and filters. PENDING Filter guards against out of range - should not?- Parameters:
modelIndex
- index in model coordinates- Returns:
- index in view coordinates if the model index maps to a view coordinate or -1 if not contained in the view.
-
getWrappedModel
public javax.swing.ListModel getWrappedModel()
returns the underlying model. If !isFilterEnabled this will be the same as getModel().- Returns:
- the underlying model
-
setFilterEnabled
public void setFilterEnabled(boolean enabled)
Enables/disables filtering support. If enabled all row indices - including the selection - are in view coordinates and getModel returns a wrapper around the underlying model. Note: as an implementation side-effect calling this method clears the selection (done in super.setModel). PENDING: cleanup state transitions!! - currently this can be safely applied once only to enable. Internal state is inconsistent if trying to disable again. As a temporary emergency measure, this will throw a IllegalStateException. see Issue #2-swinglabs.- Parameters:
enabled
-- Throws:
java.lang.IllegalStateException
- if trying to disable again.
-
isFilterEnabled
public boolean isFilterEnabled()
- Returns:
- a
indicating if filtering is enabled. - See Also:
setFilterEnabled(boolean)
-
setSelectionModel
public void setSelectionModel(javax.swing.ListSelectionModel newModel)
Overridden to update selectionMapper- Overrides:
setSelectionModel
in classjavax.swing.JList
-
setModel
public void setModel(javax.swing.ListModel model)
Sets the underlying data model. Note that if isFilterEnabled you must call getWrappedModel to access the model given here. In this case getModel returns a wrapper around the data!- Overrides:
setModel
in classjavax.swing.JList
- Parameters:
model
- the data model for this list.
-
getSelectionMapper
protected SelectionMapper getSelectionMapper()
widened access for testing...- Returns:
- the selection mapper
-
getFilters
public FilterPipeline getFilters()
- Returns:
- the
FilterPipeline
assigned to this list, or null if !isFiltersEnabled().
-
setFilters
public void setFilters(FilterPipeline pipeline)
Sets the FilterPipeline for filtering the items of this list, maybe null to remove all previously applied filters. Note: the current "interactive" sortState is preserved (by internally copying the old sortKeys to the new pipeline, if any). PRE: isFilterEnabled()- Parameters:
pipeline
- theFilterPipeline
to use, null removes all filters.- Throws:
java.lang.IllegalStateException
- if !isFilterEnabled()
-
getFilterPipelineListener
protected PipelineListener getFilterPipelineListener()
returns the listener for changes in filters.
-
createPipelineListener
protected PipelineListener createPipelineListener()
creates the listener for changes in filters.
-
updateOnFilterContentChanged
protected void updateOnFilterContentChanged()
method called on change notification from filterpipeline.
-
getComponentAdapter
protected ComponentAdapter getComponentAdapter()
- Returns:
- the unconfigured ComponentAdapter.
-
getComponentAdapter
protected ComponentAdapter getComponentAdapter(int index)
Convenience to access a configured ComponentAdapter. Note: the column index of the configured adapter is always 0.- Parameters:
index
- the row index in view coordinates, must be valid.- Returns:
- the configured ComponentAdapter.
-
setHighlighters
public void setHighlighters(Highlighter... highlighters)
Sets theHighlighter
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.
- Parameters:
highlighters
- zero or more not null highlighters to use for renderer decoration.- Throws:
java.lang.NullPointerException
- if array is null or array contains null values.- See Also:
getHighlighters()
,addHighlighter(Highlighter)
,removeHighlighter(Highlighter)
-
getHighlighters
public Highlighter[] getHighlighters()
Returns theHighlighter
s used by this table. Maybe empty, but guarantees to be never null.- Returns:
- the Highlighters used by this table, guaranteed to never null.
- See Also:
setHighlighters(Highlighter[])
-
addHighlighter
public void addHighlighter(Highlighter highlighter)
Appends aHighlighter
to the end of the list of usedHighlighter
s. The argument must not be null.- Parameters:
highlighter
- theHighlighter
to add, must not be null.- Throws:
java.lang.NullPointerException
- ifHighlighter
is null.- See Also:
removeHighlighter(Highlighter)
,setHighlighters(Highlighter[])
-
removeHighlighter
public void removeHighlighter(Highlighter highlighter)
Removes the given Highlighter.Does nothing if the Highlighter is not contained.
- Parameters:
highlighter
- the Highlighter to remove.- See Also:
addHighlighter(Highlighter)
,setHighlighters(Highlighter...)
-
getCompoundHighlighter
protected CompoundHighlighter getCompoundHighlighter()
Returns the CompoundHighlighter assigned to the table, null if none. PENDING: open up for subclasses again?.- Returns:
- the CompoundHighlighter assigned to the table.
- See Also:
#setCompoundHighlighter(CompoundHighlighter)
-
getHighlighterChangeListener
protected javax.swing.event.ChangeListener getHighlighterChangeListener()
Returns theChangeListener
to use with highlighters. Lazily creates the listener.- Returns:
- the ChangeListener for observing changes of highlighters,
guaranteed to be
not-null
-
createHighlighterChangeListener
protected javax.swing.event.ChangeListener createHighlighterChangeListener()
Creates and returns the ChangeListener observing Highlighters.Here: repaints the table on receiving a stateChanged.
- Returns:
- the ChangeListener defining the reaction to changes of highlighters.
-
getStringAt
public java.lang.String getStringAt(int row)
Returns the string representation of the cell value at the given position.- Parameters:
row
- the row index of the cell in view coordinates- Returns:
- the string representation of the cell value as it will appear in the table.
-
createDefaultCellRenderer
protected javax.swing.ListCellRenderer createDefaultCellRenderer()
Creates and returns the default cell renderer to use. Subclasses may override to use a different type. Here: returns aDefaultListRenderer
.- Returns:
- the default cell renderer to use with this list.
-
getCellRenderer
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
- Overrides:
getCellRenderer
in classjavax.swing.JList
- See Also:
setCellRenderer(ListCellRenderer)
,JXList.DelegatingRenderer
-
getWrappedCellRenderer
public javax.swing.ListCellRenderer getWrappedCellRenderer()
Returns the renderer installed by client code or the default if none has been set.- Returns:
- the wrapped renderer.
- See Also:
setCellRenderer(ListCellRenderer)
-
setCellRenderer
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
.- Overrides:
setCellRenderer
in classjavax.swing.JList
- See Also:
getWrappedCellRenderer()
,getCellRenderer()
-
updateUI
public void updateUI()
- Overrides:
updateUI
in classjavax.swing.JList
-
updateHighlighterUI
protected void updateHighlighterUI()
Updates highlighter afterupdateUI
changes.- See Also:
UIDependent
-
-