GovernmentBodyRankingPageVisitHistoryPageModContentFactoryImpl.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.govermentbodyranking.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.PageCommandGovernmentBodyRankingConstants;
  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.hack23.cia.web.impl.ui.application.views.user.govermentbody.pagemode.GovernmentBodyDescriptionConstants;
  28. import com.vaadin.ui.Layout;
  29. import com.vaadin.ui.MenuBar;
  30. import com.vaadin.ui.Panel;
  31. import com.vaadin.ui.VerticalLayout;

  32. /**
  33.  * The Class GovernmentBodyRankingPageVisitHistoryPageModContentFactoryImpl.
  34.  */
  35. @Component
  36. public final class GovernmentBodyRankingPageVisitHistoryPageModContentFactoryImpl
  37.         extends AbstractGovernmentBodyRankingPageModContentFactoryImpl {

  38.     /** The Constant NAME. */
  39.     public static final String NAME = UserViews.GOVERNMENT_BODY_RANKING_VIEW_NAME;

  40.     /**
  41.      * Instantiates a new government body ranking page visit history page mod
  42.      * content factory impl.
  43.      */
  44.     public GovernmentBodyRankingPageVisitHistoryPageModContentFactoryImpl() {
  45.         super();
  46.     }

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

  51.         getGovernmentBodyRankingMenuItemFactory().createGovernmentBodyRankingMenuBar(menuBar);

  52.         final String pageId = getPageId(parameters);

  53.         createHeader(panel, panelContent);

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

  55.         getPageActionEventHelper().createPageEvent(ViewAction.VISIT_GOVERNMENT_BODY_RANKING_VIEW, ApplicationEventGroup.USER,
  56.                 NAME, parameters, pageId);

  57.         return panelContent;

  58.     }

  59.     /**
  60.      * Creates the header.
  61.      *
  62.      * @param panel the panel
  63.      * @param panelContent the panel content
  64.      */
  65.     private void createHeader(final Panel panel, final VerticalLayout panelContent) {
  66.         CardInfoRowUtil.createPageHeader(panel, panelContent,
  67.             GovernmentBodyDescriptionConstants.VISIT_HISTORY_HEADER,
  68.             GovernmentBodyDescriptionConstants.VISIT_HISTORY_SUBTITLE,
  69.             GovernmentBodyDescriptionConstants.VISIT_HISTORY_DESC);
  70.     }

  71.     @Override
  72.     public boolean matches(final String page, final String parameters) {
  73.         return PageCommandGovernmentBodyRankingConstants.GOVERNMENT_RANKING_COMMAND_PAGEVISIT_HISTORY.matches(page, parameters);
  74.     }

  75. }