Пример #1
0
        internal Tk5TableScheme(ITableSchemeEx scheme, IInputData input, BaseSingleMetaDataConfig config,
                                Func <ITableSchemeEx, IFieldInfoEx, IInputData, BaseSingleMetaDataConfig, Tk5FieldInfoEx> createFunc)
            : this()
        {
            SetFileDependency(scheme);
            if (!string.IsNullOrEmpty(config.TableName))
            {
                TableName = config.TableName;
            }
            else
            {
                TableName = scheme.TableName;
            }
            if (config.TableDesc != null)
            {
                TableDesc = config.TableDesc.ToString();
            }
            else
            {
                TableDesc = scheme.TableDesc;
            }
            NameField = scheme.NameField;

            PageStyle pageStyle = input.Style.Style;
            var       list      = from item in scheme.Fields
                                  where IsShow(item, pageStyle, config.OverrideFields)
                                  select item;

            foreach (var item in list)
            {
                Tk5FieldInfoEx fieldInfo = createFunc(scheme, item, input, config);
                fList.Add(fieldInfo);
            }

            // 删除主Schema中的字段
            DelFields(config.DelFields);
            // 重载主Schema中的字段
            OverrideFields(input, config.OverrideFields);
            // 添加虚拟字段到主Schema中
            AddFields(input, config.AddFields);

            ProcessRefField();
        }
        public static Tk5FieldInfoEx CreateDataXmlField(ITableSchemeEx scheme,
                                                        IFieldInfoEx field, IInputData input, BaseSingleMetaDataConfig config)
        {
            Tk5FieldInfoEx fieldInfo = new Tk5FieldInfoEx(field, input.Style);

            return(fieldInfo);
        }
Пример #3
0
 public static Tk5FieldInfoEx CreatePropertyField(ITableSchemeEx scheme,
                                                  IFieldInfoEx field, IInputData input, BaseSingleMetaDataConfig config)
 {
     return(new Tk5FieldInfoEx(field.Convert <PropertyFieldInfo>(), input.Style));
 }
Пример #4
0
 internal Tk5NormalTableData(Tk5TableScheme table, BaseSingleMetaDataConfig config, IPageStyle style)
     : this(table, config, SearchControlMethod.Id, style)
 {
 }
Пример #5
0
        public static Tk5FieldInfoEx CreateDataXmlField(ITableSchemeEx scheme,
                                                        IFieldInfoEx field, IInputData input, BaseSingleMetaDataConfig config)
        {
            Tk5FieldInfoEx fieldInfo = new Tk5FieldInfoEx(field, input.Style);
            //Tk5DataXml dataXml = scheme.Convert<Tk5DataXml>();
            IDisplayObject display = scheme as IDisplayObject;

            if (display != null && input.Style.Style == PageStyle.List)
            {
                bool isNameField = display.SupportDisplay && field.FieldName == display.Name.FieldName;
                if (!config.DisableAutoDetailLink)
                {
                    if (!isNameField && fieldInfo.ListDetail != null)
                    {
                        IConfigCreator <IDisplay> iConfigCreator = fieldInfo.ListDetail.ListDisplay;
                        IHrefDisplay hrefDisplay = iConfigCreator as IHrefDisplay;
                        if (hrefDisplay != null)
                        {
                            if (string.IsNullOrEmpty(hrefDisplay.Content))
                            {
                                hrefDisplay.Content = CreateContent(input, display);
                            }
                        }
                    }
                    if (isNameField)
                    {
                        if (fieldInfo.ListDetail == null)
                        {
                            fieldInfo.ListDetail = new Tk5ListDetailConfig();
                        }
                        string content = CreateContent(input, display);
                        if (fieldInfo.ListDetail.Link == null)
                        {
                            fieldInfo.ListDetail.Link = new Tk5LinkConfig(content);
                        }
                        IHrefDisplay hrefDisplay = fieldInfo.ListDetail.ListDisplay as IHrefDisplay;
                        if (hrefDisplay == null)
                        {
                            string displayXml = string.Format(ObjectUtil.SysCulture,
                                                              "<tk:ListRefDisplay><tk:NormalDisplay/></tk:ListRefDisplay>", content);
                            var listRefDisplay = Tk5FieldInfoEx.GetDisplay(displayXml);
                            if (fieldInfo.ListDetail.ListDisplay != null)
                            {
                                var displayContainer = listRefDisplay as IDisplayContainer;
                                if (displayContainer != null)
                                {
                                    displayContainer.SetInternalDisplay(fieldInfo.ListDetail.ListDisplay);
                                }
                            }
                            fieldInfo.ListDetail.ListDisplay = listRefDisplay;
                            hrefDisplay = listRefDisplay.Convert <IHrefDisplay>();
                        }
                        if (string.IsNullOrEmpty(hrefDisplay.Content))
                        {
                            hrefDisplay.Content = content;
                        }
                    }
                }
            }
            return(fieldInfo);
        }