Search in sources :

Example 1 with PageModeMenuCommand

use of com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand in project cia by Hack23.

the class BallotMenuItemFactoryImpl method createBallotMenuBar.

@Override
public void createBallotMenuBar(final MenuBar menuBar, final String pageId) {
    initApplicationMenuBar(menuBar);
    menuBar.addItem(OVERVIEW_TEXT, VaadinIcons.PIE_CHART, new PageModeMenuCommand(UserViews.BALLOT_VIEW_NAME, PageMode.OVERVIEW, pageId));
    menuBar.addItem(CHARTS_TEXT, VaadinIcons.PIE_CHART, new PageModeMenuCommand(UserViews.BALLOT_VIEW_NAME, PageMode.CHARTS, pageId));
}
Also used : PageModeMenuCommand(com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand)

Example 2 with PageModeMenuCommand

use of com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand in project cia by Hack23.

the class CommitteeMenuItemFactoryImpl method createOverviewPage.

@Override
public void createOverviewPage(final VerticalLayout panelContent, final String pageId) {
    final ResponsiveRow grid = createGridLayout(panelContent);
    createButtonLink(grid, CURRENT_MEMBERS_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.COMMITTEE_VIEW_NAME, CommitteePageMode.CURRENT_MEMBERS.toString(), pageId), "Current roles and days served");
    createButtonLink(grid, MEMBER_HISTORY_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.COMMITTEE_VIEW_NAME, CommitteePageMode.MEMBERHISTORY.toString(), pageId), "History of all roles and days served");
    createButtonLink(grid, ROLE_GHANT_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.COMMITTEE_VIEW_NAME, CommitteePageMode.ROLEGHANT.toString(), pageId), "Gantt chart of all roles over time");
    createButtonLink(grid, DOCUMENT_ACTIVITY_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.COMMITTEE_VIEW_NAME, CommitteePageMode.DOCUMENTACTIVITY.toString(), pageId), "Chart of document activity by document type.");
    createButtonLink(grid, DOCUMENT_HISTORY_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.COMMITTEE_VIEW_NAME, CommitteePageMode.DOCUMENT_HISTORY.toString(), pageId), "Document history list");
    createButtonLink(grid, BALLOT_DECISION_SUMMARY_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.COMMITTEE_VIEW_NAME, CommitteePageMode.BALLOTDECISIONSUMMARY.toString(), pageId), "Summary of all ballot decisions");
    createButtonLink(grid, DECISION_SUMMARY_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.COMMITTEE_VIEW_NAME, CommitteePageMode.DECISIONSUMMARY.toString(), pageId), "Summary of all ballots");
    createButtonLink(grid, DECISION_TYPE_DAILY_SUMMARY_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.COMMITTEE_VIEW_NAME, CommitteePageMode.DECISIONTYPEDAILYSUMMARY.toString(), pageId), "Chart over decisions by decisions type, daily summary");
    createButtonLink(grid, "Decision flow", VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.COMMITTEE_VIEW_NAME, PageMode.CHARTS + "/" + ChartIndicators.DECISION_FLOW_CHART, pageId), "desc");
    createButtonLink(grid, PAGE_VISIT_HISTORY_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.COMMITTEE_VIEW_NAME, PageMode.PAGEVISITHISTORY, pageId), "View history of page visit for this page.");
}
Also used : PageModeMenuCommand(com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand) ResponsiveRow(com.jarektoro.responsivelayout.ResponsiveRow)

Example 3 with PageModeMenuCommand

use of com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand in project cia by Hack23.

the class CountryMenuItemFactoryImpl method addSourcesAndIndicatorsToMenu.

