internal DefinitionLocator CreateCopyForMerging() { DefinitionLocator copy = new DefinitionLocator(); copy.CopyLocatorBaseInformation(this); if (this.childDisplayOrder != null) { copy.childDisplayOrder = new HybridDictionary(); foreach (DictionaryEntry de1 in this.childDisplayOrder) { copy.childDisplayOrder[de1.Key] = de1.Value; } } if (this.childLocatorsByHRef != null) { copy.childLocatorsByHRef = new HybridDictionary(); foreach (DictionaryEntry de1 in this.childLocatorsByHRef) { ChildDefinitionLocator cdl = de1.Value as ChildDefinitionLocator; copy.childLocatorsByHRef[de1.Key] = cdl.CreateCopyForMerging(); } } //parent info udjused later copy.parents = this.parents; return(copy); }
/// <summary> /// Creates a new instance of <see cref="ChildDefinitionLocator"/>, copying /// properties from a parameter-supplied <see cref="ChildDefinitionLocator"/>. /// </summary> /// <param name="cpl">The <see cref="ChildDefinitionLocator"/> from which properties /// are to be copied to the new instance of <see cref="ChildDefinitionLocator"/>.</param> public ChildDefinitionLocator(ChildDefinitionLocator cpl) { hRef = cpl.hRef; foreach (DefinitionLocatorRelationshipInfo lri in cpl.locatorRelationshipInfos) { locatorRelationshipInfos.Add(lri); } }
/// <summary> /// Creates a new instance of <see cref="ChildDefinitionLocator"/>, copying /// properties from a parameter-supplied <see cref="ChildDefinitionLocator"/>. /// </summary> /// <param name="cpl">The <see cref="ChildDefinitionLocator"/> from which properties /// are to be copied to the new instance of <see cref="ChildDefinitionLocator"/>.</param> public ChildDefinitionLocator(ChildDefinitionLocator cpl) { hRef = cpl.hRef; foreach ( DefinitionLocatorRelationshipInfo lri in cpl.locatorRelationshipInfos ) { locatorRelationshipInfos.Add( lri ); } }
internal void Append(DefinitionLocator arg) { if (arg.childLocatorsByHRef != null) { if (this.childLocatorsByHRef == null) { this.childLocatorsByHRef = new HybridDictionary(); this.childDisplayOrder = new HybridDictionary(); } foreach (ChildDefinitionLocator cpl in arg.childLocatorsByHRef.Values) { ChildDefinitionLocator orig = this.childLocatorsByHRef[cpl.HRef] as ChildDefinitionLocator; if (orig == null) { childLocatorsByHRef[cpl.HRef] = cpl; } else { foreach (DefinitionLocatorRelationshipInfo lri in cpl.LocatorRelationshipInfos) { if (orig.CanAddRelationship(lri)) { orig.AddRelationship(lri); } } } } } if (arg.parents != null && arg.parents.Count > 0) { if (parents == null) { parents = arg.parents; } else { // unique parents only please foreach (DefinitionLocator parent in arg.Parents) { if (!parents.Contains(parent)) { parents.Add(parent); } } } } foreach (string label in arg.labelArray) { AddLabel(label); } }
internal ChildDefinitionLocator CreateCopyForMerging() { ChildDefinitionLocator ret = new ChildDefinitionLocator(); ret.hRef = this.hRef; ret.locatorRelationshipInfos = new ArrayList(this.locatorRelationshipInfos.Count); for (int i = 0; i < locatorRelationshipInfos.Count; i++) { ret.locatorRelationshipInfos.Add(new DefinitionLocatorRelationshipInfo(locatorRelationshipInfos[i] as DefinitionLocatorRelationshipInfo)); } return(ret); }
private int GetNextPriority(string childId) { if (childLocatorsByHRef != null) { ChildDefinitionLocator cpl = childLocatorsByHRef[childId] as ChildDefinitionLocator; if (cpl != null) { int maxPriority = 0; foreach (LocatorRelationshipInfo lri in cpl.LocatorRelationshipInfos) { maxPriority = Math.Max(lri.Priority, maxPriority); } return(maxPriority + 1); } } return(1); }
internal void AddChild(DefinitionLocator childPl, float orderArg, string prefLabel, string targetRole, bool?isClosed, bool?isUsable, bool?isall, bool?isScenario, bool?isDefault, bool?isRequiresElement, DimensionNode.NodeType nodeType, string priority, bool isProhibited) { childPl.AddParent(this); if (this.childLocatorsByHRef == null) { this.childLocatorsByHRef = new HybridDictionary(); this.childDisplayOrder = new HybridDictionary(); } float dispOrder = orderArg; DefinitionLocatorRelationshipInfo newRelation = DefinitionLocatorRelationshipInfo.CreateObj(prefLabel, priority, orderArg, dispOrder, prefLabel, isProhibited, targetRole, isClosed, isUsable, isall, isScenario, isRequiresElement, isDefault, nodeType); ChildDefinitionLocator cpl = childLocatorsByHRef[childPl.HRef] as ChildDefinitionLocator; if (cpl == null) { // doesn't exist in either the href table or the order table cpl = new ChildDefinitionLocator(childPl.HRef, newRelation); childLocatorsByHRef.Add(childPl.HRef, cpl); // keep these separate so they don't impact each other ChildDefinitionLocator cplOrder = new ChildDefinitionLocator(cpl); } else { // the cpl already exists, append the existing relation info cpl.AddRelationship(newRelation); } }
public bool UpdateOptionalArc(string elementId, string parentElementId, DefinitionLocatorRelationshipInfo newLocatorRelationshipInfo, Taxonomy taxonomy) { DefinitionLocator parentLocator = locators[parentElementId] as DefinitionLocator; newLocatorRelationshipInfo.IsProhibited = false; newLocatorRelationshipInfo.OrigOrder = newLocatorRelationshipInfo.Order; if (parentLocator == null && !string.IsNullOrEmpty(parentElementId)) { parentLocator = new DefinitionLocator(); parentLocator.href = parentElementId; parentLocator.MyElement = taxonomy.allElements[parentElementId] as Element; locators[parentElementId] = parentLocator; } DefinitionLocator childLocator = locators[elementId] as DefinitionLocator; if (childLocator == null) { childLocator = new DefinitionLocator(); childLocator.href = elementId; childLocator.MyElement = taxonomy.allElements[elementId] as Element; if (parentLocator != null) { childLocator.AddParent(parentLocator); } locators[elementId] = childLocator; } if (parentLocator != null) { if (parentLocator.childLocatorsByHRef == null) { parentLocator.childLocatorsByHRef = new HybridDictionary(); } ChildDefinitionLocator cpl = parentLocator.childLocatorsByHRef[elementId] as ChildDefinitionLocator; if (cpl != null) { cpl.AddRelationship(newLocatorRelationshipInfo); } else { cpl = new ChildDefinitionLocator(elementId, newLocatorRelationshipInfo); parentLocator.childLocatorsByHRef[elementId] = cpl; } } return true; }
internal void AddChild( DefinitionLocator childPl, float orderArg, string prefLabel, string targetRole, bool? isClosed, bool? isUsable, bool? isall, bool? isScenario, bool? isDefault, bool? isRequiresElement, DimensionNode.NodeType nodeType, string priority, bool isProhibited ) { childPl.AddParent( this ); if( this.childLocatorsByHRef == null ) { this.childLocatorsByHRef = new HybridDictionary(); this.childDisplayOrder = new HybridDictionary(); } float dispOrder = orderArg; DefinitionLocatorRelationshipInfo newRelation = DefinitionLocatorRelationshipInfo.CreateObj( prefLabel, priority, orderArg,dispOrder, prefLabel, isProhibited, targetRole ,isClosed, isUsable, isall,isScenario , isRequiresElement, isDefault, nodeType ); ChildDefinitionLocator cpl = childLocatorsByHRef[childPl.HRef] as ChildDefinitionLocator; if ( cpl == null ) { // doesn't exist in either the href table or the order table cpl = new ChildDefinitionLocator( childPl.HRef, newRelation ); childLocatorsByHRef.Add( childPl.HRef, cpl ); // keep these separate so they don't impact each other ChildDefinitionLocator cplOrder = new ChildDefinitionLocator( cpl ); } else { // the cpl already exists, append the existing relation info cpl.AddRelationship( newRelation ); } }
internal ChildDefinitionLocator CreateCopyForMerging() { ChildDefinitionLocator ret = new ChildDefinitionLocator(); ret.hRef = this.hRef; ret.locatorRelationshipInfos = new ArrayList(this.locatorRelationshipInfos.Count); for (int i = 0; i < locatorRelationshipInfos.Count; i++) { ret.locatorRelationshipInfos.Add(new DefinitionLocatorRelationshipInfo(locatorRelationshipInfos[i] as DefinitionLocatorRelationshipInfo)); } return ret; }