View Javadoc

1   package org.xmlhammer.gui.status;
2   
3   import java.awt.Color;
4   
5   import javax.swing.SwingUtilities;
6   
7   public class ValidationStatusBar extends StatusBar implements ValidationStatusModel {
8       private static final long serialVersionUID = 3995467594689269857L;
9       private static final Color INVALID_COLOR = new Color(159,63,63);
10      private static final Color VALID_COLOR = new Color(95,191,95);
11  
12      public ValidationStatusBar() {
13          super();
14          
15          progressbar.setForeground(VALID_COLOR);
16      }
17  
18      /* (non-Javadoc)
19       * @see org.xmlhammer.gui.status.StatusModel#reset()
20       */
21      public void reset() {
22          super.reset();
23  
24          SwingUtilities.invokeLater( new Runnable() {
25              public void run() {
26                  progressbar.setForeground(VALID_COLOR);
27              }
28          });
29      }
30  
31      public void setValid(boolean valid) {
32          if (!valid) {
33              SwingUtilities.invokeLater( new Runnable() {
34                  public void run() {
35                      progressbar.setForeground(INVALID_COLOR);
36                  }
37              });
38          }
39      }
40  }