private static void addSourcesAndIndicatorsToMenu ( final MenuItem countryIndicators , final Map < String , List < ViewWorldbankIndicatorDataCountrySummary > > sourceIndicatorMap ) { final Map < String , List < ViewWorldbankIndicatorDataCountrySummary > > sortedIndicatorMap = sourceIndicatorMap . entrySet ( ) . stream ( ) . sorted ( ( e1 , e2 ) -> e1 . getKey ( ) . compareTo ( e2 . getKey ( ) ) ) . collect ( Collectors . toMap ( Map . Entry :: getKey , Map . Entry :: getValue , ( e1 , e2 ) -> e1 , LinkedHashMap :: new ) ) ; for ( final Entry < String , List < ViewWorldbankIndicatorDataCountrySummary > > entry : sortedIndicatorMap . entrySet ( ) ) { final MenuItem sourceItems = countryIndicators . addItem ( entry . getKey ( ) , null , null ) ; final List < ViewWorldbankIndicatorDataCountrySummary > sortedEntries = entry . getValue ( ) . stream ( ) . sorted ( ( e1 , e2 ) -> e1 . getIndicatorName ( ) . compareTo ( e2 . getIndicatorName ( ) ) ) . collect ( Collectors . toList ( ) ) ; for ( final ViewWorldbankIndicatorDataCountrySummary indciatorSummary : sortedEntries ) { final MenuItem addItem = sourceItems . addItem ( indciatorSummary . getIndicatorName ( ) , new PageModeMenuCommand ( UserViews . COUNTRY_RANKING_VIEW_NAME , PageMode . INDICATORS , indciatorSummary . getEmbeddedId ( ) . getIndicatorId ( ) ) ) ; addItem . setStyleName ( "RestrictedHeader" ) ; } } }
Adds the sources and indicators to menu .