Changeset 8 in tmcsimulator-scriptbuilder


Ignore:
Timestamp:
07/25/2017 02:20:10 PM (9 years ago)
Author:
jdalbey
Message:

ScriptBuilderFrame?.java updated to add svn revision number to About box. (Also modified build.xml)

Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r7 r8  
    1111    <description>Builds, tests, and runs the project ScriptBuilder_Repo.</description> 
    1212    <import file="nbproject/build-impl.xml"/> 
     13 
     14<!--        STORE SUBVERSION BUILD STRING      --> 
     15<target name="-post-init" description="Sets the buildversion for the current build"> 
     16    <exec outputproperty="svna.version" executable="svnversion"> 
     17        <arg value="-c" /> 
     18         
     19        <redirector> 
     20            <outputfilterchain> 
     21                <tokenfilter> 
     22                    <replaceregex pattern="^[0-9]*:?" replace="" flags="g"/> 
     23                    <replaceregex pattern="M" replace="" flags="g"/> 
     24                </tokenfilter> 
     25            </outputfilterchain> 
     26        </redirector> 
     27    </exec> 
     28    <propertyfile file="${src.dir}/scriptbuilder/gui/application.properties"> 
     29        <entry key="Application.revision" value="${svna.version}" type="int" operation="="/> 
     30    </propertyfile> 
     31    <echo>Setting SVN version: ${svna.version}</echo> 
     32</target> 
     33<target name="-post-jar" description="Sets the buildversion for the current build"> 
     34    <propertyfile file="${src.dir}/scriptbuilder/gui/application.properties"> 
     35        <entry key="Application.buildnumber" value="1" type="int" operation="+"/> 
     36    </propertyfile> 
     37</target> 
    1338    <!-- 
    1439 
    15     There exist several targets which are by default empty and which can be  
    16     used for execution of your tasks. These targets are usually executed  
    17     before and after some main targets. They are:  
     40    There exist several targets which are by default empty and which can be 
     41    used for execution of your tasks. These targets are usually executed 
     42    before and after some main targets. They are: 
    1843 
    1944      -pre-init:                 called before initialization of project properties 
     
    4166        </target> 
    4267 
    43     For list of available properties check the imported  
    44     nbproject/build-impl.xml file.  
     68    For list of available properties check the imported 
     69    nbproject/build-impl.xml file. 
    4570 
    4671 
    4772    Another way to customize the build is by overriding existing main targets. 
    48     The targets of interest are:  
     73    The targets of interest are: 
    4974 
    5075      -init-macrodef-javac:     defines macro for javac compilation 
     
    5378      -init-macrodef-java:      defines macro for class execution 
    5479      -do-jar:                  JAR building 
    55       run:                      execution of project  
     80      run:                      execution of project 
    5681      -javadoc-build:           Javadoc generation 
    5782      test-report:              JUnit report generation 
     
    6590        </target> 
    6691 
    67     Notice that the overridden target depends on the jar target and not only on  
    68     the compile target as the regular run target does. Again, for a list of available  
     92    Notice that the overridden target depends on the jar target and not only on 
     93    the compile target as the regular run target does. Again, for a list of available 
    6994    properties which you can use, check the target you are overriding in the 
    70     nbproject/build-impl.xml file.  
     95    nbproject/build-impl.xml file. 
    7196 
    7297    --> 
  • trunk/src/scriptbuilder/gui/ScriptBuilderFrame.form

    r1 r8  
    838838                <Property name="text" type="java.lang.String" value="About..."/> 
    839839              </Properties> 
     840              <Events> 
     841                <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="helpAboutActionPerformed"/> 
     842              </Events> 
    840843            </MenuItem> 
    841844          </SubComponents> 
     
    10861089                          <Component id="incidentTimelinePanel10" alignment="0" min="-2" max="-2" attributes="0"/> 
    10871090                      </Group> 
    1088                       <EmptySpace pref="252" max="32767" attributes="0"/> 
     1091                      <EmptySpace pref="251" max="32767" attributes="0"/> 
    10891092                  </Group> 
    10901093              </Group> 
     
    12321235                <DimensionLayout dim="0"> 
    12331236                  <Group type="103" groupAlignment="0" attributes="0"> 
    1234                       <EmptySpace min="0" pref="6884" max="32767" attributes="0"/> 
     1237                      <EmptySpace min="0" pref="6882" max="32767" attributes="0"/> 
    12351238                  </Group> 
    12361239                </DimensionLayout> 
     
    21242127            <DimensionLayout dim="0"> 
    21252128              <Group type="103" groupAlignment="0" attributes="0"> 
    2126                   <EmptySpace min="0" pref="1008" max="32767" attributes="0"/> 
     2129                  <EmptySpace min="0" pref="1032" max="32767" attributes="0"/> 
    21272130              </Group> 
    21282131            </DimensionLayout> 
  • trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java

    r7 r8  
    1414import java.awt.event.KeyListener; 
    1515import java.io.File; 
     16import java.io.IOException; 
    1617import java.util.ArrayList; 
    1718import java.util.Observable; 
    1819import java.util.Observer; 
     20import java.util.Properties; 
    1921import java.util.Random; 
     22import java.util.logging.Level; 
     23import java.util.logging.Logger; 
    2024import javax.swing.DefaultListModel; 
    2125import javax.swing.JButton; 
     
    5559     */ 
    5660    private ArrayList<JButton> eventButtons = null; 
    57  
    5861    /** 
    5962     * True if we are currently editing an incident. 
     
    226229        @Override 
    227230        public void keyReleased(KeyEvent e) 
    228  
    229231        { 
    230232        } 
     
    10461048        incidentTimelinePanel7Layout.setHorizontalGroup( 
    10471049            incidentTimelinePanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
    1048             .addGap(0, 6884, Short.MAX_VALUE) 
     1050            .addGap(0, 6882, Short.MAX_VALUE) 
    10491051        ); 
    10501052        incidentTimelinePanel7Layout.setVerticalGroup( 
     
    12901292                    .addComponent(incidentNumberPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 
    12911293                    .addComponent(incidentTimelinePanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 
    1292                 .addContainerGap(252, Short.MAX_VALUE)) 
     1294                .addContainerGap(251, Short.MAX_VALUE)) 
    12931295        ); 
    12941296 
     
    17691771        timeStampPanelLayout.setHorizontalGroup( 
    17701772            timeStampPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
    1771             .addGap(0, 1008, Short.MAX_VALUE) 
     1773            .addGap(0, 1032, Short.MAX_VALUE) 
    17721774        ); 
    17731775        timeStampPanelLayout.setVerticalGroup( 
     
    19511953 
    19521954        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        }); 
    19531962        helpMenu.add(helpAbout); 
    19541963 
     
    20532062 
    20542063    private void cadEventMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadEventMousePressed 
    2055  
    20562064    }//GEN-LAST:event_cadEventMousePressed 
    20572065 
    20582066    private void radioEventMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_radioEventMousePressed 
    2059  
    20602067    }//GEN-LAST:event_radioEventMousePressed 
    20612068 
    20622069    private void cadEventMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_cadEventMouseReleased 
    2063  
    20642070    }//GEN-LAST:event_cadEventMouseReleased 
    20652071 
    20662072    private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed 
    2067  
    20682073    }//GEN-LAST:event_okButtonActionPerformed 
    20692074 
     
    20802085 
    20812086    private void editEventListActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editEventListActionPerformed 
    2082  
    20832087    }//GEN-LAST:event_editEventListActionPerformed 
    20842088 
     
    21242128            script.incidents.add(indx, 
    21252129                    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)); 
    21282132            script.incidents.get(indx).length = (Integer) addIncidentLength.getValue() * 60; 
    21292133            script.incidents.get(indx).setOffset((Integer) addIncidentStart.getValue() * 60); 
     
    21522156            script.incidents.add(oldIncidentIndex, 
    21532157                    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)); 
    21562160            script.incidents.get(oldIncidentIndex).length = (Integer) addIncidentLength.getValue() * 60; 
    21572161            script.incidents.get(oldIncidentIndex).slices = backup.slices; 
     
    22212225        cadButton.setSelected(true); 
    22222226    }//GEN-LAST:event_cadButtonActionPerformed 
     2227 
    22232228    /** 
    22242229     * Selects CCTV_EVENT as the current type of new event, upon click of "CCTV 
     
    22352240        cctvButton.setSelected(true); 
    22362241    }//GEN-LAST:event_cctvButtonActionPerformed 
     2242 
    22372243    /** 
    22382244     * Selects CHP_RADIO_EVENT as the current type of new event, upon click of 
     
    22512257 
    22522258    private void fileMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileMenuActionPerformed 
    2253  
    22542259    }//GEN-LAST:event_fileMenuActionPerformed 
    22552260 
     
    24722477        fc.showSaveDialog(this); 
    24732478    }//GEN-LAST:event_generateOrganizationChartActionPerformed 
     2479 
    24742480    /** 
    24752481     * Selects WITNESS_EVENT as the current type of new event, upon click of 
     
    24862492        witnessButton.setSelected(true); 
    24872493    }//GEN-LAST:event_witnessButtonActionPerformed 
     2494 
    24882495    /** 
    24892496     * Selects UNIT_EVENT as the current type of new event, upon click of "Unit 
     
    25002507        unitButton.setSelected(true); 
    25012508    }//GEN-LAST:event_unitButtonActionPerformed 
     2509 
    25022510    /** 
    25032511     * Selects TOW_EVENT as the current type of new event, upon click of "TOW 
     
    25142522        towButton.setSelected(true); 
    25152523    }//GEN-LAST:event_towButtonActionPerformed 
     2524 
    25162525    /** 
    25172526     * Selects PARAMICS_EVENT as the current type of new event, upon click of 
     
    25282537        paramicsButton.setSelected(true); 
    25292538    }//GEN-LAST:event_paramicsButtonActionPerformed 
     2539 
    25302540    /** 
    25312541     * Selects MAINTENANCE_RADIO_EVENT as the current type of new event, upon 
     
    25422552        maintenanceRadioButton.setSelected(true); 
    25432553    }//GEN-LAST:event_maintenanceRadioButtonActionPerformed 
     2554 
    25442555    /** 
    25452556     * Selects ATMS_EVAL_EVENT as the current type of new event, upon click of 
     
    25562567        atmsEvalButton.setSelected(true); 
    25572568    }//GEN-LAST:event_atmsEvalButtonActionPerformed 
     2569 
    25582570    /** 
    25592571     * Selects TELEPHONE_EVENT as the current type of new event, upon click of 
     
    25702582        telephoneButton.setSelected(true); 
    25712583    }//GEN-LAST:event_telephoneButtonActionPerformed 
     2584 
    25722585    /** 
    25732586     * Selects TMT_RADIO_EVENT as the current type of new event, upon click of 
     
    25842597        tmtRadioButton.setSelected(true); 
    25852598    }//GEN-LAST:event_tmtRadioButtonActionPerformed 
     2599 
    25862600    /** 
    25872601     * Selects CMS_EVAL_EVENT as the current type of new event, upon click of 
     
    25982612        cmsEvalButton.setSelected(true); 
    25992613    }//GEN-LAST:event_cmsEvalButtonActionPerformed 
     2614 
    26002615    /** 
    26012616     * Selects CAD_EVAL_EVENT as the current type of new event, upon click of 
     
    26122627        cadEvalButton.setSelected(true); 
    26132628    }//GEN-LAST:event_cadEvalButtonActionPerformed 
     2629 
    26142630    /** 
    26152631     * Selects ACTIVITY_LOG_EVAL_EVENT as the current type of new event, upon 
     
    26262642        activityLogEvalButton.setSelected(true); 
    26272643    }//GEN-LAST:event_activityLogEvalButtonActionPerformed 
     2644 
    26282645    /** 
    26292646     * Selects RADIO_EVAL_EVENT as the current type of new event, upon click of 
     
    26402657        radioEvalButton.setSelected(true); 
    26412658    }//GEN-LAST:event_radioEvalButtonActionPerformed 
     2659 
    26422660    /** 
    26432661     * Selects FACILITATOR_EVAL_EVENT as the current type of new event, upon 
     
    26542672        facilitatorEvalButton.setSelected(true); 
    26552673    }//GEN-LAST:event_facilitatorEvalButtonActionPerformed 
     2674 
    26562675    /** 
    26572676     * Selects AUDIO_EVENT as the current type of new event, upon click of 
     
    26772696        zoomSlider.setValue(zoomSlider.getValue() >= 21 ? 21 : zoomSlider.getValue() + 1); 
    26782697    }//GEN-LAST:event_zoomInIconMouseClicked 
     2698 
    26792699    /** 
    26802700     * Decreases zoom level upon click of the "Zoom out" icon. 
     
    26852705        zoomSlider.setValue(zoomSlider.getValue() <= 5 ? 5 : zoomSlider.getValue() - 1); 
    26862706    }//GEN-LAST:event_zoomOutIconMouseClicked 
    2687  
    26882707    private Color selectedColor = Color.BLACK; 
    26892708 
     
    27012720        // TODO add your handling code here: 
    27022721    }//GEN-LAST:event_XMLExportBtnActionPerformed 
     2722 
    27032723    /** 
    27042724     * Upon click of the "Import From XML" menu option, allows user to choose an 
     
    27132733        fc.setFileFilter(new ExtensionFileFilter("Simulation Script XML (.xml)", 
    27142734                new String[] 
    2715                 { 
    2716                     "xml" 
    2717                 })); 
     2735        { 
     2736            "xml" 
     2737        })); 
    27182738        if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION) 
    27192739        { 
     
    27232743    }//GEN-LAST:event_XMLImportBtnActionPerformed 
    27242744 
     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 
    27252783    /** 
    27262784     * Runs the script builder. 
    2727      *  
     2785     * 
    27282786     * @param args the command line arguments 
    27292787     */ 
     
    27662824        java.awt.EventQueue.invokeLater( 
    27672825                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        }); 
    27752832    } 
    2776  
    27772833    // Variables declaration - do not modify//GEN-BEGIN:variables 
    27782834    private javax.swing.JMenuItem XMLExportBtn; 
     
    29202976    private javax.swing.JSlider zoomSlider; 
    29212977    // End of variables declaration//GEN-END:variables 
    2922  
    29232978} 
Note: See TracChangeset for help on using the changeset viewer.