KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jaspersoft > jasperserver > irplugin > gui > inputcontrols > ui > BooleanInputControlUI


1 /*
2  * BasicInputControlUI.java
3  *
4  * Created on June 7, 2006, 1:50 PM
5  */

6
7 package com.jaspersoft.jasperserver.irplugin.gui.inputcontrols.ui;
8
9 import javax.swing.JLabel JavaDoc;
10
11 /**
12  *
13  * @author gtoffoli
14  */

15 public class BooleanInputControlUI extends javax.swing.JPanel JavaDoc implements InputControlUI {
16     
17     /** Creates new form BasicInputControlUI */
18     public BooleanInputControlUI() {
19         initComponents();
20     }
21     
22     public Object JavaDoc getValue()
23     {
24         return new Boolean JavaDoc(jCheckBox1.isSelected());
25     }
26     
27     public void setValue(Object JavaDoc v)
28     {
29         try {
30             jCheckBox1.setSelected( Boolean.valueOf(v+"").booleanValue() );
31         } catch (Exception JavaDoc ex)
32         {
33         }
34     }
35     
36     /** This method is called from within the constructor to
37      * initialize the form.
38      * WARNING: Do NOT modify this code. The content of this method is
39      * always regenerated by the Form Editor.
40      */

41     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
42
private void initComponents() {
43         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
44
45         jCheckBox1 = new javax.swing.JCheckBox JavaDoc();
46
47         setLayout(new java.awt.GridBagLayout JavaDoc());
48
49         setPreferredSize(new java.awt.Dimension JavaDoc(250, 24));
50         jCheckBox1.setText("jCheckBox1");
51         jCheckBox1.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
52         jCheckBox1.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
53         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
54         gridBagConstraints.gridx = 0;
55         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
56         gridBagConstraints.weightx = 1.0;
57         gridBagConstraints.insets = new java.awt.Insets JavaDoc(4, 4, 4, 4);
58         add(jCheckBox1, gridBagConstraints);
59
60     }// </editor-fold>//GEN-END:initComponents
61

62     public void setLabel(String JavaDoc lbl)
63     {
64         this.jCheckBox1.setText(lbl);
65     }
66     
67     public void setHistory(java.util.List JavaDoc values){
68         
69         if (values != null && values.size() > 0)
70         {
71             setValue(values.get(0)+"");
72         }
73     }
74     
75     // Variables declaration - do not modify//GEN-BEGIN:variables
76
private javax.swing.JCheckBox JavaDoc jCheckBox1;
77     // End of variables declaration//GEN-END:variables
78

79     public void setReadOnly( boolean b )
80     {
81         jCheckBox1.setEnabled(!b);
82     }
83 }
84
Popular Tags