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


Ignore:
Timestamp:
09/06/2017 11:37:48 AM (9 years ago)
Author:
bmcguffin
Message:

Added constructor to IncidentTimelinePanel? with a boolean parameter to determine whether the panel can display a popup menu. The incident editor frame no longer displays the popup menu upon right-click.

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

Legend:

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

    r110 r113  
    590590                </Property> 
    591591              </Properties> 
     592              <AuxValues> 
     593                <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new scriptbuilder.gui.panels.IncidentTimelinePanel(false)"/> 
     594              </AuxValues> 
    592595 
    593596              <Layout> 
  • trunk/src/scriptbuilder/gui/IncidentEditorFrame.java

    r110 r113  
    443443        timelinesScrollPane = new javax.swing.JScrollPane(); 
    444444        timelineTickPanel = new scriptbuilder.gui.panels.TimelineTickPanel(); 
    445         incidentTimelinePanel1 = new scriptbuilder.gui.panels.IncidentTimelinePanel(); 
     445        incidentTimelinePanel1 = new scriptbuilder.gui.panels.IncidentTimelinePanel(false); 
    446446        incidentNumberPanel1 = new scriptbuilder.gui.panels.IncidentNumberPanel(); 
    447447        scriptEventsPanel = new javax.swing.JPanel(); 
  • trunk/src/scriptbuilder/gui/panels/IncidentTimelinePanel.java

    r106 r113  
    5959    boolean focused; 
    6060 
     61    /** 
     62     * If true, right-clicking on this panel will produce the popup menu. 
     63     */ 
     64    private boolean hasPopupAccess; 
     65 
    6166    int cursorTime, lastSlice, x, y; 
    6267 
     
    147152                    if (e.getActionCommand().equals("Edit Events")) 
    148153                    { 
    149                         IncidentEditorFrame editor = new IncidentEditorFrame(incident, (ScriptBuilderFrame)topFrame); 
     154                        IncidentEditorFrame editor = new IncidentEditorFrame(incident, (ScriptBuilderFrame) topFrame); 
    150155                        script.addObserver(editor); 
    151156                        editor.setVisible(true); 
     
    169174 
    170175            // Does user want a popup menu? 
    171             if (e.isPopupTrigger()) 
     176            if (e.isPopupTrigger() && hasPopupAccess) 
    172177            { 
    173178                JPopupMenu popup = createPopup(); 
     
    229234                ed.setSlice(incident.slices.get(newSlice)); 
    230235            } 
    231              
    232236 
    233237            /** 
     
    319323        super(); 
    320324 
     325        hasPopupAccess = true; 
     326 
    321327        requestedEditorFillerTime = 0; 
    322328//        FACILITATOR_EVAL_EVENT, RADIO_EVAL_EVENT 
     
    348354 
    349355    /** 
     356     * Constructor. Generates a HashMap of all possible event types. 
     357     * 
     358     * @param usesPopup determines whether or not right-clicking on this panel 
     359     * will display a popup menu. 
     360     */ 
     361    public IncidentTimelinePanel(boolean usesPopup) 
     362    { 
     363        super(); 
     364 
     365        hasPopupAccess = usesPopup; 
     366 
     367        requestedEditorFillerTime = 0; 
     368//        FACILITATOR_EVAL_EVENT, RADIO_EVAL_EVENT 
     369        eventTypeToPropertyMap = new HashMap(); 
     370        eventTypeToPropertyMap.put(ScriptEventType.AUDIO_EVENT, Properties.Audio); 
     371        eventTypeToPropertyMap.put(ScriptEventType.CAD_EVENT, Properties.CADLog); 
     372        eventTypeToPropertyMap.put(ScriptEventType.CCTV_EVENT, Properties.CCTV); 
     373        eventTypeToPropertyMap.put(ScriptEventType.CHP_RADIO_EVENT, Properties.CHPRadio); 
     374        eventTypeToPropertyMap.put(ScriptEventType.PARAMICS_EVENT, Properties.Paramics); 
     375        eventTypeToPropertyMap.put(ScriptEventType.TOW_EVENT, Properties.Tow); 
     376        eventTypeToPropertyMap.put(ScriptEventType.UNIT_EVENT, Properties.Unit); 
     377        eventTypeToPropertyMap.put(ScriptEventType.WITNESS_EVENT, Properties.Witness); 
     378        eventTypeToPropertyMap.put(ScriptEventType.MAINTENANCE_RADIO_EVENT, Properties.MaintenanceRadio); 
     379        eventTypeToPropertyMap.put(ScriptEventType.TMT_RADIO_EVENT, Properties.TMTRadio); 
     380        eventTypeToPropertyMap.put(ScriptEventType.TELEPHONE_EVENT, Properties.Telephone); 
     381        eventTypeToPropertyMap.put(ScriptEventType.ATMS_EVAL_EVENT, Properties.ATMS); 
     382        eventTypeToPropertyMap.put(ScriptEventType.ACTIVITY_LOG_EVAL_EVENT, Properties.ActivityLog); 
     383        eventTypeToPropertyMap.put(ScriptEventType.CAD_EVAL_EVENT, Properties.CAD); 
     384        eventTypeToPropertyMap.put(ScriptEventType.CMS_EVAL_EVENT, Properties.CMS); 
     385        eventTypeToPropertyMap.put(ScriptEventType.FACILITATOR_EVAL_EVENT, Properties.Facilitator); 
     386        eventTypeToPropertyMap.put(ScriptEventType.RADIO_EVAL_EVENT, Properties.Radio); 
     387 
     388        // Add the mouse listener 
     389        IncidentTimelineMouseListener mouseListener 
     390                = new IncidentTimelineMouseListener(); 
     391        addMouseMotionListener(mouseListener); 
     392        addMouseListener(mouseListener); 
     393    } 
     394 
     395    /** 
    350396     * Update the panel if it's changed collapsed status. Redraw it with the 
    351397     * correct dimensions for its status. 
Note: See TracChangeset for help on using the changeset viewer.