Skip to content

Commit

Permalink
partyranking cleanup (#7110)
Browse files Browse the repository at this point in the history
  • Loading branch information
pethers authored Jan 26, 2025
1 parent e2b0032 commit 435f157
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,56 @@
*/
public interface PageCommandPartyRankingConstants {

/** The command parties link. */
PageModeMenuCommand COMMAND_PARTIES_LINK = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.DATAGRID);

/** The command party ranking all members. */
PageModeMenuCommand COMMAND_PARTY_RANKING_ALL_MEMBERS = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, "allmembers");

/** The command party ranking current members. */
PageModeMenuCommand COMMAND_PARTY_RANKING_CURRENT_MEMBERS = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, "currentmembers");


/** The command charts current government parties. */
PageModeMenuCommand COMMAND_CHARTS_CURRENT_GOVERNMENT_PARTIES = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS,
ChartIndicators.CURRENTGOVERMENTPARTIES.toString());

/** The command charts party winner. */
PageModeMenuCommand COMMAND_CHARTS_PARTY_WINNER = new PageModeMenuCommand(
/** The command charts party age. */
PageModeMenuCommand COMMAND_CHARTS_PARTY_AGE = new PageModeMenuCommand(
UserViews.PARLIAMENT_RANKING_VIEW_NAME,
PageMode.CHARTS, ChartIndicators.PARTYWINNER.toString());
PageMode.CHARTS, ChartIndicators.PARTYAGE.toString());

/** The command charts party gender. */
PageModeMenuCommand COMMAND_CHARTS_PARTY_GENDER = new PageModeMenuCommand(
UserViews.PARLIAMENT_RANKING_VIEW_NAME,
PageMode.CHARTS, ChartIndicators.PARTYGENDER.toString());

/** The command charts party age. */
PageModeMenuCommand COMMAND_CHARTS_PARTY_AGE = new PageModeMenuCommand(
/** The command charts party winner. */
PageModeMenuCommand COMMAND_CHARTS_PARTY_WINNER = new PageModeMenuCommand(
UserViews.PARLIAMENT_RANKING_VIEW_NAME,
PageMode.CHARTS, ChartIndicators.PARTYAGE.toString());
PageMode.CHARTS, ChartIndicators.PARTYWINNER.toString());


/** The party ranking command pagevisit history. */
PageModeMenuCommand PARTY_RANKING_COMMAND_PAGEVISIT_HISTORY =
new PageModeMenuCommand(UserViews.PARTY_RANKING_VIEW_NAME, PageMode.PAGEVISITHISTORY);
/** The command party leader scoreboard. */
PageModeMenuCommand COMMAND_PARTY_LEADER_SCOREBOARD = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, ChartIndicators.CURRENTPARTYLEADERSCORECARD.toString());

/** The command party ranking overview. */
PageModeMenuCommand COMMAND_PARTY_RANKING_OVERVIEW = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.OVERVIEW);
/** The command party ranking charts all parties. */
PageModeMenuCommand COMMAND_PARTY_RANKING_CHARTS_ALL_PARTIES = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, ChartIndicators.ALLPARTIES.toString());

/** The command party ranking charts current committees. */
PageModeMenuCommand COMMAND_PARTY_RANKING_CHARTS_CURRENT_COMMITTEES = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS,ChartIndicators.CURRENTCOMMITTEES.toString());

/** The command party ranking charts current parties. */
PageModeMenuCommand COMMAND_PARTY_RANKING_CHARTS_CURRENT_PARTIES = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, ChartIndicators.CURRENTPARTIES.toString());

/** The command party ranking datagrid. */
PageModeMenuCommand COMMAND_PARTY_RANKING_DATAGRID = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.DATAGRID);

/** The command party leader scoreboard. */
PageModeMenuCommand COMMAND_PARTY_LEADER_SCOREBOARD = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, "PARTYLEADERSCOREBOARD");
/** The command party ranking overview. */
PageModeMenuCommand COMMAND_PARTY_RANKING_OVERVIEW = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.OVERVIEW);

/** The command party ranking charts current parties. */
PageModeMenuCommand COMMAND_PARTY_RANKING_CHARTS_CURRENT_PARTIES = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, "CURRENT_PARTIES");

