Coverage Report - de.glossmaker.gui.bibtex.bars.BibStatusBar
 
Classes in this File Line Coverage Branch Coverage Complexity
BibStatusBar
0%
0/18
0%
0/2
1,333
 
 1  
 package de.glossmaker.gui.bibtex.bars;
 2  
 
 3  
 import java.awt.BorderLayout;
 4  
 import java.util.Timer;
 5  
 
 6  
 import javax.swing.JLabel;
 7  
 import javax.swing.JPanel;
 8  
 
 9  
 import org.bushe.swing.event.EventBus;
 10  
 import org.bushe.swing.event.EventTopicSubscriber;
 11  
 
 12  
 import de.glossmaker.gui.bibtex.EUserInteration;
 13  
 
 14  
 /**
 15  
  * 
 16  
  * @author Markus Flingelli
 17  
  *
 18  
  */
 19  0
 public class BibStatusBar extends JPanel implements EventTopicSubscriber<String> {
 20  
         private static final long serialVersionUID = 6894518217071920372L;
 21  0
         private JLabel mStatusLabel = null;
 22  
         private Timer mTimer;
 23  
         
 24  0
         public BibStatusBar() {
 25  0
                 mTimer = new Timer();
 26  0
                 for(EUserInteration events : EUserInteration.values()) {
 27  0
                         EventBus.subscribe(events.toString(), this);
 28  
                 }
 29  0
                 initialize();
 30  0
         }
 31  
         
 32  
         @Override
 33  
         public void onEvent(String command, String message) {        
 34  0
                 mTimer.cancel();
 35  0
                 mStatusLabel.setText(" " + message);
 36  0
                 mTimer =  new Timer();
 37  0
                 mTimer.schedule(new BibStatusMessageTimerTask(), 5000);
 38  0
         }
 39  
 
 40  
         private void initialize() {
 41  0
                 mStatusLabel = new JLabel(" ");
 42  0
                 mStatusLabel.setSize(200, 25);
 43  0
                 this.setLayout(new BorderLayout());
 44  0
                 this.add(mStatusLabel, BorderLayout.WEST);
 45  0
         }
 46  
 }