GenerateChildPartsIfNeeded() public method

public GenerateChildPartsIfNeeded ( ) : List
return List
Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="root"></param>
        /// <param name="cache"></param>
        /// <param name="keyAttrNames"></param>
        /// <param name="vc">for parts/layouts</param>
        /// <param name="rootClassId">class of the root object used to compute parts/layouts</param>
        /// <returns></returns>
        static private List <XmlNode> GetGeneratedChildren(XmlNode root, FdoCache cache, string[] keyAttrNames,
                                                           XmlVc vc, int rootClassId)
        {
            List <XmlNode> result = new List <XmlNode>();
            string         generateModeForColumns = XmlUtils.GetOptionalAttributeValue(root, "generate");
            bool           m_fGenerateChildPartsForParentLayouts = (generateModeForColumns == "childPartsForParentLayouts");

            // childPartsForParentLayouts
            foreach (XmlNode child in root.ChildNodes)
            {
                if (child is XmlComment)
                {
                    continue;
                }
                if (m_fGenerateChildPartsForParentLayouts)
                {
                    ChildPartGenerator cpg = new ChildPartGenerator(cache, child, vc, rootClassId);
                    cpg.GenerateChildPartsIfNeeded();
                }
                if (child.Name != "generate")
                {
                    result.Add(child);
                    continue;
                }

                PartGenerator generator;
                if (generateModeForColumns == "objectValuePartsForParentLayouts")
                {
                    generator = new ObjectValuePartGenerator(cache, child, vc, rootClassId);
                }
                else
                {
                    generator = new PartGenerator(cache, child, vc, rootClassId);
                }
                foreach (XmlNode genNode in generator.Generate())
                {
                    bool match = false;
                    if (keyAttrNames != null)
                    {
                        foreach (XmlNode matchNode in root.ChildNodes)
                        {
                            if (MatchNodes(matchNode, genNode, keyAttrNames))
                            {
                                match = true;
                                break;
                            }
                        }
                    }
                    if (!match)                     // not already present, or not checking; add it.
                    {
                        result.Add(genNode);
                    }
                }
            }
            return(result);
        }
Example #2
0
		/// <summary>
		///
		/// </summary>
		/// <param name="root"></param>
		/// <param name="cache"></param>
		/// <param name="keyAttrNames"></param>
		/// <param name="vc">for parts/layouts</param>
		/// <param name="rootClassId">class of the root object used to compute parts/layouts</param>
		/// <returns></returns>
		static private List<XmlNode> GetGeneratedChildren(XmlNode root, FdoCache cache, string[] keyAttrNames,
			XmlVc vc, int rootClassId)
		{
			List<XmlNode> result = new List<XmlNode>();
			string generateModeForColumns = XmlUtils.GetOptionalAttributeValue(root, "generate");
			bool m_fGenerateChildPartsForParentLayouts = (generateModeForColumns == "childPartsForParentLayouts");

			// childPartsForParentLayouts
			foreach(XmlNode child in root.ChildNodes)
			{
				if (child is XmlComment)
					continue;
				if (m_fGenerateChildPartsForParentLayouts)
				{
					ChildPartGenerator cpg = new ChildPartGenerator(cache, child, vc, rootClassId);
					cpg.GenerateChildPartsIfNeeded();
				}
				if (child.Name != "generate")
				{
					result.Add(child);
					continue;
				}

				PartGenerator generator;
				if (generateModeForColumns == "objectValuePartsForParentLayouts")
					generator = new ObjectValuePartGenerator(cache, child, vc, rootClassId);
				else
					generator = new PartGenerator(cache, child, vc, rootClassId);
				foreach (XmlNode genNode in generator.Generate())
				{
					bool match = false;
					if (keyAttrNames != null)
					{
						foreach (XmlNode matchNode in root.ChildNodes)
						{
							if (MatchNodes(matchNode, genNode, keyAttrNames))
							{
								match = true;
								break;
							}
						}
					}
					if (!match) // not already present, or not checking; add it.
						result.Add(genNode);
				}
			}
			return result;
		}