aboutsummaryrefslogtreecommitdiff
path: root/src/uk/org/ury/testrig/DemoMenuPanel.java
blob: 69cf982edc51c68c08f97324d554639625cf2cc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package uk.org.ury.testrig;

import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;

import uk.org.ury.frontend.FrontendMaster;
import uk.org.ury.frontend.FrontendModulePanel;
import uk.org.ury.frontend.exceptions.LoadFailureException;

public class DemoMenuPanel extends FrontendModulePanel
{
  /**
   * 
   */
  private static final long serialVersionUID = 5268978856289909262L;


  /**
   * Construct a new DemoMenuPanel.
   * 
   * @param inMaster  The new frontend master of the panel, if any.
   */
    
  public
  DemoMenuPanel (FrontendMaster inMaster)
  {
    super (null, inMaster);
    
    setLayout (new GridLayout (2, 1));
      
    JButton lb = new JButton ("Library Viewer Demo");
    JButton sb = new JButton ("Show Viewer Demo");
      
    lb.addActionListener (new ActionListener ()
    {
      @Override
      public void
      actionPerformed (ActionEvent arg0)
      {
        try
          {
            master.loadModule ("library.viewer.LibraryViewer",
                               "testrig.DemoControlPanel");
          }
        catch (LoadFailureException e)
          {
            master.fatalError (e.getMessage ());
          }
      }   
    });
      
      
    sb.addActionListener (new ActionListener ()
    {
      @Override
      public void
      actionPerformed (ActionEvent arg0)
      {
        try
          {
            master.loadModule ("show.viewer.ShowViewer",
                               "testrig.DemoControlPanel");
          }
        catch (LoadFailureException e)
          {
            master.fatalError (e.getMessage ());
          }
      }      
    });
      
      
    add (lb);
    add (sb);
  }

    
  /**
   * @return  the name of the module.
   */
    
  @Override
  public String
  getName ()
  {
    return "Demo Menu";
  }
}