KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > businesslogic > ireport > gui > ValuesDialog


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  * ValuesDialog.java
28  *
29  * Created on 7 maggio 2003, 23.43
30  *
31  */

32
33 package it.businesslogic.ireport.gui;
34
35 import it.businesslogic.ireport.*;
36 import it.businesslogic.ireport.gui.event.*;
37 import it.businesslogic.ireport.util.*;
38
39 import java.util.*;
40
41 import javax.swing.*;
42 import javax.swing.event.*;
43 import javax.swing.table.*;
44
45
46 /**
47  * @author Administrator
48  */

49 public class ValuesDialog
50     extends javax.swing.JDialog JavaDoc
51     implements SubDatasetObjectChangedListener
52 {
53
54
55     private ValuesPanel valuesPanel = null;
56
57     /**
58      * Creates new form ValuesDialog
59      * @param parent DOCUMENT ME!
60      * @param modal DOCUMENT ME!
61      */

62     public ValuesDialog(java.awt.Frame JavaDoc parent, boolean modal)
63     {
64         super(parent, modal);
65         initComponents();
66         initAll();
67     }
68     
69     public ValuesDialog(java.awt.Dialog JavaDoc parent, boolean modal)
70     {
71         super(parent, modal);
72         initComponents();
73         initAll();
74     }
75     
76     public void initAll()
77     {
78         valuesPanel = new ValuesPanel();
79         this.getContentPane().add("Center", valuesPanel);
80
81         applyI18n();
82         
83         I18n.addOnLanguageChangedListener( new LanguageChangedListener() {
84             public void languageChanged(LanguageChangedEvent evt) {
85                 applyI18n();
86             }
87         } );
88         
89         this.setSize(500, 300);
90
91         // Open in center...
92
it.businesslogic.ireport.util.Misc.centerFrame(this);
93         
94         
95         javax.swing.KeyStroke JavaDoc escape = javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0, false);
96         javax.swing.Action JavaDoc escapeAction = new javax.swing.AbstractAction JavaDoc() {
97             public void actionPerformed(java.awt.event.ActionEvent JavaDoc e) {
98                 setVisible(false);
99             }
100         };
101        
102         getRootPane().getInputMap(javax.swing.JComponent.WHEN_IN_FOCUSED_WINDOW).put(escape, "ESCAPE");
103         getRootPane().getActionMap().put("ESCAPE", escapeAction);
104
105         
106     }
107
108
109     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
110
private void initComponents() {
111
112         setTitle("Values");
113         addWindowListener(new java.awt.event.WindowAdapter JavaDoc() {
114             public void windowClosing(java.awt.event.WindowEvent JavaDoc evt) {
115                 closeDialog(evt);
116             }
117         });
118
119         pack();
120     }
121     // </editor-fold>//GEN-END:initComponents
122

123     /**
124      * Closes the dialog
125      * @param evt DOCUMENT ME!
126      */

127     private void closeDialog(java.awt.event.WindowEvent JavaDoc evt)//GEN-FIRST:event_closeDialog
128
{
129         setVisible(false);
130     }//GEN-LAST:event_closeDialog
131

132     /**
133      * @param args the command line arguments
134      */

135     public static void main(String JavaDoc[] args)
136     {
137         new ValuesDialog(new javax.swing.JFrame JavaDoc(), true).setVisible(true);
138     }
139
140     /**
141      * Getter for property jReportFrame.
142      *
143      * @return Value of property jReportFrame.
144      */

145     public it.businesslogic.ireport.gui.JReportFrame getJReportFrame()
146     {
147         return jReportFrame;
148     }
149
150     /**
151      * Setter for property jReportFrame.
152      *
153      * @param jReportFrame New value of property jReportFrame.
154      */

155     public void setJReportFrame(it.businesslogic.ireport.gui.JReportFrame jReportFrame)
156     {
157         this.jReportFrame = jReportFrame;
158
159         // Update all...
160
if (jReportFrame == null)
161         {
162             setVisible(false);
163         }
164         else if (isVisible())
165         {
166             this.setTitle(jReportFrame.getReport().getName() + " values...");
167             this.getValuesPanel().setSubDataset( getJReportFrame().getReport() );
168         }
169         if( jReportFrame != null )
170         {
171             this.getValuesPanel().setSubDataset( getJReportFrame().getReport() );
172         }
173     }
174
175    
176
177     /**
178      * DOCUMENT ME!
179      */

