KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > businesslogic > ireport > chart > ValueDatasetPanel


1 /*
2  * Copyright (C) 2005 - 2006 JasperSoft Corporation. All rights reserved.
3  * http://www.jaspersoft.com.
4  *
5  * Unless you have purchased a commercial license agreement from JasperSoft,
6  * the following license terms apply:
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as published by
10  * the Free Software Foundation.
11  *
12  * This program is distributed WITHOUT ANY WARRANTY; and without the
13  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
18  * or write to:
19  *
20  * Free Software Foundation, Inc.,
21  * 59 Temple Place - Suite 330,
22  * Boston, MA USA 02111-1307
23  *
24  *
25  *
26  *
27  * ValueDatasetPanel.java
28  *
29  * Created on 15 agosto 2005, 17.55
30  *
31  */

32
33 package it.businesslogic.ireport.chart;
34
35 import it.businesslogic.ireport.SubDataset;
36 import it.businesslogic.ireport.util.I18n;
37
38 /**
39  *
40  * @author Administrator
41  */

42 public class ValueDatasetPanel extends javax.swing.JPanel JavaDoc implements ChartDatasetPanel {
43     
44     private ValueDataset valueDataset = null;
45     
46     /** Creates new form PieDatasetPanel */
47     public ValueDatasetPanel() {
48         initComponents();
49         
50         applyI18n();
51         
52         this.jRTextExpressionValue.getDocument().addDocumentListener( new javax.swing.event.DocumentListener JavaDoc() {
53             public void changedUpdate(javax.swing.event.DocumentEvent JavaDoc evt) {
54                 jRTextExpressionValueTextChanged();
55             }
56             public void insertUpdate(javax.swing.event.DocumentEvent JavaDoc evt) {
57                 jRTextExpressionValueTextChanged();
58             }
59             public void removeUpdate(javax.swing.event.DocumentEvent JavaDoc evt) {
60                 jRTextExpressionValueTextChanged();
61             }
62         });
63         
64
65     }
66
67     public ValueDataset getValueDataset() {
68         return valueDataset;
69     }
70     
71     /**
72      * this method is used to pass the correct subdataset to the expression editor
73      */

74     public void setSubDataset( SubDataset sds )
75     {
76         jRTextExpressionValue.setSubDataset(sds);
77     }
78
79     public void setValueDataset(ValueDataset valueDataset) {
80         this.valueDataset = valueDataset;
81         jRTextExpressionValue.setText( valueDataset.getValueExpression() );
82     }
83         
84     public void jRTextExpressionValueTextChanged()
85     {
86         valueDataset.setValueExpression( jRTextExpressionValue.getText() );
87     }
88     
89     
90     
91     /** This method is called from within the constructor to
92      * initialize the form.
93      * WARNING: Do NOT modify this code. The content of this method is
94      * always regenerated by the Form Editor.
95      */

96     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
97
private void initComponents() {
98         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
99
100         jPanel1 = new javax.swing.JPanel JavaDoc();
101         jLabelValueExpression = new javax.swing.JLabel JavaDoc();
102         jRTextExpressionValue = new it.businesslogic.ireport.gui.JRTextExpressionArea();
103
104         setLayout(new java.awt.GridBagLayout JavaDoc());
105
106         jPanel1.setLayout(new java.awt.GridBagLayout JavaDoc());
107
108         jLabelValueExpression.setText("Value expression");
109         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
110         gridBagConstraints.gridx = 0;
111         gridBagConstraints.gridy = 2;
112         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
113         gridBagConstraints.weightx = 1.0;
114         gridBagConstraints.insets = new java.awt.Insets JavaDoc(4, 4, 0, 4);
115         jPanel1.add(jLabelValueExpression, gridBagConstraints);
116
117         jRTextExpressionValue.setBorder(javax.swing.BorderFactory.createEtchedBorder());
118         jRTextExpressionValue.setElectricScroll(0);
119         jRTextExpressionValue.setMinimumSize(new java.awt.Dimension JavaDoc(10, 10));
120         jRTextExpressionValue.setPreferredSize(new java.awt.Dimension JavaDoc(10, 10));
121         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
122         gridBagConstraints.gridx = 0;
123         gridBagConstraints.gridy = 3;
124         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
125         gridBagConstraints.weightx = 1.0;
126         gridBagConstraints.weighty = 1.0;
127         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 4, 4, 4);
128         jPanel1.add(jRTextExpressionValue, gridBagConstraints);
129
130         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
131         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
132         gridBagConstraints.weightx = 1.0;
133         gridBagConstraints.weighty = 1.0;
134         add(jPanel1, gridBagConstraints);
135
136     }// </editor-fold>//GEN-END:initComponents
137

138     
139     // Variables declaration - do not modify//GEN-BEGIN:variables
140
private javax.swing.JLabel JavaDoc jLabelValueExpression;
141     private javax.swing.JPanel JavaDoc jPanel1;
142     private it.businesslogic.ireport.gui.JRTextExpressionArea jRTextExpressionValue;
143     // End of variables declaration//GEN-END:variables
144

145     public void applyI18n(){
146                 // Start autogenerated code ----------------------
147
jLabelValueExpression.setText(I18n.getString("valueDatasetPanel.labelValueExpression","Value expression"));
148                 // End autogenerated code ----------------------
149
}
150 }
151
Popular Tags