Пример #1
0
        public override void onCreateTreeTable(TreeTableConductor invorker)
        {
            int selfID   = 0;
            int parentID = -1;

            TravelFold2(RootPath, ref selfID, ref parentID);
        }
Пример #2
0
        public override void onCreateTreeTable(TreeTableConductor invorker)
        {
            int           selfID = 1;
            ISet <string> sets   = new HashSet <string>();
            Dictionary <int, List <TempNodeEntry> > tempDict2 = new Dictionary <int, List <TempNodeEntry> >();
            //判别使用的是分组事件还是分组接口
            int groupCount = 0;

            if (IsUseEctarctEvent)
            {
                //添加分组字段提取器事件
                if (ExtractEvents != null)
                {
                    foreach (Delegate d in ExtractEvents.GetInvocationList())
                    {
                        ExtractEvents -= d as Del_ExtractGroupFieldValue <T>;
                    }
                }
                onBlindExtractEvent();
                groupCount = ExtractEvents.GetInvocationList().Count();
            }
            else
            {
                //添加分组字段提取器接口
                if (Extractors != null)
                {
                    Extractors.Clear();
                }
                Extractors = new List <IGroupFieldExtractor <T> >();
                onAddDataExtract(Extractors);
                groupCount = Extractors.Count();
            }

            TreeTableUtils tableUtils = invorker.convertToTreeTableUtils();

            //开始分等等级遍历
            for (int NodeLevel = 0; NodeLevel < groupCount; NodeLevel++)
            {
                //按照指定的分组方法,对每一各分组字段进行获取
                foreach (T item in DataList)
                {
                    string[] tags = new string[NodeLevel + 1];
                    if (IsUseEctarctEvent)
                    {
                        for (int index = 0; index < tags.Length; index++)
                        {
                            tags[index] = ExtractEvents.GetInvocationList()[index].DynamicInvoke(item).ToString();
                        }
                    }
                    else
                    {
                        for (int index = 0; index < tags.Length; index++)
                        {
                            tags[index] = Extractors[index].onExtractGroupFieldValue(item);
                        }
                    }

                    string tag      = onFormatTag(tags);
                    int    parentID = Tag_RootIndex;

                    if (NodeLevel != 0)
                    {
                        DataRow temp = tableUtils.FindNodeByTag(onFormatTag(tags.Take(NodeLevel).ToArray()));
                        if (temp == null)
                        {
                            continue;
                        }
                        parentID = int.Parse(temp[invorker.TableBuilder.SelfID].ToString());
                    }

                    if (tempDict2.Keys.Contains(parentID) == false)
                    {
                        tempDict2.Add(parentID, new List <TempNodeEntry>());
                    }

                    if (sets.Contains(tag) == false)
                    {
                        TempNodeEntry entry = new TempNodeEntry();
                        entry.Tag   = tag;
                        entry.Value = tags[NodeLevel];
                        onCustomTempNodeEntry(ref entry, item, NodeLevel);
                        tempDict2[parentID].Add(entry);
                        sets.Add(tag);
                    }
                }

                foreach (int Key_parentID in tempDict2.Keys)
                {
                    foreach (var value_entry in SortTempNodeEntryBeforeAddToTree(tempDict2[Key_parentID], NodeLevel, Key_parentID))
                    {
                        DataRow tempRow = Conductor.ResultTable.NewRow();
                        tempRow[Conductor.TableBuilder.SelfID]   = selfID++;
                        tempRow[Conductor.TableBuilder.Value]    = value_entry.Value;
                        tempRow[Conductor.TableBuilder.ParentID] = Key_parentID;
                        tempRow[Conductor.TableBuilder.Tag]      = value_entry.Tag;
                        //支持有其他属性的添加
                        onAddNodeEntryToDataRow(Conductor.TableBuilder, NodeLevel, tempRow, value_entry);
                        //添加到数据表
                        Conductor.ResultTable.Rows.Add(tempRow);
                    }
                }
                sets.Clear();
                tempDict2.Clear();
            }
        }
Пример #3
0
 /// <summary>
 /// 功能方法:onCreateTreeTable方法执行前进行的操作
 /// </summary>
 /// <param name="invorker">当前构建命令的指挥者</param>
 public virtual void onBeforeCreateTreeTable(TreeTableConductor invorker)
 {
     this.Conductor = invorker;
 }
Пример #4
0
 /// <summary>
 /// 功能方法:onCreateTreeTable方法执行后进行的操作
 /// </summary>
 /// <param name="invorker">当前构建命令的指挥者</param>
 public virtual void onAfterCreateTreeTable(TreeTableConductor invorker)
 {
 }
Пример #5
0
 /// <summary>
 /// 功能方法:具体的树结构构建方案
 /// </summary>
 /// <param name="invorker">当前构建命令的指挥者</param>
 public abstract void onCreateTreeTable(TreeTableConductor invorker);