deserialize method

  1. @override
void deserialize(
  1. XmlElement xml
)
override

Deserializes the FML template elements, attributes and children

Implementation

@override
  void deserialize(XmlElement xml)
  {
 // deserialize
 super.deserialize(xml);

 // properties
 icon = Xml.get(node: xml, tag: 'icon');
 expandedicon = Xml.get(node: xml, tag: 'expandedicon');

 // Build Nodes and find the youngestGeneration

 // clear nodes
 this.nodes.forEach((model) => model.dispose());
 this.nodes.clear();

 this.youngestGeneration.forEach((model) => model?.dispose());
 this.youngestGeneration.clear();

 List<TreeNodeModel> nodes = findChildrenOfExactType(TreeNodeModel).cast<TreeNodeModel>();
 nodes.forEach((dynamic node)
 {
  this.nodes.add(node);
  recurseChildren(node);
 });

 if ((datasource != null) && (this.nodes.isNotEmpty))
 {
   nodeTemplate = this.nodes.first;
   this.nodes.removeAt(0);
 }
  }