Mercurial > hg > ltpda
comparison m-toolbox/classes/@ssmblock/attachToDom.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 | |
2 function collectedHist = attachToDom(objs, dom, parent, collectedHist) | |
3 | |
4 if isempty(objs) | |
5 | |
6 % Create empty ssmblock node with the attribute 'shape' | |
7 utils.xml.attachEmptyObjectNode(objs, dom, parent); | |
8 | |
9 else | |
10 for oo = 1:numel(objs) | |
11 obj = objs(oo); | |
12 | |
13 % Create object node | |
14 ssmblockNode = dom.createElement('ssmblock'); | |
15 ssmblockNode.setAttribute('shape', sprintf('%dx%d', size(objs))); | |
16 | |
17 % Call superclass | |
18 collectedHist = attachToDom@ltpda_nuo(obj, dom, ssmblockNode, collectedHist); | |
19 | |
20 % Add name | |
21 if ~isempty(obj.name) | |
22 nameNode = dom.createElement('name'); | |
23 utils.xml.attachCharToDom(obj.name, dom, nameNode); | |
24 ssmblockNode.appendChild(nameNode); | |
25 end | |
26 | |
27 % Add ports | |
28 if isa(obj.ports, 'ssmport') | |
29 portsNode = dom.createElement('ports'); | |
30 collectedHist = obj.ports.attachToDom(dom, portsNode, collectedHist); | |
31 ssmblockNode.appendChild(portsNode); | |
32 end | |
33 | |
34 % Add description | |
35 if ~isempty(obj.description) | |
36 descriptionNode = dom.createElement('description'); | |
37 utils.xml.attachCharToDom(obj.description, dom, descriptionNode); | |
38 ssmblockNode.appendChild(descriptionNode); | |
39 end | |
40 | |
41 % Add to parent node | |
42 parent.appendChild(ssmblockNode); | |
43 | |
44 end | |
45 end | |
46 | |
47 end |