Changeset 89 in tmcsimulator-scriptbuilder for trunk/src/event
- Timestamp:
- 08/28/2017 01:38:15 PM (9 years ago)
- Location:
- trunk/src/event/editor
- Files:
-
- 7 added
- 17 edited
-
AudioPanel.java (modified) (2 diffs)
-
CADLogPanel.java (modified) (1 diff)
-
CCTVPanel.java (modified) (1 diff)
-
CHPRadioPanel.java (modified) (5 diffs)
-
CMSEvaluationPanel.java (modified) (1 diff)
-
Editor.form (modified) (4 diffs)
-
Editor.java (modified) (21 diffs)
-
GenericEvaluationPanel.java (modified) (1 diff)
-
MaintenanceRadioPanel.java (modified) (1 diff)
-
MultPropertyPanel.java (added)
-
ParamicsPanel.java (modified) (1 diff)
-
PropertyModel.java (added)
-
PropertyPanel.java (added)
-
PropertyPanels.java (added)
-
PropertyTypes.java (added)
-
PropertyUpdate.java (added)
-
RemoveablePanel.java (modified) (1 diff)
-
ScriptEventEditorPanel.java (modified) (1 diff)
-
TMTRadioPanel.java (modified) (1 diff)
-
TelephonePanel.java (modified) (1 diff)
-
TowPanel.java (modified) (1 diff)
-
UnitPanel.java (modified) (1 diff)
-
UpdateType.java (added)
-
WitnessPanel.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/event/editor/AudioPanel.java
r76 r89 28 28 /** 29 29 * Load the script event associated with this editor panel. 30 * 30 * 31 31 * @param sei The script event in question 32 32 */ … … 93 93 { 94 94 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 95 } 96 97 @Override 98 public boolean removeAssociatedEvent() 99 { 100 event.removeThis(); 101 event = null; 102 return true; 95 103 } 96 104 -
trunk/src/event/editor/CADLogPanel.java
r76 r89 63 63 { 64 64 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 65 } 66 67 @Override 68 public boolean removeAssociatedEvent() 69 { 70 event.removeThis(); 71 event = null; 72 return true; 65 73 } 66 74 -
trunk/src/event/editor/CCTVPanel.java
r76 r89 74 74 { 75 75 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 76 } 77 78 @Override 79 public boolean removeAssociatedEvent() 80 { 81 event.removeThis(); 82 event = null; 83 return true; 76 84 } 77 85 -
trunk/src/event/editor/CHPRadioPanel.java
r76 r89 101 101 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 102 102 } 103 104 @Override 105 public boolean removeAssociatedEvent() 106 { 107 ((I_ScriptEvent)event).removeThis(); 108 event = null; 109 return true; 110 } 103 111 104 112 /** … … 109 117 @SuppressWarnings("unchecked") 110 118 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 111 private void initComponents() { 119 private void initComponents() 120 { 112 121 113 122 jLabel4 = new javax.swing.JLabel(); … … 125 134 jButton2.setText("Browse"); 126 135 jButton2.setToolTipText("Browse for the radio audio file"); 127 jButton2.addMouseListener(new java.awt.event.MouseAdapter() { 128 public void mouseClicked(java.awt.event.MouseEvent evt) { 136 jButton2.addMouseListener(new java.awt.event.MouseAdapter() 137 { 138 public void mouseClicked(java.awt.event.MouseEvent evt) 139 { 129 140 browse(evt); 130 141 } … … 139 150 addFieldButton.setText("Add Field"); 140 151 addFieldButton.setToolTipText("Adds a row for dialog by the field operator in the table"); 141 addFieldButton.addActionListener(new java.awt.event.ActionListener() { 142 public void actionPerformed(java.awt.event.ActionEvent evt) { 152 addFieldButton.addActionListener(new java.awt.event.ActionListener() 153 { 154 public void actionPerformed(java.awt.event.ActionEvent evt) 155 { 143 156 addFieldButtonActionPerformed(evt); 144 157 } … … 158 171 .add(addFieldButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 130, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 159 172 .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) 160 .add(deleteSelectedButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 131, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 161 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)) 173 .add(deleteSelectedButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 131, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 162 174 .add(layout.createSequentialGroup() 163 175 .add(jLabel4) -
trunk/src/event/editor/CMSEvaluationPanel.java
r76 r89 136 136 { 137 137 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 138 } 139 140 @Override 141 public boolean removeAssociatedEvent() 142 { 143 event.removeThis(); 144 event = null; 145 return true; 138 146 } 139 147 -
trunk/src/event/editor/Editor.form
r1 r89 3 3 <Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> 4 4 <NonVisualComponents> 5 <Container class="javax.swing.JPanel" name="jPanel1"> 6 7 <Layout> 8 <DimensionLayout dim="0"> 9 <Group type="103" groupAlignment="0" attributes="0"> 10 <EmptySpace min="0" pref="100" max="32767" attributes="0"/> 11 </Group> 12 </DimensionLayout> 13 <DimensionLayout dim="1"> 14 <Group type="103" groupAlignment="0" attributes="0"> 15 <EmptySpace min="0" pref="100" max="32767" attributes="0"/> 16 </Group> 17 </DimensionLayout> 18 </Layout> 19 </Container> 5 20 <Menu class="javax.swing.JMenuBar" name="jMenuBar1"> 6 21 <SubComponents> … … 271 286 <DimensionLayout dim="0"> 272 287 <Group type="103" groupAlignment="0" attributes="0"> 273 <Group type="102" alignment="0" attributes="0"> 274 <EmptySpace max="-2" attributes="0"/> 275 <Component id="jTabbedPane1" pref="921" max="32767" attributes="0"/> 276 <EmptySpace max="-2" attributes="0"/> 277 </Group> 288 <Component id="jTabbedPane1" alignment="1" max="32767" attributes="0"/> 289 <Component id="jPanel2" alignment="0" max="32767" attributes="0"/> 278 290 </Group> 279 291 </DimensionLayout> … … 282 294 <Group type="102" alignment="0" attributes="0"> 283 295 <EmptySpace max="-2" attributes="0"/> 284 <Component id="jTabbedPane1" pref="5 80" max="32767" attributes="0"/>296 <Component id="jTabbedPane1" pref="539" max="32767" attributes="0"/> 285 297 <EmptySpace max="-2" attributes="0"/> 298 <Component id="jPanel2" min="-2" max="-2" attributes="0"/> 286 299 </Group> 287 300 </Group> … … 293 306 <Layout class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/> 294 307 </Container> 308 <Container class="javax.swing.JPanel" name="jPanel2"> 309 310 <Layout> 311 <DimensionLayout dim="0"> 312 <Group type="103" groupAlignment="0" attributes="0"> 313 <Group type="102" alignment="1" attributes="0"> 314 <EmptySpace pref="701" max="32767" attributes="0"/> 315 <Component id="btnRemoveCurrentEvent" min="-2" pref="226" max="-2" attributes="0"/> 316 <EmptySpace max="-2" attributes="0"/> 317 </Group> 318 </Group> 319 </DimensionLayout> 320 <DimensionLayout dim="1"> 321 <Group type="103" groupAlignment="0" attributes="0"> 322 <Component id="btnRemoveCurrentEvent" min="-2" max="-2" attributes="0"/> 323 </Group> 324 </DimensionLayout> 325 </Layout> 326 <SubComponents> 327 <Component class="javax.swing.JButton" name="btnRemoveCurrentEvent"> 328 <Properties> 329 <Property name="text" type="java.lang.String" value="Remove This Event"/> 330 </Properties> 331 <Events> 332 <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="btnRemoveCurrentEventActionPerformed"/> 333 </Events> 334 </Component> 335 </SubComponents> 336 </Container> 295 337 </SubComponents> 296 338 </Form> -
trunk/src/event/editor/Editor.java
r76 r89 7 7 import java.util.*; 8 8 import java.awt.event.*; 9 import scriptbuilder.gui.IncidentEditorFrame; 10 import scriptbuilder.structures.ScriptIncident; 9 11 import scriptbuilder.structures.events.*; 10 11 enum UpdateType12 {13 14 Add, Remove, TitleChange15 }16 17 class PropertyUpdate18 {19 20 private UpdateType type;21 private PropertyPanel panel;22 private int position = -1;23 24 public PropertyUpdate(UpdateType theType, PropertyPanel thePanel)25 {26 type = theType;27 panel = thePanel;28 }29 30 public PropertyUpdate(UpdateType theType, PropertyPanel thePanel, int thePosition)31 {32 this(theType, thePanel);33 position = thePosition;34 }35 36 public int getPosition()37 {38 if (position == -1)39 {40 throw new RuntimeException("position unknown");41 }42 43 return position;44 }45 46 public UpdateType getType()47 {48 return type;49 }50 51 public PropertyPanel getPanel()52 {53 return panel;54 }55 }56 57 enum PropertyTypes58 {59 60 Optional, Multiple;61 }62 63 class PropertyPanel64 {65 66 private final JPanel panel;67 private final Properties property;68 69 public PropertyPanel(JPanel thePanel,70 Properties theProperty)71 {72 panel = thePanel;73 property = theProperty;74 }75 76 public JPanel getPanel()77 {78 return panel;79 }80 81 public Properties getProperty()82 {83 return property;84 }85 86 public String title()87 {88 return property.getTitle();89 }90 }91 92 class MultPropertyPanel extends PropertyPanel93 {94 95 private int index;96 97 public MultPropertyPanel(JPanel thePanel,98 Properties theProperty,99 int theIndex)100 {101 super(thePanel, theProperty);102 index = theIndex;103 }104 105 public int getIndex()106 {107 return index;108 }109 110 public void setIndex(int newIndex)111 {112 index = newIndex;113 }114 115 @Override116 public String title()117 {118 return super.title() + " " + index;119 }120 }121 122 class PropertyPanels extends Observable123 {124 125 private Vector<PropertyPanel> properties = new Vector<PropertyPanel>();126 127 private EnumMap<Properties, Integer> propertyCounter128 = new EnumMap<Properties, Integer>(Properties.class);129 130 public PropertyPanels()131 {132 for (Properties property : Properties.values())133 {134 propertyCounter.put(property, 0);135 }136 }137 138 private int nextIndex(Properties property)139 {140 propertyCounter.put(property, propertyCounter.get(property) + 1);141 142 return propertyCounter.get(property);143 }144 145 /**146 * public Vector<PropertyPanel> getProperties() { return147 * (Vector<PropertyPanel>) properties.clone(); }148 */149 private int add(PropertyPanel panel)150 {151 int position = 0;152 153 for (int i = 0; i < properties.size(); i++)154 {155 if (properties.get(i).title().compareTo(panel.title()) < 0)156 {157 position = i + 1;158 }159 }160 161 properties.add(position, panel);162 163 return position;164 }165 166 public PropertyPanel addPropertyPanel(Properties property, JPanel panel)167 {168 PropertyPanel propertyPanel = null;169 170 if (property.getType() == PropertyTypes.Multiple)171 {172 propertyPanel = new MultPropertyPanel(panel, property, nextIndex(property));173 //propertyPanel.addObserver(this);174 int position = add(propertyPanel);175 setChanged();176 notifyObservers(new PropertyUpdate(UpdateType.Add, propertyPanel, position));177 178 }179 else if (property.getType() == PropertyTypes.Optional)180 {181 if (containsProperty(property))182 {183 throw new RuntimeException("Property \"" + property + "\" is already added");184 }185 else186 {187 propertyPanel = new PropertyPanel(panel, property);188 int position = add(propertyPanel);189 //propertyPanel.addObserver(this);190 setChanged();191 notifyObservers(new PropertyUpdate(UpdateType.Add, propertyPanel, position));192 }193 }194 else195 {196 throw new RuntimeException("Property \"" + property + "\" not accounted for");197 }198 199 return propertyPanel;200 }201 202 private boolean remove(PropertyPanel panel)203 {204 boolean result = false;205 206 if ((result = properties.remove(panel)))207 {208 setChanged();209 notifyObservers(new PropertyUpdate(UpdateType.Remove, panel));210 }211 else212 {213 throw new RuntimeException("Attempted to remove panel that did not exist");214 }215 216 if (panel.getProperty().getType() == PropertyTypes.Multiple)217 {218 Vector<MultPropertyPanel> panelsOfSameType = new Vector<MultPropertyPanel>();219 Vector<MultPropertyPanel> panelsOfGreaterIndex = new Vector<MultPropertyPanel>();220 221 propertyCounter.put(panel.getProperty(), propertyCounter.get(panel.getProperty()) - 1);222 223 // extract panels of the same property type224 for (PropertyPanel pan : properties)225 {226 if (pan.getProperty() == panel.getProperty())227 {228 panelsOfSameType.add((MultPropertyPanel) pan);229 }230 }231 232 // extract panels whose index is greater than the index of the panel233 // being removed234 for (MultPropertyPanel pan : panelsOfSameType)235 {236 if (pan.getIndex() > ((MultPropertyPanel) panel).getIndex())237 {238 panelsOfGreaterIndex.add(pan);239 }240 }241 242 // decrement the index of each of the remaining panels by one243 for (MultPropertyPanel pan : panelsOfGreaterIndex)244 {245 pan.setIndex(pan.getIndex() - 1);246 setChanged();247 notifyObservers(new PropertyUpdate(UpdateType.TitleChange, pan));248 }249 }250 else if (panel.getProperty().getType() == PropertyTypes.Optional)251 {252 // do nothing253 }254 else255 {256 throw new RuntimeException("PropertyTypes not accounted for");257 }258 259 return result;260 }261 262 public PropertyPanel removeProperty(Properties property)263 {264 if (property.getType() == PropertyTypes.Multiple)265 {266 throw new RuntimeException("Attemping to remove a property of multiple type");267 }268 269 PropertyPanel removed = null;270 271 for (PropertyPanel panel : properties)272 {273 if (panel.getProperty() == property)274 {275 removed = panel;276 }277 }278 279 if (removed == null)280 {281 throw new RuntimeException("Could not find panel with property \"" + property + "\"");282 }283 284 remove(removed);285 286 return removed;287 }288 289 public PropertyPanel removeProperty(JPanel jPanel)290 {291 PropertyPanel removed = null;292 293 for (PropertyPanel panel : properties)294 {295 if (panel.getPanel() == jPanel)296 {297 removed = panel;298 }299 }300 301 if (removed == null)302 {303 throw new RuntimeException("Could not find jPanel");304 }305 306 remove(removed);307 308 return removed;309 }310 311 public PropertyPanel removeProperty(String title)312 {313 PropertyPanel removed = null;314 315 for (PropertyPanel panel : properties)316 {317 if (panel.title().equals(title))318 {319 if (removed == null)320 {321 removed = panel;322 }323 else324 {325 throw new RuntimeException("Attempted to remove a property by title but the title was not unique");326 }327 }328 }329 330 if (removed == null)331 {332 throw new RuntimeException("Did not find titel \"" + title + "\"");333 }334 335 remove(removed);336 337 return removed;338 }339 340 public boolean removeProperty(PropertyPanel panel)341 {342 return remove(panel);343 }344 345 public boolean containsProperty(Properties property)346 {347 boolean contains = false;348 349 for (PropertyPanel panel : properties)350 {351 if (panel.getProperty() == property)352 {353 contains = true;354 }355 }356 357 return contains;358 }359 }360 361 class PropertyModel extends Observable implements Observer362 {363 364 PropertyPanels properties = new PropertyPanels();365 366 private EnumMap<Properties, Class> classMap367 = new EnumMap<Properties, Class>(Properties.class);368 369 public PropertyModel()370 {371 classMap.put(Properties.ATMS, GenericEvaluationPanel.class);372 classMap.put(Properties.ActivityLog, GenericEvaluationPanel.class);373 classMap.put(Properties.CAD, GenericEvaluationPanel.class);374 classMap.put(Properties.Facilitator, GenericEvaluationPanel.class);375 classMap.put(Properties.Radio, GenericEvaluationPanel.class);376 377 classMap.put(Properties.MaintenanceRadio, MaintenanceRadioPanel.class);378 classMap.put(Properties.TMTRadio, TMTRadioPanel.class);379 classMap.put(Properties.CHPRadio, CHPRadioPanel.class);380 classMap.put(Properties.Telephone, TelephonePanel.class);381 382 classMap.put(Properties.Audio, AudioPanel.class);383 classMap.put(Properties.CADLog, CADLogPanel.class);384 classMap.put(Properties.CCTV, CCTVPanel.class);385 classMap.put(Properties.CMS, CMSEvaluationPanel.class);386 classMap.put(Properties.Paramics, ParamicsPanel.class);387 classMap.put(Properties.Tow, TowPanel.class);388 classMap.put(Properties.Unit, UnitPanel.class);389 classMap.put(Properties.Witness, WitnessPanel.class);390 391 properties.addObserver(this);392 }393 394 public void addProperty(Properties property, I_ScriptEvent se)395 {396 try397 {398 JPanel panel = (JPanel) classMap.get(property).newInstance();399 400 final PropertyPanel propertyPanel = properties.addPropertyPanel(property, panel);401 if (panel instanceof ScriptEventEditorPanel)402 {403 ((ScriptEventEditorPanel) panel).getEventObject(se);404 }405 if (property.getType() == PropertyTypes.Multiple)406 {407 408 if (panel instanceof RemoveablePanel)409 {410 ((RemoveablePanel) panel).setRemoveListener(new ActionListener()411 {412 public void actionPerformed(ActionEvent evt)413 {414 properties.removeProperty(propertyPanel);415 }416 });417 }418 else419 {420 throw new RuntimeException("Property was multiple but panel was not removeable");421 }422 }423 }424 catch (Exception e)425 {426 System.err.println("Could not create panel of type \"" + property + "\"");427 }428 }429 430 public void removeProperty(Properties property)431 {432 properties.removeProperty(property);433 }434 435 public void update(Observable o, Object arg)436 {437 setChanged();438 notifyObservers(arg);439 }440 441 /*442 public Vector<PropertyPanel> getPropertyPanels()443 {444 return properties.getProperties();445 }446 */447 }448 12 449 13 public class Editor extends javax.swing.JFrame implements Observer 450 14 { 15 16 IncidentEditorFrame topFrame = null; 451 17 452 18 private PropertyModel model = new PropertyModel(); … … 456 22 // return model; 457 23 // } 458 459 24 public void addProperty(Properties property, I_ScriptEvent se) 460 25 { … … 492 57 * Blank constructor for a new editor. 493 58 */ 494 public Editor() 495 { 59 public Editor(IncidentEditorFrame frame) 60 { 61 topFrame = frame; 496 62 initComponents(); 497 63 … … 533 99 @SuppressWarnings("unchecked") 534 100 // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents 535 private void initComponents() { 536 101 private void initComponents() 102 { 103 104 jPanel1 = new javax.swing.JPanel(); 537 105 jTabbedPane1 = new javax.swing.JTabbedPane(); 106 jPanel2 = new javax.swing.JPanel(); 107 btnRemoveCurrentEvent = new javax.swing.JButton(); 538 108 jMenuBar1 = new javax.swing.JMenuBar(); 539 109 jMenu1 = new javax.swing.JMenu(); … … 558 128 Witness = new javax.swing.JMenuItem(); 559 129 130 org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); 131 jPanel1.setLayout(jPanel1Layout); 132 jPanel1Layout.setHorizontalGroup( 133 jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 134 .add(0, 100, Short.MAX_VALUE) 135 ); 136 jPanel1Layout.setVerticalGroup( 137 jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 138 .add(0, 100, Short.MAX_VALUE) 139 ); 140 560 141 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); 561 142 setTitle("Event Editor"); 143 144 btnRemoveCurrentEvent.setText("Remove This Event"); 145 btnRemoveCurrentEvent.addActionListener(new java.awt.event.ActionListener() 146 { 147 public void actionPerformed(java.awt.event.ActionEvent evt) 148 { 149 btnRemoveCurrentEventActionPerformed(evt); 150 } 151 }); 152 153 org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2); 154 jPanel2.setLayout(jPanel2Layout); 155 jPanel2Layout.setHorizontalGroup( 156 jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 157 .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup() 158 .addContainerGap(701, Short.MAX_VALUE) 159 .add(btnRemoveCurrentEvent, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 226, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 160 .addContainerGap()) 161 ); 162 jPanel2Layout.setVerticalGroup( 163 jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 164 .add(btnRemoveCurrentEvent) 165 ); 562 166 563 167 jMenu1.setText("Evaluations"); … … 566 170 ATMS.setText("ATMS"); 567 171 ATMS.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ATMSEval.png"))); // NOI18N 568 ATMS.addActionListener(new java.awt.event.ActionListener() { 569 public void actionPerformed(java.awt.event.ActionEvent evt) { 172 ATMS.addActionListener(new java.awt.event.ActionListener() 173 { 174 public void actionPerformed(java.awt.event.ActionEvent evt) 175 { 570 176 multipleChange(evt); 571 177 } … … 576 182 ActivityLog.setText("Activity Log"); 577 183 ActivityLog.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/ActivityLogEval.png"))); // NOI18N 578 ActivityLog.addActionListener(new java.awt.event.ActionListener() { 579 public void actionPerformed(java.awt.event.ActionEvent evt) { 184 ActivityLog.addActionListener(new java.awt.event.ActionListener() 185 { 186 public void actionPerformed(java.awt.event.ActionEvent evt) 187 { 580 188 multipleChange(evt); 581 189 } … … 586 194 CAD.setText("CAD"); 587 195 CAD.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/CADEval.png"))); // NOI18N 588 CAD.addActionListener(new java.awt.event.ActionListener() { 589 public void actionPerformed(java.awt.event.ActionEvent evt) { 196 CAD.addActionListener(new java.awt.event.ActionListener() 197 { 198 public void actionPerformed(java.awt.event.ActionEvent evt) 199 { 590 200 multipleChange(evt); 591 201 } … … 596 206 CMS.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/CMSEval.png"))); // NOI18N 597 207 CMS.setText("CMS"); 598 CMS.addMouseListener(new java.awt.event.MouseAdapter() { 599 public void mouseClicked(java.awt.event.MouseEvent evt) { 208 CMS.addMouseListener(new java.awt.event.MouseAdapter() 209 { 210 public void mouseClicked(java.awt.event.MouseEvent evt) 211 { 600 212 multipleChangeListener(evt); 601 213 } 602 214 }); 603 CMS.addActionListener(new java.awt.event.ActionListener() { 604 public void actionPerformed(java.awt.event.ActionEvent evt) { 215 CMS.addActionListener(new java.awt.event.ActionListener() 216 { 217 public void actionPerformed(java.awt.event.ActionEvent evt) 218 { 605 219 multipleChange(evt); 606 220 } … … 611 225 Facilitator.setText("Facilitator"); 612 226 Facilitator.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/FacilitatorEval.png"))); // NOI18N 613 Facilitator.addActionListener(new java.awt.event.ActionListener() { 614 public void actionPerformed(java.awt.event.ActionEvent evt) { 227 Facilitator.addActionListener(new java.awt.event.ActionListener() 228 { 229 public void actionPerformed(java.awt.event.ActionEvent evt) 230 { 615 231 optionalChange(evt); 616 232 } … … 621 237 Radio.setText("Radio"); 622 238 Radio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/RadioEval.png"))); // NOI18N 623 Radio.addActionListener(new java.awt.event.ActionListener() { 624 public void actionPerformed(java.awt.event.ActionEvent evt) { 239 Radio.addActionListener(new java.awt.event.ActionListener() 240 { 241 public void actionPerformed(java.awt.event.ActionEvent evt) 242 { 625 243 optionalChange(evt); 626 244 } … … 635 253 MaintenanceRadio.setText("Maintenance Radio"); 636 254 MaintenanceRadio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/MaintenanceRadio.png"))); // NOI18N 637 MaintenanceRadio.addActionListener(new java.awt.event.ActionListener() { 638 public void actionPerformed(java.awt.event.ActionEvent evt) { 255 MaintenanceRadio.addActionListener(new java.awt.event.ActionListener() 256 { 257 public void actionPerformed(java.awt.event.ActionEvent evt) 258 { 639 259 optionalChange(evt); 640 260 } … … 645 265 TMTRadio.setText("TMT Radio"); 646 266 TMTRadio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/TMTRadio.png"))); // NOI18N 647 TMTRadio.addActionListener(new java.awt.event.ActionListener() { 648 public void actionPerformed(java.awt.event.ActionEvent evt) { 267 TMTRadio.addActionListener(new java.awt.event.ActionListener() 268 { 269 public void actionPerformed(java.awt.event.ActionEvent evt) 270 { 649 271 optionalChange(evt); 650 272 } … … 655 277 Telephone.setText("Telephone"); 656 278 Telephone.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Telephone.png"))); // NOI18N 657 Telephone.addActionListener(new java.awt.event.ActionListener() { 658 public void actionPerformed(java.awt.event.ActionEvent evt) { 279 Telephone.addActionListener(new java.awt.event.ActionListener() 280 { 281 public void actionPerformed(java.awt.event.ActionEvent evt) 282 { 659 283 optionalChange(evt); 660 284 } … … 684 308 CHPRadio.setText("CHP Radio"); 685 309 CHPRadio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/CHPRadio.png"))); // NOI18N 686 CHPRadio.addActionListener(new java.awt.event.ActionListener() { 687 public void actionPerformed(java.awt.event.ActionEvent evt) { 310 CHPRadio.addActionListener(new java.awt.event.ActionListener() 311 { 312 public void actionPerformed(java.awt.event.ActionEvent evt) 313 { 688 314 optionalChange(evt); 689 315 } … … 719 345 layout.setHorizontalGroup( 720 346 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 721 .add(layout.createSequentialGroup() 722 .addContainerGap() 723 .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 921, Short.MAX_VALUE) 724 .addContainerGap()) 347 .add(org.jdesktop.layout.GroupLayout.TRAILING, jTabbedPane1) 348 .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 725 349 ); 726 350 layout.setVerticalGroup( … … 728 352 .add(layout.createSequentialGroup() 729 353 .addContainerGap() 730 .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 580, Short.MAX_VALUE) 731 .addContainerGap()) 354 .add(jTabbedPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 539, Short.MAX_VALUE) 355 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 356 .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 732 357 ); 733 358 … … 746 371 747 372 }//GEN-LAST:event_optionalChange 373 374 private void btnRemoveCurrentEventActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_btnRemoveCurrentEventActionPerformed 375 {//GEN-HEADEREND:event_btnRemoveCurrentEventActionPerformed 376 377 int index = jTabbedPane1.getSelectedIndex(); 378 379 if (index > 0 && jTabbedPane1.getTabComponentAt(index) != null) 380 { 381 JPanel removable = (JPanel) jTabbedPane1 382 .getSelectedComponent(); 383 this.model.properties.removeProperty(removable); 384 } 385 386 }//GEN-LAST:event_btnRemoveCurrentEventActionPerformed 748 387 749 388 /** … … 756 395 public void run() 757 396 { 758 new Editor( ).setVisible(true);397 new Editor(new IncidentEditorFrame(new ScriptIncident(100, null, null, null))).setVisible(true); 759 398 } 760 399 }); … … 780 419 private javax.swing.JMenuItem Unit; 781 420 private javax.swing.JMenuItem Witness; 421 private javax.swing.JButton btnRemoveCurrentEvent; 782 422 private javax.swing.JMenu jMenu1; 783 423 private javax.swing.JMenu jMenu3; 784 424 private javax.swing.JMenuBar jMenuBar1; 425 private javax.swing.JPanel jPanel1; 426 private javax.swing.JPanel jPanel2; 785 427 private javax.swing.JTabbedPane jTabbedPane1; 786 428 // End of variables declaration//GEN-END:variables 787 429 430 @Override 788 431 public void update(Observable o, Object arg) 789 432 { … … 808 451 jTabbedPane1.setTabComponentAt(update.getPosition(), title); 809 452 jTabbedPane1.setSelectedIndex(update.getPosition()); 453 topFrame.repaint(); 810 454 } 811 455 else if (update.getType() == UpdateType.Remove) 812 456 { 813 457 jTabbedPane1.remove(update.getPanel().getPanel()); 458 if (update.getPanel().getPanel() instanceof ScriptEventEditorPanel) 459 { 460 ((ScriptEventEditorPanel) update.getPanel().getPanel()).removeAssociatedEvent(); 461 } 462 topFrame.repaint(); 814 463 } 815 464 else if (update.getType() == UpdateType.TitleChange) -
trunk/src/event/editor/GenericEvaluationPanel.java
r7 r89 78 78 { 79 79 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 80 } 81 82 @Override 83 public boolean removeAssociatedEvent() 84 { 85 ((I_ScriptEvent)event).removeThis(); 86 event = null; 87 return true; 80 88 } 81 89 -
trunk/src/event/editor/MaintenanceRadioPanel.java
r7 r89 52 52 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 53 53 } 54 55 @Override 56 public boolean removeAssociatedEvent() 57 { 58 ((I_ScriptEvent)event).removeThis(); 59 event = null; 60 return true; 61 } 54 62 55 63 /** -
trunk/src/event/editor/ParamicsPanel.java
r50 r89 110 110 { 111 111 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 112 } 113 114 @Override 115 public boolean removeAssociatedEvent() 116 { 117 event.removeThis(); 118 event = null; 119 return true; 112 120 } 113 121 -
trunk/src/event/editor/RemoveablePanel.java
r76 r89 2 2 3 3 import java.awt.event.*; 4 import scriptbuilder.structures.events.I_ScriptEvent;5 4 6 5 public interface RemoveablePanel -
trunk/src/event/editor/ScriptEventEditorPanel.java
r76 r89 22 22 */ 23 23 void getEventObject(I_ScriptEvent sei); 24 25 /** 26 * Remove the event associated with this panel. 27 * 28 * @return true if the event was successfully deleted. 29 */ 30 boolean removeAssociatedEvent(); 24 31 } -
trunk/src/event/editor/TMTRadioPanel.java
r7 r89 52 52 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 53 53 } 54 55 @Override 56 public boolean removeAssociatedEvent() 57 { 58 ((I_ScriptEvent)event).removeThis(); 59 event = null; 60 return true; 61 } 54 62 55 63 /** -
trunk/src/event/editor/TelephonePanel.java
r7 r89 106 106 { 107 107 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 108 } 109 110 @Override 111 public boolean removeAssociatedEvent() 112 { 113 ((I_ScriptEvent)event).removeThis(); 114 event = null; 115 return true; 108 116 } 109 117 -
trunk/src/event/editor/TowPanel.java
r7 r89 136 136 { 137 137 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 138 } 139 140 @Override 141 public boolean removeAssociatedEvent() 142 { 143 event.removeThis(); 144 event = null; 145 return true; 138 146 } 139 147 -
trunk/src/event/editor/UnitPanel.java
r7 r89 121 121 { 122 122 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 123 } 124 125 @Override 126 public boolean removeAssociatedEvent() 127 { 128 event.removeThis(); 129 event = null; 130 return true; 123 131 } 124 132 -
trunk/src/event/editor/WitnessPanel.java
r50 r89 122 122 { 123 123 throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 124 } 125 126 @Override 127 public boolean removeAssociatedEvent() 128 { 129 event.removeThis(); 130 event = null; 131 return true; 124 132 } 125 133
Note: See TracChangeset
for help on using the changeset viewer.
