Clover Coverage Report
Coverage timestamp: Sun Mar 23 2008 08:24:39 GMT
83   188   6   7.55
10   126   0.19   11
11     1.45  
1    
 
 
  SATJDialog       Line # 16 83 6 0% 0.0
 
No Tests
 
1    /*
2    * NewJDialog.java
3    *
4    * Created on 24 fĂ©vrier 2007, 02:00
5    */
6   
7    package issrg.test;
8   
9    import java.awt.Dimension;
10   
11   
12    /**
13    *
14    * @author Bassem Nasser
15    */
 
16    public class SATJDialog extends javax.swing.JDialog {
17    int satlevel;
18    /** Creates new form NewJDialog */
 
19  0 toggle public SATJDialog(java.awt.Frame parent, boolean modal) {
20  0 super(parent, modal);
21  0 initComponents();
22   
23  0 arrayy=new java.awt.Label[]{label1,label2,label3,label4,label5};
24  0 label1.setEnabled(false);
25  0 jLabel1.setText("Logging: "+ label5.getText()+ ": "+label4.getText()+": "+label3.getText()+": "+label2.getText());
26  0 this.setTitle("Choose SAT Level");
27  0 this.setModal(true);
28  0 this.setLocation (0,0);
29  0 this.setBounds(0,0,500,400);
30  0 this.setEnabled(true);
31  0 this.setFocusable(true);
32  0 this.setFocusTraversalKeysEnabled(true);
33  0 this.toFront();
34  0 this.setVisible(true);
35   
36    }
37   
38    /** This method is called from within the constructor to
39    * initialize the form.
40    * WARNING: Do NOT modify this code. The content of this method is
41    * always regenerated by the Form Editor.
42    */
43    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
 
44  0 toggle private void initComponents() {
45  0 jSlider1 = new javax.swing.JSlider();
46  0 label4 = new java.awt.Label();
47  0 label3 = new java.awt.Label();
48  0 label5 = new java.awt.Label();
49  0 label2 = new java.awt.Label();
50  0 label1 = new java.awt.Label();
51  0 jLabel1 = new javax.swing.JLabel();
52  0 jToggleButton3 = new javax.swing.JToggleButton();
53  0 jToggleButton2 = new javax.swing.JToggleButton();
54   
55  0 getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
56   
57  0 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
58  0 setTitle("SATLevel");
59  0 setModal(true);
60  0 jSlider1.setMajorTickSpacing(1);
61  0 jSlider1.setMaximum(4);
62  0 jSlider1.setOrientation(javax.swing.JSlider.VERTICAL);
63  0 jSlider1.setPaintLabels(true);
64  0 jSlider1.setPaintTicks(true);
65  0 jSlider1.setSnapToTicks(true);
66  0 jSlider1.addMouseListener(new java.awt.event.MouseAdapter() {
 
67  0 toggle public void mouseReleased(java.awt.event.MouseEvent evt) {
68  0 jSlider1MouseReleased(evt);
69    }
70    });
71   
72  0 getContentPane().add(jSlider1, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 10, -1, -1));
73   
74  0 label4.setText("Acess Deny");
75  0 getContentPane().add(label4, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 50, -1, 30));
76   
77  0 label3.setText("Policy changes");
78  0 getContentPane().add(label3, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 100, -1, -1));
79   
80  0 label5.setText("Acess Grants");
81  0 getContentPane().add(label5, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 10, -1, -1));
82   
83  0 label2.setText("ShutDown/StartUp");
84  0 getContentPane().add(label2, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 140, -1, 30));
85   
86  0 label1.setText("No Info");
87  0 getContentPane().add(label1, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 190, -1, -1));
88   
89  0 jLabel1.setText(" ");
90  0 getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 260, -1, -1));
91   
92  0 jToggleButton3.setText("Cancel");
93  0 jToggleButton3.setMaximumSize(new java.awt.Dimension(53, 23));
94  0 jToggleButton3.setMinimumSize(new java.awt.Dimension(53, 23));
95  0 jToggleButton3.addMouseListener(new java.awt.event.MouseAdapter() {
 
96  0 toggle public void mouseClicked(java.awt.event.MouseEvent evt) {
97  0 jToggleButton3MouseClicked(evt);
98    }
99    });
100   
101  0 getContentPane().add(jToggleButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 120, -1, -1));
102   
103  0 jToggleButton2.setText("OK");
104  0 jToggleButton2.setMaximumSize(new java.awt.Dimension(53, 23));
105  0 jToggleButton2.setMinimumSize(new java.awt.Dimension(53, 23));
106  0 jToggleButton2.addMouseListener(new java.awt.event.MouseAdapter() {
 
107  0 toggle public void mouseClicked(java.awt.event.MouseEvent evt) {
108  0 jToggleButton2MouseClicked(evt);
109    }
110    });
111   
112  0 getContentPane().add(jToggleButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 90, 70, -1));
113   
114  0 pack();
115    }// </editor-fold>//GEN-END:initComponents
116   
 
