1 32 33 package it.businesslogic.ireport.plugin.massivecompiler; 34 35 import it.businesslogic.ireport.plugin.*; 36 import javax.swing.table.*; 37 import javax.swing.*; 38 import javax.swing.event.ListSelectionEvent ; 39 import it.businesslogic.ireport.util.I18n; 40 44 public class MassiveCompilerFrame extends javax.swing.JFrame { 45 46 private FindThread findThread = null; 47 private CompileThread compileThread = null; 48 private boolean finding = false; 49 private boolean compiling = false; 50 private it.businesslogic.ireport.gui.MainFrame iReportMainFrame = null; 51 52 53 public MassiveCompilerFrame() { 54 initComponents(); 55 56 this.setSize(550, 380); 57 it.businesslogic.ireport.util.Misc.centerFrame(this); 58 DefaultTableColumnModel dtcm = (DefaultTableColumnModel)this.jTableFiles.getColumnModel(); 60 61 jTableFiles.getColumnModel().getColumn(0).setCellRenderer( new ImageCellRenderer()); 62 63 jTableFiles.setRowHeight(18); 64 dtcm.getColumn(0).setWidth(18); 65 dtcm.getColumn(1).setWidth(300); 66 dtcm.getColumn(2).setWidth(50); 67 68 dtcm.getColumn(0).setPreferredWidth(18); 69 dtcm.getColumn(1).setPreferredWidth(300); 70 dtcm.getColumn(2).setPreferredWidth(50); 71 72 dtcm.getColumn(0).setMinWidth(18); 73 dtcm.getColumn(0).setMaxWidth(18); 74 77 78 DefaultListSelectionModel dlsm = (DefaultListSelectionModel)this.jTableFiles.getSelectionModel(); 79 dlsm.addListSelectionListener(new javax.swing.event.ListSelectionListener () { 80 public void valueChanged(ListSelectionEvent e) { 81 jTableFilesListSelectionValueChanged(e); 82 } 83 }); 84 85 applyI18n(); 86 } 87 88 93 private void initComponents() { 95 java.awt.GridBagConstraints gridBagConstraints; 96 97 jPopupMenuFiles = new javax.swing.JPopupMenu (); 98 jMenuItemDetails = new javax.swing.JMenuItem (); 99 jMenuItemOpen = new javax.swing.JMenuItem (); 100 jMenuItemViewSource = new javax.swing.JMenuItem (); 101 jPanel1 = new javax.swing.JPanel (); 102 jTextFieldPath = new javax.swing.JTextField (); 103 jButtonBrowse = new javax.swing.JButton (); 104 jCheckBoxSubDir = new javax.swing.JCheckBox (); 105 jScrollPane1 = new javax.swing.JScrollPane (); 106 jTableFiles = new javax.swing.JTable (); 107 jPanel2 = new javax.swing.JPanel (); 108 jButtonClose = new javax.swing.JButton (); 109 jPanel4 = new javax.swing.JPanel (); 110 jCheckBoxChangeFileExt = new javax.swing.JCheckBox (); 111 jCheckBoxBackup = new javax.swing.JCheckBox (); 112 jCheckBoxDirectory = new javax.swing.JCheckBox (); 113 jPanel5 = new javax.swing.JPanel (); 114 jButtonCompile = new javax.swing.JButton (); 115 jButtonCancelCompile = new javax.swing.JButton (); 116 jButtonCompileAll = new javax.swing.JButton (); 117 jPanel6 = new javax.swing.JPanel (); 118 jPanel3 = new javax.swing.JPanel (); 119 jButtonFind = new javax.swing.JButton (); 120 jButtonCancelFind = new javax.swing.JButton (); 121 122 jMenuItemDetails.setText("Details and error messages"); 123 jMenuItemDetails.addActionListener(new java.awt.event.ActionListener () { 124 public void actionPerformed(java.awt.event.ActionEvent evt) { 125 jMenuItemDetailsActionPerformed(evt); 126 } 127 }); 128 129 jPopupMenuFiles.add(jMenuItemDetails); 130 131 jMenuItemOpen.setText("Send to editor"); 132 jMenuItemOpen.addActionListener(new java.awt.event.ActionListener () { 133 public void actionPerformed(java.awt.event.ActionEvent evt) { 134 jMenuItemOpenActionPerformed(evt); 135 } 136 }); 137 138 jPopupMenuFiles.add(jMenuItemOpen); 139 140 jMenuItemViewSource.setText("View source"); 141 jMenuItemViewSource.addActionListener(new java.awt.event.ActionListener () { 142 public void actionPerformed(java.awt.event.ActionEvent evt) { 143 jMenuItemViewSourceActionPerformed(evt); 144 } 145 }); 146 147 jPopupMenuFiles.add(jMenuItemViewSource); 148 149 getContentPane().setLayout(new java.awt.GridBagLayout ()); 150 151 setTitle("Massive compiler"); 152 addWindowListener(new java.awt.event.WindowAdapter () { 153 public void windowClosing(java.awt.event.WindowEvent evt) { 154 exitForm(evt); 155 } 156 }); 157 158 jPanel1.setLayout(new java.awt.GridBagLayout ()); 159 160 jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Directory")); 161 jPanel1.setMinimumSize(new java.awt.Dimension (0, 70)); 162 jPanel1.setPreferredSize(new java.awt.Dimension (0, 70)); 163 jTextFieldPath.addActionListener(new java.awt.event.ActionListener () { 164 public void actionPerformed(java.awt.event.ActionEvent evt) { 165 jTextFieldPathActionPerformed(evt); 166 } 167 }); 168 169 gridBagConstraints = new java.awt.GridBagConstraints (); 170 gridBagConstraints.gridx = 0; 171 gridBagConstraints.gridy = 1; 172 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 173 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 174 gridBagConstraints.weightx = 1.0; 175 gridBagConstraints.insets = new java.awt.Insets (0, 2, 0, 2); 176 jPanel1.add(jTextFieldPath, gridBagConstraints); 177 178 jButtonBrowse.setText("Browse..."); 179 jButtonBrowse.setMinimumSize(new java.awt.Dimension (87, 20)); 180 jButtonBrowse.setPreferredSize(new java.awt.Dimension (87, 20)); 181 jButtonBrowse.addActionListener(new java.awt.event.ActionListener () { 182 public void actionPerformed(java.awt.event.ActionEvent evt) { 183 jButtonBrowseActionPerformed(evt); 184 } 185 }); 186 187 gridBagConstraints = new java.awt.GridBagConstraints (); 188 gridBagConstraints.gridx = 1; 189 gridBagConstraints.gridy = 0; 190 gridBagConstraints.gridheight = 2; 191 gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTHWEST; 192 jPanel1.add(jButtonBrowse, gridBagConstraints); 193 194 jCheckBoxSubDir.setText("Search Sub Directories"); 195 gridBagConstraints = new java.awt.GridBagConstraints (); 196 gridBagConstraints.gridx = 0; 197 gridBagConstraints.gridy = 2; 198 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 199 jPanel1.add(jCheckBoxSubDir, gridBagConstraints); 200 201 gridBagConstraints = new java.awt.GridBagConstraints (); 202 gridBagConstraints.gridx = 0; 203 gridBagConstraints.gridy = 0; 204 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 205 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 206 gridBagConstraints.weightx = 1.0; 207 gridBagConstraints.insets = new java.awt.Insets (4, 4, 4, 4); 208 getContentPane().add(jPanel1, gridBagConstraints); 209 210 jTableFiles.setModel(new javax.swing.table.DefaultTableModel ( 211 new Object [][] { 212 213 }, 214 new String [] { 215 "", "File", "Status" 216 } 217 ) { 218 boolean[] canEdit = new boolean [] { 219 false, false, false 220 }; 221 222 public boolean isCellEditable(int rowIndex, int columnIndex) { 223 return canEdit [columnIndex]; 224 } 225 }); 226 jTableFiles.addMouseListener(new java.awt.event.MouseAdapter () { 227 public void mouseClicked(java.awt.event.MouseEvent evt) { 228 jTableFilesMouseClicked(evt); 229 } 230 }); 231 232 jScrollPane1.setViewportView(jTableFiles); 233 234 gridBagConstraints = new java.awt.GridBagConstraints (); 235 gridBagConstraints.gridx = 0; 236 gridBagConstraints.gridy = 1; 237 gridBagConstraints.gridwidth = 2; 238 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 239 gridBagConstraints.weightx = 1.0; 240 gridBagConstraints.weighty = 1.0; 241 gridBagConstraints.insets = new java.awt.Insets (0, 4, 0, 4); 242 getContentPane().add(jScrollPane1, gridBagConstraints); 243 244 jPanel2.setLayout(new java.awt.GridBagLayout ()); 245 246 jPanel2.setMinimumSize(new java.awt.Dimension (0, 125)); 247 jPanel2.setPreferredSize(new java.awt.Dimension (0, 125)); 248 jButtonClose.setText("Close"); 249 jButtonClose.addActionListener(new java.awt.event.ActionListener () { 250 public void actionPerformed(java.awt.event.ActionEvent evt) { 251 jButtonCloseActionPerformed(evt); 252 } 253 }); 254 255 gridBagConstraints = new java.awt.GridBagConstraints (); 256 gridBagConstraints.gridx = 1; 257 gridBagConstraints.gridy = 1; 258 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 259 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 260 gridBagConstraints.weightx = 0.2; 261 gridBagConstraints.insets = new java.awt.Insets (4, 0, 4, 4); 262 jPanel2.add(jButtonClose, gridBagConstraints); 263 264 jPanel4.setLayout(new java.awt.GridBagLayout ()); 265 266 jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Options")); 267 jPanel4.setMinimumSize(new java.awt.Dimension (200, 80)); 268 jPanel4.setPreferredSize(new java.awt.Dimension (200, 80)); 269 jCheckBoxChangeFileExt.setText("Change file extension to .jrxml"); 270 gridBagConstraints = new java.awt.GridBagConstraints (); 271 gridBagConstraints.gridx = 0; 272 gridBagConstraints.gridy = 0; 273 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 274 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 275 gridBagConstraints.weightx = 1.0; 276 jPanel4.add(jCheckBoxChangeFileExt, gridBagConstraints); 277 278 jCheckBoxBackup.setText("Backup old compiled files"); 279 gridBagConstraints = new java.awt.GridBagConstraints (); 280 gridBagConstraints.gridx = 0; 281 gridBagConstraints.gridy = 1; 282 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 283 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 284 gridBagConstraints.weightx = 1.0; 285 jPanel4.add(jCheckBoxBackup, gridBagConstraints); 286 287 jCheckBoxDirectory.setSelected(true); 288 jCheckBoxDirectory.setLabel("Use the compilation directory set in the options window"); 289 gridBagConstraints = new java.awt.GridBagConstraints (); 290 gridBagConstraints.gridx = 0; 291 gridBagConstraints.gridy = 2; 292 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 293 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 294 gridBagConstraints.weightx = 1.0; 295 jPanel4.add(jCheckBoxDirectory, gridBagConstraints); 296 297 gridBagConstraints = new java.awt.GridBagConstraints (); 298 gridBagConstraints.gridx = 0; 299 gridBagConstraints.gridy = 0; 300 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 301 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; 302 gridBagConstraints.weightx = 0.8; 303 gridBagConstraints.insets = new java.awt.Insets (0, 4, 0, 4); 304 jPanel2.add(jPanel4, gridBagConstraints); 305 306 jPanel5.setLayout(new java.awt.GridBagLayout ()); 307 308 jPanel5.setPreferredSize(new java.awt.Dimension (100, 10)); 309 jButtonCompile.setText("Compile selected file(s)"); 310 jButtonCompile.setEnabled(false); 311 jButtonCompile.addActionListener(new java.awt.event.ActionListener () { 312 public void actionPerformed(java.awt.event.ActionEvent evt) { 313 jButtonCompileActionPerformed(evt); 314 } 315 }); 316 317 gridBagConstraints = new java.awt.GridBagConstraints (); 318 gridBagConstraints.gridx = 0; 319 gridBagConstraints.gridy = 0; 320 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 321 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 322 gridBagConstraints.weightx = 1.0; 323 gridBagConstraints.insets = new java.awt.Insets (4, 0, 0, 0); 324 jPanel5.add(jButtonCompile, gridBagConstraints); 325 326 jButtonCancelCompile.setText("Cancel"); 327 jButtonCancelCompile.setEnabled(false); 328 jButtonCancelCompile.addActionListener(new java.awt.event.ActionListener () { 329 public void actionPerformed(java.awt.event.ActionEvent evt) { 330 jButtonCancelCompileActionPerformed(evt); 331 } 332 }); 333 334 gridBagConstraints = new java.awt.GridBagConstraints (); 335 gridBagConstraints.gridx = 0; 336 gridBagConstraints.gridy = 2; 337 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 338 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 339 gridBagConstraints.weightx = 1.0; 340 jPanel5.add(jButtonCancelCompile, gridBagConstraints); 341 342 jButtonCompileAll.setText("Compile All"); 343 jButtonCompileAll.setEnabled(false); 344 jButtonCompileAll.addActionListener(new java.awt.event.ActionListener () { 345 public void actionPerformed(java.awt.event.ActionEvent evt) { 346 jButtonCompileAllActionPerformed(evt); 347 } 348 }); 349 350 gridBagConstraints = new java.awt.GridBagConstraints (); 351 gridBagConstraints.gridx = 0; 352 gridBagConstraints.gridy = 1; 353 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 354 gridBagConstraints.weightx = 1.0; 355 jPanel5.add(jButtonCompileAll, gridBagConstraints); 356 357 gridBagConstraints = new java.awt.GridBagConstraints (); 358 gridBagConstraints.gridx = 0; 359 gridBagConstraints.gridy = 3; 360 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 361 gridBagConstraints.weighty = 1.0; 362 jPanel5.add(jPanel6, gridBagConstraints); 363 364 gridBagConstraints = new java.awt.GridBagConstraints (); 365 gridBagConstraints.gridx = 1; 366 gridBagConstraints.gridy = 0; 367 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 368 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; 369 gridBagConstraints.weightx = 0.2; 370 gridBagConstraints.weighty = 1.0; 371 gridBagConstraints.insets = new java.awt.Insets (4, 0, 0, 4); 372 jPanel2.add(jPanel5, gridBagConstraints); 373 374 gridBagConstraints = new java.awt.GridBagConstraints (); 375 gridBagConstraints.gridx = 0; 376 gridBagConstraints.gridy = 2; 377 gridBagConstraints.gridwidth = 2; 378 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 379 getContentPane().add(jPanel2, gridBagConstraints); 380 381 jPanel3.setLayout(new java.awt.GridBagLayout ()); 382 383 jPanel3.setMinimumSize(new java.awt.Dimension (100, 10)); 384 jPanel3.setPreferredSize(new java.awt.Dimension (100, 10)); 385 jButtonFind.setText("Find"); 386 jButtonFind.addActionListener(new java.awt.event.ActionListener () { 387 public void actionPerformed(java.awt.event.ActionEvent evt) { 388 jButtonFindActionPerformed(evt); 389 } 390 }); 391 392 gridBagConstraints = new java.awt.GridBagConstraints (); 393 gridBagConstraints.gridx = 0; 394 gridBagConstraints.gridy = 0; 395 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 396 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH; 397 gridBagConstraints.weightx = 1.0; 398 jPanel3.add(jButtonFind, gridBagConstraints); 399 400 jButtonCancelFind.setText("Cancel"); 401 jButtonCancelFind.setEnabled(false); 402 jButtonCancelFind.addActionListener(new java.awt.event.ActionListener () { 403 public void actionPerformed(java.awt.event.ActionEvent evt) { 404 jButtonCancelFindActionPerformed(evt); 405 } 406 }); 407 408 gridBagConstraints = new java.awt.GridBagConstraints (); 409 gridBagConstraints.gridx = 0; 410 gridBagConstraints.gridy = 1; 411 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 412 gridBagConstraints.insets = new java.awt.Insets (2, 0, 0, 0); 413 jPanel3.add(jButtonCancelFind, gridBagConstraints); 414 415 gridBagConstraints = new java.awt.GridBagConstraints (); 416 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 417 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 418 gridBagConstraints.insets = new java.awt.Insets (4, 0, 4, 4); 419 getContentPane().add(jPanel3, gridBagConstraints); 420 421 pack(); 422 } 424 private void jMenuItemViewSourceActionPerformed(java.awt.event.ActionEvent evt) { if (iReportMainFrame == null) return; 426 if (jTableFiles.getSelectedRowCount() != 0) 427 { 428 Runtime rt = Runtime.getRuntime(); 429 String editor = "notepad.exe"; 430 try { 431 if (iReportMainFrame.getProperties().getProperty("ExternalEditor")!=null) 432 editor = (String )iReportMainFrame.getProperties().getProperty("ExternalEditor"); 433 if (editor == null || editor.equals("")) { 434 iReportMainFrame.logOnConsole(I18n.getString("messages.useNotepad", "Using notepad.exe as default editor!\n"),false); 435 editor = "notepad.exe"; 436 } 437 438 rt.exec(editor+ " \"" + ((FileEntry)this.jTableFiles.getValueAt( jTableFiles.getSelectedRow(), 0)).getFile().getCanonicalPath() +"\""); 439 } catch (Exception ex) { 440 441 javax.swing.JOptionPane.showMessageDialog(this, 442 I18n.getFormattedString("messages.errorExecutingEditor", 443 "An exception is occured executing:\n{0} \"{1}\"",new Object []{editor,"" + ((FileEntry)this.jTableFiles.getValueAt( jTableFiles.getSelectedRow(), 0)).getFile()}) ,"",javax.swing.JOptionPane.ERROR_MESSAGE); 444 } 445 } 446 } 448 private void jMenuItemOpenActionPerformed(java.awt.event.ActionEvent evt) { if (iReportMainFrame == null) return; 450 if (jTableFiles.getSelectedRowCount() != 0) 451 { 452 iReportMainFrame.openFile( ((FileEntry)this.jTableFiles.getValueAt( jTableFiles.getSelectedRow(), 0)).getFile() ); 453 } 454 } 456 private void jMenuItemDetailsActionPerformed(java.awt.event.ActionEvent evt) { if (jTableFiles.getSelectedRowCount() != 0) 458 { 459 FileDetails fd = new FileDetails(this, true); 460 fd.setFileEntry( (FileEntry)this.jTableFiles.getValueAt( jTableFiles.getSelectedRow(), 0) ); 461 fd.setVisible(true); 462 } 463 } 465 private void jTableFilesMouseClicked(java.awt.event.MouseEvent evt) { if (evt.getButton() == evt.BUTTON1 && evt.getClickCount() == 2) 467 { 468 if (jTableFiles.getSelectedRowCount() != 0) 469 { 470 FileDetails fd = new FileDetails(this, true); 471 fd.setFileEntry( (FileEntry)this.jTableFiles.getValueAt( jTableFiles.getSelectedRow(), 0) ); 472 fd.setVisible(true); 473 } 474 } 475 else if (evt.getButton() == evt.BUTTON3 && evt.getClickCount() == 1) 476 { 477 this.jPopupMenuFiles.show(jTableFiles, evt.getPoint().x, evt.getPoint().y); 478 } 479 } 481 private void jButtonCompileAllActionPerformed(java.awt.event.ActionEvent evt) { 484 compileThread = new CompileThread(this); 485 compileThread.setCompileSelectedOnly(false); 486 startCompiling(); 487 compileThread.start(); 488 } 490 private void jButtonCancelCompileActionPerformed(java.awt.event.ActionEvent evt) { compileThread.stop(); 492 finishedCompiling(); 493 } 495 private void jButtonCompileActionPerformed(java.awt.event.ActionEvent evt) { 497 499 compileThread = new CompileThread(this); 500 compileThread.setCompileSelectedOnly(true); 501 startCompiling(); 502 compileThread.start(); 503 504 } 506 private void jButtonCloseActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false); 508 } 510 private void jButtonCancelFindActionPerformed(java.awt.event.ActionEvent evt) { 512 findThread.stop(); 513 finishedFind(); 514 515 } 517 private void jButtonFindActionPerformed(java.awt.event.ActionEvent evt) { 519 if (jTextFieldPath.getText().length() == 0) 520 { 521 JOptionPane.showMessageDialog(this, 522 I18n.getString("messages.massiveCompilerFrame.noDir", "Please select a directory."), 523 I18n.getString("messages.massiveCompilerFrame.noDirCaption", "No dir..."), JOptionPane.WARNING_MESSAGE); 524 return; 525 } 526 findThread = new FindThread(this); 527 startFind(); 528 findThread.start(); 529 530 } 532 private void jButtonBrowseActionPerformed(java.awt.event.ActionEvent evt) { 534 JFileChooser jfc = new JFileChooser(); 536 jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); 537 if (jfc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) 538 { 539 jTextFieldPath.setText( jfc.getSelectedFile().getPath()); 540 } 541 542 } 544 private void jTextFieldPathActionPerformed(java.awt.event.ActionEvent evt) { } 548 549 private void exitForm(java.awt.event.WindowEvent evt) { this.setVisible(false); 551 } 553 556 public static void main(String args[]) { 557 new MassiveCompilerFrame().setVisible(true); 558 } 559 560 561 private javax.swing.JButton jButtonBrowse; 563 private javax.swing.JButton jButtonCancelCompile; 564 private javax.swing.JButton jButtonCancelFind; 565 private javax.swing.JButton jButtonClose; 566 private javax.swing.JButton jButtonCompile; 567 private javax.swing.JButton jButtonCompileAll; 568 private javax.swing.JButton jButtonFind; 569 private javax.swing.JCheckBox jCheckBoxBackup; 570 private javax.swing.JCheckBox jCheckBoxChangeFileExt; 571 private javax.swing.JCheckBox jCheckBoxDirectory; 572 private javax.swing.JCheckBox jCheckBoxSubDir; 573 private javax.swing.JMenuItem jMenuItemDetails; 574 private javax.swing.JMenuItem jMenuItemOpen; 575 private javax.swing.JMenuItem jMenuItemViewSource; 576 private javax.swing.JPanel jPanel1; 577 private javax.swing.JPanel jPanel2; 578 private javax.swing.JPanel jPanel3; 579 private javax.swing.JPanel jPanel4; 580 private javax.swing.JPanel jPanel5; 581 private javax.swing.JPanel jPanel6; 582 private javax.swing.JPopupMenu jPopupMenuFiles; 583 private javax.swing.JScrollPane jScrollPane1; 584 private javax.swing.JTable jTableFiles; 585 private javax.swing.JTextField jTextFieldPath; 586 588 589 public javax.swing.JTable getFileTable() 590 { 591 return jTableFiles; 592 } 593 594 public String getFindDirectory() 595 { 596 return jTextFieldPath.getText(); 597 } 598 599 public boolean isSearchSubDirectory() 600 { 601 return jCheckBoxSubDir.isSelected(); 602 } 603 604 public boolean isSelectedChangeFileExt() 605 { 606 return jCheckBoxChangeFileExt.isSelected(); 607 } 608 609 public boolean isSelectedBackup() 610 { 611 return jCheckBoxBackup.isSelected(); 612 } 613 614 public boolean isSelectedOptionsCompileDir() 615 { 616 return jCheckBoxDirectory.isSelected(); 617 } 618 619 public void finishedFind() 620 { 621 finding = false; 622 this.jButtonCancelFind.setEnabled(false); 623 this.jButtonFind.setEnabled(true); 624 this.jButtonClose.setEnabled(true); 625 this.jCheckBoxSubDir.setEnabled(true); 626 this.jTextFieldPath.setEditable(true); 627 628 if (this.jTableFiles.getRowCount() > 0) 629 { 630 this.jButtonCompileAll.setEnabled(true); 631 jTableFilesListSelectionValueChanged(new ListSelectionEvent (this,0,0,false)); 632 } 633 else 634 { 635 this.jButtonCompileAll.setEnabled(false); 636 } 637 638 } 639 640 public void startFind() 641 { 642 finding = true; 643 this.jButtonCancelFind.setEnabled(true); 644 this.jButtonFind.setEnabled(false); 645 646 this.jButtonCompileAll.setEnabled(false); 647 this.jButtonCompile.setEnabled(false); 648 this.jButtonClose.setEnabled(false); 649 this.jCheckBoxSubDir.setEnabled(false); 650 this.jTextFieldPath.setEditable(false); 651 652 } 653 654 public void finishedCompiling() 655 { 656 compiling = false; 657 this.jButtonCancelCompile.setEnabled(false); 658 this.jButtonFind.setEnabled(true); 659 this.jButtonClose.setEnabled(true); 660 this.jCheckBoxBackup.setEnabled(true); 661 this.jCheckBoxChangeFileExt.setEnabled(true); 662 663 if (this.jTableFiles.getRowCount() > 0) 664 { 665 this.jButtonCompileAll.setEnabled(true); 666 jTableFilesListSelectionValueChanged(new ListSelectionEvent (this,0,0,false)); 667 } 668 else 669 { 670 this.jButtonCompileAll.setEnabled(false); 671 } 672 } 673 674 public void startCompiling() 675 { 676 compiling = true; 677 this.jButtonCancelCompile.setEnabled(false); 678 this.jButtonFind.setEnabled(false); 679 680 this.jButtonCompileAll.setEnabled(false); 681 this.jButtonCompile.setEnabled(false); 682 this.jButtonClose.setEnabled(false); 683 this.jCheckBoxBackup.setEnabled(false); 684 this.jCheckBoxChangeFileExt.setEnabled(false); 685 } 686 687 public void jTableFilesListSelectionValueChanged(ListSelectionEvent e) 688 { 689 if (finding) return; 690 if (this.jTableFiles.getSelectedRowCount() > 0) 691 { 692 this.jButtonCompile.setEnabled(true); 693 } 694 else 695 { 696 this.jButtonCompile.setEnabled(false); 697 } 698 } 699 700 704 public it.businesslogic.ireport.gui.MainFrame getIReportMainFrame() { 705 return iReportMainFrame; 706 } 707 708 712 public void setIReportMainFrame(it.businesslogic.ireport.gui.MainFrame iReportMainFrame) { 713 this.iReportMainFrame = iReportMainFrame; 714 } 715 716 public void applyI18n(){ 717 jMenuItemDetails.setText(I18n.getString("massiveCompilerFrame.menuItemDetails","Details and error messages")); 719 jMenuItemOpen.setText(I18n.getString("massiveCompilerFrame.menuItemOpen","Send to editor")); 720 jMenuItemViewSource.setText(I18n.getString("massiveCompilerFrame.menuItemViewSource","View source")); 721 jCheckBoxBackup.setText(I18n.getString("massiveCompilerFrame.checkBoxBackup","Backup old compiled files")); 724 jCheckBoxChangeFileExt.setText(I18n.getString("massiveCompilerFrame.checkBoxChangeFileExt","Change file extension to .jrxml")); 725 jCheckBoxSubDir.setText(I18n.getString("massiveCompilerFrame.checkBoxSubDir","Search Sub Directories")); 726 jButtonBrowse.setText(I18n.getString("massiveCompilerFrame.buttonBrowse","Browse...")); 729 jButtonCancelCompile.setText(I18n.getString("massiveCompilerFrame.buttonCancelCompile","Cancel")); 730 jButtonCancelFind.setText(I18n.getString("massiveCompilerFrame.buttonCancelFind","Cancel")); 731 jButtonClose.setText(I18n.getString("massiveCompilerFrame.buttonClose","Close")); 732 jButtonCompile.setText(I18n.getString("massiveCompilerFrame.buttonCompile","Compile selected file(s)")); 733 jButtonCompileAll.setText(I18n.getString("massiveCompilerFrame.buttonCompileAll","Compile All")); 734 jButtonFind.setText(I18n.getString("massiveCompilerFrame.buttonFind","Find")); 735 737 jTableFiles.getColumnModel().getColumn(1).setHeaderValue(I18n.getString("massiveCompilerFrame.tablecolumn.file","File") ); 738 jTableFiles.getColumnModel().getColumn(2).setHeaderValue(I18n.getString("massiveCompilerFrame.tablecolumn.status","Status") ); 739 740 ((javax.swing.border.TitledBorder )jPanel1.getBorder()).setTitle(I18n.getString("massiveCompilerFrame.panelBorder.Directory","Directory") ); 741 ((javax.swing.border.TitledBorder )jPanel4.getBorder()).setTitle(I18n.getString("massiveCompilerFrame.panelBorder.Options","Options") ); 742 } 743 } 744 | Popular Tags |