Coverage Report - org.jtheque.films.view.impl.AbstractDelegatedView
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractDelegatedView
0 %
0/19
N/A
1
AbstractDelegatedView$1
0 %
0/3
N/A
1
 
 1  
 package org.jtheque.films.view.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.Managers;
 20  
 import org.jtheque.core.managers.view.able.IView;
 21  
 import org.jtheque.core.managers.view.able.IViewManager;
 22  
 import org.jtheque.core.managers.view.able.components.IModel;
 23  
 import org.jtheque.core.managers.view.edt.SimpleTask;
 24  
 
 25  
 /**
 26  
  * An abstract delegated view. It seems a view who delegates all the view's operations to an other view. 
 27  
  * 
 28  
  * @author Baptiste Wicht
 29  
  */
 30  0
 public abstract class AbstractDelegatedView implements IView {
 31  
     /**
 32  
      * Return the implementation of the view. 
 33  
      * 
 34  
      * @return The implementation of the view. 
 35  
      */
 36  
     public abstract IView getImplementationView();
 37  
 
 38  
     /**
 39  
      * Build the delegated view in EDT. This method only call the buildDelegatedView() method in the EDT. 
 40  
      */
 41  
     public final void buildInEDT(){
 42  0
         Managers.getManager(IViewManager.class).execute(new SimpleTask(){
 43  
             @Override
 44  
             public void run() {
 45  0
                 buildDelegatedView();
 46  0
             }
 47  
         });
 48  0
     }
 49  
 
 50  
     /**
 51  
      * Build the delegated view. This method must only be called from the buildInEDT() method. With that contract respected, 
 52  
      * this method is always called in the EDT. 
 53  
      */
 54  
     protected abstract void buildDelegatedView();
 55  
 
 56  
     @Override
 57  
     public final void display() {
 58  0
         getImplementationView().display();
 59  0
     }
 60  
 
 61  
     @Override
 62  
     public final Object getImpl() {
 63  0
         return getImplementationView().getImpl();
 64  
     }
 65  
 
 66  
     @Override
 67  
     public final void closeDown() {
 68  0
         getImplementationView().closeDown();
 69  0
     }
 70  
 
 71  
     @Override
 72  
     public final void toFirstPlan() {
 73  0
         getImplementationView().toFirstPlan();
 74  0
     }
 75  
 
 76  
     @Override
 77  
     public final void setEnabled(boolean enabled) {
 78  0
         getImplementationView().setEnabled(enabled);
 79  0
     }
 80  
 
 81  
     @Override
 82  
     public final boolean isEnabled() {
 83  0
         return getImplementationView().isEnabled();
 84  
     }
 85  
 
 86  
     @Override
 87  
     public final void sendMessage(String message, Object value) {
 88  0
         getImplementationView().sendMessage(message, value);
 89  0
     }
 90  
 
 91  
     @Override
 92  
     public final void refresh() {
 93  0
         getImplementationView().refresh();
 94  0
     }
 95  
 
 96  
     @Override
 97  
     public IModel getModel() {
 98  0
         return getImplementationView().getModel();
 99  
     }
 100  
 
 101  
     @Override
 102  
     public final boolean validateContent() {
 103  0
         return getImplementationView().validateContent();
 104  
     }
 105  
 }