comparison m-toolbox/classes/@plist/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 plist 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 appendChild = true;
14 % Don't create a plist node if the method is called by the history
15 % property 'plistUsed'
16 % Remark: This is only possible if the propertie have only one plist
17 % object
18 nodeName = utils.xml.mchar(parent.getNodeName);
19 if strcmp(nodeName, 'plistUsed') && numel(objs) == 1
20 plistNode = parent;
21 appendChild = false;
22 else
23 % Create object node
24 plistNode = dom.createElement('plist');
25 end
26
27 % Set shape
28 plistNode.setAttribute('shape', sprintf('%dx%d', size(objs)));
29
30 % Call superclass
31 collectedHist = attachToDom@ltpda_uo(obj, dom, plistNode, collectedHist);
32
33 % Add params
34 if isa(obj.params, 'param')
35 collectedHist = obj.params.attachToDom(dom, plistNode, collectedHist);
36 end
37
38 % Add to parent node
39 if appendChild
40 parent.appendChild(plistNode);
41 end
42
43 end
44 end
45
46 end