diff --git a/src/main/java/org/codehaus/mojo/versions/reporting/AbstractVersionsReportRenderer.java b/src/main/java/org/codehaus/mojo/versions/reporting/AbstractVersionsReportRenderer.java index 7fe827e9fd..2193ddef18 100644 --- a/src/main/java/org/codehaus/mojo/versions/reporting/AbstractVersionsReportRenderer.java +++ b/src/main/java/org/codehaus/mojo/versions/reporting/AbstractVersionsReportRenderer.java @@ -136,59 +136,33 @@ protected void renderOverview() */ protected void renderOverviewTableRow( Q stats ) { - sink.tableCell(); - renderSuccessIcon(); - sink.tableCell_(); - sink.tableCell(); - sink.text( getText( "report.overview.numUpToDate" ) ); - sink.tableCell_(); - sink.tableCell(); - sink.text( Integer.toString( stats.getUpToDate() ) ); - sink.tableCell_(); - sink.tableRow_(); - sink.tableRow(); - sink.tableCell(); - renderWarningIcon(); - sink.tableCell_(); - sink.tableCell(); - sink.text( getText( "report.overview.numNewerVersionAvailable" ) ); - sink.tableCell_(); - sink.tableCell(); - sink.text( Integer.toString( stats.getAny() ) ); - sink.tableCell_(); - sink.tableRow_(); - sink.tableRow(); - sink.tableCell(); - renderWarningIcon(); - sink.tableCell_(); - sink.tableCell(); - sink.text( getText( "report.overview.numNewerIncrementalAvailable" ) ); - sink.tableCell_(); - sink.tableCell(); - sink.text( Integer.toString( stats.getIncremental() ) ); - sink.tableCell_(); - sink.tableRow_(); + renderStatRow( "report.overview.numUpToDate", stats.getUpToDate(), true ); + renderStatRow( "report.overview.numNewerVersionAvailable", stats.getAny(), false ); + renderStatRow( "report.overview.numNewerIncrementalAvailable", stats.getIncremental(), false ); + renderStatRow( "report.overview.numNewerMinorAvailable", stats.getMinor(), false ); + renderStatRow( "report.overview.numNewerMajorAvailable", stats.getMajor(), false ); + } + + protected void renderStatRow( String textKey, int statCount, boolean forceSuccessIcon ) + { sink.tableRow(); sink.tableCell(); - renderWarningIcon(); + if ( statCount == 0 || forceSuccessIcon ) + { + renderSuccessIcon(); + } + else + { + renderWarningIcon(); + } sink.tableCell_(); sink.tableCell(); - sink.text( getText( "report.overview.numNewerMinorAvailable" ) ); + sink.text( getText( textKey ) ); sink.tableCell_(); sink.tableCell(); - sink.text( Integer.toString( stats.getMinor() ) ); + sink.text( Integer.toString( statCount ) ); sink.tableCell_(); sink.tableRow_(); - sink.tableRow(); - sink.tableCell(); - renderWarningIcon(); - sink.tableCell_(); - sink.tableCell(); - sink.text( getText( "report.overview.numNewerMajorAvailable" ) ); - sink.tableCell_(); - sink.tableCell(); - sink.text( Integer.toString( stats.getMajor() ) ); - sink.tableCell_(); } /** diff --git a/src/main/java/org/codehaus/mojo/versions/reporting/PluginUpdatesReportRenderer.java b/src/main/java/org/codehaus/mojo/versions/reporting/PluginUpdatesReportRenderer.java index 7f38c91d5b..6d0713cd41 100644 --- a/src/main/java/org/codehaus/mojo/versions/reporting/PluginUpdatesReportRenderer.java +++ b/src/main/java/org/codehaus/mojo/versions/reporting/PluginUpdatesReportRenderer.java @@ -143,12 +143,8 @@ protected void renderSummaryTableHeader( boolean hasScope, boolean hasType ) protected void renderOverviewTableRow( T stats ) { super.renderOverviewTableRow( stats ); - sink.tableCell(); - sink.text( getText( "report.overview.numNewerDependenciesAvailable" ) ); - sink.tableCell_(); - sink.tableCell(); - sink.text( Integer.toString( ( (PluginOverviewStats) stats ).getDependencies() ) ); - sink.tableCell_(); + super.renderStatRow( "report.overview.numNewerDependenciesAvailable", + ( (PluginOverviewStats) stats ).getDependencies(), false ); } protected void renderSummaryTableRow( Dependency artifact, PluginUpdatesDetails details )