Coverage Report - com.liquidatom.derbyscore.ui.ControlWindow
 
Classes in this File Line Coverage Branch Coverage Complexity
ControlWindow
0%
0/450
0%
0/28
1.927
ControlWindow$1
0%
0/39
0%
0/4
1.927
ControlWindow$1$1
0%
0/29
0%
0/44
1.927
ControlWindow$10
0%
0/3
N/A
1.927
ControlWindow$11
0%
0/3
N/A
1.927
ControlWindow$12
0%
0/3
N/A
1.927
ControlWindow$13
0%
0/3
N/A
1.927
ControlWindow$14
0%
0/3
N/A
1.927
ControlWindow$15
0%
0/3
N/A
1.927
ControlWindow$16
0%
0/23
0%
0/13
1.927
ControlWindow$17
0%
0/1
N/A
1.927
ControlWindow$2
0%
0/4
N/A
1.927
ControlWindow$3
0%
0/3
N/A
1.927
ControlWindow$4
0%
0/3
N/A
1.927
ControlWindow$5
0%
0/3
N/A
1.927
ControlWindow$6
0%
0/3
N/A
1.927
ControlWindow$7
0%
0/3
N/A
1.927
ControlWindow$8
0%
0/3
N/A
1.927
ControlWindow$9
0%
0/3
N/A
1.927
 
 1  
 package com.liquidatom.derbyscore.ui;
 2  
 
 3  
 import com.liquidatom.derbyscore.PicoContainerFactory;
 4  
 import com.liquidatom.derbyscore.domain.Bout;
 5  
 import com.liquidatom.derbyscore.domain.BoutListener;
 6  
 import com.liquidatom.derbyscore.domain.Team;
 7  
 import com.liquidatom.derbyscore.theme.Theme;
 8  
 import com.liquidatom.derbyscore.theme.ThemeBuilder;
 9  
 import com.liquidatom.derbyscore.theme.ThemeFactory;
 10  
 import java.awt.DefaultKeyboardFocusManager;
 11  
 import java.awt.EventQueue;
 12  
 import java.awt.GraphicsConfiguration;
 13  
 import java.awt.GraphicsEnvironment;
 14  
 import java.awt.Image;
 15  
 import java.awt.KeyboardFocusManager;
 16  
 import java.awt.Transparency;
 17  
 import java.awt.event.KeyEvent;
 18  
 import java.awt.event.WindowAdapter;
 19  
 import java.awt.event.WindowEvent;
 20  
 import java.awt.image.BufferedImage;
 21  
 import java.io.File;
 22  
 import java.io.IOException;
 23  
 import java.net.URL;
 24  
 import java.util.concurrent.CountDownLatch;
 25  
 import javax.imageio.ImageIO;
 26  
 import javax.swing.ImageIcon;
 27  
 import javax.swing.JFileChooser;
 28  
 import javax.swing.JFrame;
 29  
 import org.picocontainer.MutablePicoContainer;
 30  
 import org.slf4j.Logger;
 31  
 import org.slf4j.LoggerFactory;
 32  
 
 33  
 /**
 34  
  *
 35  
  * @author Russell Francis (russ@metro-six.com)
 36  
  */
 37  0
 public class ControlWindow extends JFrame implements BoutListener {
 38  
 
 39  0
     static private final Logger log = LoggerFactory.getLogger(ControlWindow.class);
 40  
 
 41  
     private ScoreboardWindow scoreboardWindow;
 42  0
     final private CountDownLatch latch = new CountDownLatch(1);
 43  
 
 44  0
     public ControlWindow() throws IOException {
 45  0
         initComponents();
 46  0
         setLocationRelativeTo(null);
 47  
 
 48  0
         final Runnable r = new Runnable() {
 49  
 
 50  
         public void run() {
 51  
         // Setup icons and logos.
 52  0
         URL appLogo = ControlWindow.class.getResource("/gfx/brrg.png");
 53  0
         URL themeIcon = ControlWindow.class.getResource("/gfx/theme.png");
 54  0
         URL exitIcon = ControlWindow.class.getResource("/gfx/exit.png");
 55  0
         URL aboutIcon = ControlWindow.class.getResource("/gfx/question.png");
 56  
 
 57  
         try {
 58  0
             setIconImage(ImageIO.read(appLogo));
 59  0
             loadThemeMenuItem.setIcon(new ImageIcon(ImageIO.read(themeIcon).getScaledInstance(22, 22, Image.SCALE_SMOOTH)));
 60  0
             quitMenuItem.setIcon(new ImageIcon(ImageIO.read(exitIcon).getScaledInstance(22, 22, Image.SCALE_SMOOTH)));
 61  0
             aboutMenuItem.setIcon(new ImageIcon(ImageIO.read(aboutIcon).getScaledInstance(22, 22, Image.SCALE_SMOOTH)));
 62  
         }
 63  0
         catch (IOException e) {
 64  0
             throw new RuntimeException(e.getMessage(), e);
 65  0
         }
 66  
 
 67  0
         BufferedImage teamALogo = getBout().getTeamA().getImage();
 68  0
         if (teamALogo != null) {
 69  0
             teamALogoButton.setIcon(new ImageIcon(teamALogo));
 70  
         }
 71  
 
 72  0
         BufferedImage teamBLogo = getBout().getTeamB().getImage();
 73  0
         if (teamBLogo != null) {
 74  0
             teamBLogoButton.setIcon(new ImageIcon(teamBLogo));
 75  
         }
 76  
 
 77  0
         startJamButton.setIcon(new ImageIcon(getClass().getResource("/gfx/ledgreen.png")));
 78  0
         lineupButton.setIcon(new ImageIcon(getClass().getResource("/gfx/ledorange.png")));
 79  0
         endJamButton.setIcon(new ImageIcon(getClass().getResource("/gfx/ledred.png")));
 80  0
         timeoutButton.setIcon(new ImageIcon(getClass().getResource("/gfx/player_pause.png")));
 81  0
         officialTimeoutButton.setIcon(new ImageIcon(getClass().getResource("/gfx/zebra_watch.png")));
 82  0
         showScoreboardButton.setIcon(new ImageIcon(getClass().getResource("/gfx/scoreboard_32x32.png")));
 83  0
         fullscreenButton.setIcon(new ImageIcon(getClass().getResource("/gfx/windows_fullscreen.png")));
 84  
 
 85  0
         periodComboBox.addActionListener(new PeriodActionListener(getBout()));
 86  
 
 87  0
         KeyboardFocusManager.setCurrentKeyboardFocusManager(new DefaultKeyboardFocusManager() {
 88  
             @Override
 89  
             public boolean dispatchKeyEvent(KeyEvent e) {
 90  0
                 boolean consumeKeyEvent = false;
 91  0
                 if (KeyEvent.KEY_PRESSED == e.getID()) {
 92  0
                     int keyCode = e.getKeyCode();
 93  0
                     if (keyCode == KeyEvent.VK_UP || keyCode == KeyEvent.VK_DOWN) {
 94  0
                         consumeKeyEvent = true;
 95  
                     }
 96  
 
 97  0
                     if (e.isControlDown() && !e.isAltDown() && teamAJamPointsSpinner.isEnabled()) {
 98  0
                         if (keyCode == KeyEvent.VK_UP) {
 99  0
                             getBout().getTeamA().setJamPoints(getBout().getTeamA().getJamPoints() + 1);
 100  
                         }
 101  0
                         else if (keyCode == KeyEvent.VK_DOWN) {
 102  0
                             getBout().getTeamA().setJamPoints(Math.max(0, getBout().getTeamA().getJamPoints() - 1));
 103  
                         }
 104  0
                         else if (keyCode == KeyEvent.VK_L) {
 105  0
                             if (getBout().isTeamALead()) {
 106  0
                                 getBout().setLead(null);
 107  
                             }
 108  
                             else {
 109  0
                                 getBout().setLead(getBout().getTeamA());
 110  
                             }
 111  
                         }                    }
 112  0
                     else if (!e.isControlDown() && e.isAltDown() && teamBJamPointsSpinner.isEnabled()) {
 113  0
                         if (keyCode == KeyEvent.VK_UP) {
 114  0
                             getBout().getTeamB().setJamPoints(getBout().getTeamB().getJamPoints() + 1);
 115  
                         }
 116  0
                         else if (keyCode == KeyEvent.VK_DOWN) {
 117  0
                             getBout().getTeamB().setJamPoints(Math.max(0, getBout().getTeamB().getJamPoints() - 1));
 118  
                         }
 119  0
                         else if (keyCode == KeyEvent.VK_L) {
 120  0
                             if (getBout().isTeamBLead()) {
 121  0
                                 getBout().setLead(null);
 122  
                             }
 123  
                             else {
 124  0
                                 getBout().setLead(getBout().getTeamB());
 125  
                             }
 126  
                         }
 127  
                     }
 128  0
                     else if (keyCode == KeyEvent.VK_F1 && startJamButton.isEnabled()) {
 129  0
                         startJam();
 130  
                     }
 131  0
                     else if (keyCode == KeyEvent.VK_F2 && endJamButton.isEnabled()) {
 132  0
                         endJam();
 133  
                     }
 134  
                 }
 135  
                 
 136  0
                 return !consumeKeyEvent ? super.dispatchKeyEvent(e) : true;
 137  
             }
 138  
         });
 139  
 
 140  0
         jamTimeTextField.addKeyListener(new TimeTextFieldKeyListener(jamTimeTextField, getBout().getJamClock()));
 141  0
         periodTimeTextField.addKeyListener(new TimeTextFieldKeyListener(periodTimeTextField, getBout().getPeriodClock()));
 142  
 
 143  0
         teamAScoreSpinner.addChangeListener(new ScoreChangeListener(getBout().getTeamA()));
 144  0
         teamAJamPointsSpinner.addChangeListener(new JamPointsChangeListener(getBout().getTeamA()));
 145  0
         teamATimeoutSpinner.addChangeListener(new TimeoutChangeListener(getBout().getTeamA()));
 146  0
         teamBScoreSpinner.addChangeListener(new ScoreChangeListener(getBout().getTeamB()));
 147  0
         teamBJamPointsSpinner.addChangeListener(new JamPointsChangeListener(getBout().getTeamB()));
 148  0
         teamBTimeoutSpinner.addChangeListener(new TimeoutChangeListener(getBout().getTeamB()));
 149  
 
 150  
 
 151  0
         getBout().getTeamA().addListener(
 152  
                 new ControlWindowTeamListener(teamALogoButton, teamALabel, teamAScoreSpinner, teamAJamPointsSpinner, teamATimeoutSpinner));
 153  0
         getBout().getTeamB().addListener(
 154  
                 new ControlWindowTeamListener(teamBLogoButton, teamBLabel, teamBScoreSpinner, teamBJamPointsSpinner, teamBTimeoutSpinner));
 155  0
         getBout().markConfigured();
 156  
 
 157  0
         }
 158  
         };
 159  
 
 160  0
         getBout().addListener(this);
 161  0
         EventQueue.invokeLater(r);
 162  0
     }
 163  
 
 164  
     protected void windowClosed() {
 165  0
         if (scoreboardWindow != null) {
 166  0
             scoreboardWindow.dispose();
 167  
         }
 168  0
         latch.countDown();
 169  0
     }
 170  
 
 171  
     protected void changeLogo(Team team) {
 172  0
         JFileChooser chooser = new JFileChooser();
 173  0
         int option = chooser.showOpenDialog(this);
 174  0
         if (option == JFileChooser.APPROVE_OPTION) {
 175  
             try {
 176  0
                 GraphicsConfiguration defaultConfiguration = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration();
 177  
 
 178  0
                 BufferedImage img = ImageIO.read(chooser.getSelectedFile());
 179  0
                 BufferedImage big = defaultConfiguration.createCompatibleImage(img.getWidth(), img.getHeight(), Transparency.TRANSLUCENT);
 180  0
                 big.getGraphics().drawImage(img, 0, 0, img.getWidth(), img.getHeight(), this);
 181  0
                 team.setImage(big);
 182  
             }
 183  0
             catch (Exception e) {
 184  0
                 if (log.isErrorEnabled()) {
 185  0
                     log.error("Unable to set icon: " + e.getMessage(), e);
 186  
                 }
 187  0
             }
 188  
         }
 189  0
     }
 190  
 
 191  
     protected void lineup() {
 192  0
         getBout().lineup();
 193  0
     }
 194  
 
 195  
     protected void startJam() {
 196  0
         getBout().beginJam();
 197  0
     }
 198  
 
 199  
     protected void endJam() {
 200  0
         getBout().endJam();
 201  0
     }
 202  
 
 203  
     protected void teamTimeout() {
 204  0
         getBout().timeout();
 205  0
     }
 206  
 
 207  
     protected void officialTimeout() {
 208  0
         getBout().officialTimeout();
 209  0
     }
 210  
 
 211  
     protected void showScoreboard() {
 212  0
         if (scoreboardWindow == null) {
 213  0
             showScoreboardButton.setText("Hide Scoreboard");
 214  0
             scoreboardWindow = new ScoreboardWindow(getBout());
 215  0
             scoreboardWindow.addWindowListener(new WindowAdapter() {
 216  
                 @Override
 217  
                 public void windowClosed(WindowEvent evt) {
 218  0
                     showScoreboardButton.setText("Show Scoreboard");
 219  0
                     scoreboardWindow = null;
 220  0
                 }
 221  
             });
 222  0
             scoreboardWindow.setVisible(true);
 223  0
             getBout().addListener(scoreboardWindow);
 224  
         }
 225  
         else {
 226  0
             scoreboardWindow.dispose();
 227  
         }
 228  0
     }
 229  
 
 230  
     protected void fullscreenScoreboard() {
 231  0
         if (scoreboardWindow != null) {
 232  0
             if (!"Restore".equals(fullscreenButton.getText())) {
 233  0
                 fullscreenButton.setText("Restore");
 234  0
                 scoreboardWindow.setExtendedState(getExtendedState() | JFrame.MAXIMIZED_BOTH);
 235  
             }
 236  
             else {
 237  0
                 fullscreenButton.setText("Maximize");
 238  0
                 scoreboardWindow.setExtendedState(JFrame.NORMAL);
 239  
             }
 240  
         }
 241  0
     }
 242  
 
 243  
     public void awaitClosed() throws InterruptedException {
 244  0
         latch.await();
 245  0
     }
 246  
 
 247  
     protected void loadTheme() {
 248  
         try {
 249  0
             JFileChooser chooser = new JFileChooser();
 250  0
             chooser.setMultiSelectionEnabled(false);
 251  0
             chooser.showOpenDialog(this);
 252  0
             File selectedFile = chooser.getSelectedFile();
 253  
 
 254  
             // Create and register our global theme.
 255  0
             if (selectedFile != null && selectedFile.isFile() && selectedFile.canRead()) {
 256  0
                 ThemeBuilder themeBuilder = new ThemeBuilder();
 257  0
                 Theme theme = themeBuilder.buildTheme(selectedFile.toURI().toURL());
 258  0
                 ThemeFactory.getInstance().setCurrent(theme);
 259  
             }
 260  
         }
 261  0
         catch (Exception e) {
 262  0
             if (log.isErrorEnabled()) {
 263  0
                 log.error("Unable to load suggested theme: " + e.getMessage(), e);
 264  
             }
 265  0
         }
 266  0
     }
 267  
     
 268  
     protected void displayAboutDialog() {
 269  0
         final AboutDialog dialog = new AboutDialog();
 270  0
         dialog.setVisible(true);
 271  0
     }
 272  
 
 273  
     /** This method is called from within the constructor to
 274  
      * initialize the form.
 275  
      * WARNING: Do NOT modify this code. The content of this method is
 276  
      * always regenerated by the Form Editor.
 277  
      */
 278  
     @SuppressWarnings("unchecked")
 279  
     // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
 280  
     private void initComponents() {
 281  
 
 282  0
         mainToolbar = new javax.swing.JToolBar();
 283  0
         startJamButton = new javax.swing.JButton();
 284  0
         lineupButton = new javax.swing.JButton();
 285  0
         endJamButton = new javax.swing.JButton();
 286  0
         timeoutButton = new javax.swing.JButton();
 287  0
         officialTimeoutButton = new javax.swing.JButton();
 288  0
         showScoreboardButton = new javax.swing.JButton();
 289  0
         fullscreenButton = new javax.swing.JButton();
 290  0
         mainPanel = new javax.swing.JPanel();
 291  0
         commonPanel = new javax.swing.JPanel();
 292  0
         periodTimeTextField = new javax.swing.JTextField();
 293  0
         jamTimeTextField = new javax.swing.JTextField();
 294  0
         periodTimeLabel = new javax.swing.JLabel();
 295  0
         jamTimeLabel = new javax.swing.JLabel();
 296  0
         messageLabel = new javax.swing.JLabel();
 297  0
         periodComboBox = new javax.swing.JComboBox();
 298  0
         teamAPanel = new javax.swing.JPanel();
 299  0
         jPanel7 = new javax.swing.JPanel();
 300  0
         jPanel1 = new javax.swing.JPanel();
 301  0
         teamALabel = new javax.swing.JLabel();
 302  0
         jPanel4 = new javax.swing.JPanel();
 303  0
         teamAScoreSpinner = new javax.swing.JSpinner();
 304  0
         jPanel6 = new javax.swing.JPanel();
 305  0
         teamALogoButton = new javax.swing.JButton();
 306  0
         jPanel13 = new javax.swing.JPanel();
 307  0
         teamATimeoutsLabel = new javax.swing.JLabel();
 308  0
         teamATimeoutSpinner = new javax.swing.JSpinner();
 309  0
         jPanel3 = new javax.swing.JPanel();
 310  0
         jLabel1 = new javax.swing.JLabel();
 311  0
         teamAJamPointsSpinner = new javax.swing.JSpinner();
 312  0
         teamBPanel = new javax.swing.JPanel();
 313  0
         jPanel9 = new javax.swing.JPanel();
 314  0
         jPanel2 = new javax.swing.JPanel();
 315  0
         teamBLabel = new javax.swing.JLabel();
 316  0
         jPanel10 = new javax.swing.JPanel();
 317  0
         teamBScoreSpinner = new javax.swing.JSpinner();
 318  0
         jPanel11 = new javax.swing.JPanel();
 319  0
         teamBLogoButton = new javax.swing.JButton();
 320  0
         jPanel12 = new javax.swing.JPanel();
 321  0
         teamBTimeoutsLabel = new javax.swing.JLabel();
 322  0
         teamBTimeoutSpinner = new javax.swing.JSpinner();
 323  0
         jPanel8 = new javax.swing.JPanel();
 324  0
         jLabel2 = new javax.swing.JLabel();
 325  0
         teamBJamPointsSpinner = new javax.swing.JSpinner();
 326  0
         jMenuBar1 = new javax.swing.JMenuBar();
 327  0
         fileMenu = new javax.swing.JMenu();
 328  0
         loadThemeMenuItem = new javax.swing.JMenuItem();
 329  0
         jSeparator1 = new javax.swing.JPopupMenu.Separator();
 330  0
         quitMenuItem = new javax.swing.JMenuItem();
 331  0
         helpMenu = new javax.swing.JMenu();
 332  0
         aboutMenuItem = new javax.swing.JMenuItem();
 333  
 
 334  0
         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
 335  0
         setTitle("Derby Score");
 336  0
         addWindowListener(new java.awt.event.WindowAdapter() {
 337  
             public void windowClosed(java.awt.event.WindowEvent evt) {
 338  0
                 formWindowClosed(evt);
 339  0
             }
 340  
         });
 341  
 
 342  0
         mainToolbar.setRollover(true);
 343  0
         mainToolbar.setDoubleBuffered(true);
 344  
 
 345  0
         startJamButton.setText("[F1] Start Jam");
 346  0
         startJamButton.setDoubleBuffered(true);
 347  0
         startJamButton.setEnabled(false);
 348  0
         startJamButton.setFocusable(false);
 349  0
         startJamButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
 350  0
         startJamButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
 351  0
         startJamButton.addActionListener(new java.awt.event.ActionListener() {
 352  
             public void actionPerformed(java.awt.event.ActionEvent evt) {
 353  0
                 startJamButtonActionPerformed(evt);
 354  0
             }
 355  
         });
 356  0
         mainToolbar.add(startJamButton);
 357  
 
 358  0
         lineupButton.setText("Lineup");
 359  0
         lineupButton.setDoubleBuffered(true);
 360  0
         lineupButton.setEnabled(false);
 361  0
         lineupButton.setFocusable(false);
 362  0
         lineupButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
 363  0
         lineupButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
 364  0
         lineupButton.addActionListener(new java.awt.event.ActionListener() {
 365  
             public void actionPerformed(java.awt.event.ActionEvent evt) {
 366  0
                 lineupButtonActionPerformed(evt);
 367  0
             }
 368  
         });
 369  0
         mainToolbar.add(lineupButton);
 370  
 
 371  0
         endJamButton.setText("[F2] End Jam");
 372  0
         endJamButton.setDoubleBuffered(true);
 373  0
         endJamButton.setEnabled(false);
 374  0
         endJamButton.setFocusable(false);
 375  0
         endJamButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
 376  0
         endJamButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
 377  0
         endJamButton.addActionListener(new java.awt.event.ActionListener() {
 378  
             public void actionPerformed(java.awt.event.ActionEvent evt) {
 379  0
                 endJamButtonActionPerformed(evt);
 380  0
             }
 381  
         });
 382  0
         mainToolbar.add(endJamButton);
 383  
 
 384  0
         timeoutButton.setText("Timeout");
 385  0
         timeoutButton.setDoubleBuffered(true);
 386  0
         timeoutButton.setFocusable(false);
 387  0
         timeoutButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
 388  0
         timeoutButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
 389  0
         timeoutButton.addActionListener(new java.awt.event.ActionListener() {
 390  
             public void actionPerformed(java.awt.event.ActionEvent evt) {
 391  0
                 timeoutButtonActionPerformed(evt);
 392  0
             }
 393  
         });
 394  0
         mainToolbar.add(timeoutButton);
 395  
 
 396  0
         officialTimeoutButton.setText("Official Timeout");
 397  0
         officialTimeoutButton.setDoubleBuffered(true);
 398  0
         officialTimeoutButton.setEnabled(false);
 399  0
         officialTimeoutButton.setFocusable(false);
 400  0
         officialTimeoutButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
 401  0
         officialTimeoutButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
 402  0
         officialTimeoutButton.addActionListener(new java.awt.event.ActionListener() {
 403  
             public void actionPerformed(java.awt.event.ActionEvent evt) {
 404  0
                 officialTimeoutButtonActionPerformed(evt);
 405  0
             }
 406  
         });
 407  0
         mainToolbar.add(officialTimeoutButton);
 408  
 
 409  0
         showScoreboardButton.setText("Show Scoreboard");
 410  0
         showScoreboardButton.setDoubleBuffered(true);
 411  0
         showScoreboardButton.setFocusable(false);
 412  0
         showScoreboardButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
 413  0
         showScoreboardButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
 414  0
         showScoreboardButton.addActionListener(new java.awt.event.ActionListener() {
 415  
             public void actionPerformed(java.awt.event.ActionEvent evt) {
 416  0
                 scoreboardToggleButtonActionPerformed(evt);
 417  0
             }
 418  
         });
 419  0
         mainToolbar.add(showScoreboardButton);
 420  
 
 421  0
         fullscreenButton.setText("Fullscreen");
 422  0
         fullscreenButton.setFocusable(false);
 423  0
         fullscreenButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
 424  0
         fullscreenButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
 425  0
         fullscreenButton.addActionListener(new java.awt.event.ActionListener() {
 426  
             public void actionPerformed(java.awt.event.ActionEvent evt) {
 427  0
                 fullscreenButtonActionPerformed(evt);
 428  0
             }
 429  
         });
 430  0
         mainToolbar.add(fullscreenButton);
 431  
 
 432  0
         getContentPane().add(mainToolbar, java.awt.BorderLayout.PAGE_START);
 433  
 
 434  0
         mainPanel.setLayout(new java.awt.BorderLayout());
 435  
 
 436  0
         periodTimeTextField.setEditable(false);
 437  0
         periodTimeTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
 438  0
         periodTimeTextField.setText("30:00");
 439  0
         periodTimeTextField.setDoubleBuffered(true);
 440  
 
 441  0
         jamTimeTextField.setEditable(false);
 442  0
         jamTimeTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
 443  0
         jamTimeTextField.setText("02:00");
 444  0
         jamTimeTextField.setDoubleBuffered(true);
 445  
 
 446  0
         periodTimeLabel.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
 447  0
         periodTimeLabel.setText("Period");
 448  0
         periodTimeLabel.setDoubleBuffered(true);
 449  
 
 450  0
         jamTimeLabel.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
 451  0
         jamTimeLabel.setText("Jam");
 452  0
         jamTimeLabel.setDoubleBuffered(true);
 453  
 
 454  0
         messageLabel.setFont(new java.awt.Font("DejaVu Sans", 0, 18));
 455  0
         messageLabel.setForeground(new java.awt.Color(0, 0, 250));
 456  0
         messageLabel.setText("Get Ready!");
 457  0
         messageLabel.setDoubleBuffered(true);
 458  
 
 459  0
         periodComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Period 1", "Period 2", "Overtime" }));
 460  0
         periodComboBox.setDoubleBuffered(true);
 461  
 
 462  0
         javax.swing.GroupLayout commonPanelLayout = new javax.swing.GroupLayout(commonPanel);
 463  0
         commonPanel.setLayout(commonPanelLayout);
 464  0
         commonPanelLayout.setHorizontalGroup(
 465  
             commonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 466  
             .addGroup(commonPanelLayout.createSequentialGroup()
 467  
                 .addGroup(commonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 468  
                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, commonPanelLayout.createSequentialGroup()
 469  
                         .addGap(12, 12, 12)
 470  
                         .addGroup(commonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
 471  
                             .addComponent(jamTimeLabel)
 472  
                             .addComponent(periodTimeLabel))
 473  
                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 474  
                         .addGroup(commonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 475  
                             .addComponent(jamTimeTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)
 476  
                             .addComponent(periodTimeTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 365, Short.MAX_VALUE)))
 477  
                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, commonPanelLayout.createSequentialGroup()
 478  
                         .addContainerGap()
 479  
                         .addComponent(periodComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE))
 480  
                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, commonPanelLayout.createSequentialGroup()
 481  
                         .addGap(30, 30, 30)
 482  
                         .addComponent(messageLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE)))
 483  
                 .addContainerGap())
 484  
         );
 485  0
         commonPanelLayout.setVerticalGroup(
 486  
             commonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 487  
             .addGroup(commonPanelLayout.createSequentialGroup()
 488  
                 .addGap(21, 21, 21)
 489  
                 .addComponent(periodComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 490  
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 491  
                 .addGroup(commonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 492  
                     .addComponent(periodTimeLabel)
 493  
                     .addComponent(periodTimeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 494  
                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 495  
                 .addGroup(commonPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 496  
                     .addComponent(jamTimeLabel)
 497  
                     .addComponent(jamTimeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
 498  
                 .addGap(18, 18, 18)
 499  
                 .addComponent(messageLabel)
 500  
                 .addGap(231, 231, 231))
 501  
         );
 502  
 
 503  0
         mainPanel.add(commonPanel, java.awt.BorderLayout.CENTER);
 504  
 
 505  0
         teamAPanel.setLayout(new java.awt.BorderLayout());
 506  
 
 507  0
         jPanel7.setLayout(new javax.swing.BoxLayout(jPanel7, javax.swing.BoxLayout.Y_AXIS));
 508  
 
 509  0
         teamALabel.setText("Team A");
 510  0
         teamALabel.setDoubleBuffered(true);
 511  0
         jPanel1.add(teamALabel);
 512  
 
 513  0
         jPanel7.add(jPanel1);
 514  
 
 515  0
         teamAScoreSpinner.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
 516  0
         teamAScoreSpinner.setToolTipText("The number of points currently earned by team A in all finalized jams.");
 517  0
         teamAScoreSpinner.setDoubleBuffered(true);
 518  0
         teamAScoreSpinner.setEditor(new javax.swing.JSpinner.NumberEditor(teamAScoreSpinner, ""));
 519  0
         teamAScoreSpinner.setEnabled(false);
 520  0
         teamAScoreSpinner.setMinimumSize(new java.awt.Dimension(120, 28));
 521  0
         teamAScoreSpinner.setPreferredSize(new java.awt.Dimension(120, 28));
 522  0
         jPanel4.add(teamAScoreSpinner);
 523  
 
 524  0
         jPanel7.add(jPanel4);
 525  
 
 526  0
         teamALogoButton.setDoubleBuffered(true);
 527  0
         teamALogoButton.setMaximumSize(new java.awt.Dimension(120, 120));
 528  0
         teamALogoButton.setMinimumSize(new java.awt.Dimension(120, 120));
 529  0
         teamALogoButton.setPreferredSize(new java.awt.Dimension(120, 120));
 530  0
         teamALogoButton.addActionListener(new java.awt.event.ActionListener() {
 531  
             public void actionPerformed(java.awt.event.ActionEvent evt) {
 532  0
                 teamALogoButtonActionPerformed(evt);
 533  0
             }
 534  
         });
 535  0
         jPanel6.add(teamALogoButton);
 536  
 
 537  0
         jPanel7.add(jPanel6);
 538  
 
 539  0
         jPanel13.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
 540  
 
 541  0
         teamATimeoutsLabel.setText("Timeouts");
 542  0
         teamATimeoutsLabel.setDoubleBuffered(true);
 543  0
         jPanel13.add(teamATimeoutsLabel);
 544  
 
 545  0
         teamATimeoutSpinner.setModel(new javax.swing.SpinnerNumberModel(3, 0, 3, 1));
 546  0
         teamATimeoutSpinner.setDoubleBuffered(true);
 547  0
         teamATimeoutSpinner.setEditor(new javax.swing.JSpinner.NumberEditor(teamATimeoutSpinner, ""));
 548  0
         teamATimeoutSpinner.setEnabled(false);
 549  0
         jPanel13.add(teamATimeoutSpinner);
 550  
 
 551  0
         jPanel7.add(jPanel13);
 552  
 
 553  0
         jPanel3.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
 554  
 
 555  0
         jLabel1.setText("Jam Points");
 556  0
         jLabel1.setDoubleBuffered(true);
 557  0
         jPanel3.add(jLabel1);
 558  
 
 559  0
         teamAJamPointsSpinner.setDoubleBuffered(true);
 560  0
         teamAJamPointsSpinner.setEnabled(false);
 561  0
         teamAJamPointsSpinner.setMinimumSize(new java.awt.Dimension(50, 26));
 562  0
         teamAJamPointsSpinner.setNextFocusableComponent(teamBJamPointsSpinner);
 563  0
         teamAJamPointsSpinner.setPreferredSize(new java.awt.Dimension(50, 26));
 564  0
         jPanel3.add(teamAJamPointsSpinner);
 565  
 
 566  0
         jPanel7.add(jPanel3);
 567  
 
 568  0
         teamAPanel.add(jPanel7, java.awt.BorderLayout.NORTH);
 569  
 
 570  0
         mainPanel.add(teamAPanel, java.awt.BorderLayout.WEST);
 571  
 
 572  0
         teamBPanel.setLayout(new java.awt.BorderLayout());
 573  
 
 574  0
         jPanel9.setLayout(new javax.swing.BoxLayout(jPanel9, javax.swing.BoxLayout.Y_AXIS));
 575  
 
 576  0
         teamBLabel.setText("Team B");
 577  0
         teamBLabel.setDoubleBuffered(true);
 578  0
         jPanel2.add(teamBLabel);
 579  
 
 580  0
         jPanel9.add(jPanel2);
 581  
 
 582  0
         teamBScoreSpinner.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1)));
 583  0
         teamBScoreSpinner.setDoubleBuffered(true);
 584  0
         teamBScoreSpinner.setEditor(new javax.swing.JSpinner.NumberEditor(teamBScoreSpinner, ""));
 585  0
         teamBScoreSpinner.setEnabled(false);
 586  0
         teamBScoreSpinner.setMinimumSize(new java.awt.Dimension(120, 28));
 587  0
         teamBScoreSpinner.setPreferredSize(new java.awt.Dimension(120, 28));
 588  0
         jPanel10.add(teamBScoreSpinner);
 589  
 
 590  0
         jPanel9.add(jPanel10);
 591  
 
 592  0
         teamBLogoButton.setDoubleBuffered(true);
 593  0
         teamBLogoButton.setMaximumSize(new java.awt.Dimension(120, 120));
 594  0
         teamBLogoButton.setMinimumSize(new java.awt.Dimension(120, 120));
 595  0
         teamBLogoButton.setPreferredSize(new java.awt.Dimension(120, 120));
 596  0
         teamBLogoButton.addActionListener(new java.awt.event.ActionListener() {
 597  
             public void actionPerformed(java.awt.event.ActionEvent evt) {
 598  0
                 teamBLogoButtonActionPerformed(evt);
 599  0
             }
 600  
         });
 601  0
         jPanel11.add(teamBLogoButton);
 602  
 
 603  0
         jPanel9.add(jPanel11);
 604  
 
 605  0
         jPanel12.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
 606  
 
 607  0
         teamBTimeoutsLabel.setText("Timeouts");
 608  0
         teamBTimeoutsLabel.setDoubleBuffered(true);
 609  0
         jPanel12.add(teamBTimeoutsLabel);
 610  
 
 611  0
         teamBTimeoutSpinner.setModel(new javax.swing.SpinnerNumberModel(3, 0, 3, 1));
 612  0
         teamBTimeoutSpinner.setDoubleBuffered(true);
 613  0
         teamBTimeoutSpinner.setEnabled(false);
 614  0
         jPanel12.add(teamBTimeoutSpinner);
 615  
 
 616  0
         jPanel9.add(jPanel12);
 617  
 
 618  0
         jPanel8.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
 619  
 
 620  0
         jLabel2.setText("Jam Points");
 621  0
         jLabel2.setDoubleBuffered(true);
 622  0
         jPanel8.add(jLabel2);
 623  
 
 624  0
         teamBJamPointsSpinner.setDoubleBuffered(true);
 625  0
         teamBJamPointsSpinner.setEnabled(false);
 626  0
         teamBJamPointsSpinner.setMinimumSize(new java.awt.Dimension(50, 26));
 627  0
         teamBJamPointsSpinner.setNextFocusableComponent(teamBJamPointsSpinner);
 628  0
         teamBJamPointsSpinner.setPreferredSize(new java.awt.Dimension(50, 26));
 629  0
         jPanel8.add(teamBJamPointsSpinner);
 630  
 
 631  0
         jPanel9.add(jPanel8);
 632  
 
 633  0
         teamBPanel.add(jPanel9, java.awt.BorderLayout.NORTH);
 634  
 
 635  0
         mainPanel.add(teamBPanel, java.awt.BorderLayout.EAST);
 636  
 
 637  0
         getContentPane().add(mainPanel, java.awt.BorderLayout.CENTER);
 638  
 
 639  0
         jMenuBar1.setDoubleBuffered(true);
 640  
 
 641  0
         fileMenu.setText("File");
 642  0
         fileMenu.setDoubleBuffered(true);
 643  
 
 644  0
         loadThemeMenuItem.setText("Load Theme");
 645  0
         loadThemeMenuItem.setToolTipText("Load a theme for the scoreboard from the system.");
 646  0
         loadThemeMenuItem.addActionListener(new java.awt.event.ActionListener() {
 647  
             public void actionPerformed(java.awt.event.ActionEvent evt) {
 648  0
                 loadThemeMenuItemActionPerformed(evt);
 649  0
             }
 650  
         });
 651  0
         fileMenu.add(loadThemeMenuItem);
 652  0
         fileMenu.add(jSeparator1);
 653  
 
 654  0
         quitMenuItem.setText("Quit");
 655  0
         quitMenuItem.setToolTipText("Exit the application.");
 656  0
         quitMenuItem.setDoubleBuffered(true);
 657  0
         quitMenuItem.addActionListener(new java.awt.event.ActionListener() {
 658  
             public void actionPerformed(java.awt.event.ActionEvent evt) {
 659  0
                 quitMenuItemActionPerformed(evt);
 660  0
             }
 661  
         });
 662  0
         fileMenu.add(quitMenuItem);
 663  
 
 664  0
         jMenuBar1.add(fileMenu);
 665  
 
 666  0
         helpMenu.setText("Help");
 667  
 
 668  0
         aboutMenuItem.setText("About");
 669  0
         aboutMenuItem.setToolTipText("Information about the application and usage.");
 670  0
         aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {
 671  
             public void actionPerformed(java.awt.event.ActionEvent evt) {
 672  0
                 aboutMenuItemActionPerformed(evt);
 673  0
             }
 674  
         });
 675  0
         helpMenu.add(aboutMenuItem);
 676  
 
 677  0
         jMenuBar1.add(helpMenu);
 678  
 
 679  0
         setJMenuBar(jMenuBar1);
 680  
 
 681  0
         pack();
 682  0
     }// </editor-fold>//GEN-END:initComponents
 683  
 
 684  
     private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
 685  0
         windowClosed();
 686  0
     }//GEN-LAST:event_formWindowClosed
 687  
 
 688  
     private void quitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quitMenuItemActionPerformed
 689  0
         dispose();
 690  0
     }//GEN-LAST:event_quitMenuItemActionPerformed
 691  
 
 692  
     private void teamBLogoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_teamBLogoButtonActionPerformed
 693  0
         changeLogo(getBout().getTeamB());
 694  0
     }//GEN-LAST:event_teamBLogoButtonActionPerformed
 695  
 
 696  
     private void teamALogoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_teamALogoButtonActionPerformed
 697  0
         changeLogo(getBout().getTeamA());
 698  0
     }//GEN-LAST:event_teamALogoButtonActionPerformed
 699  
 
 700  
     private void startJamButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startJamButtonActionPerformed
 701  0
         startJam();
 702  0
     }//GEN-LAST:event_startJamButtonActionPerformed
 703  
 
 704  
     private void endJamButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_endJamButtonActionPerformed
 705  0
         endJam();
 706  0
     }//GEN-LAST:event_endJamButtonActionPerformed
 707  
 
 708  
     private void officialTimeoutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_officialTimeoutButtonActionPerformed
 709  0
         officialTimeout();
 710  0
     }//GEN-LAST:event_officialTimeoutButtonActionPerformed
 711  
 
 712  
     private void timeoutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timeoutButtonActionPerformed
 713  0
         teamTimeout();
 714  0
     }//GEN-LAST:event_timeoutButtonActionPerformed
 715  
 
 716  
     private void scoreboardToggleButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_scoreboardToggleButtonActionPerformed
 717  0
         showScoreboard();
 718  0
     }//GEN-LAST:event_scoreboardToggleButtonActionPerformed
 719  
 
 720  
     private void lineupButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lineupButtonActionPerformed
 721  0
         lineup();
 722  0
     }//GEN-LAST:event_lineupButtonActionPerformed
 723  
 
 724  
     private void loadThemeMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loadThemeMenuItemActionPerformed
 725  0
         loadTheme();
 726  0
     }//GEN-LAST:event_loadThemeMenuItemActionPerformed
 727  
 
 728  
     private void fullscreenButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fullscreenButtonActionPerformed
 729  0
         fullscreenScoreboard();
 730  0
     }//GEN-LAST:event_fullscreenButtonActionPerformed
 731  
 
 732  
     private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutMenuItemActionPerformed
 733  0
         displayAboutDialog();
 734  0
     }//GEN-LAST:event_aboutMenuItemActionPerformed
 735  
 
 736  
     // Variables declaration - do not modify//GEN-BEGIN:variables
 737  
     private javax.swing.JMenuItem aboutMenuItem;
 738  
     private javax.swing.JPanel commonPanel;
 739  
     private javax.swing.JButton endJamButton;
 740  
     private javax.swing.JMenu fileMenu;
 741  
     private javax.swing.JButton fullscreenButton;
 742  
     private javax.swing.JMenu helpMenu;
 743  
     private javax.swing.JLabel jLabel1;
 744  
     private javax.swing.JLabel jLabel2;
 745  
     private javax.swing.JMenuBar jMenuBar1;
 746  
     private javax.swing.JPanel jPanel1;
 747  
     private javax.swing.JPanel jPanel10;
 748  
     private javax.swing.JPanel jPanel11;
 749  
     private javax.swing.JPanel jPanel12;
 750  
     private javax.swing.JPanel jPanel13;
 751  
     private javax.swing.JPanel jPanel2;
 752  
     private javax.swing.JPanel jPanel3;
 753  
     private javax.swing.JPanel jPanel4;
 754  
     private javax.swing.JPanel jPanel6;
 755  
     private javax.swing.JPanel jPanel7;
 756  
     private javax.swing.JPanel jPanel8;
 757  
     private javax.swing.JPanel jPanel9;
 758  
     private javax.swing.JPopupMenu.Separator jSeparator1;
 759  
     private javax.swing.JLabel jamTimeLabel;
 760  
     private javax.swing.JTextField jamTimeTextField;
 761  
     private javax.swing.JButton lineupButton;
 762  
     private javax.swing.JMenuItem loadThemeMenuItem;
 763  
     private javax.swing.JPanel mainPanel;
 764  
     private javax.swing.JToolBar mainToolbar;
 765  
     private javax.swing.JLabel messageLabel;
 766  
     private javax.swing.JButton officialTimeoutButton;
 767  
     private javax.swing.JComboBox periodComboBox;
 768  
     private javax.swing.JLabel periodTimeLabel;
 769  
     private javax.swing.JTextField periodTimeTextField;
 770  
     private javax.swing.JMenuItem quitMenuItem;
 771  
     private javax.swing.JButton showScoreboardButton;
 772  
     private javax.swing.JButton startJamButton;
 773  
     private javax.swing.JSpinner teamAJamPointsSpinner;
 774  
     private javax.swing.JLabel teamALabel;
 775  
     private javax.swing.JButton teamALogoButton;
 776  
     private javax.swing.JPanel teamAPanel;
 777  
     private javax.swing.JSpinner teamAScoreSpinner;
 778  
     private javax.swing.JSpinner teamATimeoutSpinner;
 779  
     private javax.swing.JLabel teamATimeoutsLabel;
 780  
     private javax.swing.JSpinner teamBJamPointsSpinner;
 781  
     private javax.swing.JLabel teamBLabel;
 782  
     private javax.swing.JButton teamBLogoButton;
 783  
     private javax.swing.JPanel teamBPanel;
 784  
     private javax.swing.JSpinner teamBScoreSpinner;
 785  
     private javax.swing.JSpinner teamBTimeoutSpinner;
 786  
     private javax.swing.JLabel teamBTimeoutsLabel;
 787  
     private javax.swing.JButton timeoutButton;
 788  
     // End of variables declaration//GEN-END:variables
 789  
 
 790  
     public void onChanged() {
 791  0
         EventQueue.invokeLater(new Runnable() {
 792  
             public void run() {
 793  0
                 if (getBout().isOvertime()) {
 794  0
                     periodComboBox.getModel().setSelectedItem(periodComboBox.getModel().getElementAt(2));
 795  
                 } else {
 796  0
                     periodComboBox.getModel().setSelectedItem(periodComboBox.getModel().getElementAt(getBout().getPeriod()-1));
 797  
                 }
 798  
 
 799  0
                 if (!periodTimeTextField.isEditable()) {
 800  0
                     periodTimeTextField.setText(getBout().getPeriodClock().getDisplayTime());
 801  
                 }
 802  
 
 803  0
                 if (!jamTimeTextField.isEditable()) {
 804  0
                     jamTimeTextField.setText(getBout().getJamClock().getDisplayTime());
 805  
                 }
 806  
 
 807  0
                 switch (getBout().getBoutState()) {
 808  
                     case UNCONFIGURED:
 809  0
                         setUnconfiguredState();
 810  0
                         break;
 811  
                     case CONFIGURED:
 812  0
                         setConfiguredState();
 813  0
                         break;
 814  
                     case JAMMING:
 815  0
                         setJammingState();
 816  0
                         break;
 817  
                     case LINEUP:
 818  0
                         setLineupState();
 819  0
                         break;
 820  
                     case TEAM_TIMEOUT:
 821  0
                         setTeamTimeoutState();
 822  0
                         break;
 823  
                     case OFFICIAL_TIMEOUT:
 824  0
                         setOfficialTimeoutState();
 825  0
                         break;
 826  
 //                    case INTERMISSION:
 827  
 //                        setIntermissionState();
 828  
 //                        break;
 829  
 //                    case OVERTIME_LINEUP:
 830  
 //                        setOvertimeLineupState();
 831  
 //                        break;
 832  
 //                    case FINISHED:
 833  
 //                        setFinishedState();
 834  
 //                        break;
 835  
                     default:
 836  0
                         messageLabel.setText("?");
 837  
                         break;
 838  
                 }
 839  0
             }
 840  
         });
 841  0
     }
 842  
     
 843  
     protected void setUnconfiguredState() {
 844  0
         startJamButton.setEnabled(false);
 845  0
         endJamButton.setEnabled(false);
 846  0
         lineupButton.setEnabled(false);
 847  0
         timeoutButton.setEnabled(false);
 848  0
         officialTimeoutButton.setEnabled(false);
 849  0
         jamTimeTextField.setEditable(true);
 850  0
         periodTimeTextField.setEditable(true);
 851  
 
 852  0
         messageLabel.setText("Unconfigured");
 853  0
     }
 854  
 
 855  
     protected void setConfiguredState() {
 856  0
         teamALogoButton.setEnabled(true);
 857  0
         teamATimeoutSpinner.setEnabled(true);
 858  0
         teamAScoreSpinner.setEnabled(true);
 859  0
         teamAJamPointsSpinner.setEnabled(true);
 860  
 
 861  0
         teamBLogoButton.setEnabled(true);
 862  0
         teamBTimeoutSpinner.setEnabled(true);
 863  0
         teamBScoreSpinner.setEnabled(true);
 864  0
         teamBJamPointsSpinner.setEnabled(true);
 865  
 
 866  0
         lineupButton.setEnabled(true);
 867  0
         startJamButton.setEnabled(true);
 868  0
         endJamButton.setEnabled(false);
 869  0
         timeoutButton.setEnabled(false);
 870  0
         officialTimeoutButton.setEnabled(true);
 871  0
         jamTimeTextField.setEditable(true);
 872  0
         periodTimeTextField.setEditable(true);
 873  
 
 874  0
         messageLabel.setText("Configured");
 875  0
     }
 876  
 
 877  
     protected void setJammingState() {
 878  0
         lineupButton.setEnabled(false);
 879  0
         startJamButton.setEnabled(false);
 880  0
         endJamButton.setEnabled(true);
 881  0
         timeoutButton.setEnabled(false);
 882  0
         officialTimeoutButton.setEnabled(true);
 883  0
         jamTimeTextField.setEditable(false);
 884  0
         periodTimeTextField.setEditable(false);
 885  0
         teamALogoButton.setEnabled(false);
 886  0
         teamBLogoButton.setEnabled(false);
 887  
 
 888  0
         messageLabel.setText("Jamming" + (getBout().isOvertime() ? " Overtime" : ""));
 889  0
     }
 890  
 
 891  
     protected void setLineupState() {
 892  0
         startJamButton.setEnabled(true);
 893  0
         lineupButton.setEnabled(false);
 894  0
         endJamButton.setEnabled(false);
 895  0
         timeoutButton.setEnabled(true);
 896  0
         officialTimeoutButton.setEnabled(true);
 897  0
         jamTimeTextField.setEditable(false);
 898  0
         periodTimeTextField.setEditable(false);
 899  0
         teamALogoButton.setEnabled(false);
 900  0
         teamBLogoButton.setEnabled(false);
 901  
 
 902  0
         messageLabel.setText("Lineup" + (getBout().isOvertime() ? " Overtime" : ""));
 903  0
     }
 904  
 
 905  
     protected void setTeamTimeoutState() {
 906  0
         startJamButton.setEnabled(true);
 907  0
         lineupButton.setEnabled(true);
 908  0
         endJamButton.setEnabled(false);
 909  0
         timeoutButton.setEnabled(false);
 910  0
         officialTimeoutButton.setEnabled(true);
 911  0
         jamTimeTextField.setEditable(false);
 912  0
         periodTimeTextField.setEditable(true);
 913  0
         teamALogoButton.setEnabled(false);
 914  0
         teamBLogoButton.setEnabled(false);
 915  
 
 916  0
         messageLabel.setText("Team Timeout" + (getBout().isOvertime() ? " Overtime" : ""));
 917  0
     }
 918  
 
 919  
     protected void setOfficialTimeoutState() {
 920  0
         lineupButton.setEnabled(true);
 921  0
         startJamButton.setEnabled(true);
 922  0
         endJamButton.setEnabled(false);
 923  0
         timeoutButton.setEnabled(true);
 924  0
         officialTimeoutButton.setEnabled(false);
 925  0
         jamTimeTextField.setEditable(true);
 926  0
         periodTimeTextField.setEditable(true);
 927  0
         teamALogoButton.setEnabled(true);
 928  0
         teamBLogoButton.setEnabled(true);
 929  
 
 930  0
         messageLabel.setText("Official Timeout" + (getBout().isOvertime() ? " Overtime" : ""));
 931  0
     }
 932  
 
 933  
     protected void setIntermissionState() {
 934  0
         startJamButton.setEnabled(true);
 935  0
         endJamButton.setEnabled(false);
 936  0
         lineupButton.setEnabled(false);
 937  0
         officialTimeoutButton.setEnabled(false);
 938  0
         jamTimeTextField.setEditable(false);
 939  0
         periodTimeTextField.setEditable(false);
 940  0
         teamALogoButton.setEnabled(false);
 941  0
         teamBLogoButton.setEnabled(false);
 942  
 
 943  0
         messageLabel.setText("Intermission");
 944  0
     }
 945  
 
 946  
     protected void setOvertimeLineupState() {
 947  0
         startJamButton.setEnabled(true);
 948  0
         endJamButton.setEnabled(false);
 949  0
         lineupButton.setEnabled(false);
 950  0
         timeoutButton.setEnabled(true);
 951  0
         officialTimeoutButton.setEnabled(true);
 952  0
         jamTimeTextField.setEditable(false);
 953  0
         periodTimeTextField.setEditable(false);
 954  0
         teamALogoButton.setEnabled(false);
 955  0
         teamBLogoButton.setEnabled(false);
 956  
 
 957  0
         messageLabel.setText("Overtime Lineup");
 958  0
     }
 959  
 
 960  
     protected void setFinishedState() {
 961  0
         startJamButton.setEnabled(false);
 962  0
         endJamButton.setEnabled(false);
 963  0
         lineupButton.setEnabled(false);
 964  0
         timeoutButton.setEnabled(false);
 965  0
         officialTimeoutButton.setEnabled(false);
 966  0
         jamTimeTextField.setEditable(false);
 967  0
         periodTimeTextField.setEditable(false);
 968  0
         teamALogoButton.setEnabled(false);
 969  0
         teamBLogoButton.setEnabled(false);
 970  
 
 971  0
         messageLabel.setText("Finished");
 972  0
     }
 973  
 
 974  
     protected Bout getBout() {
 975  0
         PicoContainerFactory picoContainerFactory = PicoContainerFactory.getInstance();
 976  0
         MutablePicoContainer pico = picoContainerFactory.get();
 977  0
         return pico.getComponent(Bout.class);
 978  
     }
 979  
 }