@SuppressWarnings("unchecked") private void updateRepresentation(List<InvocationSequenceData> invocations){
  sourceInvocations=invocations;
  resetDisplayed=false;
  MutableDouble duration=new MutableDouble(0d);
  List<SqlStatementData> sqlList=new ArrayList<>();
  InvocationSequenceDataHelper.collectSqlsInInvocations(invocations,sqlList,duration);
  double totalInvocationsDuration=0d;
  for (  InvocationSequenceData inv : invocations) {
    totalInvocationsDuration+=inv.getDuration();
  }
  double percentage=(duration.toDouble() / totalInvocationsDuration) * 100;
  slowest80List.clear();
  int slowest80=getSlowestSqlCount(duration.toDouble(),sqlList,0.8d,slowest80List);
  int slowest20=sqlList.size() - slowest80;
  slowest20List=CollectionUtils.subtract(sqlList,slowest80List);
  totalSql.setText("<form><p><b>" + TOTAL_SQLS + "</b> "+ sqlList.size()+ "</p></form>",true,false);
  totalDuration.setText("<form><p><b>" + TOTAL_DURATION + "</b> "+ NumberFormatter.formatDouble(duration.doubleValue())+ " ms</p></form>",true,false);
  String formatedPercentage=NumberFormatter.formatDouble(percentage,1);
  if (CollectionUtils.isNotEmpty(sqlList)) {
    Color durationInInvocationColor=ColorFormatter.getPerformanceColor(GREEN_RGB,YELLOW_RGB,RED_RGB,percentage,20d,80d,resourceManager);
    percentageOfDuration.setColor("durationInInvocationColor",durationInInvocationColor);
    percentageOfDuration.setText("<form><p><b>" + SQLS_DURATION_IN_INVOCATION + "</b> <span color=\"durationInInvocationColor\">"+ formatedPercentage+ "%</span></p></form>",true,false);
  }
 else {
    percentageOfDuration.setText("<form><p><b>" + SQLS_DURATION_IN_INVOCATION + "</b> "+ formatedPercentage+ "%</p></form>",true,false);
  }
  String slowest80String=getCountAndPercentage(slowest80,sqlList.size());
  String slowest20String=getCountAndPercentage(slowest20,sqlList.size());
  if (CollectionUtils.isNotEmpty(sqlList)) {
    double slowest80Percentage=((double)slowest80 / sqlList.size()) * 100;
    if (Double.isNaN(slowest80Percentage)) {
      slowest80Percentage=0;
    }
    Color color8020=ColorFormatter.getPerformanceColor(GREEN_RGB,YELLOW_RGB,RED_RGB,slowest80Percentage,70d,10d,resourceManager);
    slowestCount.setColor(SLOWEST8020_COLOR,color8020);
    slowestHyperlinkSettings.setForeground(color8020);
    StringBuilder text=new StringBuilder("<b>" + SLOWEST_80_20 + "</b> ");
    if (slowest80 > 0) {
      text.append("<a href=\"" + SLOWEST80_LINK + "\">"+ slowest80String+ "</a>");
    }
 else {
      text.append("<span color=\"" + SLOWEST8020_COLOR + "\">"+ slowest80String+ "</span>");
    }
    text.append(" / ");
    if (slowest20 > 0) {
      text.append("<a href=\"" + SLOWEST20_LINK + "\">"+ slowest20String+ "</a>");
    }
 else {
      text.append("<span color=\"" + SLOWEST8020_COLOR + "\">"+ slowest20String+ "</span>");
    }
    slowestContent=text.toString();
  }
 else {
    slowestContent="<b>" + SLOWEST_80_20 + "</b> "+ slowest80String+ " / "+ slowest20String;
  }
  slowestCount.setText("<form><p>" + slowestContent + "</p></form>",true,false);
  main.layout();
}

