public class GlazedListsRowHideShowLayer<T> extends AbstractLayerTransform implements IRowHideShowCommandLayer, IUniqueIndexLayer
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.
Modifier and Type | Field and Description |
---|---|
static String |
PERSISTENCE_KEY_HIDDEN_ROW_IDS |
static String |
PERSISTENCE_KEY_HIDDEN_ROW_IDS_COUNT
Key for persisting the number of hidden row id's.
|
underlyingLayer
layerPainter
DOT, VALUE_SEPARATOR
Constructor and Description |
---|
GlazedListsRowHideShowLayer(ILayer underlyingLayer,
IRowDataProvider<T> rowDataProvider,
IRowIdAccessor<T> rowIdAccessor)
Creates a
GlazedListsRowHideShowLayer 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 a
GlazedListsRowHideShowLayer 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 a
GlazedListsRowHideShowLayer for adding row hide/show for GlazedLists based
NatTables. |
Modifier and Type | Method and Description |
---|---|
int |
getColumnPositionByIndex(int columnIndex) |
ca.odell.glazedlists.matchers.MatcherEditor<T> |
getMatcherEditor() |
int |
getRowPositionByIndex(int rowIndex) |
void |
hideRowIndexes(Collection<Integer> rowIndexes)
Hide the rows at the given indexes.
|
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 |
registerCommandHandlers()
Register the
ILayerCommandHandler 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 |
showAllRows()
Show all rows that where previously hidden.
|
void |
showRowIndexes(Collection<Integer> rowIndexes)
Show the rows with the given indexes again.
|
void |
showRows(Collection<Serializable> rowIds)
Show the rows that contain the objects with the given row ids.
|
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, isRowPositionResizable, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, setClientAreaProvider, setUnderlyingLayer, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions
addConfiguration, addLayerListener, clearConfiguration, fireLayerEvent, getBoundsByPosition, getClientAreaProvider, getConfigLabelAccumulator, getRegionName, handleLayerEvent, hasLayerListener, registerCommandHandler, registerEventHandler, registerPersistable, removeLayerListener, setConfigLabelAccumulator, setLayerPainter, setRegionName, toString, unregisterCommandHandler, unregisterPersistable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addLayerListener, configure, dispose, doCommand, fireLayerEvent, getBoundsByPosition, getCellByPosition, getCellPainter, getClientAreaProvider, getColumnCount, getColumnIndexByPosition, getColumnPositionByX, getColumnWidthByPosition, getConfigLabelsByPosition, getDataValueByPosition, getDisplayModeByPosition, getHeight, getLayerPainter, getPreferredColumnCount, getPreferredHeight, getPreferredRowCount, getPreferredWidth, getRegionLabelsByXY, getRowCount, getRowHeightByPosition, getRowIndexByPosition, getRowPositionByY, getStartXOfColumnPosition, getStartYOfRowPosition, getUnderlyingLayerByPosition, getUnderlyingLayersByColumnPosition, getUnderlyingLayersByRowPosition, getWidth, hasLayerListener, isColumnPositionResizable, isRowPositionResizable, localToUnderlyingColumnPosition, localToUnderlyingRowPosition, registerCommandHandler, registerPersistable, removeLayerListener, setClientAreaProvider, underlyingToLocalColumnPosition, underlyingToLocalColumnPositions, underlyingToLocalRowPosition, underlyingToLocalRowPositions, unregisterCommandHandler, unregisterPersistable
handleLayerEvent
public static final String PERSISTENCE_KEY_HIDDEN_ROW_IDS_COUNT
public static final String PERSISTENCE_KEY_HIDDEN_ROW_IDS
public GlazedListsRowHideShowLayer(ILayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor)
GlazedListsRowHideShowLayer
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 hide MatcherEditor
against the FilterList
yourself.underlyingLayer
- The underlying layer.rowDataProvider
- The IRowDataProvider
needed to get the object at a given position so it
is possible to retrieve the id that is used for filtering.rowIdAccessor
- The IRowIdAccessor
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.public GlazedListsRowHideShowLayer(ILayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor, ca.odell.glazedlists.FilterList<T> filterList)
GlazedListsRowHideShowLayer
for adding row hide/show for GlazedLists based
NatTables. Using this constructor will add the MatcherEditor
to the given FilterList
.
This might not work correctly in combination with other filters like e.g. the filter row.underlyingLayer
- The underlying layer.rowDataProvider
- The IRowDataProvider
needed to get the object at a given position so it
is possible to retrieve the id that is used for filtering.rowIdAccessor
- The IRowIdAccessor
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
- The FilterList
to apply the local row hide Matcher
to.public GlazedListsRowHideShowLayer(ILayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor, ca.odell.glazedlists.matchers.CompositeMatcherEditor<T> matcherEditor)
GlazedListsRowHideShowLayer
for adding row hide/show for GlazedLists based
NatTables. Using this constructor will add the MatcherEditor
to the given
CompositeMatcherEditor
. This way it is possible to add more filter logic than only the
row hide filter.underlyingLayer
- The underlying layer.rowDataProvider
- The IRowDataProvider
needed to get the object at a given position so it
is possible to retrieve the id that is used for filtering.rowIdAccessor
- The IRowIdAccessor
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
- The CompositeMatcherEditor
to which the local row hide Matcher
should be added.protected void registerCommandHandlers()
ILayerCommandHandler
that will handle the row hide/show events
for this layer.registerCommandHandlers
in class AbstractLayer
public void hideRowPositions(Collection<Integer> rowPositions)
hideRowPositions
in interface IRowHideShowCommandLayer
rowPositions
- The positions of the rows to hide.public void hideRowIndexes(Collection<Integer> rowIndexes)
hideRowIndexes
in interface IRowHideShowCommandLayer
rowIndexes
- The indexes of the rows to hide.public void showRowIndexes(Collection<Integer> rowIndexes)
showRowIndexes
in interface IRowHideShowCommandLayer
rowIndexes
- The indexes of the rows that should be showed again.public void hideRows(Collection<Serializable> rowIds)
rowIds
- The row ids of the rows that should be hidden.public void showRows(Collection<Serializable> rowIds)
rowIds
- The row ids of the rows that should be showed.public void showAllRows()
showAllRows
in interface IRowHideShowCommandLayer
public ca.odell.glazedlists.matchers.MatcherEditor<T> getMatcherEditor()
MatcherEditor
that is used to filter the rows with the specified id's.public int getColumnPositionByIndex(int columnIndex)
getColumnPositionByIndex
in interface IUniqueIndexLayer
public int getRowPositionByIndex(int rowIndex)
getRowPositionByIndex
in interface IUniqueIndexLayer
public void saveState(String prefix, Properties properties)
IPersistable
saveState
in interface IPersistable
saveState
in class AbstractLayerTransform
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.public void loadState(String prefix, Properties properties)
AbstractLayerTransform
IStructuralChangeEvent
from underlying
layers will reset caches after state has been loadedloadState
in interface IPersistable
loadState
in class AbstractLayerTransform
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.Copyright © 2013. All Rights Reserved.