Class SummaryRowLayer

    • Field Detail

      • DEFAULT_SUMMARY_ROW_CONFIG_LABEL

        public static final String DEFAULT_SUMMARY_ROW_CONFIG_LABEL
        Label that gets attached to the LabelStack for every cell in the summary row.
        See Also:
        Constant Field Values
      • DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX

        public static final String DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX
        Prefix of the labels that get attached to cells in the summary row. The complete label will consist of this prefix and the column index at the end of the label. This way every cell in the summary row can be accessed directly via label mechanism.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SummaryRowLayer

        public SummaryRowLayer​(IUniqueIndexLayer underlyingDataLayer,
                               IConfigRegistry configRegistry)
        Creates a SummaryRowLayer on top of the given underlying layer. It uses smooth value updates as default.

        Note: This constructor will create the SummaryRowLayer by using the default configuration. The default configuration doesn't fit the needs so you usually will use your custom summary row configuration.

        Parameters:
        underlyingDataLayer - The underlying layer on which the SummaryRowLayer should be build.
        configRegistry - The ConfigRegistry for retrieving the ISummaryProvider per column.
        See Also:
        DefaultSummaryRowConfiguration
      • SummaryRowLayer

        public SummaryRowLayer​(IUniqueIndexLayer underlyingDataLayer,
                               IConfigRegistry configRegistry,
                               boolean autoConfigure)
        Creates a SummaryRowLayer on top of the given underlying layer. It uses smooth value updates as default.

        Note: This constructor will create the SummaryRowLayer by using the default configuration if the autoConfig parameter is set to true. The default configuration doesn't fit the needs so you usually will use your custom summary row configuration. When using a custom configuration you should use this constructor setting autoConfig to false. Otherwise you might get strange behaviour as the default configuration will be set additionally to your configuration.

        Parameters:
        underlyingDataLayer - The underlying layer on which the SummaryRowLayer should be build.
        configRegistry - The ConfigRegistry for retrieving the ISummaryProvider per column.
        autoConfigure - true to use the DefaultSummaryRowConfiguration, false if a custom configuration will be set after the creation.
        See Also:
        DefaultSummaryRowConfiguration
      • SummaryRowLayer

        public SummaryRowLayer​(IUniqueIndexLayer underlyingDataLayer,
                               IConfigRegistry configRegistry,
                               boolean smoothUpdates,
                               boolean autoConfigure)
        Creates a SummaryRowLayer on top of the given underlying layer.

        Note: This constructor will create the SummaryRowLayer by using the default configuration if the autoConfig parameter is set to true. The default configuration doesn't fit the needs so you usually will use your custom summary row configuration. When using a custom configuration you should use this constructor setting autoConfig to false. Otherwise you might get strange behaviour as the default configuration will be set additionally to your configuration.

        Parameters:
        underlyingDataLayer - The underlying layer on which the SummaryRowLayer should be build.
        configRegistry - The ConfigRegistry for retrieving the ISummaryProvider per column.
        smoothUpdates - true if the summary value updates should be performed smoothly, false if on re-calculation the value should be immediately shown as not calculated.
        autoConfigure - true to use the DefaultSummaryRowConfiguration, false if a custom configuration will be set after the creation.
        See Also:
        DefaultSummaryRowConfiguration
    • Method Detail

      • isSummaryRowPosition

        public boolean isSummaryRowPosition​(int rowPosition)
        Checks if the given row position is the position of the summary row.
        Parameters:
        rowPosition - The row position to check.
        Returns:
        true if the given row position is the summary row position.
        Since:
        1.6
      • getSummaryRowPosition

        public int getSummaryRowPosition()
        Get the position of the summary row in this layer.
        Returns:
        The position of the summary row. Typically rowCount - 1.
        Since:
        1.6
      • 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.
      • 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
      • clearCache

        public void clearCache()
        Clear the internal cache to trigger new calculations.

        Usually it is not necessary to call this method manually. But for certain use cases it might be useful, e.g. changing the summary provider implementation at runtime.

        See Also:
        CalculatedValueCache.clearCache()
      • killCache

        public void killCache()
        Clears all values in the internal cache to trigger new calculations. This will also clear all values in the cache copy and will result in rendering like there was never a summary value calculated before.

        Usually it is not necessary to call this method manually. But for certain use cases it might be useful, e.g. changing the summary provider implementation at runtime.

        See Also:
        CalculatedValueCache.killCache()
      • getConfigLabelsByPositionWithoutTransformation

        protected LabelStack getConfigLabelsByPositionWithoutTransformation​(int columnPosition,
                                                                            int rowPosition)
        This method is a wrapper for calling getConfigLabelsByPosition(int, int). It is needed because sub-classes of the SummaryRowLayer might perform column position-index transformations, which would be executed again if the call for config labels is nested, e.g. in calculateNewSummaryValue(int, boolean). By providing and using this implementation, sub-classes that perform position-index transformations are able to implement this method by directly accessing the super implementation.
        Parameters:
        columnPosition - The column position of the cell for which the config labels are requested. If transformations are necessary, this value should be already transformed.
        rowPosition - The row position of the cell for which the config labels are requested. If transformations are necessary, this value should be already transformed.
        Returns:
        The LabelStack for the cell at the given coordinates.
      • getConfigLabelsByPosition

        public LabelStack getConfigLabelsByPosition​(int columnPosition,
                                                    int rowPosition)
        Description copied from interface: ILayer
        Returns the config labels for the cell at the given coordinates. Needed to retrieve the corresponding configurations out of the IConfigRegistry.
        Specified by:
        getConfigLabelsByPosition in interface ILayer
        Overrides:
        getConfigLabelsByPosition in class AbstractLayerTransform
        Parameters:
        columnPosition - The column position of the cell.
        rowPosition - The row position of the cell.
        Returns:
        The LabelStack with the config labels for the cell at the given coordinates.
      • 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.
      • 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.
      • 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.
      • 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
      • getRowHeightByPosition

        public int getRowHeightByPosition​(int rowPosition)
        Description copied from interface: ILayer
        Returns the height in pixels of the given row. The height of invisible and non-existing rows is 0.
        Specified by:
        getRowHeightByPosition in interface ILayer
        Overrides:
        getRowHeightByPosition in class AbstractLayerTransform
        Parameters:
        rowPosition - The row position in this layer.
        Returns:
        The height of the row.
      • isStandalone

        public boolean isStandalone()
        Returns:
        true if the summary row is rendered standalone, false if it is rendered below the underlying layer.
      • setStandalone

        public void setStandalone​(boolean standalone)
        Configure whether the summary row should be rendered below the underlying layer (false) or if it should be rendered standalone in a separate region of a composite (true).
        Parameters:
        standalone - Whether the summary row should be rendered standalone or below the underlying layer.
      • getValueCache

        public ICalculatedValueCache getValueCache()
        Returns:
        The ICalculatedValueCache that contains the summary values and performs summary calculation in background processes if necessary.
        Since:
        1.3
      • setValueCache

        public void setValueCache​(ICalculatedValueCache valueCache)
        Set the ICalculatedValueCache that should be used internally to calculate the summary values in a background thread and cache the results.

        Note: By default the CalculatedValueCache is used. Be sure you know what you are doing when you are trying to exchange the implementation.

        Parameters:
        valueCache - The ICalculatedValueCache that contains the summary values and performs summary calculation in background processes if necessary.
        Since:
        1.3
      • getUnderlyingLayersByColumnPosition

        public Collection<ILayer> getUnderlyingLayersByColumnPosition​(int columnPosition)
        Description copied from interface: ILayer
        Returns the layers that are directly below this layer for the given column position. For simple layers this collection will typically only have one entry. Layer compositions might return multiple values, e.g. in a default grid there will be 2 layers in the collection as there are two layers involved in a column.
        Specified by:
        getUnderlyingLayersByColumnPosition in interface ILayer
        Overrides:
        getUnderlyingLayersByColumnPosition in class AbstractLayerTransform
        Parameters:
        columnPosition - The column position for which the underlying layers are requested.
        Returns:
        The layers that are directly below this layer for the given column position or null if this layer has no underlying layers.
      • getUnderlyingLayersByRowPosition

        public Collection<ILayer> getUnderlyingLayersByRowPosition​(int rowPosition)
        Description copied from interface: ILayer
        Returns the layers that are directly below this layer for the given row position. For simple layers this collection will typically only have one entry. Layer compositions might return multiple values, e.g. in a default grid there will be 2 layers in the collection as there are two layers involved in a row.
        Specified by:
        getUnderlyingLayersByRowPosition in interface ILayer
        Overrides:
        getUnderlyingLayersByRowPosition in class AbstractLayerTransform
        Parameters:
        rowPosition - The row position for which the underlying layers are requested.
        Returns:
        The layers that are directly below this layer for the given row position or null if this layer has no underlying layers.
      • getUnderlyingLayerByPosition

        public ILayer getUnderlyingLayerByPosition​(int columnPosition,
                                                   int rowPosition)
        Description copied from interface: ILayer
        Returns the layer that is directly below this layer for the given cell coordinate.
        Specified by:
        getUnderlyingLayerByPosition in interface ILayer
        Overrides:
        getUnderlyingLayerByPosition in class AbstractLayerTransform
        Parameters:
        columnPosition - The column position for which the underlying layer is requested.
        rowPosition - The row position for which the underlying layer is requested.
        Returns:
        The layer that is directly below this layer for the given cell coordinates or null if this layer has no underlying layers.