public static String createAssignmentMessage ( final String tagName , final AssignmentResult < ? extends NamedEntity > result , final VaadinMessageSource i18n ) { final StringBuilder formMsg = new StringBuilder ( ) ; final int assignedCount = result . getAssigned ( ) ; final int alreadyAssignedCount = result . getAlreadyAssigned ( ) ; final int unassignedCount = result . getUnassigned ( ) ; if ( assignedCount == 1 ) { formMsg . append ( i18n . getMessage ( "message.target.assigned.one" , result . getAssignedEntity ( ) . get ( 0 ) . getName ( ) , tagName ) ) . append ( "<br>" ) ; } else if ( assignedCount > 1 ) { formMsg . append ( i18n . getMessage ( "message.target.assigned.many" , assignedCount , tagName ) ) . append ( "<br>" ) ; if ( alreadyAssignedCount > 0 ) { final String alreadyAssigned = i18n . getMessage ( "message.target.alreadyAssigned" , alreadyAssignedCount ) ; formMsg . append ( alreadyAssigned ) . append ( "<br>" ) ; } } if ( unassignedCount == 1 ) { formMsg . append ( i18n . getMessage ( "message.target.unassigned.one" , result . getUnassignedEntity ( ) . get ( 0 ) . getName ( ) , tagName ) ) . append ( "<br>" ) ; } else if ( unassignedCount > 1 ) { formMsg . append ( i18n . getMessage ( "message.target.unassigned.many" , unassignedCount , tagName ) ) . append ( "<br>" ) ; } return formMsg . toString ( ) ; }
Display Target Tag action message .