Exemple #1
0
        internal static void SetHrefDisplay(object display, string content)
        {
            IHrefDisplay href = display as IHrefDisplay;

            if (href != null)
            {
                if (string.IsNullOrEmpty(href.Content))
                {
                    href.Content = content;
                }
            }
        }
Exemple #2
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);
        }