/** The command party ranking charts all parties. */
PageModeMenuCommand COMMAND_PARTY_RANKING_CHARTS_ALL_PARTIES = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, "ALL_PARTIES");

/** The command charts current parties leader scoreboard. */
PageModeMenuCommand COMMAND_CHARTS_CURRENT_PARTIES_LEADER_SCOREBOARD = new PageModeMenuCommand(
UserViews.PARTY_RANKING_VIEW_NAME, PageMode.CHARTS, "CURRENT_PARTIES_LEADER_SCOREBOARD");
/** The party ranking command pagevisit history. */
PageModeMenuCommand PARTY_RANKING_COMMAND_PAGEVISIT_HISTORY =
new PageModeMenuCommand(UserViews.PARTY_RANKING_VIEW_NAME, PageMode.PAGEVISITHISTORY);

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.PartyRankingMenuItemFactory;
import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.PoliticianRankingMenuItemFactory;
import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandMainViewConstants;
import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants;
import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPoliticianConstants;
import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandUserConstants;
import com.hack23.cia.web.impl.ui.application.views.common.rows.RowUtil;
Expand Down Expand Up @@ -90,7 +91,7 @@ public void addRankingMenu(final MenuBar menuBar) {
rankingsMenuItem.addItem(MINISTRIES_LEADER_SCOREBOARD, VaadinIcons.TROPHY,
PageCommandUserConstants.COMMAND_CHARTS_CURRENT_MINISTRIES_LEADER_SCOREBOARD);
rankingsMenuItem.addItem(PART_LEADERS_SCOREBOARD, VaadinIcons.TROPHY,
COMMAND_CHARTS_CURRENT_PARTIES_LEADER_SCOREBOARD);
COMMAND_PARTY_LEADER_SCOREBOARD);

