View Javadoc

1   package org.lcsim.plugin.conditions;
2   
3   import javax.swing.DefaultComboBoxModel;
4   import org.freehep.application.Application;
5   import org.freehep.swing.wizard.Finishable;
6   import org.freehep.swing.wizard.WizardPage;
7   import org.lcsim.conditions.*;
8   
9   /**
10   *
11   * @author tonyj
12   * @version $Id: ConditionsAliasWizardPage.java,v 1.2 2007/04/09 05:11:11 tonyj Exp $
13   */
14  class ConditionsAliasWizardPage extends WizardPage implements Finishable
15  {
16     private ConditionsWizardPage wp;
17     /** Creates new form ConditionsAliasWizardPage */
18     ConditionsAliasWizardPage(ConditionsWizardPage wp)
19     {
20        this.wp = wp;
21        initComponents();
22     }
23     
24     /** This method is called from within the constructor to
25      * initialize the form.
26      * WARNING: Do NOT modify this code. The content of this method is
27      * always regenerated by the Form Editor.
28      */
29     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
30     private void initComponents()
31     {
32        java.awt.GridBagConstraints gridBagConstraints;
33  
34        jLabel1 = new javax.swing.JLabel();
35        jComboBox1 = new javax.swing.JComboBox();
36  
37        setLayout(new java.awt.GridBagLayout());
38  
39        jLabel1.setText("Set as alias for");
40        gridBagConstraints = new java.awt.GridBagConstraints();
41        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
42        add(jLabel1, gridBagConstraints);
43  
44        jComboBox1.setModel(new DefaultComboBoxModel(ConditionsReader.getDetectorNames().toArray()));
45        gridBagConstraints = new java.awt.GridBagConstraints();
46        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
47        add(jComboBox1, gridBagConstraints);
48  
49     }// </editor-fold>//GEN-END:initComponents
50  
51     public void onFinish()
52     {
53        try
54        {
55           wp.addAlias(jComboBox1.getSelectedItem().toString());
56           dispose();
57        }
58        catch (ConditionsManager.ConditionsNotFoundException x)
59        {
60           Application.error(this,"Error creating alias",x);
61        }
62     }
63     
64     
65     // Variables declaration - do not modify//GEN-BEGIN:variables
66     private javax.swing.JComboBox jComboBox1;
67     private javax.swing.JLabel jLabel1;
68     // End of variables declaration//GEN-END:variables
69     
70  }