Changeset 49 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder
- Timestamp:
- 08/08/2017 09:55:18 AM (9 years ago)
- Location:
- trunk/src/scriptbuilder
- Files:
-
- 4 edited
-
gui/ScriptBuilderFrame.form (modified) (1 diff)
-
gui/ScriptBuilderFrame.java (modified) (11 diffs)
-
gui/panels/IncidentTimelinePanel.java (modified) (1 diff)
-
structures/SimulationScript.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/ScriptBuilderFrame.form
r11 r49 844 844 </SubComponents> 845 845 </Menu> 846 <Menu class="javax.swing.JMenu" name="jMenu2">847 <Properties>848 <Property name="text" type="java.lang.String" value="XML"/>849 </Properties>850 <SubComponents>851 <MenuItem class="javax.swing.JMenuItem" name="XMLImportBtn">852 <Properties>853 <Property name="text" type="java.lang.String" value="Import from XML"/>854 </Properties>855 <Events>856 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="XMLImportBtnActionPerformed"/>857 </Events>858 </MenuItem>859 <MenuItem class="javax.swing.JMenuItem" name="XMLExportBtn">860 <Properties>861 <Property name="text" type="java.lang.String" value="Export to XML"/>862 </Properties>863 <Events>864 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="XMLExportBtnActionPerformed"/>865 </Events>866 </MenuItem>867 </SubComponents>868 </Menu>869 846 </SubComponents> 870 847 </Menu> -
trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java
r34 r49 529 529 helpTutorial = new javax.swing.JMenuItem(); 530 530 helpAbout = new javax.swing.JMenuItem(); 531 jMenu2 = new javax.swing.JMenu();532 XMLImportBtn = new javax.swing.JMenuItem();533 XMLExportBtn = new javax.swing.JMenuItem();534 531 535 532 popupDeleteIncident.setText("Delete Incident..."); … … 1310 1307 .addGroup(scriptEventsPanelLayout.createSequentialGroup() 1311 1308 .addContainerGap() 1312 .addComponent(scriptEventsPane , javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)1309 .addComponent(scriptEventsPane) 1313 1310 .addContainerGap()) 1314 1311 ); … … 1365 1362 .addContainerGap() 1366 1363 .addGroup(scriptEventsPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 1367 .addComponent(incidentDescriptionPane, javax.swing.GroupLayout.Alignment.TRAILING , javax.swing.GroupLayout.DEFAULT_SIZE, 453, Short.MAX_VALUE)1364 .addComponent(incidentDescriptionPane, javax.swing.GroupLayout.Alignment.TRAILING) 1368 1365 .addComponent(jLabel4) 1369 1366 .addGroup(scriptEventsPanel1Layout.createSequentialGroup() … … 1373 1370 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 1374 1371 .addGroup(scriptEventsPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 1375 .addComponent(incidentName , javax.swing.GroupLayout.DEFAULT_SIZE, 366, Short.MAX_VALUE)1376 .addComponent(incidentNumber , javax.swing.GroupLayout.DEFAULT_SIZE, 366, Short.MAX_VALUE))))1372 .addComponent(incidentName) 1373 .addComponent(incidentNumber)))) 1377 1374 .addContainerGap()) 1378 1375 ); … … 1963 1960 scriptBuilderMenuBar.add(helpMenu); 1964 1961 1965 jMenu2.setText("XML");1966 1967 XMLImportBtn.setText("Import from XML");1968 XMLImportBtn.addActionListener(new java.awt.event.ActionListener()1969 {1970 public void actionPerformed(java.awt.event.ActionEvent evt)1971 {1972 XMLImportBtnActionPerformed(evt);1973 }1974 });1975 jMenu2.add(XMLImportBtn);1976 1977 XMLExportBtn.setText("Export to XML");1978 XMLExportBtn.addActionListener(new java.awt.event.ActionListener()1979 {1980 public void actionPerformed(java.awt.event.ActionEvent evt)1981 {1982 XMLExportBtnActionPerformed(evt);1983 }1984 });1985 jMenu2.add(XMLExportBtn);1986 1987 scriptBuilderMenuBar.add(jMenu2);1988 1989 1962 setJMenuBar(scriptBuilderMenuBar); 1990 1963 … … 2266 2239 private void fileOpenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileOpenActionPerformed 2267 2240 JFileChooser fc = new JFileChooser(); 2268 fc.setFileFilter(new ExtensionFileFilter("Simulation Script (.xml)", new String[] 2269 { 2270 "xml" 2271 })); 2272 fc.showOpenDialog(this); 2241 2242 fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)", 2243 new String[] 2244 { 2245 "xml" 2246 })); 2247 if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) 2248 { 2249 System.out.println(fc.getSelectedFile().getName()); 2250 script.loadScriptFromFile(fc.getSelectedFile()); 2251 script.saveFile = fc.getSelectedFile(); 2252 } 2273 2253 }//GEN-LAST:event_fileOpenActionPerformed 2274 2254 … … 2281 2261 private void fileSaveAsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveAsActionPerformed 2282 2262 JFileChooser fc = new JFileChooser(); 2283 fc.setFileFilter(new ExtensionFileFilter("Simulation Script (.xml)", new String[] 2284 { 2285 "xml" 2286 })); 2287 fc.showSaveDialog(this); 2263 2264 fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)", 2265 new String[] 2266 { 2267 "xml" 2268 })); 2269 2270 if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) 2271 { 2272 script.saveScriptToFile(fc.getSelectedFile()); 2273 script.saveFile = fc.getSelectedFile(); 2274 } 2288 2275 }//GEN-LAST:event_fileSaveAsActionPerformed 2289 2276 … … 2295 2282 */ 2296 2283 private void fileSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileSaveActionPerformed 2297 JFileChooser fc = new JFileChooser(); 2298 fc.setFileFilter(new ExtensionFileFilter("Simulation Script (.xml)", new String[] 2299 { 2300 "xml" 2301 })); 2302 fc.showSaveDialog(this); 2284 if (script.saveFile == null) 2285 { 2286 fileSaveAsActionPerformed(evt); 2287 } 2288 else 2289 { 2290 script.saveScriptToFile(script.saveFile); 2291 } 2303 2292 }//GEN-LAST:event_fileSaveActionPerformed 2304 2293 … … 2746 2735 }//GEN-LAST:event_jButton3ActionPerformed 2747 2736 2748 private void XMLExportBtnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_XMLExportBtnActionPerformed2749 {//GEN-HEADEREND:event_XMLExportBtnActionPerformed2750 JFileChooser fc = new JFileChooser();2751 2752 fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",2753 new String[]2754 {2755 "xml"2756 }));2757 2758 if (fc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)2759 {2760 script.saveScriptToFile(fc.getSelectedFile());2761 }2762 }//GEN-LAST:event_XMLExportBtnActionPerformed2763 2764 /**2765 * Upon click of the "Import From XML" menu option, allows user to choose an2766 * XML script, and loads it into the script model.2767 *2768 * @param evt the button press event2769 */2770 private void XMLImportBtnActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_XMLImportBtnActionPerformed2771 {//GEN-HEADEREND:event_XMLImportBtnActionPerformed2772 JFileChooser fc = new JFileChooser();2773 2774 fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)",2775 new String[]2776 {2777 "xml"2778 }));2779 if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)2780 {2781 System.out.println(fc.getSelectedFile().getName());2782 script.loadScriptFromFile(fc.getSelectedFile());2783 }2784 }//GEN-LAST:event_XMLImportBtnActionPerformed2785 2737 /* Help > About simply displays the current SVN revision number so 2786 2738 * the user can determine which version of the source code was used to … … 2877 2829 } 2878 2830 // Variables declaration - do not modify//GEN-BEGIN:variables 2879 private javax.swing.JMenuItem XMLExportBtn;2880 private javax.swing.JMenuItem XMLImportBtn;2881 2831 private javax.swing.JButton activityLogEvalButton; 2882 2832 private javax.swing.JTextArea addIncidentDescription; … … 2971 2921 private javax.swing.JLabel jLabel8; 2972 2922 private javax.swing.JLabel jLabel9; 2973 private javax.swing.JMenu jMenu2;2974 2923 private javax.swing.JMenuItem jMenuItem2; 2975 2924 private javax.swing.JMenuItem jMenuItem3; -
trunk/src/scriptbuilder/gui/panels/IncidentTimelinePanel.java
r31 r49 161 161 { 162 162 ed.setVisible(true); 163 System.out.println(incident.slices.get(newSlice).toXML());164 163 } 165 164 } -
trunk/src/scriptbuilder/structures/SimulationScript.java
r46 r49 49 49 Color.GRAY 50 50 }; 51 52 public File saveFile = null; 51 53 52 54 public String title = "";
Note: See TracChangeset
for help on using the changeset viewer.
