Beispiel #1
0
        //panel里面的
        public List <GridPanel> GetGridPanel()
        {
            //grids 按表名排序
            grids.Sort((x, y) => x.Y.CompareTo(y.Y));

            //region 默认center
            foreach (var gridPanel in grids)
            {
                //item值不明?先注释
                //foreach (var item in gridPanel.Items)
                //{
                //    grids.Add(ControlConverter.ConvertToExtPanel((PbGridInfo)item));
                //}

                AllGrids.Add(gridPanel);
            }

            foreach (var container in containers)
            {
                foreach (var gridPanel in container.Panels)
                {
                    AllGrids.Add(gridPanel);
                }
            }

            CommonParser.Log("Panel转换成功.");

            return(grids);
        }
Beispiel #2
0
 //panel里面的
 public List <GridPanel> GetGridPanel()
 {
     //region 默认center
     foreach (var gridPanel in grids)
     {
         foreach (var item in gridPanel.Items)
         {
             grids.Add(ControlConverter.ConvertToExtPanel((PbGridInfo)item));
         }
     }
     CommonParser.Log("Panel转换成功.");
     return(grids);
 }
Beispiel #3
0
        //表单里的控件排序、转换
        public void SetFormPanel()
        {
            Dictionary <int, SortedList <int, PbBaseControlInfo> > dic =
                new Dictionary <int, SortedList <int, PbBaseControlInfo> >();

            formPanel.Items = this.Sort(formPanel.Items, ref dic);


            //转类型
            foreach (var item in formPanel.Items)
            {
                formPanel.Fields.Add(AppControlConverter.ConvertToExtControl(item));
            }
            CommonParser.Log("formPanel转换成功.");
        }
Beispiel #4
0
        //表头普通的
        public TableLayoutForm GetFormInfo()
        {
            Dictionary <int, SortedList <int, PbBaseControlInfo> > dic =
                new Dictionary <int, SortedList <int, PbBaseControlInfo> >();

            layoutForm.Items = this.Sort(layoutForm.Items, ref dic);

            //计算该fieldset 每行最多的colspan
            layoutForm = CalColSpan(layoutForm, dic);

            //转类型
            foreach (var item in layoutForm.Items)
            {
                layoutForm.FieldsApp.Add(AppControlConverter.ConvertToExtControl(item));
            }
            CommonParser.Log("TableLayoutForm转换成功.");
            return(layoutForm);
        }
Beispiel #5
0
        public static GridPanel ConvertToExtPanel(PbGridInfo pbinfo)
        {
            GridPanel gridPanel = new GridPanel();

            gridPanel.ID           = pbinfo.Id;
            gridPanel.Region       = "center";//默认自适应
            gridPanel.TableName    = pbinfo.TableName;
            gridPanel.TitleName    = pbinfo.FullName;
            gridPanel.Sql          = pbinfo.Sql;
            gridPanel.X            = pbinfo.XPos;
            gridPanel.Y            = pbinfo.YPos;
            gridPanel.Height       = pbinfo.Height;
            gridPanel.Width        = pbinfo.Width;
            gridPanel.IsInTab      = pbinfo.IsInTab;
            gridPanel.Subtotal     = pbinfo.Subtotal;
            gridPanel.Sumdic       = pbinfo.Sumdic;
            gridPanel.Subdic       = pbinfo.Subdic;
            gridPanel.Groupfield   = pbinfo.Groupfield;
            gridPanel.Groupcolsdic = pbinfo.Groupcolsdic;
            gridPanel.LevelSum     = pbinfo.LevelSum;
            gridPanel.Columns      = CommonParser.GetListColumns(pbinfo.PbBaseTextInfos);
            gridPanel.Collapse     = pbinfo.Collapse;
            gridPanel.Title        = pbinfo.Title;

            //用于判断grid中某些列是否存在
            foreach (var item in gridPanel.Columns)
            {
                gridPanel.ColumnNames.Add(item.DataIndex);

                //分组列是帮助列的话改用名称列分组
                if (item.editor.XType == "ngCustomFormHelp" || item.editor.XType == "ngRichHelp")
                {
                    if (gridPanel.Groupfield.ContainsKey(item.DataIndex))  //有关联的标签和输入框
                    {
                        gridPanel.Groupfield[item.DataIndex] = item.DataIndex + "_name";
                        pbinfo.Groupfield[item.DataIndex]    = item.DataIndex + "_name";
                    }
                }
            }

            return(gridPanel);
        }
