Changeset 127 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/gui/IncidentPaletteFrame.java
- Timestamp:
- 09/26/2017 01:44:55 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/IncidentPaletteFrame.java
r103 r127 9 9 import java.io.File; 10 10 import java.io.FileFilter; 11 import java.io.IOException; 11 12 import java.text.SimpleDateFormat; 12 13 import java.time.LocalDate; 13 14 import java.util.ArrayList; 14 15 import java.util.Date; 16 import java.util.Properties; 15 17 import java.util.TimeZone; 18 import java.util.logging.Level; 19 import java.util.logging.Logger; 20 import javax.swing.JOptionPane; 16 21 import javax.swing.JPanel; 17 22 import javax.swing.JScrollPane; … … 26 31 public class IncidentPaletteFrame extends javax.swing.JFrame 27 32 { 33 34 private String incDir; 28 35 29 36 private SimulationScript script; … … 62 69 initComponents(); 63 70 64 incidentList = loadIncidentsFromFiles("Incidents"); 71 String propfilename = "/scriptbuilder/gui/application.properties"; 72 String propKey = "Incidents.directory"; 73 incDir = ""; 74 // Load the application properties (created by build.xml) 75 try 76 { 77 Properties props = new Properties(); 78 props.load(this.getClass().getResourceAsStream(propfilename)); 79 incDir = (String) props.get(propKey); 80 } 81 catch (IOException ex) 82 { 83 Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE, 84 "IncidentPaletteFrame.loadIncidentsFromFiles." 85 + " IOError reading " + propfilename); 86 } 87 88 incidentList = loadIncidentsFromFiles(incDir); 65 89 66 90 refresh(); … … 81 105 }); 82 106 107 //If the folder isn't correct then just hand back an empty list 108 if (!folder.exists()) 109 { 110 JOptionPane.showMessageDialog(this, 111 "Unable to locate folder of existing incidents.\n" 112 + "Folder \""+incDir+"\" should have been included in the\n" 113 + "ScriptBuilder.zip file you downloaded.\n" 114 + "TO FIX: Close the ScriptBuilder program and run it from\n" 115 + "the same directory where you opened the .zip file.\n\n" 116 + "(If the problem persists, contact the developers.)", "Missing Folder: \""+incDir+"\"", JOptionPane.ERROR_MESSAGE); 117 return newList; 118 } 119 83 120 incidentFiles = folder.listFiles(); 84 121 … … 211 248 }); 212 249 213 txtSearchFilter.setText("Search..."); 250 txtSearchFilter.addActionListener(new java.awt.event.ActionListener() 251 { 252 public void actionPerformed(java.awt.event.ActionEvent evt) 253 { 254 txtSearchFilterActionPerformed(evt); 255 } 256 }); 214 257 215 258 javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); … … 389 432 this.dispose(); 390 433 }//GEN-LAST:event_btnClosePaletteActionPerformed 434 435 private void txtSearchFilterActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_txtSearchFilterActionPerformed 436 {//GEN-HEADEREND:event_txtSearchFilterActionPerformed 437 // TODO add your handling code here: 438 }//GEN-LAST:event_txtSearchFilterActionPerformed 391 439 392 440
Note: See TracChangeset
for help on using the changeset viewer.
