Coverage Report - org.jtheque.films.stats.view.impl.actions.AcRefreshStats
 
Classes in this File Line Coverage Branch Coverage Complexity
AcRefreshStats
0 %
0/11
N/A
1
 
 1  
 package org.jtheque.films.stats.view.impl.actions;
 2  
 
 3  
 /*
 4  
  * This file is part of JTheque.
 5  
  *
 6  
  * JTheque is free software: you can redistribute it and/or modify
 7  
  * it under the terms of the GNU General Public License as published by
 8  
  * the Free Software Foundation, either version 3 of the License.
 9  
  *
 10  
  * JTheque is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13  
  * GNU General Public License for more details.
 14  
  *
 15  
  * You should have received a copy of the GNU General Public License
 16  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 17  
  */
 18  
 
 19  
 import org.jtheque.core.managers.Managers;
 20  
 import org.jtheque.core.managers.beans.IBeansManager;
 21  
 import org.jtheque.core.managers.resource.IResourceManager;
 22  
 import org.jtheque.core.managers.resource.ImageType;
 23  
 import org.jtheque.core.managers.view.able.IViewManager;
 24  
 import org.jtheque.core.managers.view.impl.actions.JThequeAction;
 25  
 import org.jtheque.films.stats.controller.able.IStatsController;
 26  
 import org.jtheque.films.stats.services.able.IStatsService;
 27  
 import org.jtheque.films.stats.view.able.IStatsView;
 28  
 import org.jtheque.films.utils.Constants;
 29  
 
 30  
 import javax.annotation.Resource;
 31  
 import java.awt.event.ActionEvent;
 32  
 
 33  
 /**
 34  
  * Action to refresh the stats view.
 35  
  *
 36  
  * @author Baptiste Wicht
 37  
  */
 38  
 public final class AcRefreshStats extends JThequeAction {
 39  
     /**
 40  
      * Construct a new AcRefreshStats.
 41  
      */
 42  
     public AcRefreshStats() {
 43  0
         super("stats.actions.refresh");
 44  
 
 45  0
         setIcon(Managers.getManager(IResourceManager.class).getIcon(Constants.IMAGE_BASE_NAME, "refresh", ImageType.PNG));
 46  0
     }
 47  
 
 48  
     @Override
 49  
     public void actionPerformed(ActionEvent event) {
 50  0
         IStatsView view = Managers.getManager(IBeansManager.class).<IStatsController>getBean("statsController").getView();
 51  
 
 52  0
         Managers.getManager(IBeansManager.class).<IStatsService>getBean("statsService").refreshStats();
 53  0
         String[] titles = Managers.getManager(IBeansManager.class).<IStatsService>getBean("statsService").getTitles();
 54  
 
 55  0
         view.getHeaderRealizers().setDescription(titles[0]);
 56  0
         view.getHeaderActors().setDescription(titles[1]);
 57  0
         view.getHeaderFilms().setDescription(titles[2]);
 58  
 
 59  0
         Managers.getManager(IViewManager.class).refresh(view.getTab());
 60  0
     }
 61  
 }