Class GlazedListsRowHideShowLayer<T>
java.lang.Object
org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
org.eclipse.nebula.widgets.nattable.extension.glazedlists.hideshow.GlazedListsRowHideShowLayer<T>
- All Implemented Interfaces:
IRowHideShowLayer
,ILayer
,ILayerListener
,IUniqueIndexLayer
,IPersistable
public class GlazedListsRowHideShowLayer<T>
extends AbstractLayerTransform
implements IRowHideShowLayer, IUniqueIndexLayer
Adds the functionality for manually hiding rows in a NatTable that is based
on GlazedLists. Technically it will filter items by id in the
FilterList
.
Note: If you want to add row hide/show AND filtering to your NatTable, you
need to use the DefaultGlazedListsStaticFilterStrategy and add the
Matcher
that is used by this command as a static
MatcherEditor
. Otherwise these two functions will not work correctly
together.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
Key for persisting the number of hidden row id's.Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
underlyingLayer
Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
commandHandlers, eventHandlers, eventHelperLock, layerPainter
Fields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR
-
Constructor Summary
ConstructorDescriptionGlazedListsRowHideShowLayer
(ILayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor) Creates aGlazedListsRowHideShowLayer
for adding row hide/show for GlazedLists based NatTables.GlazedListsRowHideShowLayer
(ILayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor, ca.odell.glazedlists.FilterList<T> filterList) Creates aGlazedListsRowHideShowLayer
for adding row hide/show for GlazedLists based NatTables.GlazedListsRowHideShowLayer
(ILayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor, ca.odell.glazedlists.matchers.CompositeMatcherEditor<T> matcherEditor) Creates aGlazedListsRowHideShowLayer
for adding row hide/show for GlazedLists based NatTables. -
Method Summary
Modifier and TypeMethodDescriptionint
getColumnPositionByIndex
(int columnIndex) ca.odell.glazedlists.matchers.MatcherEditor<T>
ca.odell.glazedlists.matchers.MatcherEditor<T>
int
getRowPositionByIndex
(int rowIndex) void
hideRowIndexes
(int... rowIndexes) Hide the rows with the given indexes.void
hideRowIndexes
(Collection<Integer> rowIndexes) Hide the rows at the given indexes.void
hideRowPositions
(int... rowPositions) Hide the rows at the given positions.void
hideRowPositions
(Collection<Integer> rowPositions) Hide the rows at the given positions.void
hideRows
(Collection<Serializable> rowIds) Hide the rows that contain the objects with the given row ids.void
loadState
(String prefix, Properties properties) Underlying layers must load state first.protected void
Register theILayerCommandHandler
that will handle the row hide/show events for this layer.void
saveState
(String prefix, Properties properties) Saves the state to the given Properties using the specified prefix.void
Show all rows that where previously hidden.void
showRowIndexes
(int... rowIndexes) Show the rows with the given indexes again.void
showRowIndexes
(Collection<Integer> rowIndexes) Show the rows with the given indexes again.void
showRowPosition
(int rowPosition, boolean showToTop, boolean showAll) Show the row(s) that are hidden next to the given row position.void
showRows
(Collection<Serializable> rowIds) Show the rows that contain the objects with the given row ids.Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
configure, dispose, doCommand, getCellByPosition, getCellPainter, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayer, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions
Methods inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getConfigLabelAccumulator, getProvidedLabels, getRegionName, handleLayerEvent, hasLayerListener, registerCommandHandler, registerEventHandler, registerPersistable, removeLayerListener, setConfigLabelAccumulator, setLayerPainter, setRegionName, toString, unregisterCommandHandler, unregisterEventHandler, unregisterPersistable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayer
addLayerListener, configure, dispose, doCommand, fireLayerEvent, getBoundsByPosition, getCellByPosition, getCellPainter, getClientAreaProvider, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getProvidedLabels, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, hasLayerListener, isColumnPositionResizable, isDynamicSizeLayer, isRowPositionResizable, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions, unregisterCommandHandler, unregisterPersistable
Methods inherited from interface org.eclipse.nebula.widgets.nattable.layer.ILayerListener
handleLayerEvent
-
Field Details
-
PERSISTENCE_KEY_HIDDEN_ROW_IDS_COUNT
Key for persisting the number of hidden row id's. This is necessary because the id's are serializables and reading them againd by ObjectInputStream need to know how long to read.- See Also:
-
PERSISTENCE_KEY_HIDDEN_ROW_IDS
- See Also:
-
-
Constructor Details
-
GlazedListsRowHideShowLayer
public GlazedListsRowHideShowLayer(ILayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor) Creates aGlazedListsRowHideShowLayer
for adding row hide/show for GlazedLists based NatTables. Using this constructor will only instantiate this layer. To use this correctly you need to register the local row hideMatcherEditor
against theFilterList
yourself.- Parameters:
underlyingLayer
- The underlying layer.rowDataProvider
- TheIRowDataProvider
needed to get the object at a given position so it is possible to retrieve the id that is used for filtering.rowIdAccessor
- TheIRowIdAccessor
that is used to extract the id out of the row object. This is necessary to determine the row object to hide in terms of content.
-
GlazedListsRowHideShowLayer
public GlazedListsRowHideShowLayer(ILayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor, ca.odell.glazedlists.FilterList<T> filterList) Creates aGlazedListsRowHideShowLayer
for adding row hide/show for GlazedLists based NatTables. Using this constructor will add theMatcherEditor
to the givenFilterList
. This might not work correctly in combination with other filters like e.g. the filter row.- Parameters:
underlyingLayer
- The underlying layer.rowDataProvider
- TheIRowDataProvider
needed to get the object at a given position so it is possible to retrieve the id that is used for filtering.rowIdAccessor
- TheIRowIdAccessor
that is used to extract the id out of the row object. This is necessary to determine the row object to hide in terms of content.filterList
- TheFilterList
to apply the local row hideMatcher
to.
-
GlazedListsRowHideShowLayer
public GlazedListsRowHideShowLayer(ILayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor, ca.odell.glazedlists.matchers.CompositeMatcherEditor<T> matcherEditor) Creates aGlazedListsRowHideShowLayer
for adding row hide/show for GlazedLists based NatTables. Using this constructor will add theMatcherEditor
to the givenCompositeMatcherEditor
. This way it is possible to add more filter logic than only the row hide filter.- Parameters:
underlyingLayer
- The underlying layer.rowDataProvider
- TheIRowDataProvider
needed to get the object at a given position so it is possible to retrieve the id that is used for filtering.rowIdAccessor
- TheIRowIdAccessor
that is used to extract the id out of the row object. This is necessary to determine the row object to hide in terms of content.matcherEditor
- TheCompositeMatcherEditor
to which the local row hideMatcher
should be added.
-
-
Method Details
-
registerCommandHandlers
protected void registerCommandHandlers()Register theILayerCommandHandler
that will handle the row hide/show events for this layer.- Overrides:
registerCommandHandlers
in classAbstractLayer
-
getHideRowMatcherEditor
- Returns:
- The
MatcherEditor
that is used to filter rows via row id's. - Since:
- 2.0
-
hideRowPositions
public void hideRowPositions(int... rowPositions) Description copied from interface:IRowHideShowLayer
Hide the rows at the given positions.- Specified by:
hideRowPositions
in interfaceIRowHideShowLayer
- Parameters:
rowPositions
- The positions of the rows to hide.
-
hideRowPositions
Hide the rows at the given positions. Will collect the id's of the rows at the given positions as this layer operates on content rather than positions.- Specified by:
hideRowPositions
in interfaceIRowHideShowLayer
- Parameters:
rowPositions
- The positions of the rows to hide.
-
hideRowIndexes
public void hideRowIndexes(int... rowIndexes) Description copied from interface:IRowHideShowLayer
Hide the rows with the given indexes.- Specified by:
hideRowIndexes
in interfaceIRowHideShowLayer
- Parameters:
rowIndexes
- The indexes of the rows to hide.
-
hideRowIndexes
Hide the rows at the given indexes. Will collect the id's of the rows at the given positions as this layer operates on content rather than positions.- Specified by:
hideRowIndexes
in interfaceIRowHideShowLayer
- Parameters:
rowIndexes
- The indexes of the rows to hide.
-
showRowIndexes
public void showRowIndexes(int... rowIndexes) Description copied from interface:IRowHideShowLayer
Show the rows with the given indexes again.- Specified by:
showRowIndexes
in interfaceIRowHideShowLayer
- Parameters:
rowIndexes
- The indexes of the rows that should be showed again.
-
showRowIndexes
Show the rows with the given indexes again. Will collect the id's of the rows at the given positions as this layer operates on content rather than positions.- Specified by:
showRowIndexes
in interfaceIRowHideShowLayer
- Parameters:
rowIndexes
- The indexes of the rows that should be showed again.
-
hideRows
Hide the rows that contain the objects with the given row ids.- Parameters:
rowIds
- The row ids of the rows that should be hidden.
-
showRows
Show the rows that contain the objects with the given row ids. Will of course only have impact if those rows are currently hidden.- Parameters:
rowIds
- The row ids of the rows that should be showed.
-
showRowPosition
public void showRowPosition(int rowPosition, boolean showToTop, boolean showAll) Show the row(s) that are hidden next to the given row position.This method is not supported by this layer as hidden rows are actually filtered from the content and therefore not next to another position on a deeper layer!
- Specified by:
showRowPosition
in interfaceIRowHideShowLayer
- Parameters:
rowPosition
- The row position whose neighbors should be shown again.showToTop
- Whether the row positions to the top or the bottom of the given row position should be shown again.showAll
- Whether all hidden adjacent rows should be shown again or only the single direct adjacent row.
-
showAllRows
public void showAllRows()Show all rows that where previously hidden.- Specified by:
showAllRows
in interfaceIRowHideShowLayer
-
getMatcherEditor
- Returns:
- The
MatcherEditor
that is used to filter the rows with the specified id's.
-
getColumnPositionByIndex
public int getColumnPositionByIndex(int columnIndex) - Specified by:
getColumnPositionByIndex
in interfaceIUniqueIndexLayer
-
getRowPositionByIndex
public int getRowPositionByIndex(int rowIndex) - Specified by:
getRowPositionByIndex
in interfaceIUniqueIndexLayer
-
saveState
Description copied from interface:IPersistable
Saves the state to the given Properties using the specified prefix. Note: The prefix must be prepended to the property key to support multiple states within one Properties instance.- Specified by:
saveState
in interfaceIPersistable
- Overrides:
saveState
in classAbstractLayerTransform
- Parameters:
prefix
- The prefix to use for the state keys. Is also used as the state configuration name.properties
- The Properties instance to save the state to.
-
loadState
Description copied from class:AbstractLayerTransform
Underlying layers must load state first. If this is not done,IStructuralChangeEvent
from underlying layers will reset caches after state has been loaded- Specified by:
loadState
in interfaceIPersistable
- Overrides:
loadState
in classAbstractLayerTransform
- Parameters:
prefix
- The prefix to use for the state keys. Is also used as the state configuration name.properties
- The Properties instance to load the state from.
-