@ Transient public String getTagsList ( final boolean brLineBreak ) { // define the line breaks for html and for tooltips final String lineBreak = brLineBreak ? "<br/>" : "\n" ; final String boldStart = brLineBreak ? "<b>" : "" ; final String boldEnd = brLineBreak ? "</b>" : "" ; final TreeMap < NameIDSortMap , ArrayList < String > > tags = new TreeMap < NameIDSortMap , ArrayList < String > > ( ) ; for ( final TagToProject tagToProject : tagToProjects ) { final Tag tag = tagToProject . getTag ( ) ; final Set < TagToCategory > tagToCategories = tag . getTagToCategories ( ) ; if ( tagToCategories . size ( ) == 0 ) { NameIDSortMap categoryDetails = new NameIDSortMap ( "Uncategorised" , - 1 , 0 ) ; if ( ! tags . containsKey ( categoryDetails ) ) tags . put ( categoryDetails , new ArrayList < String > ( ) ) ; tags . get ( categoryDetails ) . add ( tag . getTagName ( ) ) ; } else { for ( final TagToCategory category : tagToCategories ) { NameIDSortMap categoryDetails = new NameIDSortMap ( category . getCategory ( ) . getCategoryName ( ) , category . getCategory ( ) . getCategoryId ( ) , category . getCategory ( ) . getCategorySort ( ) == null ? 0 : category . getCategory ( ) . getCategorySort ( ) ) ; if ( ! tags . containsKey ( categoryDetails ) ) tags . put ( categoryDetails , new ArrayList < String > ( ) ) ; tags . get ( categoryDetails ) . add ( tag . getTagName ( ) ) ; } } } String tagsList = "" ; for ( final NameIDSortMap key : tags . keySet ( ) ) { // sort alphabetically Collections . sort ( tags . get ( key ) ) ; if ( tagsList . length ( ) != 0 ) tagsList += lineBreak ; tagsList += boldStart + key . getName ( ) + boldEnd + ": " ; String thisTagList = "" ; for ( final String tag : tags . get ( key ) ) { if ( thisTagList . length ( ) != 0 ) thisTagList += ", " ; thisTagList += tag ; } tagsList += thisTagList + " " ; } return tagsList ; }
Generates a HTML formatted and categorized list of the tags that are associated with this topic