180     public void applyI18n()
181     {
182         this.getValuesPanel().applyI18n();
183     }
184
185     /**
186      * DOCUMENT ME!
187      *
188      * @param evt DOCUMENT ME!
189      */

190     public void languageChanged(LanguageChangedEvent evt)
191     {
192         this.applyI18n();
193     }
194
195     // Variables declaration - do not modify//GEN-BEGIN:variables
196
// End of variables declaration//GEN-END:variables
197
private JReportFrame jReportFrame;
198
199     /**
200      * DOCUMENT ME!
201      *
202      * @param visible DOCUMENT ME!
203      */

204     public void setVisible(boolean visible)
205     {
206
207         if (visible == isVisible())
208         {
209
210             return;
211         }
212
213         super.setVisible(visible);
214
215         if (visible == true)
216         {
217             this.setJReportFrame(jReportFrame);
218         }
219     }
220
221     /**
222      * DOCUMENT ME!
223      *
224      * @param p DOCUMENT ME!
225      */

226     public void modifyErrorParameter(it.businesslogic.ireport.JRParameter p)
227     {
228
229         this.getValuesPanel().modifyErrorParameter(p);
230     }
231
232     /**
233      * DOCUMENT ME!
234      *
235      * @param tab DOCUMENT ME!
236      */

237     public void gotoTab(String JavaDoc tab)
238     {
239
240         this.getValuesPanel().gotoTab(tab);
241     }
242
243     /**
244      * DOCUMENT ME!
245      *
246      * @return DOCUMENT ME!
247      */

248     public Vector getClipboardFields()
249     {
250         return getValuesPanel().getClipboardFields();
251     }
252
253     /**
254      * DOCUMENT ME!
255      *
256      * @param clipboardFields DOCUMENT ME!
257      */

258     public void setClipboardFields(Vector clipboardFields)
259     {
260         getValuesPanel().setClipboardFields(clipboardFields);
261     }
262
263     /**
264      * DOCUMENT ME!
265      *
266      * @return DOCUMENT ME!
267      */

268     public Vector getClipboardVariables()
269     {
270
271         return getValuesPanel().getClipboardVariables();
272     }
273
274     /**
275      * DOCUMENT ME!
276      *
277      * @param clipboardVariables DOCUMENT ME!
278      */

279     public void setClipboardVariables(Vector clipboardVariables)
280     {
281         getValuesPanel().setClipboardVariables(clipboardVariables);
282     }
283
284     /**
285      * DOCUMENT ME!
286      *
287      * @return DOCUMENT ME!
288      */

289     public Vector getClipboardParameters()
290     {
291
292         return getValuesPanel().getClipboardParameters();
293     }
294
295     /**
296      * DOCUMENT ME!
297      *
298      * @param clipboardParameters DOCUMENT ME!
299      */

300     public void setClipboardParameters(Vector clipboardParameters)
301     {
302         getValuesPanel().setClipboardParameters(clipboardParameters);
303     }
304
305
306     /**
307      * DOCUMENT ME!
308      *
309      * @param evt DOCUMENT ME!
310      */

311     public void subDatasetObjectChanged(SubDatasetObjectChangedEvent evt)
312     {
313         if ( evt.getSource() == getValuesPanel().getSubDataset() )
314         {
315             if (evt.getType() == evt.PARAMETER)
316             {
317                 getValuesPanel().updateParameters();
318             }
319             else if (evt.getType() == evt.VARIABLE)
320             {
321                 getValuesPanel().updateVariables();
322             }
323             else if (evt.getType() == evt.FIELD)
324             {
325                 getValuesPanel().updateFields();
326             }
327         }
328     }
329
330     public ValuesPanel getValuesPanel() {
331         return valuesPanel;
332     }
333
334     public void setValuesPanel(ValuesPanel valuesPanel) {
335         this.valuesPanel = valuesPanel;
336     }
337 }
338
Popular Tags