source: tmcsimulator/trunk/src/tmcsim/cadmodels/BlankScreenModel.java @ 2

Revision 2, 2.0 KB checked in by jdalbey, 10 years ago (diff)

Initial Import of project files

Line 
1package tmcsim.cadmodels;
2
3import org.w3c.dom.Document;
4import org.w3c.dom.Element;
5import org.w3c.dom.Node;
6
7import tmcsim.common.ScriptException;
8import tmcsim.common.CADEnums.CADScreenNum;
9import tmcsim.common.CADEnums.CADScreenType;
10import tmcsim.common.CADProtocol.CAD_COMMANDS;
11
12
13/**
14 * BlankScreenModel is a CADScreenModel object used to display a blank CAD Screen. 
15 * <br/>
16 * This element parses and creates the following XML schema in its toXML() and
17 * fromXML() methods.  The ROOT element is the parameter for those methods. 
18 * See the class description for the CADScreenModel XML schema.<br/>
19 * <ROOT>
20 *    <BLANK_SCREEN>
21 *       <BASE_MODEL_INFO/>
22 *    </BLANK_SCREEN>
23 * </ROOT>
24 *
25 * @see CADScreenModel
26 * @author Matthew Cechini
27 * @version
28 */
29public class BlankScreenModel extends CADScreenModel {
30   
31   
32    /**
33     * Constructor.  Initialize base class with screen model type and
34     * current cad screen number.
35     *
36     * @param num Current CADScreen number.
37     */
38    public BlankScreenModel(CADScreenNum num) {
39        super(CADScreenType.BLANKSCREEN, num);
40       
41    }
42   
43    /**
44     * Constructor.  Initialize base class with screen model type and
45     * current cad screen number.
46     *
47     * @param newNode Node containing XML data for this model object.
48     * @throws ScriptException if there is an error in parsing the Node.
49     */   
50    public BlankScreenModel(Node newNode) throws ScriptException {
51        super(CADScreenType.BLANKSCREEN, CADScreenNum.ONE);
52       
53        fromXML(newNode);   
54    }
55       
56    public void addModelObject(Object o) {}
57 
58    public void toXML(Element currElem) {
59       
60        Document theDoc = currElem.getOwnerDocument();
61
62        Element modelElem = theDoc.createElement(CAD_COMMANDS.BLANK_SCREEN.fullName);
63       
64        baseToXML(modelElem);   
65
66        currElem.appendChild(modelElem);
67    }
68   
69    public void fromXML(Node modelNode) throws ScriptException {   
70       
71        modelNode = modelNode.getFirstChild();
72        baseFromXML(modelNode);
73       
74    } 
75   
76}
Note: See TracBrowser for help on using the repository browser.