117  0 toggle private void jToggleButton2MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jToggleButton2MouseClicked
118    // TODO add your handling code here:
119  0 satlevel=jSlider1.getValue();
120  0 this.setVisible(false);
121    }//GEN-LAST:event_jToggleButton2MouseClicked
122   
 
123  0 toggle private void jToggleButton3MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jToggleButton3MouseClicked
124    // TODO add your handling code here:
125  0 this.dispose();
126  0 System.exit(-1);
127    }//GEN-LAST:event_jToggleButton3MouseClicked
128   
 
129  0 toggle private void jSlider1MouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jSlider1MouseReleased
130    // TODO add your handling code here:
131   
132   
133  0 if(jSlider1.getValue()==0){
134  0 label1.setEnabled(true);
135  0 label2.setEnabled(false);
136  0 label3.setEnabled(false);
137  0 label4.setEnabled(false);
138  0 label5.setEnabled(false);
139    } else{
140  0 label1.setEnabled(false);
141  0 turnOffAbove(jSlider1.getValue(),4);
142  0 turnOnBelow(jSlider1.getValue(),0);
143   
144    }
145  0 showOnNames();
146    }//GEN-LAST:event_jSlider1MouseReleased
 
147  0 toggle void turnOffAbove(int x,int maximum){
148  0 for(int i=x;i<=maximum;i++)
149  0 arrayy[i].setEnabled(false);
150    }
151   
 
152  0 toggle void turnOnBelow(int x,int minimum){
153  0 for(int i=x;i>minimum;i--){
154  0 arrayy[i].setEnabled(true);
155    }
156    }
157   
 
158  0 toggle void showOnNames(){
159  0 jLabel1.setText("Logging: ");
160  0 for(int i=0;i<5;i++)
161  0 if(arrayy[i].isEnabled())
162  0 jLabel1.setText(jLabel1.getText()+ ": "+arrayy[i].getText());
163    }
164   
165    /**
166    * @param args the command line arguments
167    */
168    /* public static void main(String args[]) {
169    java.awt.EventQueue.invokeLater(new Runnable() {
170    public void run() {
171    new SATJDialog(new javax.swing.JFrame(), true).setVisible(true);
172    }
173    });
174    }*/
175   
176    // Variables declaration - do not modify//GEN-BEGIN:variables
177    private javax.swing.JLabel jLabel1;
178    private javax.swing.JSlider jSlider1;
179    private javax.swing.JToggleButton jToggleButton2;
180    private javax.swing.JToggleButton jToggleButton3;
181    private java.awt.Label label1;
182    private java.awt.Label label2;
183    private java.awt.Label label3;
184    private java.awt.Label label4;
185    private java.awt.Label label5;
186    // End of variables declaration//GEN-END:variables
187    private java.awt.Label[] arrayy;
188    }