AbstractAdminSystemPageModContentFactoryImpl.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.admin.system.pagemode;

  20. import org.springframework.beans.factory.annotation.Autowired;

  21. import com.hack23.cia.web.impl.ui.application.views.common.pagemode.AbstractBasicPageModContentFactoryImpl;
  22. import com.hack23.cia.web.impl.ui.application.views.common.paging.PagingUtil;
  23. import com.vaadin.ui.HorizontalLayout;

  24. /**
  25.  * The Class AbstractAdminSystemPageModContentFactoryImpl.
  26.  */
  27. public abstract class AbstractAdminSystemPageModContentFactoryImpl extends AbstractBasicPageModContentFactoryImpl {

  28.     /** The paging util. */
  29.     @Autowired
  30.     private PagingUtil pagingUtil;

  31.     /** The view name. */
  32.     private final String viewName;

  33.     /**
  34.      * Instantiates a new abstract admin system page mod content factory impl.
  35.      *
  36.      * @param viewName the view name
  37.      */
  38.     public AbstractAdminSystemPageModContentFactoryImpl(final String viewName) {
  39.         super();
  40.         this.viewName = viewName;
  41.     }

  42.     /**
  43.      * Gets the paging util.
  44.      *
  45.      * @return the paging util
  46.      */
  47.     protected final PagingUtil getPagingUtil() {
  48.         return pagingUtil;
  49.     }

  50.     @Override
  51.     public boolean matches(final String page, final String parameters) {
  52.         return viewName.equals(page);
  53.     }

  54.     /**
  55.      * Creates a consistent HorizontalLayout for panel content.
  56.      *
  57.      * @return the horizontal layout
  58.      */
  59.     protected HorizontalLayout createHorizontalLayout() {
  60.         final HorizontalLayout layout = new HorizontalLayout();
  61.         layout.setSizeFull();
  62.         layout.setMargin(true);
  63.         layout.setSpacing(true);
  64.         return layout;
  65.     }

  66. }