Coverage Report - org.jtheque.core.managers.view.impl.components.panel.KernelInfoPanel
 
Classes in this File Line Coverage Branch Coverage Complexity
KernelInfoPanel
0 %
0/13
N/A
1
 
 1  
 package org.jtheque.core.managers.view.impl.components.panel;
 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.update.IUpdateManager;
 21  
 import org.jtheque.core.managers.view.impl.actions.module.UpdateKernelAction;
 22  
 import org.jtheque.core.utils.ui.PanelBuilder;
 23  
 import org.jtheque.utils.ui.GridBagUtils;
 24  
 
 25  
 import javax.swing.JPanel;
 26  
 import java.awt.Component;
 27  
 import java.awt.Font;
 28  
 import java.awt.Insets;
 29  
 
 30  
 /**
 31  
  * A panel to display information about the kernel.
 32  
  *
 33  
  * @author Baptiste Wicht
 34  
  */
 35  
 public final class KernelInfoPanel extends JPanel {
 36  
     private static final int TITLE_FONT_SIZE = 16;
 37  
 
 38  
     /**
 39  
      * Construct a new KernelInfoPanel.
 40  
      */
 41  
     public KernelInfoPanel() {
 42  0
         super();
 43  
 
 44  0
         build();
 45  0
     }
 46  
 
 47  
     /**
 48  
      * Build the GUI.
 49  
      */
 50  
     private void build() {
 51  0
         PanelBuilder builder = new PanelBuilder(this);
 52  
 
 53  0
         builder.setDefaultInsets(new Insets(4, 4, 4, 4));
 54  
 
 55  0
         Component kernelLabel = builder.addI18nLabel("modules.view.label.kernel", builder.gbcSet(0, 0, GridBagUtils.NONE, GridBagUtils.LINE_START, 1, 3));
 56  0
         kernelLabel.setFont(kernelLabel.getFont().deriveFont(Font.BOLD, TITLE_FONT_SIZE));
 57  
 
 58  0
         builder.addI18nLabel("modules.view.label.versions.current", builder.gbcSet(1, 0));
 59  
 
 60  0
         builder.addLabel(Managers.getCore().getCoreCurrentVersion().getVersion(), builder.gbcSet(1, 1));
 61  
 
 62  0
         builder.addI18nLabel("modules.view.label.versions.online", builder.gbcSet(2, 0));
 63  
 
 64  0
         builder.addLabel(Managers.getManager(IUpdateManager.class).getMostRecentVersion(Managers.getCore()).getVersion(), getForeground(),
 65  
                 builder.gbcSet(2, 1));
 66  
 
 67  0
         builder.addButton(new UpdateKernelAction(), builder.gbcSet(4, 0, GridBagUtils.NONE, GridBagUtils.LINE_START, 1, 3));
 68  0
     }
 69  
 }