/**
 * Adds the sources and indicators to menu.
 *
 * @param countryIndicators
 *            the country indicators
 * @param sourceIndicatorMap
 *            the source indicator map
 */
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) {
            MenuItem addItem = sourceItems.addItem(indciatorSummary.getIndicatorName(), new PageModeMenuCommand(UserViews.COUNTRY_RANKING_VIEW_NAME, PageMode.INDICATORS, indciatorSummary.getEmbeddedId().getIndicatorId()));
            addItem.setStyleName("RestrictedHeader");
        }
    }
}
Also used : PageMode(com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode) Arrays(java.util.Arrays) MenuItem(com.vaadin.ui.MenuBar.MenuItem) WorldbankIndicatorDataCountrySummaryEmbeddedId_(com.hack23.cia.model.internal.application.data.impl.WorldbankIndicatorDataCountrySummaryEmbeddedId_) VerticalLayout(com.vaadin.ui.VerticalLayout) Alignment(com.vaadin.ui.Alignment) Autowired(org.springframework.beans.factory.annotation.Autowired) ViewWorldbankIndicatorDataCountrySummary_(com.hack23.cia.model.internal.application.data.impl.ViewWorldbankIndicatorDataCountrySummary_) LinkedHashMap(java.util.LinkedHashMap) PageModeMenuCommand(com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand) Service(org.springframework.stereotype.Service) Map(java.util.Map) ViewWorldbankIndicatorDataCountrySummary(com.hack23.cia.model.internal.application.data.impl.ViewWorldbankIndicatorDataCountrySummary) VaadinIcons(com.vaadin.icons.VaadinIcons) SimpleEntry(java.util.AbstractMap.SimpleEntry) ContentRatio(com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio) MenuBar(com.vaadin.ui.MenuBar) UserViews(com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews) Collectors(java.util.stream.Collectors) ApplicationManager(com.hack23.cia.service.api.ApplicationManager) CountryMenuItemFactory(com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.CountryMenuItemFactory) DataContainer(com.hack23.cia.service.api.DataContainer) AbstractMap(java.util.AbstractMap) List(java.util.List) ApplicationMenuItemFactory(com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.ApplicationMenuItemFactory) WorldbankIndicatorDataCountrySummaryEmbeddedId(com.hack23.cia.model.internal.application.data.impl.WorldbankIndicatorDataCountrySummaryEmbeddedId) Entry(java.util.Map.Entry) PageModeMenuCommand(com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand) ViewWorldbankIndicatorDataCountrySummary(com.hack23.cia.model.internal.application.data.impl.ViewWorldbankIndicatorDataCountrySummary) List(java.util.List) MenuItem(com.vaadin.ui.MenuBar.MenuItem) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) AbstractMap(java.util.AbstractMap)

Example 4 with PageModeMenuCommand

use of com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand in project cia by Hack23.

the class MinistryMenuItemFactoryImpl method createMinistryMenuBar.

@Override
public void createMinistryMenuBar(final MenuBar menuBar, final String pageId) {
    initApplicationMenuBar(menuBar);
    applicationMenuItemFactory.addRankingMenu(menuBar);
    ministryRankingMenuItemFactory.createMinistryRankingTopics(menuBar.addItem(MINISTRY_RANKING, VaadinIcons.GROUP, null));
    final MenuItem ministryItem = menuBar.addItem("Ministry " + pageId, VaadinIcons.GROUP, null);
    ministryItem.addItem(OVERVIEW_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, PageMode.OVERVIEW, pageId));
    final MenuItem rolesItem = ministryItem.addItem(ROLES_TEXT, VaadinIcons.GROUP, null);
    rolesItem.addItem(CURRENT_MEMBERS_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, MinistryPageMode.CURRENTMEMBERS.toString(), pageId));
    rolesItem.addItem(MEMBER_HISTORY_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, MinistryPageMode.MEMBERHISTORY.toString(), pageId));
    rolesItem.addItem(ROLE_GHANT_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, MinistryPageMode.ROLEGHANT.toString(), pageId));
    rolesItem.addItem(GOVERNMENT_BODIES, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, MinistryPageMode.GOVERNMENT_BODIES.toString(), pageId));
    final MenuItem documentItem = ministryItem.addItem(DOCUMENTS_TEXT, VaadinIcons.GROUP, null);
    documentItem.addItem(DOCUMENT_ACTIVITY_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, MinistryPageMode.DOCUMENTACTIVITY.toString(), pageId));
    documentItem.addItem(DOCUMENT_HISTORY_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, MinistryPageMode.DOCUMENTHISTORY.toString(), pageId));
    ministryItem.addItem(PAGE_VISIT_HISTORY_TEXT, VaadinIcons.GROUP, new PageModeMenuCommand(UserViews.MINISTRY_VIEW_NAME, PageMode.PAGEVISITHISTORY, pageId));
}
Also used : PageModeMenuCommand(com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand) MenuItem(com.vaadin.ui.MenuBar.MenuItem)

Example 5 with PageModeMenuCommand

