1 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 49 public class ValuesDialog 50 extends javax.swing.JDialog 51 implements SubDatasetObjectChangedListener 52 { 53 54 55 private ValuesPanel valuesPanel = null; 56 57 62 public ValuesDialog(java.awt.Frame parent, boolean modal) 63 { 64 super(parent, modal); 65 initComponents(); 66 initAll(); 67 } 68 69 public ValuesDialog(java.awt.Dialog 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 it.businesslogic.ireport.util.Misc.centerFrame(this); 93 94 95 javax.swing.KeyStroke escape = javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_ESCAPE, 0, false); 96 javax.swing.Action escapeAction = new javax.swing.AbstractAction () { 97 public void actionPerformed(java.awt.event.ActionEvent 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 private void initComponents() { 111 112 setTitle("Values"); 113 addWindowListener(new java.awt.event.WindowAdapter () { 114 public void windowClosing(java.awt.event.WindowEvent evt) { 115 closeDialog(evt); 116 } 117 }); 118 119 pack(); 120 } 121 123 127 private void closeDialog(java.awt.event.WindowEvent evt) { 129 setVisible(false); 130 } 132 135 public static void main(String [] args) 136 { 137 new ValuesDialog(new javax.swing.JFrame (), true).setVisible(true); 138 } 139 140 145 public it.businesslogic.ireport.gui.JReportFrame getJReportFrame() 146 { 147 return jReportFrame; 148 } 149 150 155 public void setJReportFrame(it.businesslogic.ireport.gui.JReportFrame jReportFrame) 156 { 157 this.jReportFrame = jReportFrame; 158 159 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 180 public void applyI18n() 181 { 182 this.getValuesPanel().applyI18n(); 183 } 184 185 190 public void languageChanged(LanguageChangedEvent evt) 191 { 192 this.applyI18n(); 193 } 194 195 private JReportFrame jReportFrame; 198 199 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 226 public void modifyErrorParameter(it.businesslogic.ireport.JRParameter p) 227 { 228 229 this.getValuesPanel().modifyErrorParameter(p); 230 } 231 232 237 public void gotoTab(String tab) 238 { 239 240 this.getValuesPanel().gotoTab(tab); 241 } 242 243 248 public Vector getClipboardFields() 249 { 250 return getValuesPanel().getClipboardFields(); 251 } 252 253 258 public void setClipboardFields(Vector clipboardFields) 259 { 260 getValuesPanel().setClipboardFields(clipboardFields); 261 } 262 263 268 public Vector getClipboardVariables() 269 { 270 271 return getValuesPanel().getClipboardVariables(); 272 } 273 274 279 public void setClipboardVariables(Vector clipboardVariables) 280 { 281 getValuesPanel().setClipboardVariables(clipboardVariables); 282 } 283 284 289 public Vector getClipboardParameters() 290 { 291 292 return getValuesPanel().getClipboardParameters(); 293 } 294 295 300 public void setClipboardParameters(Vector clipboardParameters) 301 { 302 getValuesPanel().setClipboardParameters(clipboardParameters); 303 } 304 305 306 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 |