Class CoverageMetricColumn

java.lang.Object
hudson.views.ListViewColumn
io.jenkins.plugins.coverage.metrics.steps.CoverageMetricColumn
All Implemented Interfaces:
ExtensionPoint, Describable<ListViewColumn>

public class CoverageMetricColumn extends ListViewColumn
Dashboard column model which represents coverage metrics of different coverage types.
Author:
Florian Orendi
  • Constructor Details

    • CoverageMetricColumn

      @DataBoundConstructor public CoverageMetricColumn()
      Creates a new column.
  • Method Details

    • getFormatter

      public ElementFormatter getFormatter()
    • setColumnName

      @DataBoundSetter public void setColumnName(String columnName)
      Sets the display name of the column.
      Parameters:
      columnName - the human-readable name of the column
    • getColumnName

      public String getColumnName()
    • setBaseline

      @DataBoundSetter public void setBaseline(Baseline baseline)
      Sets the baseline of the values that will be shown.
      Parameters:
      baseline - the baseline to use
    • getBaseline

      public Baseline getBaseline()
    • setMetric

      @DataBoundSetter public void setMetric(edu.hm.hafner.coverage.Metric metric)
      Sets the metric of the values that will be shown.
      Parameters:
      metric - the metric to use
    • getMetric

      public edu.hm.hafner.coverage.Metric getMetric()
    • getAllValues

      public List<edu.hm.hafner.coverage.Value> getAllValues(Job<?,?> job)
      Returns all available values for the specified baseline.
      Parameters:
      job - the job in the current row
      Returns:
      the available values
    • formatMetric

      public String formatMetric(edu.hm.hafner.coverage.Value value)
      Returns a formatted and localized String representation of the specified value (without metric).
      Parameters:
      value - the value to format
      Returns:
      the value formatted as a string
    • formatValue

      public String formatValue(edu.hm.hafner.coverage.Value value)
      Returns a formatted and localized String representation of the specified value (without metric).
      Parameters:
      value - the value to format
      Returns:
      the value formatted as a string
    • getCoverageText

      public String getCoverageText(Job<?,?> job)
      Provides a text which represents the coverage percentage of the selected coverage type and metric.
      Parameters:
      job - the job in the current row
      Returns:
      the coverage text
    • getCoverageValue

      public Optional<edu.hm.hafner.coverage.Value> getCoverageValue(Job<?,?> job)
      Provides the coverage value of the selected coverage type and metric.
      Parameters:
      job - the job in the current row
      Returns:
      the coverage percentage
    • getDisplayColors

      public ColorProvider.DisplayColors getDisplayColors(Job<?,?> job, Optional<? extends edu.hm.hafner.coverage.Value> coverage)
      Provides the line color for representing the passed coverage value.
      Parameters:
      job - the job in the current row
      coverage - The coverage value as percentage
      Returns:
      the line color as hex string
    • getRelativeCoverageUrl

      public String getRelativeCoverageUrl(Job<?,?> job)
      Provides the relative URL which can be used for accessing the coverage report.
      Parameters:
      job - the job in the current row
      Returns:
      the relative URL or an empty string when there is no matching URL
    • getBackgroundColorFillPercentage

      public String getBackgroundColorFillPercentage(String percentage)
      Transforms percentages with a ',' decimal separator to a representation using a '.' in order to use the percentage for styling HTML tags.
      Parameters:
      percentage - The text representation of a percentage
      Returns:
      the formatted percentage string