Changeset 98 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder


Ignore:
Timestamp:
08/29/2017 10:40:27 AM (9 years ago)
Author:
bmcguffin
Message:

Added "Add 15 minutes" button, btnAddTime, to both Script Builder and Incident Editor windows. Clicking the button allows the user to add 15 minutes of scrollable space to the end of the timeline window, so that new events can be added after the end. This extra time does not interact with the model and so does not enter the save file, or persist between iterations of the program.

Location:
trunk/src/scriptbuilder/gui
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/gui/IncidentEditorFrame.form

    r89 r98  
    447447              <EmptySpace max="-2" attributes="0"/> 
    448448              <Group type="103" groupAlignment="0" attributes="0"> 
    449                   <Component id="timelinesScrollPane" alignment="0" min="0" pref="0" max="32767" attributes="1"/> 
    450                   <Component id="timeStampScrollPane" alignment="0" max="32767" attributes="0"/> 
    451                   <Group type="102" alignment="1" attributes="0"> 
    452                       <Component id="scriptEventsPanel1" max="32767" attributes="0"/> 
    453                       <EmptySpace max="-2" attributes="0"/> 
    454                       <Component id="scriptEventsPanel" max="32767" attributes="0"/> 
    455                   </Group> 
    456449                  <Group type="102" alignment="0" attributes="0"> 
    457450                      <Component id="selectButton" min="-2" pref="40" max="-2" attributes="0"/> 
     
    462455                      <EmptySpace type="separate" max="-2" attributes="0"/> 
    463456                      <Group type="103" groupAlignment="0" attributes="0"> 
    464                           <Component id="zoomInIcon" alignment="0" min="-2" max="-2" attributes="0"/> 
    465                           <Component id="zoomSlider" alignment="0" min="-2" pref="31" max="-2" attributes="0"/> 
    466                           <Component id="zoomOutIcon" alignment="0" min="-2" max="-2" attributes="0"/> 
    467                       </Group> 
     457                          <Group type="102" alignment="0" attributes="0"> 
     458                              <Group type="103" groupAlignment="0" attributes="0"> 
     459                                  <Component id="zoomInIcon" alignment="0" min="-2" max="-2" attributes="0"/> 
     460                                  <Component id="zoomOutIcon" alignment="0" min="-2" max="-2" attributes="0"/> 
     461                              </Group> 
     462                              <EmptySpace min="0" pref="0" max="32767" attributes="0"/> 
     463                          </Group> 
     464                          <Group type="102" alignment="0" attributes="0"> 
     465                              <Component id="zoomSlider" min="-2" pref="31" max="-2" attributes="0"/> 
     466                              <EmptySpace max="-2" attributes="0"/> 
     467                              <Component id="btnAddTime" max="32767" attributes="0"/> 
     468                          </Group> 
     469                      </Group> 
     470                  </Group> 
     471                  <Component id="timelinesScrollPane" alignment="0" min="0" pref="0" max="32767" attributes="1"/> 
     472                  <Component id="timeStampScrollPane" alignment="0" max="32767" attributes="0"/> 
     473                  <Group type="102" alignment="1" attributes="0"> 
     474                      <Component id="scriptEventsPanel1" max="32767" attributes="0"/> 
     475                      <EmptySpace max="-2" attributes="0"/> 
     476                      <Component id="scriptEventsPanel" max="32767" attributes="0"/> 
    468477                  </Group> 
    469478              </Group> 
     
    490499                      <EmptySpace min="-2" pref="20" max="-2" attributes="0"/> 
    491500                      <Component id="zoomInIcon" min="-2" max="-2" attributes="0"/> 
    492                       <EmptySpace min="-2" pref="1" max="-2" attributes="0"/> 
    493                       <Component id="zoomSlider" min="-2" pref="69" max="-2" attributes="1"/> 
     501                      <Group type="103" groupAlignment="0" attributes="0"> 
     502                          <Group type="102" attributes="0"> 
     503                              <EmptySpace min="-2" pref="1" max="-2" attributes="0"/> 
     504                              <Component id="zoomSlider" min="-2" pref="69" max="-2" attributes="1"/> 
     505                          </Group> 
     506                          <Group type="102" alignment="0" attributes="0"> 
     507                              <EmptySpace min="-2" pref="17" max="-2" attributes="0"/> 
     508                              <Component id="btnAddTime" min="-2" pref="44" max="-2" attributes="0"/> 
     509                          </Group> 
     510                      </Group> 
    494511                      <EmptySpace max="-2" attributes="0"/> 
    495512                      <Component id="zoomOutIcon" min="-2" max="-2" attributes="0"/> 
     
    12711288            <DimensionLayout dim="0"> 
    12721289              <Group type="103" groupAlignment="0" attributes="0"> 
    1273                   <EmptySpace min="0" pref="1032" max="32767" attributes="0"/> 
     1290                  <EmptySpace min="0" pref="1036" max="32767" attributes="0"/> 
    12741291              </Group> 
    12751292            </DimensionLayout> 
     
    12831300      </SubComponents> 
    12841301    </Container> 
     1302    <Component class="javax.swing.JButton" name="btnAddTime"> 
     1303      <Properties> 
     1304        <Property name="text" type="java.lang.String" value="+15:00"/> 
     1305      </Properties> 
     1306      <Events> 
     1307        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAddTimeActionPerformed"/> 
     1308      </Events> 
     1309    </Component> 
    12851310  </SubComponents> 
    12861311</Form> 
  • trunk/src/scriptbuilder/gui/IncidentEditorFrame.java

    r89 r98  
    2222import javax.swing.DefaultListModel; 
    2323import javax.swing.JButton; 
     24import scriptbuilder.gui.panels.IncidentTimelinePanel; 
    2425import scriptbuilder.structures.ScriptEvent; 
    2526import scriptbuilder.structures.ScriptEvent.ScriptEventType; 
     
    310311            theIncident = (ScriptIncident) arg; 
    311312             
    312             timelineTickPanel.update(theIncident); 
    313             timeStampPanel.update(theIncident); 
     313            timelineTickPanel.update(theIncident, incidentTimelinePanel1); 
     314            timeStampPanel.update(theIncident, incidentTimelinePanel1); 
    314315 
    315316            incidentTimelinePanel1.timelinePanelUpdate(theIncident); 
     
    438439        timeStampScrollPane = new javax.swing.JScrollPane(); 
    439440        timeStampPanel = new scriptbuilder.gui.panels.TimeStampPanel(); 
     441        btnAddTime = new javax.swing.JButton(); 
    440442 
    441443        cadEvent.setText("CAD Event"); 
     
    12451247        timeStampPanelLayout.setHorizontalGroup( 
    12461248            timeStampPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
    1247             .addGap(0, 1032, Short.MAX_VALUE) 
     1249            .addGap(0, 1036, Short.MAX_VALUE) 
    12481250        ); 
    12491251        timeStampPanelLayout.setVerticalGroup( 
     
    12531255 
    12541256        timeStampScrollPane.setViewportView(timeStampPanel); 
     1257 
     1258        btnAddTime.setText("+15:00"); 
     1259        btnAddTime.addActionListener(new java.awt.event.ActionListener() 
     1260        { 
     1261            public void actionPerformed(java.awt.event.ActionEvent evt) 
     1262            { 
     1263                btnAddTimeActionPerformed(evt); 
     1264            } 
     1265        }); 
    12551266 
    12561267        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 
     
    12611272                .addContainerGap() 
    12621273                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
    1263                     .addComponent(timelinesScrollPane, 0, 0, Short.MAX_VALUE) 
    1264                     .addComponent(timeStampScrollPane) 
    1265                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 
    1266                         .addComponent(scriptEventsPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 
    1267                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 
    1268                         .addComponent(scriptEventsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 
    12691274                    .addGroup(layout.createSequentialGroup() 
    12701275                        .addComponent(selectButton, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) 
     
    12751280                        .addGap(18, 18, 18) 
    12761281                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
    1277                             .addComponent(zoomInIcon) 
    1278                             .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) 
    1279                             .addComponent(zoomOutIcon)))) 
     1282                            .addGroup(layout.createSequentialGroup() 
     1283                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
     1284                                    .addComponent(zoomInIcon) 
     1285                                    .addComponent(zoomOutIcon)) 
     1286                                .addGap(0, 0, Short.MAX_VALUE)) 
     1287                            .addGroup(layout.createSequentialGroup() 
     1288                                .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) 
     1289                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 
     1290                                .addComponent(btnAddTime, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) 
     1291                    .addComponent(timelinesScrollPane, 0, 0, Short.MAX_VALUE) 
     1292                    .addComponent(timeStampScrollPane) 
     1293                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 
     1294                        .addComponent(scriptEventsPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 
     1295                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 
     1296                        .addComponent(scriptEventsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) 
    12801297                .addContainerGap()) 
    12811298        ); 
     
    12951312                        .addGap(20, 20, 20) 
    12961313                        .addComponent(zoomInIcon) 
    1297                         .addGap(1, 1, 1) 
    1298                         .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE) 
     1314                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 
     1315                            .addGroup(layout.createSequentialGroup() 
     1316                                .addGap(1, 1, 1) 
     1317                                .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)) 
     1318                            .addGroup(layout.createSequentialGroup() 
     1319                                .addGap(17, 17, 17) 
     1320                                .addComponent(btnAddTime, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))) 
    12991321                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 
    13001322                        .addComponent(zoomOutIcon))) 
     
    16911713        zoomSlider.setValue(zoomSlider.getValue() <= 5 ? 5 : zoomSlider.getValue() - 1); 
    16921714    }//GEN-LAST:event_zoomOutIconMouseClicked 
     1715 
     1716    private void btnAddTimeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnAddTimeActionPerformed 
     1717    {//GEN-HEADEREND:event_btnAddTimeActionPerformed 
     1718        incidentTimelinePanel1.requestedEditorFillerTime += IncidentTimelinePanel.FILLER_INTERVAL_SECONDS; 
     1719        this.update(null, theIncident); 
     1720    }//GEN-LAST:event_btnAddTimeActionPerformed 
    16931721 
    16941722    /** 
     
    17811809    private javax.swing.JButton atmsEvalButton; 
    17821810    private javax.swing.JButton audioButton; 
     1811    private javax.swing.JButton btnAddTime; 
    17831812    private javax.swing.JButton cadButton; 
    17841813    private javax.swing.JButton cadEvalButton; 
  • trunk/src/scriptbuilder/gui/ScriptBuilderFrame.form

    r89 r98  
    905905                  <Component id="timeStampScrollPane" alignment="0" max="32767" attributes="0"/> 
    906906                  <Group type="102" alignment="1" attributes="0"> 
    907                       <EmptySpace min="0" pref="597" max="32767" attributes="0"/> 
     907                      <EmptySpace min="0" pref="604" max="32767" attributes="0"/> 
    908908                      <Component id="zoomOutIcon" min="-2" max="-2" attributes="0"/> 
    909909                      <EmptySpace max="-2" attributes="0"/> 
     
    911911                      <EmptySpace max="-2" attributes="0"/> 
    912912                      <Component id="zoomInIcon" min="-2" max="-2" attributes="0"/> 
    913                       <EmptySpace min="-2" pref="136" max="-2" attributes="0"/> 
     913                      <EmptySpace type="separate" max="-2" attributes="0"/> 
     914                      <Component id="btnAddTime" min="-2" max="-2" attributes="0"/> 
     915                      <EmptySpace min="-2" pref="21" max="-2" attributes="0"/> 
    914916                  </Group> 
    915917              </Group> 
     
    926928                  <Component id="zoomSlider" min="-2" max="-2" attributes="1"/> 
    927929                  <Component id="zoomInIcon" min="-2" max="-2" attributes="0"/> 
     930                  <Component id="btnAddTime" min="-2" max="-2" attributes="0"/> 
    928931              </Group> 
    929932              <EmptySpace min="-2" max="-2" attributes="0"/> 
     
    15041507      </SubComponents> 
    15051508    </Container> 
     1509    <Component class="javax.swing.JButton" name="btnAddTime"> 
     1510      <Properties> 
     1511        <Property name="text" type="java.lang.String" value="+15:00"/> 
     1512      </Properties> 
     1513      <Events> 
     1514        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnAddTimeActionPerformed"/> 
     1515      </Events> 
     1516    </Component> 
    15061517  </SubComponents> 
    15071518</Form> 
  • trunk/src/scriptbuilder/gui/ScriptBuilderFrame.java

    r95 r98  
    2525import javax.swing.UIManager; 
    2626import javax.swing.UnsupportedLookAndFeelException; 
     27import scriptbuilder.gui.panels.IncidentTimelinePanel; 
    2728import scriptbuilder.structures.ScriptEvent; 
    2829import scriptbuilder.structures.ScriptEvent.ScriptEventType; 
     
    333334        timeStampScrollPane = new javax.swing.JScrollPane(); 
    334335        timeStampPanel = new scriptbuilder.gui.panels.TimeStampPanel(); 
     336        btnAddTime = new javax.swing.JButton(); 
    335337        scriptBuilderMenuBar = new javax.swing.JMenuBar(); 
    336338        fileMenu = new javax.swing.JMenu(); 
     
    11771179        timeStampScrollPane.setViewportView(timeStampPanel); 
    11781180 
     1181        btnAddTime.setText("+15:00"); 
     1182        btnAddTime.addActionListener(new java.awt.event.ActionListener() 
     1183        { 
     1184            public void actionPerformed(java.awt.event.ActionEvent evt) 
     1185            { 
     1186                btnAddTimeActionPerformed(evt); 
     1187            } 
     1188        }); 
     1189 
    11791190        fileMenu.setText("File"); 
    11801191        fileMenu.setMargin(new java.awt.Insets(0, 10, 0, 10)); 
     
    14001411                    .addComponent(timeStampScrollPane) 
    14011412                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 
    1402                         .addGap(0, 597, Short.MAX_VALUE) 
     1413                        .addGap(0, 604, Short.MAX_VALUE) 
    14031414                        .addComponent(zoomOutIcon) 
    14041415                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 
     
    14061417                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 
    14071418                        .addComponent(zoomInIcon) 
    1408                         .addGap(136, 136, 136))) 
     1419                        .addGap(18, 18, 18) 
     1420                        .addComponent(btnAddTime) 
     1421                        .addGap(21, 21, 21))) 
    14091422                .addContainerGap()) 
    14101423        ); 
     
    14161429                    .addComponent(zoomOutIcon) 
    14171430                    .addComponent(zoomSlider, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 
    1418                     .addComponent(zoomInIcon)) 
     1431                    .addComponent(zoomInIcon) 
     1432                    .addComponent(btnAddTime)) 
    14191433                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 
    14201434                .addComponent(timeStampScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) 
     
    20252039    }//GEN-LAST:event_deleteIncidentActionPerformed 
    20262040 
     2041    private void btnAddTimeActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnAddTimeActionPerformed 
     2042    {//GEN-HEADEREND:event_btnAddTimeActionPerformed 
     2043        IncidentTimelinePanel.requestedScriptBuilderFillerTime += IncidentTimelinePanel.FILLER_INTERVAL_SECONDS; 
     2044        this.update(script, script); 
     2045    }//GEN-LAST:event_btnAddTimeActionPerformed 
     2046 
    20272047    /** 
    20282048     * Read the version number from the application properties. The file 
     
    21162136    private javax.swing.JSpinner addIncidentStart; 
    21172137    private javax.swing.JFrame addNoiseFrame; 
     2138    private javax.swing.JButton btnAddTime; 
    21182139    private javax.swing.JMenuItem cadEvent; 
    21192140    private javax.swing.JFrame cadEventFrame; 
  • trunk/src/scriptbuilder/gui/panels/IncidentTimelinePanel.java

    r96 r98  
    6262 
    6363    /** 
     64     * Filler time at the end of the screen for a particular incident 
     65     */ 
     66    public int requestedEditorFillerTime; 
     67 
     68    /** 
     69     * Filler time at the end of the screen for the whole script 
     70     */ 
     71    public static int requestedScriptBuilderFillerTime = 0; 
     72 
     73    /** 
     74     * Constant for amount of filler to add, in seconds. Set to 15 minutes 
     75     */ 
     76    public static final int FILLER_INTERVAL_SECONDS = 900; 
     77 
     78    /** 
    6479     * The map representing the properties of this incident's events. Keys: 
    6580     * event types. Values: Properties objects for those events. 
     
    310325        super(); 
    311326 
     327        requestedEditorFillerTime = 0; 
    312328//        FACILITATOR_EVAL_EVENT, RADIO_EVAL_EVENT 
    313329        eventTypeToPropertyMap = new HashMap(); 
     
    352368        { 
    353369 
    354             newSize = new Dimension(((incident.length + incident.offset) 
    355                     / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION 
    356                     * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK) 
    357                     + ScriptBuilderGuiConstants.EVENT_ICON_WIDTH, 
    358                     ScriptBuilderGuiConstants.TIMELINE_COLLAPSED_HEIGHT 
    359                     + ScriptBuilderGuiConstants.SCRIPT_EVENT_ICON_STEP * 2); 
     370            if (getTopLevelAncestor() instanceof IncidentEditorFrame) 
     371            { 
     372 
     373                newSize = new Dimension(((incident.length + incident.offset + requestedEditorFillerTime) 
     374                        / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION 
     375                        * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK) 
     376                        + ScriptBuilderGuiConstants.EVENT_ICON_WIDTH, 
     377                        ScriptBuilderGuiConstants.TIMELINE_COLLAPSED_HEIGHT 
     378                        + ScriptBuilderGuiConstants.SCRIPT_EVENT_ICON_STEP * 2); 
     379            } 
     380            else 
     381            { 
     382                newSize = new Dimension(((incident.length + incident.offset + requestedScriptBuilderFillerTime) 
     383                        / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION 
     384                        * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK) 
     385                        + ScriptBuilderGuiConstants.EVENT_ICON_WIDTH, 
     386                        ScriptBuilderGuiConstants.TIMELINE_COLLAPSED_HEIGHT 
     387                        + ScriptBuilderGuiConstants.SCRIPT_EVENT_ICON_STEP * 2); 
     388            } 
    360389 
    361390        } 
  • trunk/src/scriptbuilder/gui/panels/TimeStampPanel.java

    r76 r98  
    6161                if ((incident.length + incident.offset) > longestLength) 
    6262                { 
    63                     longestLength = incident.length + incident.offset; 
     63                    longestLength = incident.length + incident.offset + IncidentTimelinePanel.requestedScriptBuilderFillerTime; 
    6464                } 
    6565            } 
     
    9292     * @param incident the incident which this window is editing. 
    9393     */ 
    94     public void update(ScriptIncident incident) 
     94    public void update(ScriptIncident incident, IncidentTimelinePanel timeline) 
    9595    { 
    9696        longestLength = ScriptBuilderGuiConstants.TICK_TIMELINE_SMALLEST_LENGTH; 
     
    105105            if ((incident.length + incident.offset) > longestLength) 
    106106            { 
    107                 longestLength = incident.length + incident.offset; 
     107                longestLength = incident.length + incident.offset + timeline.requestedEditorFillerTime; 
    108108            } 
    109109        } 
  • trunk/src/scriptbuilder/gui/panels/TimelineTickPanel.java

    r76 r98  
    118118                if ((incident.length + incident.offset) > longestLength) 
    119119                { 
    120                     longestLength = incident.length + incident.offset; 
     120                    longestLength = incident.length + incident.offset + IncidentTimelinePanel.requestedScriptBuilderFillerTime; 
    121121                } 
    122122            } 
     
    141141     * @param incident the incident being edited 
    142142     */ 
    143     public void update(ScriptIncident incident) 
     143    public void update(ScriptIncident incident, IncidentTimelinePanel timeline) 
    144144    { 
    145145        longestLength = ScriptBuilderGuiConstants.TICK_TIMELINE_SMALLEST_LENGTH; 
     
    155155            if ((incident.length + incident.offset) > longestLength) 
    156156            { 
    157                 longestLength = incident.length + incident.offset; 
     157                longestLength = incident.length + incident.offset + timeline.requestedEditorFillerTime; 
    158158            } 
    159159 
Note: See TracChangeset for help on using the changeset viewer.