deserialize method
Deserializes the FML template elements, attributes and children
Implementation
@override
void deserialize(XmlElement xml)
{
// deserialize
super.deserialize(xml);
// checkboxes can have multiple values
var values = Xml.getChildElements(node: xml, tag: 'value');
if (values != null) {
for (var element in values) {
String? v = Xml.getText(element);
if (!S.isNullOrEmpty(v))
{
if (_value == null) {
value = v;
} else if (!_value!.contains(v)) {
_value!.add(v);
}
}
}
}
/// layout attributes
layout = Xml.get(node: xml, tag: 'layout');
center = Xml.get(node: xml, tag: 'center');
wrap = Xml.get(node: xml, tag: 'wrap');
/// styling attributes
size = Xml.get(node: xml, tag: 'size');
// clear options
for (var option in this.options) {
option.dispose();
}
this.options.clear();
// Build options
List<OptionModel> options = findChildrenOfExactType(OptionModel).cast<OptionModel>();
// set prototype
if ((!S.isNullOrEmpty(datasource)) && (options.isNotEmpty))
{
prototype = WidgetModel.prototypeOf(options[0].element);
options.removeAt(0);
}
// build options
for (var option in options) {
this.options.add(option);
}
}