コード例 #1
0
            public CCPage(CCreator parent, ITisPageParams page, String page_id)
#endif
                : base(parent, page != null? page.Name:String.Empty, null, null)
            {
                try
                {
                    if (groups == null)
                    {
                        groups = new List <CCGroup>();
                    }
                    else
                    {
                        groups.Clear();
                    }

                    this.EflowOwner  = page;
                    this.PageID      = page_id;
                    this.NamedParent = page.ParentForm.Name;
                    bool           hasEfi = false;
                    CCGroup        grp    = null;
                    List <CCTable> tables = new List <CCTable>();

                    if (!String.IsNullOrEmpty(page_id))
                    {
                        //-- Get matched EFI --\\
                        ITisEFIParams efi = page.get_LinkedEFI(page_id);
                        hasEfi = efi != null;
                        if (hasEfi)
                        {
                            //-- Get all fields and field-groups that has ROIs --\\
                            foreach (ITisROIParams roi in efi.ROIs)
                            {
                                if (roi.Miscellaneous.OrderInField == 1)
                                {
                                    ITisFieldParams fp = page.get_LinkedField(roi.Miscellaneous.FieldName);

                                    if (fp != null)
                                    {
                                        if (fp.ParentFieldGroupExists)
                                        {
                                            //-- A standard field --\\
                                            grp = GetGroup(fp.ParentFieldGroup.Name);
                                            if (grp == null)
                                            {
                                                grp = new CCGroup(parent, fp.ParentFieldGroup, false);
                                                groups.Add(grp);
                                            }

                                            CCField cf = grp.GetField(fp.Name);

                                            //-- Create field and join sll ROIs --\\
                                            if (cf == null)
                                            {
                                                cf = grp.AddField(fp.Name, String.Empty, 0, CCUtils.MergerRoisRect(CCUtils.GetLinkedRois(efi, fp.Name)));
                                            }
                                            else
                                            {
                                                cf.Rect = new FieldRect(CCUtils.MergerRoisRect(CCUtils.GetLinkedRois(efi, fp.Name)));
                                            }

                                            grp.AddField(cf);
                                        }
                                        else if (fp.ParentFieldTableExists)
                                        {
                                            //-- A table field --\\
                                            grp = AddGroup(fp.ParentFieldTable.ParentFieldGroup.Name);
                                            CCTable tbl = grp.AddTable(fp.ParentFieldTable.Name);

                                            if (!tables.Contains(tbl))
                                            {
                                                tables.Add(tbl);
                                            }
                                            CCFieldArray fldArr = tbl.AddFieldArray(fp.Name);
                                            fldArr.AddField(fp, CCUtils.MergerRoisRect(CCUtils.GetLinkedRois(efi, fp.Name)));
                                            //CCField cf = fldArr.AddField(fldArr.fp.Name);

                                            ////-- Create field and join sll ROIs --\\
                                            //if (cf == null) cf = grp.AddField(fp.Name, String.Empty, 0, CCUtils.MergerRoisRect(CCUtils.GetLinkedRois(efi, fp.Name)));
                                            //else cf.Rect = new FieldRect(CCUtils.MergerRoisRect(CCUtils.GetLinkedRois(efi, fp.Name)));

                                            //CCFieldArray cfAr = tbl.AddFieldArray(fp.Name);

                                            //cfAr.AddField(cf);
                                        }
                                    }
                                }
                            }

                            //-- Add rows if KeepEmptyRows is marked --\\
                            if (tables != null && tables.Count > 0)
                            {
                                foreach (CCTable tbl in tables)
                                {
                                    ITisFieldTableParams efTable = page.get_LinkedFieldTable(tbl.Name);
                                    if (efTable != null && efTable.Table.KeepEmptyRows && efTable.Table.NumberOfRows > tbl.NumberOfRows)
                                    {
                                        tbl.AddRow();
                                    }
                                }
                            }
                        }
                    }

                    if (!hasEfi)
                    {
                        foreach (ITisFieldParams fld in page.LinkedFields)
                        {
                            if (fld.ParentFieldGroupExists)
                            {
                                grp = GetGroup(fld.ParentFieldGroup.Name);
                                if (grp == null)
                                {
                                    grp = new CCGroup(parent, fld.ParentFieldGroup, false);
                                    groups.Add(grp);
                                }
                            }
                            else if (fld.ParentFieldTableExists)
                            {
                                grp = GetGroup(fld.ParentFieldTable.ParentFieldGroup.Name);
                                if (grp == null)
                                {
                                    grp = new CCGroup(parent, fld.ParentFieldTable.ParentFieldGroup, false);
                                    groups.Add(grp);
                                }
                            }
                        }

                        foreach (ITisFieldTableParams fldTbl in page.LinkedFieldTables)
                        {
                            grp = GetGroup(fldTbl.ParentFieldGroup.Name);
                            if (grp == null)
                            {
                                grp = new CCGroup(parent, fldTbl.ParentFieldGroup, false);
                                groups.Add(grp);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    ILog.LogError(ex);
                }
            }