Search in sources :

Example 6 with Country

use of com.hack23.cia.model.external.worldbank.data.impl.Country in project cia by Hack23.

the class UserRoleSystemTest method siteTestCountryRankingOverviewTest.

/**
 * Site test country ranking overview test.
 *
 * @throws Exception
 *             the exception
 */
@Test
public void siteTestCountryRankingOverviewTest() throws Exception {
    final WebDriver driver = getWebDriver();
    assertNotNull(NO_WEBDRIVER_EXIST_FOR_BROWSER + browser, driver);
    final UserPageVisit userPageVisit = new UserPageVisit(driver, browser);
    userPageVisit.visitDirectPage(new PageModeMenuCommand(UserViews.COUNTRY_RANKING_VIEW_NAME, PageMode.OVERVIEW));
}
Also used : WebDriver(org.openqa.selenium.WebDriver) PageModeMenuCommand(com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand) Test(org.junit.Test)

Example 7 with Country

use of com.hack23.cia.model.external.worldbank.data.impl.Country in project cia by Hack23.

the class WorldIndicatorChartDataManagerImpl method createIndicatorChart.

@Override
public void createIndicatorChart(final AbstractOrderedLayout content, final List<WorldBankData> list, final ViewWorldbankIndicatorDataCountrySummary summary) {
    final Map<Country, List<WorldBankData>> countryIndicatorsMap = list.stream().collect(Collectors.groupingBy(WorldBankData::getCountry, Collectors.toList()));
    final Series series = new Series();
    final DataSeries dataSeries = new DataSeries();
    for (final Entry<Country, List<WorldBankData>> entry : countryIndicatorsMap.entrySet()) {
        series.addSeries(new XYseries().setLabel(entry.getKey().getValue()));
        dataSeries.newSeries();
        for (final WorldBankData item : entry.getValue()) {
            if (item != null && item.getYearDate() != null && item.getDataValue() != null && !item.getDataValue().isEmpty()) {
                dataSeries.add(item.getYearDate() + "-01-01", Float.valueOf(item.getDataValue()));
            }
        }
    }
    addChart(content, summary.getIndicatorName(), new DCharts().setDataSeries(dataSeries).setOptions(getChartOptions().createOptionsCountryLineChart(series)).show(), false);
}
Also used : DataSeries(org.dussan.vaadin.dcharts.data.DataSeries) Series(org.dussan.vaadin.dcharts.options.Series) WorldBankData(com.hack23.cia.model.external.worldbank.data.impl.WorldBankData) Country(com.hack23.cia.model.external.worldbank.data.impl.Country) List(java.util.List) DataSeries(org.dussan.vaadin.dcharts.data.DataSeries) DCharts(org.dussan.vaadin.dcharts.DCharts) XYseries(org.dussan.vaadin.dcharts.base.elements.XYseries)

Aggregations

PageModeMenuCommand (com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand)4 Test (org.junit.Test)3 WebDriver (org.openqa.selenium.WebDriver)3 VerticalLayout (com.vaadin.ui.VerticalLayout)2 List (java.util.List)2 CountryElement (com.hack23.cia.model.external.worldbank.countries.impl.CountryElement)1 Country (com.hack23.cia.model.external.worldbank.data.impl.Country)1 WorldBankData (com.hack23.cia.model.external.worldbank.data.impl.WorldBankData)1 IndicatorElement (com.hack23.cia.model.external.worldbank.indicators.impl.IndicatorElement)1 ViewWorldbankIndicatorDataCountrySummary (com.hack23.cia.model.internal.application.data.impl.ViewWorldbankIndicatorDataCountrySummary)1 ViewWorldbankIndicatorDataCountrySummary_ (com.hack23.cia.model.internal.application.data.impl.ViewWorldbankIndicatorDataCountrySummary_)1 WorldbankIndicatorDataCountrySummaryEmbeddedId (com.hack23.cia.model.internal.application.data.impl.WorldbankIndicatorDataCountrySummaryEmbeddedId)1 WorldbankIndicatorDataCountrySummaryEmbeddedId_ (com.hack23.cia.model.internal.application.data.impl.WorldbankIndicatorDataCountrySummaryEmbeddedId_)1 ApplicationConfiguration (com.hack23.cia.model.internal.application.system.impl.ApplicationConfiguration)1 ApplicationManager (com.hack23.cia.service.api.ApplicationManager)1 DataContainer (com.hack23.cia.service.api.DataContainer)1 ApplicationMenuItemFactory (com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.ApplicationMenuItemFactory)1 CountryMenuItemFactory (com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.CountryMenuItemFactory)1 ContentRatio (com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio)1 PageMode (com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode)1