Coverage Report - org.jtheque.primary.view.impl.components.panels.AbstractPrincipalDataPanel
 
Classes in this File Line Coverage Branch Coverage Complexity
AbstractPrincipalDataPanel
0 %
0/15
N/A
1
 
 1  
 package org.jtheque.primary.view.impl.components.panels;
 2  
 
 3  
 import org.jdesktop.swingx.JXTree;
 4  
 import org.jtheque.core.managers.view.able.components.IModel;
 5  
 import org.jtheque.primary.controller.able.FormBean;
 6  
 import org.jtheque.primary.view.able.ToolbarView;
 7  
 import org.jtheque.primary.view.impl.renderers.JThequeTreeCellRenderer;
 8  
 import org.jtheque.primary.view.impl.sort.SortManager;
 9  
 
 10  
 /*
 11  
  * This file is part of JTheque.
 12  
  *            
 13  
  * JTheque is free software: you can redistribute it and/or modify
 14  
  * it under the terms of the GNU General Public License as published by
 15  
  * the Free Software Foundation, either version 3 of the License. 
 16  
  *
 17  
  * JTheque is distributed in the hope that it will be useful,
 18  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 19  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 20  
  * GNU General Public License for more details.
 21  
  *
 22  
  * You should have received a copy of the GNU General Public License
 23  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 24  
  */
 25  
 
 26  
 /**
 27  
  * An abstract principal data panel.
 28  
  *
 29  
  * @author Baptiste Wicht
 30  
  * @param <M> The type of model.
 31  
  */
 32  
 public abstract class AbstractPrincipalDataPanel<M extends IModel> extends PrincipalDataPanel<M> {
 33  
         private ToolbarView toolBar;
 34  
         private JXTree tree;
 35  
 
 36  
         private final String dataType;
 37  
 
 38  0
         private static final SortManager SORTER = new SortManager();
 39  
 
 40  
         /**
 41  
          * Construct a new AbstractPrincipalDataPanel for a specific data type.
 42  
          *
 43  
          * @param dataType The data type.
 44  
          */
 45  
         public AbstractPrincipalDataPanel(String dataType){
 46  0
                 super();
 47  
 
 48  0
                 this.dataType = dataType;
 49  0
         }
 50  
 
 51  
         @Override
 52  
         public final Object getImpl(){
 53  0
                 return this;
 54  
         }
 55  
 
 56  
         @Override
 57  
         public final ToolbarView getToolbarView(){
 58  0
                 return toolBar;
 59  
         }
 60  
 
 61  
         @Override
 62  
         protected final JXTree getTree(){
 63  0
                 return tree;
 64  
         }
 65  
 
 66  
         @Override
 67  
         public final String getDataType(){
 68  0
                 return dataType;
 69  
         }
 70  
 
 71  
         /**
 72  
          * Set the tool bar of the view.
 73  
          *
 74  
          * @param toolBar The tool bar of the view.
 75  
          */
 76  
         public final void setToolBar(ToolbarView toolBar){
 77  0
                 this.toolBar = toolBar;
 78  0
         }
 79  
 
 80  
         /**
 81  
          * Init the tree.
 82  
          */
 83  
         public final void initTree(){
 84  0
                 tree = new JXTree(getTreeModel());
 85  0
                 tree.setCellRenderer(new JThequeTreeCellRenderer());
 86  0
                 tree.putClientProperty("JTree.lineStyle", "None");
 87  0
         }
 88  
 
 89  
         /**
 90  
          * Return the sorter used to sort the datas of the view.
 91  
          *
 92  
          * @return A SortManager instance to sort the datas.
 93  
          */
 94  
         public static SortManager getSorter(){
 95  0
                 return SORTER;
 96  
         }
 97  
 
 98  
         /**
 99  
          * Fill the form bean with the informations of the view.
 100  
          *
 101  
          * @param fb The form bean to fill.
 102  
          */
 103  
         public abstract void fillFormBean(FormBean fb);
 104  
 
 105  
         /**
 106  
          * Set the current object.
 107  
          *
 108  
          * @param object The objec to set as the current object.
 109  
          */
 110  
         public abstract void setCurrent(Object object);
 111  
 }