View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
3   	$Id
4   */
5   
6   package com.hack23.cia.web.viewfactory.impl.user;
7   
8   import java.util.List;
9   
10  import com.hack23.cia.model.sweden.impl.Vote;
11  import com.hack23.cia.web.viewfactory.api.user.VotesModelAndView;
12  import com.hack23.cia.web.views.common.ActiveUserView;
13  import com.hack23.cia.web.views.user.BallotPanel;
14  
15  /***
16   * The Class VotesViewFactoryImpl.
17   */
18  public class VotesViewFactoryImpl extends
19          AbstractParliamentViewFactoryImpl<VotesModelAndView> {
20  
21      /*
22       * (non-Javadoc)
23       * 
24       * @seecom.hack23.cia.web.viewfactory.impl.common.ViewFactory#
25       * getSupportedModelAndView()
26       */
27      @SuppressWarnings("unchecked")
28      @Override
29      public final Class getSupportedModelAndView() {
30          return VotesModelAndView.class;
31      }
32  
33      /*
34       * (non-Javadoc)
35       * 
36       * @seecom.hack23.cia.web.viewfactory.impl.common.AbstractViewFactoryImpl#
37       * processSpecificView
38       * (com.hack23.cia.web.viewfactory.api.common.AbstractModelAndView)
39       */
40      @Override
41      public final void processSpecificView(final VotesModelAndView modelAndView) {
42          final List<Vote> votes = modelAndView.getVotes();
43          ActiveUserView.changeContentView(new BallotPanel(modelAndView.getUserSessionDTO(),votes.get(
44                          0).getBallot()));
45      }
46  }