| 1 | package tmcsim.cadmodels; |
|---|
| 2 | |
|---|
| 3 | import org.w3c.dom.Document; |
|---|
| 4 | import org.w3c.dom.Element; |
|---|
| 5 | import org.w3c.dom.Node; |
|---|
| 6 | |
|---|
| 7 | import tmcsim.common.ScriptException; |
|---|
| 8 | import tmcsim.common.CADEnums.CADScreenNum; |
|---|
| 9 | import tmcsim.common.CADEnums.CADScreenType; |
|---|
| 10 | import 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 | */ |
|---|
| 29 | public 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 | } |
|---|