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
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final StringKey for persisting the number of hidden row id's.Fields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform
underlyingLayerFields inherited from class org.eclipse.nebula.widgets.nattable.layer.AbstractLayer
commandHandlers, eventHandlers, eventHelperLock, layerPainterFields inherited from interface org.eclipse.nebula.widgets.nattable.persistence.IPersistable
DOT, VALUE_SEPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionGlazedListsRowHideShowLayer(ILayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor) Creates aGlazedListsRowHideShowLayerfor adding row hide/show for GlazedLists based NatTables.GlazedListsRowHideShowLayer(ILayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor, ca.odell.glazedlists.FilterList<T> filterList) Creates aGlazedListsRowHideShowLayerfor 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 aGlazedListsRowHideShowLayerfor adding row hide/show for GlazedLists based NatTables. -
Method Summary
Modifier and TypeMethodDescriptionintgetColumnPositionByIndex(int columnIndex) ca.odell.glazedlists.matchers.MatcherEditor<T>ca.odell.glazedlists.matchers.MatcherEditor<T>intgetRowPositionByIndex(int rowIndex) voidhideRowIndexes(int... rowIndexes) Hide the rows with the given indexes.voidhideRowIndexes(Collection<Integer> rowIndexes) Hide the rows at the given indexes.voidhideRowPositions(int... rowPositions) Hide the rows at the given positions.voidhideRowPositions(Collection<Integer> rowPositions) Hide the rows at the given positions.voidhideRows(Collection<Serializable> rowIds) Hide the rows that contain the objects with the given row ids.voidloadState(String prefix, Properties properties) Underlying layers must load state first.protected voidRegister theILayerCommandHandlerthat will handle the row hide/show events for this layer.voidsaveState(String prefix, Properties properties) Saves the state to the given Properties using the specified prefix.voidShow all rows that where previously hidden.voidshowRowIndexes(int... rowIndexes) Show the rows with the given indexes again.voidshowRowIndexes(Collection<Integer> rowIndexes) Show the rows with the given indexes again.voidshowRowPosition(int rowPosition, boolean showToTop, boolean showAll) Show the row(s) that are hidden next to the given row position.voidshowRows(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, underlyingToLocalRowPositionsMethods 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, unregisterPersistableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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, unregisterPersistableMethods 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 aGlazedListsRowHideShowLayerfor 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 hideMatcherEditoragainst theFilterListyourself.- Parameters:
underlyingLayer- The underlying layer.rowDataProvider- TheIRowDataProviderneeded to get the object at a given position so it is possible to retrieve the id that is used for filtering.rowIdAccessor- TheIRowIdAccessorthat 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 aGlazedListsRowHideShowLayerfor adding row hide/show for GlazedLists based NatTables. Using this constructor will add theMatcherEditorto the givenFilterList. This might not work correctly in combination with other filters like e.g. the filter row.- Parameters:
underlyingLayer- The underlying layer.rowDataProvider- TheIRowDataProviderneeded to get the object at a given position so it is possible to retrieve the id that is used for filtering.rowIdAccessor- TheIRowIdAccessorthat 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- TheFilterListto apply the local row hideMatcherto.
-
GlazedListsRowHideShowLayer
public GlazedListsRowHideShowLayer(ILayer underlyingLayer, IRowDataProvider<T> rowDataProvider, IRowIdAccessor<T> rowIdAccessor, ca.odell.glazedlists.matchers.CompositeMatcherEditor<T> matcherEditor) Creates aGlazedListsRowHideShowLayerfor adding row hide/show for GlazedLists based NatTables. Using this constructor will add theMatcherEditorto the givenCompositeMatcherEditor. This way it is possible to add more filter logic than only the row hide filter.- Parameters:
underlyingLayer- The underlying layer.rowDataProvider- TheIRowDataProviderneeded to get the object at a given position so it is possible to retrieve the id that is used for filtering.rowIdAccessor- TheIRowIdAccessorthat 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- TheCompositeMatcherEditorto which the local row hideMatchershould be added.
-
-
Method Details
-
registerCommandHandlers
protected void registerCommandHandlers()Register theILayerCommandHandlerthat will handle the row hide/show events for this layer.- Overrides:
registerCommandHandlersin classAbstractLayer
-
getHideRowMatcherEditor
- Returns:
- The
MatcherEditorthat is used to filter rows via row id's. - Since:
- 2.0
-
hideRowPositions
public void hideRowPositions(int... rowPositions) Description copied from interface:IRowHideShowLayerHide the rows at the given positions.- Specified by:
hideRowPositionsin 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:
hideRowPositionsin interfaceIRowHideShowLayer- Parameters:
rowPositions- The positions of the rows to hide.
-
hideRowIndexes
public void hideRowIndexes(int... rowIndexes) Description copied from interface:IRowHideShowLayerHide the rows with the given indexes.- Specified by:
hideRowIndexesin 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:
hideRowIndexesin interfaceIRowHideShowLayer- Parameters:
rowIndexes- The indexes of the rows to hide.
-
showRowIndexes
public void showRowIndexes(int... rowIndexes) Description copied from interface:IRowHideShowLayerShow the rows with the given indexes again.- Specified by:
showRowIndexesin 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:
showRowIndexesin 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:
showRowPositionin 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:
showAllRowsin interfaceIRowHideShowLayer
-
getMatcherEditor
- Returns:
- The
MatcherEditorthat is used to filter the rows with the specified id's.
-
getColumnPositionByIndex
public int getColumnPositionByIndex(int columnIndex) - Specified by:
getColumnPositionByIndexin interfaceIUniqueIndexLayer
-
getRowPositionByIndex
public int getRowPositionByIndex(int rowIndex) - Specified by:
getRowPositionByIndexin interfaceIUniqueIndexLayer
-
saveState
Description copied from interface:IPersistableSaves 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:
saveStatein interfaceIPersistable- Overrides:
saveStatein 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:AbstractLayerTransformUnderlying layers must load state first. If this is not done,IStructuralChangeEventfrom underlying layers will reset caches after state has been loaded- Specified by:
loadStatein interfaceIPersistable- Overrides:
loadStatein 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.
-