Coverage Report - org.jtheque.primary.controller.impl.ChoiceController
 
Classes in this File Line Coverage Branch Coverage Complexity
ChoiceController
0 %
0/14
N/A
1
 
 1  
 package org.jtheque.primary.controller.impl;
 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.view.able.IView;
 20  
 import org.jtheque.core.managers.view.able.controller.AbstractController;
 21  
 import org.jtheque.primary.controller.able.IChoiceController;
 22  
 import org.jtheque.primary.view.able.IChoiceView;
 23  
 import org.jtheque.primary.view.impl.choice.ChoiceAction;
 24  
 import org.jtheque.primary.view.impl.choice.ChoiceActionFactory;
 25  
 
 26  
 import javax.annotation.Resource;
 27  
 
 28  
 /**
 29  
  * A Choice Controller.
 30  
  *
 31  
  * @author Baptiste Wicht
 32  
  */
 33  0
 public final class ChoiceController extends AbstractController implements IChoiceController {
 34  
         private String action;
 35  
         private String content;
 36  
 
 37  
         @Resource
 38  
         private IChoiceView choiceView;
 39  
 
 40  
         @Override
 41  
         public void doAction(Object selectedItem){
 42  0
                 ChoiceAction choiceAction = ChoiceActionFactory.getChoiceAction(action);
 43  0
                 choiceAction.setSelectedItem(selectedItem);
 44  0
                 choiceAction.setContent(content);
 45  0
                 choiceAction.execute();
 46  
 
 47  0
                 closeView();
 48  0
         }
 49  
 
 50  
         @Override
 51  
         public void setAction(String action){
 52  0
                 this.action = action;
 53  0
         }
 54  
 
 55  
         @Override
 56  
         public void setContent(String content){
 57  0
                 this.content = content;
 58  0
         }
 59  
 
 60  
         @Override
 61  
         public void displayView(){
 62  0
                 choiceView.display(content);
 63  0
         }
 64  
 
 65  
         @Override
 66  
         public IView getView(){
 67  0
                 return choiceView;
 68  
         }
 69  
 }