@ SuppressWarnings ( "unchecked" ) private void updateRepresentation ( List < InvocationSequenceData > invocations ) { sourceInvocations = invocations ; resetDisplayed = false ; MutableDouble duration = new MutableDouble ( 0d ) ; List < SqlStatementData > sqlList = new ArrayList < > ( ) ; InvocationSequenceDataHelper . collectSqlsInInvocations ( invocations , sqlList , duration ) ; double totalInvocationsDuration = 0d ; for ( InvocationSequenceData inv : invocations ) { totalInvocationsDuration += inv . getDuration ( ) ; } double percentage = ( duration . toDouble ( ) / totalInvocationsDuration ) * 100 ; slowest80List . clear ( ) ; int slowest80 = getSlowestSqlCount ( duration . toDouble ( ) , sqlList , 0.8d , slowest80List ) ; int slowest20 = sqlList . size ( ) - slowest80 ; slowest20List = CollectionUtils . subtract ( sqlList , slowest80List ) ; totalSql . setText ( "<form><p><b>" + TOTAL_SQLS + "</b> " + sqlList . size ( ) + "</p></form>" , true , false ) ; totalDuration . setText ( "<form><p><b>" + TOTAL_DURATION + "</b> " + NumberFormatter . formatDouble ( duration . doubleValue ( ) ) + " ms</p></form>" , true , false ) ; String formatedPercentage = NumberFormatter . formatDouble ( percentage , 1 ) ; if ( CollectionUtils . isNotEmpty ( sqlList ) ) { Color durationInInvocationColor = ColorFormatter . getPerformanceColor ( GREEN_RGB , YELLOW_RGB , RED_RGB , percentage , 20d , 80d , resourceManager ) ; percentageOfDuration . setColor ( "durationInInvocationColor" , durationInInvocationColor ) ; percentageOfDuration . setText ( "<form><p><b>" + SQLS_DURATION_IN_INVOCATION + "</b> <span color=\"durationInInvocationColor\">" + formatedPercentage + "%</span></p></form>" , true , false ) ; } else { percentageOfDuration . setText ( "<form><p><b>" + SQLS_DURATION_IN_INVOCATION + "</b> " + formatedPercentage + "%</p></form>" , true , false ) ; } String slowest80String = getCountAndPercentage ( slowest80 , sqlList . size ( ) ) ; String slowest20String = getCountAndPercentage ( slowest20 , sqlList . size ( ) ) ; if ( CollectionUtils . isNotEmpty ( sqlList ) ) { double slowest80Percentage = ( ( double ) slowest80 / sqlList . size ( ) ) * 100 ; if ( Double . isNaN ( slowest80Percentage ) ) { slowest80Percentage = 0 ; } Color color8020 = ColorFormatter . getPerformanceColor ( GREEN_RGB , YELLOW_RGB , RED_RGB , slowest80Percentage , 70d , 10d , resourceManager ) ; slowestCount . setColor ( SLOWEST8020_COLOR , color8020 ) ; slowestHyperlinkSettings . setForeground ( color8020 ) ; StringBuilder text = new StringBuilder ( "<b>" + SLOWEST_80_20 + "</b> " ) ; if ( slowest80 > 0 ) { text . append ( "<a href=\"" + SLOWEST80_LINK + "\">" + slowest80String + "</a>" ) ; } else { text . append ( "<span color=\"" + SLOWEST8020_COLOR + "\">" + slowest80String + "</span>" ) ; } text . append ( " / " ) ; if ( slowest20 > 0 ) { text . append ( "<a href=\"" + SLOWEST20_LINK + "\">" + slowest20String + "</a>" ) ; } else { text . append ( "<span color=\"" + SLOWEST8020_COLOR + "\">" + slowest20String + "</span>" ) ; } slowestContent = text . toString ( ) ; } else { slowestContent = "<b>" + SLOWEST_80_20 + "</b> " + slowest80String + " / " + slowest20String ; } slowestCount . setText ( "<form><p>" + slowestContent + "</p></form>" , true , false ) ; main . layout ( ) ; }
updates the representation of the text form .