final MenuItem countryMenuItem = rankingsMenuItem.addItem(COUNTRY_RANKING_LINK_TEXT, VaadinIcons.FLAG,
COMMAND_COUNTRY_RANKING_OVERVIEW);
Expand Down Expand Up @@ -146,7 +147,7 @@ public MenuBar createMainPageMenuBar(final MenuBar menuBar) {
@Override
public void createOverviewPage(final VerticalLayout panelContent) {
final ResponsiveRow grid = RowUtil.createGridLayout(panelContent);
createButtonLink(grid, SWEDEN_DASHBOARD, VaadinIcons.FLAG, COMMAND_DASHBOARDVIEW_OVERVIEW, "Visualize political activity in Sweden, present key performance indicators and metadata"); createButtonLink(grid, MINISTRIES_LEADER_SCOREBOARD, VaadinIcons.TROPHY, COMMAND_CHARTS_CURRENT_MINISTRIES_LEADER_SCOREBOARD, MINISTRIES_LEADER_SCOREBOARD_DESCRIPTION); createButtonLink(grid, PART_LEADERS_SCOREBOARD, VaadinIcons.TROPHY, COMMAND_CHARTS_CURRENT_PARTIES_LEADER_SCOREBOARD, DESC_LEADERS_SCOREBOARD); createButtonLink(grid, COUNTRY_RANKING_LINK_TEXT, VaadinIcons.FLAG, COMMAND_COUNTRY_RANKING_OVERVIEW, COUNTRY_RANKING_DESCRIPTION); createButtonLink(grid, MINISTRY_RANKING_LINK_TEXT, VaadinIcons.OFFICE, COMMAND_MINISTRY_RANKING_OVERVIEW, MINISTRY_RANKING_DESCRIPTION); createButtonLink(grid, MINISTRIES_LINK_TEXT, VaadinIcons.OFFICE, COMMAND_MINISTRIES_LINK, MINISTRIES_DESCRIPTION); createButtonLink(grid, GOVERNMENT_BODY_RANKING, VaadinIcons.BUILDING_O, COMMAND_GOVERNMENT_BODY_RANKING_OVERVIEW, GOVERNMENT_BODY_RANKING_DESCRIPTION); createButtonLink(grid, GOVERNMENT_BODIES, VaadinIcons.BUILDING_O, COMMAND_GOVERNMENT_BODY_RANKING_DATAGRID, GOVERNMENT_BODIES_DESCRIPTION); createButtonLink(grid, PARLIAMENT_RANKING_LINK_TEXT, VaadinIcons.INSTITUTION, COMMAND_PARLIAMENT_RANKING_OVERVIEW, PARLIAMENT_RANKING_DESCRIPTION);
createButtonLink(grid, SWEDEN_DASHBOARD, VaadinIcons.FLAG, COMMAND_DASHBOARDVIEW_OVERVIEW, "Visualize political activity in Sweden, present key performance indicators and metadata"); createButtonLink(grid, MINISTRIES_LEADER_SCOREBOARD, VaadinIcons.TROPHY, COMMAND_CHARTS_CURRENT_MINISTRIES_LEADER_SCOREBOARD, MINISTRIES_LEADER_SCOREBOARD_DESCRIPTION); createButtonLink(grid, PART_LEADERS_SCOREBOARD, VaadinIcons.TROPHY, COMMAND_PARTY_LEADER_SCOREBOARD, DESC_LEADERS_SCOREBOARD); createButtonLink(grid, COUNTRY_RANKING_LINK_TEXT, VaadinIcons.FLAG, COMMAND_COUNTRY_RANKING_OVERVIEW, COUNTRY_RANKING_DESCRIPTION); createButtonLink(grid, MINISTRY_RANKING_LINK_TEXT, VaadinIcons.OFFICE, COMMAND_MINISTRY_RANKING_OVERVIEW, MINISTRY_RANKING_DESCRIPTION); createButtonLink(grid, MINISTRIES_LINK_TEXT, VaadinIcons.OFFICE, COMMAND_MINISTRIES_LINK, MINISTRIES_DESCRIPTION); createButtonLink(grid, GOVERNMENT_BODY_RANKING, VaadinIcons.BUILDING_O, COMMAND_GOVERNMENT_BODY_RANKING_OVERVIEW, GOVERNMENT_BODY_RANKING_DESCRIPTION); createButtonLink(grid, GOVERNMENT_BODIES, VaadinIcons.BUILDING_O, COMMAND_GOVERNMENT_BODY_RANKING_DATAGRID, GOVERNMENT_BODIES_DESCRIPTION); createButtonLink(grid, PARLIAMENT_RANKING_LINK_TEXT, VaadinIcons.INSTITUTION, COMMAND_PARLIAMENT_RANKING_OVERVIEW, PARLIAMENT_RANKING_DESCRIPTION);
createButtonLink(grid, COMMITTEE_RANKING_LINK_TEXT, VaadinIcons.GROUP, COMMAND_COMMITTEE_RANKING_OVERVIEW,
COMMITTEE_RANKING_DESCRIPTION);
createButtonLink(grid, COMMITTEES_LINK_TEXT, VaadinIcons.GROUP,
Expand All @@ -155,7 +156,7 @@ public void createOverviewPage(final VerticalLayout panelContent) {
createButtonLink(grid, PARTY_RANKING_LINK_TEXT, VaadinIcons.USERS, COMMAND_PARTY_RANKING_OVERVIEW,
PARTY_RANKING_DESCRIPTION);
createButtonLink(grid, PARTIES_LINK_TEXT, VaadinIcons.USERS,
COMMAND_PARTIES_LINK,
PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_DATAGRID,
PARTIES_DESCRIPTION);
createButtonLink(grid, POLITICIAN_RANKING_LINK_TEXT, VaadinIcons.USER, POLITICIAN_RANKING_COMMAND_DATAGRID,
POLITICIAN_RANKING_DESCRIPTION);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void createOverviewPage(final VerticalLayout panelContent) {
final ResponsiveRow grid = RowUtil.createGridLayout(panelContent);

createButtonLink(grid, PART_LEADERS_SCOREBOARD, VaadinIcons.TROPHY,
COMMAND_CHARTS_CURRENT_PARTIES_LEADER_SCOREBOARD, DESC_LEADERS_SCOREBOARD);
COMMAND_PARTY_LEADER_SCOREBOARD, DESC_LEADERS_SCOREBOARD);

createButtonLink(grid, TOTAL_MEMBERS, VaadinIcons.USERS,
PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_DATAGRID, DESC_ALL_PARTIES_ROLES);
Expand Down Expand Up @@ -125,7 +125,7 @@ public void createPartyRankingTopics(final MenuItem partynMenuItem) {
partynMenuItem.addItem(OVERVIEW_TEXT, VaadinIcons.DASHBOARD, PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_OVERVIEW);

partynMenuItem.addItem(PART_LEADERS_SCOREBOARD, VaadinIcons.TROPHY,
COMMAND_CHARTS_CURRENT_PARTIES_LEADER_SCOREBOARD);
COMMAND_PARTY_LEADER_SCOREBOARD);

// Total members using USERS icon for multiple people
final MenuItem listItem = partynMenuItem.addItem(TOTAL_MEMBERS, VaadinIcons.USERS, PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_DATAGRID);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.hack23.cia.web.impl.ui.application.views.user.party.pagemode;

/**
* The Interface PartyViewConstants.
*/
public interface PartyViewConstants {

}

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package com.hack23.cia.web.impl.ui.application.views.user.partyranking.pagemode;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Service;
Expand All @@ -27,10 +26,9 @@
import com.hack23.cia.web.impl.ui.application.action.ViewAction;
import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.ChartDataManager;
import com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.PartyDataSeriesFactory;
import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants;
import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil;
import com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Layout;
Expand Down Expand Up @@ -93,8 +91,7 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina

@Override
public boolean matches(final String page, final String parameters) {
return NAME.equals(page) && StringUtils.contains(parameters, PageMode.CHARTS.toString())
&& parameters.contains(ChartIndicators.ALLPARTIES.toString());
return PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_CHARTS_ALL_PARTIES.matches(page, parameters);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package com.hack23.cia.web.impl.ui.application.views.user.partyranking.pagemode;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Service;
Expand All @@ -27,10 +26,9 @@
import com.hack23.cia.web.impl.ui.application.action.ViewAction;
import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.ChartDataManager;
import com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.PartyDataSeriesFactory;
import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants;
import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil;
import com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Layout;
Expand Down Expand Up @@ -92,8 +90,7 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina

@Override
public boolean matches(final String page, final String parameters) {
return NAME.equals(page) && StringUtils.contains(parameters, PageMode.CHARTS.toString())
&& parameters.contains(ChartIndicators.CURRENTCOMMITTEES.toString());
return PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_CHARTS_CURRENT_COMMITTEES.matches(page, parameters);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package com.hack23.cia.web.impl.ui.application.views.user.partyranking.pagemode;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Service;
Expand All @@ -27,10 +26,9 @@
import com.hack23.cia.web.impl.ui.application.action.ViewAction;
import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.ChartDataManager;
import com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.PartyDataSeriesFactory;
import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants;
import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil;
import com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Layout;
Expand Down Expand Up @@ -93,8 +91,7 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina

@Override
public boolean matches(final String page, final String parameters) {
return NAME.equals(page) && StringUtils.contains(parameters, PageMode.CHARTS.toString())
&& parameters.contains(ChartIndicators.CURRENTGOVERMENTPARTIES.toString());
return PageCommandPartyRankingConstants.COMMAND_CHARTS_CURRENT_GOVERNMENT_PARTIES.matches(page, parameters);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
*/
package com.hack23.cia.web.impl.ui.application.views.user.partyranking.pagemode;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Service;
Expand All @@ -27,10 +26,9 @@
import com.hack23.cia.web.impl.ui.application.action.ViewAction;
import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.ChartDataManager;
import com.hack23.cia.web.impl.ui.application.views.common.dataseriesfactory.api.PartyDataSeriesFactory;
import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPartyRankingConstants;
import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil;
import com.hack23.cia.web.impl.ui.application.views.common.sizing.ContentRatio;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.ChartIndicators;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews;
import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Layout;
Expand Down Expand Up @@ -94,8 +92,7 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina

@Override
public boolean matches(final String page, final String parameters) {
return NAME.equals(page) && StringUtils.contains(parameters, PageMode.CHARTS.toString())
&& parameters.contains(ChartIndicators.CURRENTPARTIES.toString());
return PageCommandPartyRankingConstants.COMMAND_PARTY_RANKING_CHARTS_CURRENT_PARTIES.matches(page, parameters);
}


Expand Down
Loading

0 comments on commit 435f157

Please sign in to comment.