Coverage Report - org.homeunix.thecave.buddi.view.menu.items.SingletonPanelMenuEntry
 
Classes in this File Line Coverage Branch Coverage Complexity
SingletonPanelMenuEntry
0%
0/11
0%
0/2
1.333
 
 1  
 package org.homeunix.thecave.buddi.view.menu.items;
 2  
 
 3  
 import java.awt.event.ActionEvent;
 4  
 
 5  
 import org.homeunix.thecave.buddi.plugin.api.BuddiPanelPlugin;
 6  
 import org.homeunix.thecave.buddi.plugin.api.util.TextFormatter;
 7  
 import org.homeunix.thecave.buddi.view.MainFrame;
 8  
 
 9  
 import ca.digitalcave.moss.swing.MossCheckboxMenuItem;
 10  
 
 11  
 /**
 12  
  *
 13  
  * @author mpeccorini
 14  
  */
 15  
 public class SingletonPanelMenuEntry extends MossCheckboxMenuItem {
 16  
 
 17  
         public static final long serialVersionUID = 0;
 18  
         private final BuddiPanelPlugin plugin;
 19  
 
 20  
         public SingletonPanelMenuEntry(MainFrame parentFrame, BuddiPanelPlugin plugin) {
 21  0
                 super(parentFrame, TextFormatter.getTranslation(plugin.getTabLabelKey()));
 22  0
                 this.plugin = plugin;
 23  0
         }
 24  
 
 25  
         @Override
 26  
         public void actionPerformed(ActionEvent e) {
 27  0
                 if (isSelected()){
 28  0
                         plugin.setParentFrame((MainFrame)getFrame());
 29  0
                         plugin.updateContent();
 30  0
                         ((MainFrame)getFrame()).addPanel(TextFormatter.getTranslation(plugin.getTabLabelKey()), plugin);
 31  
                 } else {
 32  0
                         plugin.close();
 33  
                 }
 34  0
         }
 35  
 
 36  
         public void panelPluginClosed(BuddiPanelPlugin plugin) {
 37  0
                 setSelected(false);
 38  0
         }
 39  
 }