Changeset 9 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/structures/SimulationScript.java
- Timestamp:
- 07/25/2017 02:59:09 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/structures/SimulationScript.java
r1 r9 26 26 * @version 2017/06/22 27 27 */ 28 public class SimulationScript extends Observable implements Observer28 public class SimulationScript extends Observable 29 29 { 30 30 … … 155 155 156 156 /** 157 * Pass incident focus events on to observers, if applicable. 158 * 159 * @param o The observable object sending the update 160 * @param arg Argument parameter of update 161 */ 162 @Override 163 public void update(Observable o, Object arg) 164 { 165 if (arg instanceof SliceChangedEvent) 166 { 167 // The slice focus has changed; pass the message 168 setChanged(); 169 notifyObservers(arg); 170 } 171 else if (arg instanceof IncidentFocusedEvent) 172 { 173 // The slice focus has changed; pass the message 174 setChanged(); 175 notifyObservers(arg); 176 } 177 else 178 { 179 // The script has changed, notify observers 180 setChanged(); 181 notifyObservers(this); 182 } 157 * Update the script's observers. 158 * 159 */ 160 public void update() 161 { 162 // The script has changed, notify observers 163 setChanged(); 164 notifyObservers(this); 165 } 166 167 /** 168 * Tell this script's observers that there is a new slice event. 169 * 170 * @param e the slice focus event 171 */ 172 public void broadcastEvent(SliceChangedEvent e) 173 { 174 // The slice focus has changed; pass the message 175 setChanged(); 176 notifyObservers(e); 177 } 178 179 /** 180 * Tell this script's observers that there is a new slice event. 181 * 182 * @param e the incident focus event 183 */ 184 public void broadcastEvent(IncidentFocusedEvent e) 185 { 186 // The slice focus has changed; pass the message 187 setChanged(); 188 notifyObservers(e); 183 189 } 184 190 … … 210 216 ex.printStackTrace(); 211 217 } 212 update(this, this);218 this.update(); 213 219 } 214 220 }
Note: See TracChangeset
for help on using the changeset viewer.
