Class AbstractRowHideShowLayer

All Implemented Interfaces:
ILayer, ILayerListener, IUniqueIndexLayer, IPersistable
Direct Known Subclasses:
HierarchicalTreeLayer, RowGroupExpandCollapseLayer, RowGroupExpandCollapseLayer, RowHideShowLayer, RowIdHideShowLayer, TreeLayer

public abstract class AbstractRowHideShowLayer extends AbstractLayerTransform implements IUniqueIndexLayer
Abstract implementation for row hide/show operations.
  • Constructor Details

    • AbstractRowHideShowLayer

      public AbstractRowHideShowLayer(IUniqueIndexLayer underlyingLayer)
      Constructor.
      Parameters:
      underlyingLayer - The underlying layer.
  • Method Details

    • getUnderlyingLayer

      protected IUniqueIndexLayer getUnderlyingLayer()
      Overrides:
      getUnderlyingLayer in class AbstractLayerTransform
      Returns:
      The underlying layer.
      Since:
      2.0
    • handleLayerEvent

      public void handleLayerEvent(ILayerEvent event)
      Description copied from class: AbstractLayer
      Handle layer event notification. Convert it to your context and propagate UP. If you override this method you MUST NOT FORGET to raise the event up the layer stack by calling super.fireLayerEvent(event) - unless you plan to eat the event yourself.
      Specified by:
      handleLayerEvent in interface ILayerListener
      Overrides:
      handleLayerEvent in class AbstractLayer
      Parameters:
      event - the event
    • doCommand

      public boolean doCommand(ILayerCommand command)
      Description copied from interface: ILayer
      Opportunity to respond to a command as it flows down the stack. If the layer is not interested in the command it should allow the command to keep traveling down the stack.

      Note: Before the layer can process a command it must convert the command to its local coordinates using ILayerCommand.convertToTargetLayer(ILayer)

      Specified by:
      doCommand in interface ILayer
      Overrides:
      doCommand in class AbstractLayerTransform
      Parameters:
      command - The command to execute.
      Returns:
      true if the command has been handled and was therefore consumed, false otherwise.
    • getColumnPositionByIndex

      public int getColumnPositionByIndex(int columnIndex)
      Specified by:
      getColumnPositionByIndex in interface IUniqueIndexLayer
    • getRowCount

      public int getRowCount()
      Specified by:
      getRowCount in interface ILayer
      Overrides:
      getRowCount in class AbstractLayerTransform
      Returns:
      The number of rows in this layer.
    • getRowIndexByPosition

      public int getRowIndexByPosition(int rowPosition)
      Description copied from interface: ILayer
      Gets the underlying non-transformed row index for the given row position on this layer.
      Specified by:
      getRowIndexByPosition in interface ILayer
      Overrides:
      getRowIndexByPosition in class AbstractLayerTransform
      Parameters:
      rowPosition - The row position relative to this layer.
      Returns:
      An underlying non-transformed row index, or -1 if the given row position does not exist within this coordinate system.
    • getRowPositionByIndex

      public int getRowPositionByIndex(int rowIndex)
      Specified by:
      getRowPositionByIndex in interface IUniqueIndexLayer
    • getRowPositionsByIndexes

      public Collection<Integer> getRowPositionsByIndexes(Collection<Integer> rowIndexes)
      Get the local row positions for the given row indexes.
      Parameters:
      rowIndexes - The row indexes for which the local row positions are requested.
      Returns:
      The local row positions for the given row indexes.
    • getRowPositionsByIndexes

      public int[] getRowPositionsByIndexes(int... rowIndexes)
      Get the local row positions for the given row indexes.
      Parameters:
      rowIndexes - The row indexes for which the local row positions are requested.
      Returns:
      The local row positions for the given row indexes.
      Since:
      2.0
    • localToUnderlyingRowPosition

      public int localToUnderlyingRowPosition(int localRowPosition)
      Description copied from interface: ILayer
      Convert a row position to the coordinates of the underlying layer. This is possible since each layer is aware of its underlying layer.
      Specified by:
      localToUnderlyingRowPosition in interface ILayer
      Overrides:
      localToUnderlyingRowPosition in class AbstractLayerTransform
      Parameters:
      localRowPosition - row position in local (the layer's own) coordinates
      Returns:
      row position in the underlying layer's coordinates
    • underlyingToLocalRowPosition

      public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition)
      Description copied from interface: ILayer
      Transforms the row position relative to the given underlying layer to this layer coordinates.
      Specified by:
      underlyingToLocalRowPosition in interface ILayer
      Overrides:
      underlyingToLocalRowPosition in class AbstractLayerTransform
      Parameters:
      sourceUnderlyingLayer - The underlying layer to which the given row position matches.
      underlyingRowPosition - The row position in the given underlying layer that should be converted to a local row position.
      Returns:
      The given row position transformed to be local to this layer.
    • underlyingToLocalRowPositions

      public Collection<Range> underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection<Range> underlyingRowPositionRanges)
      Description copied from interface: ILayer
      Transforms the row position ranges relative to the given underlying layer to this layer coordinates.
      Specified by:
      underlyingToLocalRowPositions in interface ILayer
      Overrides:
      underlyingToLocalRowPositions in class AbstractLayerTransform
      Parameters:
      sourceUnderlyingLayer - The underlying layer to which the given row positions match.
      underlyingRowPositionRanges - The row position ranges relative to the given underlying layer that should be converted to local row positions.
      Returns:
      The given row position ranges transformed to this layer.
    • getHeight

      public int getHeight()
      Description copied from interface: ILayer
      Returns the total height in pixels of this layer.
      Specified by:
      getHeight in interface ILayer
      Overrides:
      getHeight in class AbstractLayerTransform
      Returns:
      The total height in pixels of this layer.
    • getRowPositionByY

      public int getRowPositionByY(int y)
      Description copied from interface: ILayer
      Returns the row position that contains the given y coordinate.
      Specified by:
      getRowPositionByY in interface ILayer
      Overrides:
      getRowPositionByY in class AbstractLayerTransform
      Parameters:
      y - a vertical pixel location relative to the pixel boundary of this layer
      Returns:
      a row position relative to the associated coordinate system, or -1 if there is no row that contains y
    • getStartYOfRowPosition

      public int getStartYOfRowPosition(int localRowPosition)
      Description copied from interface: ILayer
      Returns the y offset in pixels of the given row.
      Specified by:
      getStartYOfRowPosition in interface ILayer
      Overrides:
      getStartYOfRowPosition in class AbstractLayerTransform
      Parameters:
      localRowPosition - the row position in this layer
      Returns:
      the y offset of the row, or -1
    • isRowIndexHidden

      public abstract boolean isRowIndexHidden(int rowIndex)
      Will check if the row at the specified index is hidden or not. Checks this layer and also the sublayers for the visibility.
      Parameters:
      rowIndex - The row index of the row whose visibility state should be checked.
      Returns:
      true if the row at the specified index is hidden, false if it is visible.
    • getHiddenRowIndexes

      public abstract Collection<Integer> getHiddenRowIndexes()
      Will collect and return all indexes of the rows that are hidden in this layer.

      Note: It is not intended that it also collects the row indexes of underlying layers. This would cause issues on calculating positions, as every layer is responsible for those calculations itself.

      Since 2.0 it is recommended to use getHiddenRowIndexesArray() to avoid unnecessary autoboxing operations.

      Returns:
      Collection of all row indexes that are hidden in this layer.
    • getHiddenRowIndexesArray

      public abstract int[] getHiddenRowIndexesArray()
      Will collect and return all indexes of the rows that are hidden in this layer.

      Note: It is not intended that it also collects the row indexes of underlying layers. This would cause issues on calculating positions, as every layer is responsible for those calculations itself.

      Returns:
      All row indexes that are hidden in this layer.
      Since:
      2.0
    • hasHiddenRows

      public abstract boolean hasHiddenRows()
      Check if this layer actively hides rows.
      Returns:
      true if rows are hidden by this layer, false if not.
      Since:
      2.0
    • getCellByPosition

      public ILayerCell getCellByPosition(int columnPosition, int rowPosition)
      Description copied from interface: ILayer
      Returns the cell for the given coordinates on this layer.
      Specified by:
      getCellByPosition in interface ILayer
      Overrides:
      getCellByPosition in class AbstractLayerTransform
      Parameters:
      columnPosition - The column position of the requested cell.
      rowPosition - The row position of the requested cell.
      Returns:
      The ILayerCell for the given coordinates in this layer or null if the coordinates are invalid on this layer.
    • invalidateCache

      protected void invalidateCache()
      Invalidate the cache to ensure that information is rebuild.
    • cacheVisibleRowIndexes

      protected void cacheVisibleRowIndexes()
      Build up the row caches.