Warning: Can't use blame annotator:
svn blame failed on trunk/src/scriptbuilder/structures/events/CADEvent.java: ("Can't find a temporary directory: Internal error", 20014)

source: tmcsimulator-scriptbuilder/trunk/src/scriptbuilder/structures/events/CADEvent.java @ 185

Revision 185, 1.5 KB checked in by jdalbey, 6 years ago (diff)

CADEvent.java added a toString() method with text that will appear in tooltip and Script Event panel.

RevLine 
1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6package scriptbuilder.structures.events;
7
8import java.util.StringTokenizer;
9import scriptbuilder.structures.ELEMENT;
10import scriptbuilder.structures.I_XML_Writable;
11import scriptbuilder.structures.ScriptEvent;
12import scriptbuilder.structures.XMLWriter;
13
14/**
15 * Data model for a CAD incident event. CAD events have a string description of
16 * what is occurring at that time, and may or may not have sub-events.
17 *
18 * @author Bryan McGuffin
19 */
20public class CADEvent extends ScriptEvent implements I_XML_Writable
21{
22
23    /**
24     * Constructor.
25     */
26    public CADEvent()
27    {
28        super(ScriptEventType.CAD_EVENT);
29    }
30
31    /**
32     * True if this CAD event has sub-events.
33     */
34    public boolean hasSubEvents = false;
35
36    /**
37     * Description of this event.
38     */
39    public String detail = "";
40
41    @Override
42    public String toXML()
43    {
44        StringTokenizer tok = new StringTokenizer(detail, "\n");
45        String output = "";
46        while (tok.hasMoreTokens())
47        {
48            output += XMLWriter.simpleTag(tok.nextToken(), ELEMENT.DETAIL);
49        }
50        return output;
51    }
52    /**
53     * @return a string representation of this event. Used for example in
54     * Script Events Panel of Incident Editor window.
55     */
56    @Override
57    public String toString()
58    {
59        return getScriptEventType().toString() + " " + detail; 
60    }
61}
Note: See TracBrowser for help on using the repository browser.