Changeset 103 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/gui/IncidentEditorFrame.java
- Timestamp:
- 09/01/2017 12:13:01 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/IncidentEditorFrame.java
r98 r103 1 1 /** 2 2 * Frame for the Individual Incident Editor. 3 * 3 * 4 4 * @author Bryan McGuffin 5 5 * @version 2017/08/08 … … 12 12 import java.awt.event.KeyEvent; 13 13 import java.awt.event.KeyListener; 14 import java.awt.event.WindowAdapter; 15 import java.awt.event.WindowEvent; 14 16 import java.io.IOException; 15 17 import java.util.ArrayList; … … 40 42 public class IncidentEditorFrame extends javax.swing.JFrame implements Observer 41 43 { 42 44 43 45 /** 44 46 * The script incident currently being edited. 45 47 */ 46 48 private ScriptIncident theIncident; 47 49 50 private ScriptBuilderFrame parent; 51 52 private int savedOffset; 53 48 54 /** 49 55 * The current type of selected event. … … 232 238 * Constructor. Prep new script model, initialize the GUI, and add listeners 233 239 * for all buttons. 234 * 235 * @param theIncidentthe Script Incident which this window will edit.236 */ 237 public IncidentEditorFrame(ScriptIncident theIncident)240 * 241 * @param inc the Script Incident which this window will edit. 242 */ 243 public IncidentEditorFrame(ScriptIncident inc, ScriptBuilderFrame topFrame) 238 244 { 239 this.theIncident = theIncident; 245 this.theIncident = inc; 246 this.savedOffset = this.theIncident.offset; 247 this.theIncident.setOffset(0); 248 this.parent = topFrame; 240 249 initComponents(); 241 this.update(null, theIncident); 250 251 timelineTickPanel.update(theIncident, incidentTimelinePanel1); 252 timeStampPanel.update(theIncident, incidentTimelinePanel1); 253 254 incidentTimelinePanel1.timelinePanelUpdate(theIncident); 255 256 incidentNumberPanel1.update(theIncident); 242 257 selectButton.addKeyListener(new TimelineKeyListener()); 243 258 cadButton.addKeyListener(new TimelineKeyListener()); … … 261 276 // zoomSlider.setValue(zoomSlider.getValue() - 1); 262 277 // zoomSlider.setValue(zoomSlider.getValue() + 1); 263 264 278 // Set listener for scroll pane 265 279 AdjustmentListener listener = new MyAdjustmentListener(); … … 287 301 eventButtons.add(facilitatorEvalButton); 288 302 eventButtons.add(radioEvalButton); 289 290 incidentNumber.setText(""+this.theIncident.number); 291 incidentName.setText(""+this.theIncident.name); 292 incidentDescription.setText(""+this.theIncident.description); 303 304 this.addWindowListener(new WindowAdapter() 305 { 306 @Override 307 public void windowClosing(WindowEvent e) 308 { 309 theIncident.setOffset(savedOffset); 310 parent.returnFocus(); 311 } 312 }); 313 314 incidentNumber.setText("" + this.theIncident.number); 315 incidentName.setText("" + this.theIncident.name); 316 incidentDescription.setText("" + this.theIncident.description); 293 317 zoomSlider.setValue(zoomSlider.getMinimum()); 318 this.update(null, this.theIncident); 294 319 } 295 320 … … 310 335 { 311 336 theIncident = (ScriptIncident) arg; 312 337 313 338 timelineTickPanel.update(theIncident, incidentTimelinePanel1); 314 339 timeStampPanel.update(theIncident, incidentTimelinePanel1); … … 329 354 { 330 355 TimeSlice slice = ((SliceChangedEvent) arg).slice; 331 356 332 357 DefaultListModel model = new DefaultListModel(); 333 358 for (I_ScriptEvent e : slice.events)
Note: See TracChangeset
for help on using the changeset viewer.