use of com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand in project cia by Hack23.

the class PoliticianMenuItemFactoryImpl method createPoliticianMenuBar.

@Override
public void createPoliticianMenuBar(final MenuBar menuBar, final String pageId) {
    initApplicationMenuBar(menuBar);
    applicationMenuItemFactory.addRankingMenu(menuBar);
    politicianRankingMenuItemFactory.createPoliticianRankingTopics(menuBar.addItem(POLITICIAN_RANKING, VaadinIcons.BUG, null));
    final MenuItem politicanItem = menuBar.addItem("Politician " + pageId, VaadinIcons.BUG, null);
    politicanItem.addItem(OVERVIEW_TEXT, VaadinIcons.BUG, new PageModeMenuCommand(UserViews.POLITICIAN_VIEW_NAME, PageMode.OVERVIEW, pageId));
    politicanItem.addItem(INDICATORS_TEXT, VaadinIcons.BUG, new PageModeMenuCommand(UserViews.POLITICIAN_VIEW_NAME, PageMode.INDICATORS, pageId));
    final MenuItem rolesItem = politicanItem.addItem(ROLES_TEXT, VaadinIcons.BUG, null);
    rolesItem.addItem(TOTAL_EXPERIENCE, VaadinIcons.BUG, new PageModeMenuCommand(UserViews.POLITICIAN_VIEW_NAME, PoliticianPageMode.ROLESUMMARY.toString(), pageId));
    rolesItem.addItem(ROLE_LIST, VaadinIcons.BUG, new PageModeMenuCommand(UserViews.POLITICIAN_VIEW_NAME, PoliticianPageMode.ROLELIST.toString(), pageId));
    rolesItem.addItem(ROLE_GHANT_TEXT, VaadinIcons.BUG, new PageModeMenuCommand(UserViews.POLITICIAN_VIEW_NAME, PoliticianPageMode.ROLEGHANT.toString(), pageId));
    final MenuItem documentItem = politicanItem.addItem(DOCUMENTS_TEXT, VaadinIcons.BUG, null);
    documentItem.addItem(DOCUMENT_ACTIVITY_TEXT, VaadinIcons.BUG, new PageModeMenuCommand(UserViews.POLITICIAN_VIEW_NAME, PoliticianPageMode.DOCUMENTACTIVITY.toString(), pageId));
    documentItem.addItem(DOCUMENT_HISTORY_TEXT, VaadinIcons.BUG, new PageModeMenuCommand(UserViews.POLITICIAN_VIEW_NAME, PoliticianPageMode.DOCUMENTHISTORY.toString(), pageId));
    final MenuItem ballotItem = politicanItem.addItem(BALLOTS_TEXT, VaadinIcons.BUG, null);
    ballotItem.addItem(VOTE_HISTORY, VaadinIcons.BUG, new PageModeMenuCommand(UserViews.POLITICIAN_VIEW_NAME, PoliticianPageMode.VOTEHISTORY.toString(), pageId));
    ballotItem.addItem(BALLOT_DECISION_SUMMARY_TEXT, VaadinIcons.BUG, new PageModeMenuCommand(UserViews.POLITICIAN_VIEW_NAME, PoliticianPageMode.BALLOTDECISIONSUMMARY.toString(), pageId));
    politicanItem.addItem(PAGE_VISIT_HISTORY_TEXT, VaadinIcons.BUG, new PageModeMenuCommand(UserViews.POLITICIAN_VIEW_NAME, PageMode.PAGEVISITHISTORY, pageId));
}
Also used : PageModeMenuCommand(com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand) MenuItem(com.vaadin.ui.MenuBar.MenuItem)

Aggregations

PageModeMenuCommand (com.hack23.cia.web.impl.ui.application.views.common.pagelinks.api.PageModeMenuCommand)151 Test (org.junit.Test)135 WebDriver (org.openqa.selenium.WebDriver)135 WebElement (org.openqa.selenium.WebElement)12 ResponsiveRow (com.jarektoro.responsivelayout.ResponsiveRow)7 MenuItem (com.vaadin.ui.MenuBar.MenuItem)7 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 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 UserViews (com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews)1 VaadinIcons (com.vaadin.icons.VaadinIcons)1 Alignment (com.vaadin.ui.Alignment)1 MenuBar (com.vaadin.ui.MenuBar)1