The contents of the observer export depends on the export flags used. By default (using the default exportXml() function) the export just contains the observer's data along with its children. When other flags are also active and you call exportXmlExt() on observer, the export will look different. See Qtilities::Core::ObserverData::ExportItem for more details.
Lets look at the default output format of Observer for a simple tree constructed like this:
TreeNode* rootNode = new TreeNode("Root Node");
rootNode->enableActivityControl(ObserverHints::CheckboxActivityDisplay);
rootNode->enableNamingControl(ObserverHints::ReadOnlyNames,NamingPolicyFilter::ProhibitDuplicateNames);
rootNode->setChildType("Example child type");
rootNode->addItem("Item 1");
rootNode->addItem("Item 2");
rootNode->addItem("Item 3");
TreeNode* child_node = rootNode->addNode("TestNode1");
child_node->addItem("TestChild1");
child_node->addItem("TestChild2");
child_node->addItem("TestChild3");
The resulting export looks like this (Just using Qtilities::Core::ObserverData::ExportData ):
<object_node ExportFlags="1">
<Data>
<ObserverHints ActivityDisplay="CheckboxActivityDisplay" NamingControl="ReadOnlyNames"/>
<SubjectFilter NewSubjectActivityPolicy="SetNewInactive"
MinimumActivityPolicy="AllowNoneActive"
InstanceFactoryInfo="qti.def.FactoryTag.ActivityFilter"
Name=""
ParentTrackingPolicy="ParentIgnoreActivity"
ActivityPolicy="MultipleActivity"/>
<SubjectFilter ValidityResolutionPolicy="PromptUser"
UniquenessPolicy="ProhibitDuplicateNames"
InstanceFactoryInfo="qti.def.FactoryTag.NamingFilter"
UniquenessResolutionPolicy="PromptUser"
ProcessingCycleValidationCheckFlags="AllChecks"/>
<SubjectFilter GroupName="Example child type"
InversedFiltering="True"
InstanceFactoryInfo="qti.def.FactoryTag.SubjectTypeFilter"
TypeCount="0"/>
</Data>
<Children>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="Item 1"
Activity="Inactive"/>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="Item 2"
Activity="Inactive"/>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="Item 3"
Activity="Inactive"/>
<TreeItem Ownership="SpecificObserverOwnership"
ExportFlags="1"
InstanceFactoryInfo="qti.def.FactoryTag.TreeNode"
Name="TestNode1"
Activity="Inactive">
<Data>
<ObserverHints/>
</Data>
<Children>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="TestChild1"/>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="TestChild2"/>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="TestChild3"/>
<TreeItem InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="Item 3"
Activity="Inactive"/>
</Children>
</TreeItem>
</Children>
</object_node>
For more complex cases the relational data can be added (using ExportRelationalData ) along with a VisitorID on each item in the tree. Again lets look at an example tree:
TreeNode* rootNode = new TreeNode("Root Node");
rootNode->enableActivityControl(ObserverHints::CheckboxActivityDisplay);
rootNode->enableNamingControl(ObserverHints::ReadOnlyNames,NamingPolicyFilter::ProhibitDuplicateNames);
rootNode->setChildType("Example child type");
rootNode->addItem("Item 1");
rootNode->addItem("Item 2");
TreeItem* shared_item = rootNode->addItem("Shared Item");
TreeNode* child_nodeA = rootNode->addNode("TestNodeA");
child_nodeA->addItem("TestChild1");
child_nodeA->addItem("TestChild2");
child_nodeA->addItem("TestChild3");
TreeNode* child_nodeB = rootNode->addNode("TestNodeB");
child_nodeB->addItem("TestChild1");
child_nodeB->addItem("TestChild2");
child_nodeB->addItem("TestChild3");
child_nodeB->addItem(shared_item);
The result looks like this:
<object_node ExportFlags="7" VisitorID="0">
<RelationalData EntryCount="12">
<Entry_0 SessionID="20" Ownership="-1" Name="Root Node"
VisitorID="0" Children="1,2,3,4,8" ParentVisitorID="-1"/>
<Entry_1 SessionID="-1" Parents="0" Ownership="2" Name="Item 1"
VisitorID="1" ParentVisitorID="0"/>
<Entry_2 SessionID="-1" Parents="0" Ownership="2" Name="Item 2"
VisitorID="2" ParentVisitorID="0"/>
<Entry_3 SessionID="-1" Parents="0,8" Ownership="3" Name="Shared Item"
VisitorID="3" ParentVisitorID="-1"/>
<Entry_4 SessionID="22" Parents="0" Ownership="2" Name="TestNodeA"
VisitorID="4" Children="5,6,7" ParentVisitorID="0"/>
<Entry_5 SessionID="-1" Parents="4" Ownership="2" Name="TestChild1"
VisitorID="5" ParentVisitorID="4"/>
<Entry_6 SessionID="-1" Parents="4" Ownership="2" Name="TestChild2"
VisitorID="6" ParentVisitorID="4"/>
<Entry_7 SessionID="-1" Parents="4" Ownership="2" Name="TestChild3"
VisitorID="7" ParentVisitorID="4"/>
<Entry_8 SessionID="23" Parents="0" Ownership="2" Name="TestNodeB"
VisitorID="8" Children="9,10,11,3" ParentVisitorID="0"/>
<Entry_9 SessionID="-1" Parents="8" Ownership="2" Name="TestChild1"
VisitorID="9" ParentVisitorID="8"/>
<Entry_10 SessionID="-1" Parents="8" Ownership="2" Name="TestChild2"
VisitorID="10" ParentVisitorID="8"/>
<Entry_11 SessionID="-1" Parents="8" Ownership="2" Name="TestChild3"
VisitorID="11" ParentVisitorID="8"/>
</RelationalData>
<Data>
<ObserverHints ActivityDisplay="CheckboxActivityDisplay" NamingControl="ReadOnlyNames"/>
<SubjectFilter NewSubjectActivityPolicy="SetNewInactive"
MinimumActivityPolicy="AllowNoneActive"
InstanceFactoryInfo="qti.def.FactoryTag.ActivityFilter"
Name=""
ParentTrackingPolicy="ParentIgnoreActivity"
ActivityPolicy="MultipleActivity"/>
<SubjectFilter ValidityResolutionPolicy="PromptUser"
UniquenessPolicy="ProhibitDuplicateNames"
InstanceFactoryInfo="qti.def.FactoryTag.NamingFilter"
UniquenessResolutionPolicy="PromptUser"
ProcessingCycleValidationCheckFlags="AllChecks"/>
<SubjectFilter GroupName="Example child type"
InversedFiltering="True"
InstanceFactoryInfo="qti.def.FactoryTag.SubjectTypeFilter"
TypeCount="0"/>
</Data>
<Children>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="Item 1"
VisitorID="1"
Activity="Inactive"/>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="Item 2"
VisitorID="2"
Activity="Inactive"/>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="Item 3"
VisitorID="3"
Activity="Inactive"/>
<TreeItem InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
VisitorID="8"
Name="Shared Item
Activity="Inactive"/>
<TreeItem Ownership="SpecificObserverOwnership"
ExportFlags="1"
VisitorID="4"
InstanceFactoryInfo="qti.def.FactoryTag.TreeNode"
Name="TestNode1"
Activity="Inactive"/>
<Data>
<ObserverHints/>
</Data>
<Children>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
VisitorID="5"
Name="TestChild1"/>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
VisitorID="6"
Name="TestChild2"/>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
VisitorID="7"
Name="TestChild3"/>
</Children>
</TreeItem>
<TreeItem Ownership="SpecificObserverOwnership"
ExportFlags="3" InstanceFactoryInfo="qti.def.FactoryTag.TreeNode"
Name="TestNodeB" VisitorID="8"
Activity="Inactive">
<Data>
<ObserverHints/>
</Data>
<Children>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="TestChild1"
VisitorID="9"/>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="TestChild2"
VisitorID="10"/>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="TestChild3"
VisitorID="11"/>
</Children>
</TreeItem>
</Children>
</object_node>
With categories we can construct a tree like this:
TreeNode* rootNode = new TreeNode("Root Node");
rootNode->enableActivityControl(ObserverHints::CheckboxActivityDisplay);
rootNode->enableNamingControl(ObserverHints::ReadOnlyNames,NamingPolicyFilter::ProhibitDuplicateNames);
rootNode->setChildType("Example child type");
rootNode->enableCategorizedDisplay();
rootNode->addItem("Item 1",QtilitiesCategory("TestCategory1"));
rootNode->addItem("Item 2",QtilitiesCategory("TestCategory1::LowerTestLevel","::"));
rootNode->addItem("Item 3",QtilitiesCategory("TestCategory2"));
TreeNode* child_node = rootNode->addNode("TestNode1");
child_node->addItem("TestChild1");
child_node->addItem("TestChild2");
child_node->addItem("TestChild3");
And the output looks like this:
<object_node ExportFlags="1">
<Data>
<ObserverHints HierarchicalDisplay="CategorizedHierarchy"/>
</Data>
<Children>
<TreeItem Ownership="SpecificObserverOwnership" InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="Item 1" Activity="Inactive">
<Category AccessMode="3" Depth="1">
<CategoryLevel_0 Name="TestCategory1"/>
</Category>
</TreeItem>
<TreeItem Ownership="SpecificObserverOwnership" InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="Item 2" Activity="Inactive">
<Category AccessMode="3" Depth="2">
<CategoryLevel_0 Name="TestCategory1"/>
<CategoryLevel_1 Name="LowerTestLevel"/>
</Category>
</TreeItem>
<TreeItem Ownership="SpecificObserverOwnership" InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="Item 3" Activity="Inactive">
<Category AccessMode="3" Depth="1">
<CategoryLevel_0 Name="TestCategory2"/>
</Category>
</TreeItem>
<TreeItem Ownership="SpecificObserverOwnership" ExportFlags="1"
InstanceFactoryInfo="qti.def.FactoryTag.TreeNode" Name="TestNode1" Activity="Inactive">
<Data>
<ObserverHints/>
</Data>
<Children>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="TestChild1"/>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="TestChild2"/>
<TreeItem Ownership="SpecificObserverOwnership"
InstanceFactoryInfo="qti.def.FactoryTag.TreeItem"
Name="TestChild3"/>
</Children>
</TreeItem>
</Children>
</object_node>
|