Coverage Report - org.jtheque.primary.view.impl.components.panels.AbstractPrincipalDelegatedView
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractPrincipalDelegatedView
0 %
0/23
N/A
1
 
 1  
 package org.jtheque.primary.view.impl.components.panels;
 2  
 
 3  
 import org.jtheque.core.managers.view.able.IView;
 4  
 import org.jtheque.core.managers.view.able.components.IModel;
 5  
 import org.jtheque.core.managers.view.able.components.TabComponent;
 6  
 import org.jtheque.core.managers.view.impl.components.panel.AbstractDelegatedView;
 7  
 import org.jtheque.primary.od.able.Data;
 8  
 import org.jtheque.primary.view.able.PrincipalDataView;
 9  
 import org.jtheque.primary.view.able.ToolbarView;
 10  
 import org.jtheque.primary.view.impl.listeners.CurrentObjectListener;
 11  
 import org.jtheque.primary.view.impl.listeners.ObjectChangedEvent;
 12  
 
 13  
 import javax.swing.JComponent;
 14  
 
 15  
 /*
 16  
  * This file is part of JTheque.
 17  
  *            
 18  
  * JTheque is free software: you can redistribute it and/or modify
 19  
  * it under the terms of the GNU General Public License as published by
 20  
  * the Free Software Foundation, either version 3 of the License. 
 21  
  *
 22  
  * JTheque is distributed in the hope that it will be useful,
 23  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 24  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 25  
  * GNU General Public License for more details.
 26  
  *
 27  
  * You should have received a copy of the GNU General Public License
 28  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 29  
  */
 30  
 
 31  
 /**
 32  
  * An abstract principal delegated view. It's a delegated view for principal data.
 33  
  *
 34  
  * @author Baptiste Wicht.
 35  
  * @param <T> The type of view.
 36  
  */
 37  
 public abstract class AbstractPrincipalDelegatedView<T extends IView> extends AbstractDelegatedView<T>
 38  
                 implements PrincipalDataView, CurrentObjectListener, TabComponent {
 39  
         private AbstractPrincipalDataPanel<? extends IModel> view;
 40  
 
 41  
         private final int position;
 42  
         private final String titleKey;
 43  
 
 44  
         /**
 45  
          * Construct a new AbstractPrincipalDelegatedView.
 46  
          *
 47  
          * @param position The position of of the view in the tabbed pane.
 48  
          * @param titleKey The title key of the tabbed pane.
 49  
          */
 50  
         protected AbstractPrincipalDelegatedView(int position, String titleKey){
 51  0
                 super();
 52  
 
 53  0
                 this.position = position;
 54  0
                 this.titleKey = titleKey;
 55  0
         }
 56  
 
 57  
         @Override
 58  
         public final Integer getPosition(){
 59  0
                 return position;
 60  
         }
 61  
 
 62  
         @Override
 63  
         public final String getTitleKey(){
 64  0
                 return titleKey;
 65  
         }
 66  
 
 67  
         @Override
 68  
         public final JComponent getComponent(){
 69  0
                 return view;
 70  
         }
 71  
 
 72  
         @Override
 73  
         public final void select(Data data){
 74  0
                 view.select(data);
 75  0
         }
 76  
 
 77  
         @Override
 78  
         public final void sort(String sort){
 79  0
                 view.sort(sort);
 80  0
         }
 81  
 
 82  
         @Override
 83  
         public final void resort(){
 84  0
                 view.resort();
 85  0
         }
 86  
 
 87  
         @Override
 88  
         public final void selectFirst(){
 89  0
                 view.selectFirst();
 90  0
         }
 91  
 
 92  
         @Override
 93  
         public final ToolbarView getToolbarView(){
 94  0
                 return view.getToolbarView();
 95  
         }
 96  
 
 97  
         @Override
 98  
         public IModel getModel(){
 99  0
                 return view.getModel();
 100  
         }
 101  
 
 102  
         @Override
 103  
         public final void clear(){
 104  0
                 view.clear();
 105  0
         }
 106  
 
 107  
         @Override
 108  
         public void objectChanged(ObjectChangedEvent event){
 109  0
                 view.setCurrent(event.getObject());
 110  0
         }
 111  
 
 112  
         /**
 113  
          * Set the delegated view of the view.
 114  
          *
 115  
          * @param view The delegated view.
 116  
          */
 117  
         public final void setView(AbstractPrincipalDataPanel<? extends IModel> view){
 118  0
                 this.view = view;
 119  0
         }
 120  
 }