PoliticianRankingPageVisitHistoryPageModContentFactoryImpl.java

  1. /*
  2.  * Copyright 2010-2025 James Pether Sörling
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *   http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  *
  16.  *  $Id$
  17.  *  $HeadURL$
  18. */
  19. package com.hack23.cia.web.impl.ui.application.views.user.politicianranking.pagemode;

  20. import org.springframework.security.access.annotation.Secured;
  21. import org.springframework.stereotype.Component;

  22. import com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup;
  23. import com.hack23.cia.web.impl.ui.application.action.ViewAction;
  24. import com.hack23.cia.web.impl.ui.application.views.common.menufactory.api.pagecommands.PageCommandPoliticianRankingConstants;
  25. import com.hack23.cia.web.impl.ui.application.views.common.pagemode.CardInfoRowUtil;
  26. import com.hack23.cia.web.impl.ui.application.views.common.viewnames.UserViews;
  27. import com.vaadin.ui.Layout;
  28. import com.vaadin.ui.MenuBar;
  29. import com.vaadin.ui.Panel;
  30. import com.vaadin.ui.VerticalLayout;

  31. /**
  32.  * The Class PoliticianRankingPageVisitHistoryPageModContentFactoryImpl.
  33.  */
  34. @Component
  35. public final class PoliticianRankingPageVisitHistoryPageModContentFactoryImpl
  36.         extends AbstractPoliticianRankingPageModContentFactoryImpl {

  37.     /** The Constant NAME. */
  38.     public static final String NAME = UserViews.POLITICIAN_RANKING_VIEW_NAME;

  39.     /**
  40.      * Instantiates a new politician ranking page visit history page mod content
  41.      * factory impl.
  42.      */
  43.     public PoliticianRankingPageVisitHistoryPageModContentFactoryImpl() {
  44.         super();
  45.     }

  46.     @Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
  47.     @Override
  48.     public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
  49.         final VerticalLayout panelContent = createPanelContent();

  50.         getPoliticianRankingMenuItemFactory().createPoliticianRankingMenuBar(menuBar);
  51.         CardInfoRowUtil.createPageHeader(panel, panelContent,
  52.             PoliticianRankingDescriptionConstants.VISIT_HISTORY_HEADER,
  53.             PoliticianRankingDescriptionConstants.VISIT_HISTORY_SUBTITLE,
  54.             PoliticianRankingDescriptionConstants.VISIT_HISTORY_DESC);

  55.         final String pageId = getPageId(parameters);

  56.         getAdminChartDataManager().createApplicationActionEventPageModeDailySummaryChart(panelContent,NAME);

  57.         getPageActionEventHelper().createPageEvent(ViewAction.VISIT_POLITICIAN_RANKING_VIEW, ApplicationEventGroup.USER,
  58.                 NAME, parameters, pageId);

  59.         return panelContent;

  60.     }

  61.     @Override
  62.     public boolean matches(final String page, final String parameters) {
  63.         return PageCommandPoliticianRankingConstants.POLITICIAN_RANKING_COMMAND_PAGEVISIT_HISTORY.matches(page, parameters);
  64.     }

  65. }