Beispiel #6
0
        public GridPanel GetGridInfo(PbBillInfo billInfo)
        {
            GridPanel listgrid = new GridPanel();

            listgrid.ID        = billInfo.PbList.Id;
            listgrid.Region    = "center";//默认自适应
            listgrid.TableName = billInfo.PbList.TableName;
            listgrid.Sql       = billInfo.PbList.Sql;

            listgrid.Columns = CommonParser.GetListColumns(billInfo.PbList.PbBaseTextInfos);

            //用于判断grid中某些列是否存在
            foreach (var item in listgrid.Columns)
            {
                listgrid.ColumnNames.Add(item.DataIndex);
            }

            CommonParser.Log("ListGrid转换成功.");

            return(listgrid);
        }
Beispiel #7
0
        //groupbox里面的fieldset
        public List <FieldSet> GetFieldSetInfo(PbBillInfo billInfo)
        {
            //1.定义容器:表头的groupbox,转成ng3中fieldset
            if (billInfo.HeadInfo.PbBaseControlInfos.Count > 0)
            {
                //将fieldset都先放入containers
                foreach (var headinfo in billInfo.HeadInfo.PbBaseControlInfos)
                {
                    FieldSet fieldSet = new FieldSet();
                    fieldSet.X      = headinfo.XPos;
                    fieldSet.Y      = headinfo.YPos;
                    fieldSet.Width  = headinfo.Width;
                    fieldSet.Height = headinfo.Height;
                    fieldSet.ID     = headinfo.Id;
                    fieldSet.Title  = ((PbGroupboxInfo)(headinfo)).Text;

                    //设置fieldset折叠属性,/0、null或空:不能折叠,默认展开,1:能折叠,默认展开,2:能折叠,默认折叠,3:隐藏
                    var collapse = ((PbGroupboxInfo)(headinfo)).Collapse;
                    if (collapse == "1")
                    {
                        fieldSet.Collapsible = true;
                        fieldSet.Collapsed   = false;
                    }
                    else if (collapse == "2")
                    {
                        fieldSet.Collapsible = true;
                        fieldSet.Collapsed   = true;
                    }
                    else if (collapse == "3")
                    {
                        fieldSet.Collapsible = false;
                        fieldSet.Collapsed   = false;
                        fieldSet.Border      = false;
                        fieldSet.Title       = "";
                    }
                    else
                    {
                        fieldSet.Collapsible = false;  //不允许折叠
                        fieldSet.Collapsed   = false;  //默认展开
                    }

                    containers.Add(fieldSet);
                }
            }

            //2.表头所有列(包括fieldset中列),放到layoutForm或容器
            foreach (var pbColumn in billInfo.HeadInfo.PbColumns)
            {
                //将控件放到指定的容器内
                FindContain(pbColumn, pbColumn.XPos, pbColumn.YPos);
            }

            //3.容器内列排序和生成成二维列表列
            for (int i = 0; i < containers.Count; i++)
            {
                Dictionary <int, SortedList <int, PbBaseControlInfo> > dic =
                    new Dictionary <int, SortedList <int, PbBaseControlInfo> >();
                containers[i].Items = Sort(containers[i].Items, ref dic);

                /*  comment by ljy 此函数废弃,列宽改成按设计器列属性设置来确定
                 * //计算该fieldset 每行最多的colspan
                 * //算占多少  //不能用ref 动态类
                 * containers[i] = CalColSpan(containers[i], dic);
                 * //containers[i].ColumnsPerRow = 4;
                 */

                containers[i].ColumnsPerRow = billInfo.HeadInfo.ColumnsPerRow;  //每行分几列

                //按行布局二维列表结构, 控件转成ng3类型; 容器内所有列转成ng3类型后赋给Allfields; 每行几列按设计器上实际布局来
                containers[i].FieldRows = GetFieldsRows(dic, containers[i], null);
            }

            //4.表体所有grid(包括fieldset中grid),转成ng类型并放到grids或容器(fieldset中可能有grid,在设计时就应该避免groupbox中有grid)
            if (billInfo.PbGrids.Count > 0)
            {
                foreach (var gridpanel in billInfo.PbGrids)
                {
                    FindContain(gridpanel, gridpanel.XPos, gridpanel.YPos);
                }
            }


            /*
             * //含有金格控件
             * if (billInfo.OfficeInfo.Visible)
             * {
             *  FieldSet fieldSet = new FieldSet();
             *  fieldSet.X = billInfo.OfficeInfo.XPos;
             *  fieldSet.Y = billInfo.OfficeInfo.YPos;
             *  fieldSet.Width = billInfo.OfficeInfo.Width;
             *  fieldSet.Height = billInfo.OfficeInfo.Height;
             *  fieldSet.Title = "金格控件";
             *  FieldSetBlobdoc = fieldSet;  //赋给返回的金格控件fieldset
             *  //containers.Add(fieldSet);
             * }
             *
             * //含有进度控件
             * if (billInfo.ScheduleInfo.Visible)
             * {
             *  FieldSet fieldSet = new FieldSet();
             *  fieldSet.X = billInfo.ScheduleInfo.XPos;
             *  fieldSet.Y = billInfo.ScheduleInfo.YPos;
             *  fieldSet.Width = billInfo.ScheduleInfo.Width;
             *  fieldSet.Height = billInfo.ScheduleInfo.Height;
             *  fieldSet.Title = "进度控件";
             *  containers.Add(fieldSet);
             * }
             */

            //为容器内的控件进行布局 region
            //SetLayout();

            //GroupBox根据Y坐标进行排序
            containers.Sort((x, y) => x.Y.CompareTo(y.Y));

            CommonParser.Log("GroupBox转换成功.");

            return(containers);
        }
