Changeset 8 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder
- Timestamp:
- 07/25/2017 02:20:10 PM (9 years ago)
- Location:
- trunk/src/scriptbuilder/gui
- Files:
-
- 1 added
- 2 edited
-
ScriptBuilderFrame.form (modified) (4 diffs)
-
ScriptBuilderFrame.java (modified) (35 diffs)
-
application.properties (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/ScriptBuilderFrame.form
r1 r8 838 838 <Property name="text" type="java.lang.String" value="About..."/> 839 839 </Properties> 840 <Events> 841 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="helpAboutActionPerformed"/> 842 </Events> 840 843 </MenuItem> 841 844 </SubComponents> … … 1086 1089 <Component id="incidentTimelinePanel10" alignment="0" min="-2" max="-2" attributes="0"/> 1087 1090 </Group> 1088 <EmptySpace pref="25 2" max="32767" attributes="0"/>1091 <EmptySpace pref="251" max="32767" attributes="0"/> 1089 1092 </Group> 1090 1093 </Group> … … 1232 1235 <DimensionLayout dim="0"> 1233 1236 <Group type="103" groupAlignment="0" attributes="0"> 1234 <EmptySpace min="0" pref="688 4" max="32767" attributes="0"/>1237 <EmptySpace min="0" pref="6882" max="32767" attributes="0"/> 1235 1238 </Group> 1236 1239 </DimensionLayout> … … 2124 2127 <DimensionLayout dim="0"> 2125 2128 <Group type="103" groupAlignment="0" attributes="0"> 2126 <EmptySpace min="0" pref="10 08" max="32767" attributes="0"/>2129 <EmptySpace min="0" pref="1032" max="32767" attributes="0"/> 2127 2130 </Group> 2128 2131 </DimensionLayout> -
trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java
r7 r8 14 14 import java.awt.event.KeyListener; 15 15 import java.io.File; 16 import java.io.IOException; 16 17 import java.util.ArrayList; 17 18 import java.util.Observable; 18 19 import java.util.Observer; 20 import java.util.Properties; 19 21 import java.util.Random; 22 import java.util.logging.Level; 23 import java.util.logging.Logger; 20 24 import javax.swing.DefaultListModel; 21 25 import javax.swing.JButton; … … 55 59 */ 56 60 private ArrayList<JButton> eventButtons = null; 57 58 61 /** 59 62 * True if we are currently editing an incident. … … 226 229 @Override 227 230 public void keyReleased(KeyEvent e) 228 229 231 { 230 232 } … … 1046 1048 incidentTimelinePanel7Layout.setHorizontalGroup( 1047 1049 incidentTimelinePanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 1048 .addGap(0, 688 4, Short.MAX_VALUE)1050 .addGap(0, 6882, Short.MAX_VALUE) 1049 1051 ); 1050 1052 incidentTimelinePanel7Layout.setVerticalGroup( … … 1290 1292 .addComponent(incidentNumberPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 1291 1293 .addComponent(incidentTimelinePanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 1292 .addContainerGap(25 2, Short.MAX_VALUE))1294 .addContainerGap(251, Short.MAX_VALUE)) 1293 1295 ); 1294 1296 … … 1769 1771 timeStampPanelLayout.setHorizontalGroup( 1770 1772 timeStampPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 1771 .addGap(0, 10 08, Short.MAX_VALUE)1773 .addGap(0, 1032, Short.MAX_VALUE) 1772 1774 ); 1773 1775 timeStampPanelLayout.setVerticalGroup( … … 1951 1953 1952 1954 helpAbout.setText("About..."); 1955 helpAbout.addActionListener(new java.awt.event.ActionListener() 1956 { 1957 public void actionPerformed(java.awt.event.ActionEvent evt) 1958 { 1959 helpAboutActionPerformed(evt); 1960 } 1961 }); 1953 1962 helpMenu.add(helpAbout); 1954 1963 … … 2053 2062 2054 2063 private void cadEventMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadEventMousePressed 2055 2056 2064 }//GEN-LAST:event_cadEventMousePressed 2057 2065 2058 2066 private void radioEventMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_radioEventMousePressed 2059 2060 2067 }//GEN-LAST:event_radioEventMousePressed 2061 2068 2062 2069 private void cadEventMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadEventMouseReleased 2063 2064 2070 }//GEN-LAST:event_cadEventMouseReleased 2065 2071 2066 2072 private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed 2067 2068 2073 }//GEN-LAST:event_okButtonActionPerformed 2069 2074 … … 2080 2085 2081 2086 private void editEventListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editEventListActionPerformed 2082 2083 2087 }//GEN-LAST:event_editEventListActionPerformed 2084 2088 … … 2124 2128 script.incidents.add(indx, 2125 2129 new ScriptIncident(SimulationScript.incidentColors[indx], 2126 (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(),2127 script));2130 (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(), 2131 script)); 2128 2132 script.incidents.get(indx).length = (Integer) addIncidentLength.getValue() * 60; 2129 2133 script.incidents.get(indx).setOffset((Integer) addIncidentStart.getValue() * 60); … … 2152 2156 script.incidents.add(oldIncidentIndex, 2153 2157 new ScriptIncident(SimulationScript.incidentColors[oldIncidentIndex], 2154 (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(),2155 script));2158 (Integer) addIncidentNumber.getValue(), addIncidentName.getText(), addIncidentDescription.getText(), 2159 script)); 2156 2160 script.incidents.get(oldIncidentIndex).length = (Integer) addIncidentLength.getValue() * 60; 2157 2161 script.incidents.get(oldIncidentIndex).slices = backup.slices; … … 2221 2225 cadButton.setSelected(true); 2222 2226 }//GEN-LAST:event_cadButtonActionPerformed 2227 2223 2228 /** 2224 2229 * Selects CCTV_EVENT as the current type of new event, upon click of "CCTV … … 2235 2240 cctvButton.setSelected(true); 2236 2241 }//GEN-LAST:event_cctvButtonActionPerformed 2242 2237 2243 /** 2238 2244 * Selects CHP_RADIO_EVENT as the current type of new event, upon click of … … 2251 2257 2252 2258 private void fileMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileMenuActionPerformed 2253 2254 2259 }//GEN-LAST:event_fileMenuActionPerformed 2255 2260 … … 2472 2477 fc.showSaveDialog(this); 2473 2478 }//GEN-LAST:event_generateOrganizationChartActionPerformed 2479 2474 2480 /** 2475 2481 * Selects WITNESS_EVENT as the current type of new event, upon click of … … 2486 2492 witnessButton.setSelected(true); 2487 2493 }//GEN-LAST:event_witnessButtonActionPerformed 2494 2488 2495 /** 2489 2496 * Selects UNIT_EVENT as the current type of new event, upon click of "Unit … … 2500 2507 unitButton.setSelected(true); 2501 2508 }//GEN-LAST:event_unitButtonActionPerformed 2509 2502 2510 /** 2503 2511 * Selects TOW_EVENT as the current type of new event, upon click of "TOW … … 2514 2522 towButton.setSelected(true); 2515 2523 }//GEN-LAST:event_towButtonActionPerformed 2524 2516 2525 /** 2517 2526 * Selects PARAMICS_EVENT as the current type of new event, upon click of … … 2528 2537 paramicsButton.setSelected(true); 2529 2538 }//GEN-LAST:event_paramicsButtonActionPerformed 2539 2530 2540 /** 2531 2541 * Selects MAINTENANCE_RADIO_EVENT as the current type of new event, upon … … 2542 2552 maintenanceRadioButton.setSelected(true); 2543 2553 }//GEN-LAST:event_maintenanceRadioButtonActionPerformed 2554 2544 2555 /** 2545 2556 * Selects ATMS_EVAL_EVENT as the current type of new event, upon click of … … 2556 2567 atmsEvalButton.setSelected(true); 2557 2568 }//GEN-LAST:event_atmsEvalButtonActionPerformed 2569 2558 2570 /** 2559 2571 * Selects TELEPHONE_EVENT as the current type of new event, upon click of … … 2570 2582 telephoneButton.setSelected(true); 2571 2583 }//GEN-LAST:event_telephoneButtonActionPerformed 2584 2572 2585 /** 2573 2586 * Selects TMT_RADIO_EVENT as the current type of new event, upon click of … … 2584 2597 tmtRadioButton.setSelected(true); 2585 2598 }//GEN-LAST:event_tmtRadioButtonActionPerformed 2599 2586 2600 /** 2587 2601 * Selects CMS_EVAL_EVENT as the current type of new event, upon click of … … 2598 2612 cmsEvalButton.setSelected(true); 2599 2613 }//GEN-LAST:event_cmsEvalButtonActionPerformed 2614 2600 2615 /** 2601 2616 * Selects CAD_EVAL_EVENT as the current type of new event, upon click of … … 2612 2627 cadEvalButton.setSelected(true); 2613 2628 }//GEN-LAST:event_cadEvalButtonActionPerformed 2629 2614 2630 /** 2615 2631 * Selects ACTIVITY_LOG_EVAL_EVENT as the current type of new event, upon … … 2626 2642 activityLogEvalButton.setSelected(true); 2627 2643 }//GEN-LAST:event_activityLogEvalButtonActionPerformed 2644 2628 2645 /** 2629 2646 * Selects RADIO_EVAL_EVENT as the current type of new event, upon click of … … 2640 2657 radioEvalButton.setSelected(true); 2641 2658 }//GEN-LAST:event_radioEvalButtonActionPerformed 2659 2642 2660 /** 2643 2661 * Selects FACILITATOR_EVAL_EVENT as the current type of new event, upon … … 2654 2672 facilitatorEvalButton.setSelected(true); 2655 2673 }//GEN-LAST:event_facilitatorEvalButtonActionPerformed 2674 2656 2675 /** 2657 2676 * Selects AUDIO_EVENT as the current type of new event, upon click of … … 2677 2696 zoomSlider.setValue(zoomSlider.getValue() >= 21 ? 21 : zoomSlider.getValue() + 1); 2678 2697 }//GEN-LAST:event_zoomInIconMouseClicked 2698 2679 2699 /** 2680 2700 * Decreases zoom level upon click of the "Zoom out" icon. … … 2685 2705 zoomSlider.setValue(zoomSlider.getValue() <= 5 ? 5 : zoomSlider.getValue() - 1); 2686 2706 }//GEN-LAST:event_zoomOutIconMouseClicked 2687 2688 2707 private Color selectedColor = Color.BLACK; 2689 2708 … … 2701 2720 // TODO add your handling code here: 2702 2721 }//GEN-LAST:event_XMLExportBtnActionPerformed 2722 2703 2723 /** 2704 2724 * Upon click of the "Import From XML" menu option, allows user to choose an … … 2713 2733 fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)", 2714 2734 new String[] 2715 {2716 "xml"2717 }));2735 { 2736 "xml" 2737 })); 2718 2738 if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) 2719 2739 { … … 2723 2743 }//GEN-LAST:event_XMLImportBtnActionPerformed 2724 2744 2745 private void helpAboutActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_helpAboutActionPerformed 2746 {//GEN-HEADEREND:event_helpAboutActionPerformed 2747 JOptionPane.showMessageDialog(rootPane, "Revision: " + getAppVersion(), "About", JOptionPane.INFORMATION_MESSAGE); 2748 }//GEN-LAST:event_helpAboutActionPerformed 2749 2750 /** 2751 * Read the version number from the application properties. The file 2752 * 'application.properties' is generated by build.xml. 2753 * 2754 * @return a version string obtained from application.properties file, or 2755 * "Version: unknown" if an IOerror prevents us from reading the file. 2756 */ 2757 private String getAppVersion() 2758 { 2759 String propfilename = "/scriptbuilder/gui/application.properties"; 2760 String propKey = "Application.revision"; 2761 String version = "unknown"; 2762 try 2763 { 2764 Properties props = new Properties(); 2765 props.load(this.getClass().getResourceAsStream(propfilename)); 2766 version = (String) props.get(propKey); 2767 } 2768 catch (IOException ex) 2769 { 2770 Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE, 2771 "ScriptBuilderFrame.getAppVersion()." 2772 + " IOError reading " + propfilename); 2773 } 2774 catch (NullPointerException npe) 2775 { 2776 Logger.getLogger("scriptbuilder.gui").log(Level.SEVERE, 2777 "ScriptBuilderFrame.getAppVersion().load." 2778 + " Missing file: " + propfilename); 2779 } 2780 return version; 2781 } 2782 2725 2783 /** 2726 2784 * Runs the script builder. 2727 * 2785 * 2728 2786 * @param args the command line arguments 2729 2787 */ … … 2766 2824 java.awt.EventQueue.invokeLater( 2767 2825 new Runnable() 2768 { 2769 public void run() 2770 { 2771 new ScriptBuilderFrame().setVisible(true); 2772 } 2773 } 2774 ); 2826 { 2827 public void run() 2828 { 2829 new ScriptBuilderFrame().setVisible(true); 2830 } 2831 }); 2775 2832 } 2776 2777 2833 // Variables declaration - do not modify//GEN-BEGIN:variables 2778 2834 private javax.swing.JMenuItem XMLExportBtn; … … 2920 2976 private javax.swing.JSlider zoomSlider; 2921 2977 // End of variables declaration//GEN-END:variables 2922 2923 2978 }
Note: See TracChangeset
for help on using the changeset viewer.
