Coverage Report - org.jtheque.core.managers.view.impl.components.panel.ModulesPanel
 
Classes in this File Line Coverage Branch Coverage Complexity
ModulesPanel
0 %
0/13
N/A
1
 
 1  
 package org.jtheque.core.managers.view.impl.components.panel;
 2  
 
 3  
 import org.jtheque.core.managers.Managers;
 4  
 import org.jtheque.core.managers.module.beans.ModuleContainer;
 5  
 import org.jtheque.core.managers.view.able.IViewManager;
 6  
 import org.jtheque.core.managers.view.able.components.IModulesPanelView;
 7  
 import org.jtheque.core.managers.view.impl.actions.ActionFactory;
 8  
 import org.jtheque.core.managers.view.impl.actions.module.DisableModuleAction;
 9  
 import org.jtheque.core.managers.view.impl.actions.module.EnableModuleAction;
 10  
 import org.jtheque.core.managers.view.impl.actions.module.InstallModuleAction;
 11  
 import org.jtheque.core.managers.view.impl.actions.module.LoadModuleAction;
 12  
 import org.jtheque.core.managers.view.impl.actions.module.UninstallModuleAction;
 13  
 import org.jtheque.core.managers.view.impl.actions.module.UpdateModuleAction;
 14  
 import org.jtheque.core.managers.view.impl.components.model.ModuleListModel;
 15  
 import org.jtheque.core.managers.view.impl.components.renderers.ModuleListRenderer;
 16  
 import org.jtheque.core.utils.ui.PanelBuilder;
 17  
 import org.jtheque.utils.ui.GridBagUtils;
 18  
 import org.jtheque.utils.ui.LinedButtonBarBuilder;
 19  
 
 20  
 import javax.swing.JList;
 21  
 import javax.swing.JPanel;
 22  
 
 23  
 /*
 24  
  * This file is part of JTheque.
 25  
  *
 26  
  * JTheque is free software: you can redistribute it and/or modify
 27  
  * it under the terms of the GNU General Public License as published by
 28  
  * the Free Software Foundation, either version 3 of the License.
 29  
  *
 30  
  * JTheque is distributed in the hope that it will be useful,
 31  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 32  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 33  
  * GNU General Public License for more details.
 34  
  *
 35  
  * You should have received a copy of the GNU General Public License
 36  
  * along with JTheque.  If not, see <http://www.gnu.org/licenses/>.
 37  
  */
 38  
 
 39  
 /**
 40  
  * @author Baptiste Wicht
 41  
  */
 42  
 public final class ModulesPanel extends JPanel implements IModulesPanelView {
 43  
     private final JList modulesList;
 44  
 
 45  
     /**
 46  
      * Construct a new ModulesPanel. 
 47  
      */
 48  
     public ModulesPanel(){
 49  0
         super();
 50  
 
 51  0
         PanelBuilder builder = new PanelBuilder(this);
 52  
 
 53  0
         builder.add(new KernelInfoPanel(), builder.gbcSet(0, 0, GridBagUtils.HORIZONTAL, GridBagUtils.BASELINE_LEADING, 1.0, 0.0));
 54  
 
 55  0
         modulesList = builder.addList(new ModuleListModel(), new ModuleListRenderer(), builder.gbcSet(0, 1, GridBagUtils.BOTH, GridBagUtils.BASELINE_LEADING, 1.0, 1.0));
 56  0
         modulesList.setVisibleRowCount(4);
 57  
 
 58  0
         LinedButtonBarBuilder barBuilder = new LinedButtonBarBuilder(2);
 59  
 
 60  0
         barBuilder.addActions(1, new EnableModuleAction(), new DisableModuleAction(), new UninstallModuleAction(), new UpdateModuleAction());
 61  0
         barBuilder.addActions(2, new InstallModuleAction(), new LoadModuleAction(), ActionFactory.createDisplayViewAction("modules.actions.repository", "repositoryView"));
 62  
 
 63  0
         builder.add(barBuilder.getPanel(), builder.gbcSet(0, 2, GridBagUtils.HORIZONTAL, GridBagUtils.BASELINE_LEADING, 1.0, 0.0));
 64  0
     }
 65  
 
 66  
     @Override
 67  
     public ModuleContainer getSelectedModule() {
 68  0
         return (ModuleContainer) modulesList.getSelectedValue();
 69  
     }
 70  
 
 71  
     @Override
 72  
     public void refresh() {
 73  0
         Managers.getManager(IViewManager.class).refresh(modulesList);
 74  0
     }
 75  
 }