Beispiel #8
0
        //groupbox里面的fieldset
        public List <FieldSet> GetFieldSetInfo(PbBillInfo billInfo)
        {
            //含有groupbox表头
            if (billInfo.HeadInfo.PbBaseControlInfos.Count > 0)
            {
                //将容器都先放入containers
                foreach (var headinfo in billInfo.HeadInfo.PbBaseControlInfos)
                {
                    FieldSet fieldSet = new FieldSet();
                    fieldSet.X      = headinfo.XPos;
                    fieldSet.Y      = headinfo.YPos;
                    fieldSet.Width  = headinfo.Width;
                    fieldSet.Height = headinfo.Height;
                    fieldSet.ID     = headinfo.Id;
                    fieldSet.Title  = ((PbGroupboxInfo)(headinfo)).Text;
                    containers.Add(fieldSet);
                }
            }

            foreach (var pbColumn in billInfo.HeadInfo.PbColumns)
            {
                //将控件放到指定的容器内
                FindContain(pbColumn, pbColumn.XPos, pbColumn.YPos);
            }

            //因为要赋值回去,所以不能foreach
            for (int i = 0; i < containers.Count; i++)
            {
                Dictionary <int, SortedList <int, PbBaseControlInfo> > dic =
                    new Dictionary <int, SortedList <int, PbBaseControlInfo> >();
                containers[i].Items = this.Sort(containers[i].Items, ref dic);

                //计算该fieldset 每行最多的colspan
                //算占多少  //不能用ref 动态类
                containers[i] = CalColSpan(containers[i], dic);
            }

            //含有表体
            if (billInfo.PbGrids.Count > 0)
            {
                foreach (var gridpanel in billInfo.PbGrids)
                {
                    FindContain(gridpanel, gridpanel.XPos, gridpanel.YPos);
                }
            }

            //含有金格控件
            if (billInfo.OfficeInfo.Visible)
            {
                FieldSet fieldSet = new FieldSet();
                fieldSet.X      = billInfo.OfficeInfo.XPos;
                fieldSet.Y      = billInfo.OfficeInfo.YPos;
                fieldSet.Width  = billInfo.OfficeInfo.Width;
                fieldSet.Height = billInfo.OfficeInfo.Height;
                fieldSet.Title  = "金格控件";
                containers.Add(fieldSet);
            }

            //含有进度控件
            if (billInfo.ScheduleInfo.Visible)
            {
                FieldSet fieldSet = new FieldSet();
                fieldSet.X      = billInfo.ScheduleInfo.XPos;
                fieldSet.Y      = billInfo.ScheduleInfo.YPos;
                fieldSet.Width  = billInfo.ScheduleInfo.Width;
                fieldSet.Height = billInfo.ScheduleInfo.Height;
                fieldSet.Title  = "进度控件";
                containers.Add(fieldSet);
            }

            //为容器内的控件进行布局 region
            SetLayout();

            for (int i = 0; i < containers.Count; i++)
            {
                //转类型
                foreach (var item in containers[i].Items)
                {
                    if (item is PbGridInfo)
                    {
                        containers[i].Panels.Add(ControlConverter.ConvertToExtPanel((PbGridInfo)item));
                    }
                    else
                    {
                        containers[i].AllFields.Add(ControlConverter.ConvertToExtControl(item));
                    }
                    //PbBaseControlInfo pbcontrol = item;
                    // expressions.Add(()pbcontrol.);
                }
            }
            CommonParser.Log("GroupBox转换成功.");
            return(containers);
        }