AbstractChartDataManagerImpl.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.common.chartfactory.impl;

  20. import org.dussan.vaadin.dcharts.DCharts;
  21. import org.springframework.beans.factory.annotation.Autowired;

  22. import com.hack23.cia.service.api.ApplicationManager;
  23. import com.hack23.cia.web.impl.ui.application.views.common.chartfactory.api.ChartOptions;
  24. import com.vaadin.ui.AbstractOrderedLayout;

  25. /**
  26.  * The Class AbstractChartDataManagerImpl.
  27.  */
  28. public abstract class AbstractChartDataManagerImpl {

  29.     /** The application manager. */
  30.     @Autowired
  31.     private ApplicationManager applicationManager;

  32.     /** The chart options. */
  33.     @Autowired
  34.     private ChartOptions chartOptions;

  35.     /**
  36.      * Instantiates a new abstract chart data manager impl.
  37.      */
  38.     public AbstractChartDataManagerImpl() {
  39.         super();
  40.     }

  41.     /**
  42.      * Adds the chart.
  43.      *
  44.      * @param layout
  45.      *            the layout
  46.      * @param caption
  47.      *            the caption
  48.      * @param chart
  49.      *            the chart
  50.      * @param isFullPage
  51.      *            the isFullPage
  52.      */
  53.     protected static final void addChart(final AbstractOrderedLayout layout, final String caption, final DCharts chart, final boolean isFullPage) {
  54.         ChartUtils.addChart(layout, caption, chart, isFullPage);
  55.     }

  56.     /**
  57.      * Gets the application manager.
  58.      *
  59.      * @return the application manager
  60.      */
  61.     protected final ApplicationManager getApplicationManager() {
  62.         return applicationManager;
  63.     }

  64.     /**
  65.      * Gets the chart options.
  66.      *
  67.      * @return the chart options
  68.      */
  69.     protected final ChartOptions getChartOptions() {
  70.         return chartOptions;
  71.     }

  72.     /**
  73.      * Gets the party name.
  74.      *
  75.      * @param partySummary
  76.      *            the partySummary
  77.      * @return the party name
  78.      */
  79.     protected final String getPartyName(final String partySummary) {
  80.         return ChartUtils.getPartyName(applicationManager, partySummary);
  81.     }
  82. }