Inheritance: ChartAttributeBase
Esempio n. 1
0
        /// <summary>
        /// FusionLink 정보를 문자열로 표현합니다. 내부에서 <see cref="Url"/>를 UrlEncoding을 수행합니다.
        /// </summary>
        /// <param name="link"></param>
        /// <returns></returns>
        /// <example>
        /// <code>
        /// // PopUp
        /// &lt;set label='May' value='761' Link='P-detailsPopUp,width=400,height=300,toolbar=no,scrollbars=yes,resizable=yes-../Ajax/Default.aspx'/&gt;
        /// // Frame
        /// &lt;set label='May' value='761' Link='F-detailsFrame-../Ajax/Default.aspx'/&gt;
        //  // NewWindow
        /// &lt;set label='May' value='761' Link='n-../Ajax/Default.aspx'/&gt;
        /// // javascript
        /// &lt;set label='Apr' value='494' Link="javascript:PopUp('April');" /&gt;
        /// </code>
        /// </example>
        public static string ToLinkString(FusionLink link) {
            Guard.Assert(link != null, @"link is null.");

            var builder = new StringBuilder();

            if(link.Url.IsNotWhiteSpace()) {
                switch(link.LinkMethod) {
                    case FusionLinkMethod.PopUp:
                        builder.Append(LINK_POPUP);

                        if(link.Width.HasValue)
                            builder.AppendFormat(",width={0}", link.Width);
                        if(link.Height.HasValue)
                            builder.AppendFormat(",height={0}", link.Height);
                        if(link.ToolBar.HasValue)
                            builder.AppendFormat(",toolbar={0}", link.ToolBar.Value.ToYesNo().ToLower());
                        if(link.Scrollbars.HasValue)
                            builder.AppendFormat(",scrollbars={0}", link.Scrollbars.Value.ToYesNo().ToLower());
                        if(link.Resizable.HasValue)
                            builder.AppendFormat(",resizable={0}", link.Resizable.Value.ToYesNo().ToLower());

                        builder.Append("-").Append(link.Url.UrlEncode());
                        break;

                    case FusionLinkMethod.Frame:
                        builder.AppendFormat(LINK_FRAME + "{0}-{1}", link.FrameName, link.Url.UrlEncode());
                        break;

                    case FusionLinkMethod.NewWindow:
                        builder.Append(LINK_WINDOW).Append(link.Url.UrlEncode());
                        break;

                    case FusionLinkMethod.Javascript:
                        builder.Append(LINK_JAVASCRIPT).Append(link.Url);
                        break;
                    default:
                        builder.AppendFormat("{0}", link.Url.UrlEncode());
                        break;
                }
            }

            var linkStr = builder.ToString();

            if(IsDebugEnabled)
                log.Debug("Fusion Link = " + linkStr);

            return linkStr;
        }
Esempio n. 2
0
        /// <summary>
        /// FusionLink 정보를 문자열로 표현합니다. 내부에서 <see cref="Url"/>를 UrlEncoding을 수행합니다.
        /// </summary>
        /// <param name="link"></param>
        /// <returns></returns>
        /// <example>
        /// <code>
        /// // PopUp
        /// &lt;set label='May' value='761' Link='P-detailsPopUp,width=400,height=300,toolbar=no,scrollbars=yes,resizable=yes-../Ajax/Default.aspx'/&gt;
        /// // Frame
        /// &lt;set label='May' value='761' Link='F-detailsFrame-../Ajax/Default.aspx'/&gt;
        //  // NewWindow
        /// &lt;set label='May' value='761' Link='n-../Ajax/Default.aspx'/&gt;
        /// // javascript
        /// &lt;set label='Apr' value='494' Link="javascript:PopUp('April');" /&gt;
        /// </code>
        /// </example>
        public static string ToLinkString(FusionLink link)
        {
            Guard.Assert(link != null, @"link is null.");

            var builder = new StringBuilder();

            if (link.Url.IsNotWhiteSpace())
            {
                switch (link.LinkMethod)
                {
                case FusionLinkMethod.PopUp:
                    builder.Append(LINK_POPUP);

                    if (link.Width.HasValue)
                    {
                        builder.AppendFormat(",width={0}", link.Width);
                    }
                    if (link.Height.HasValue)
                    {
                        builder.AppendFormat(",height={0}", link.Height);
                    }
                    if (link.ToolBar.HasValue)
                    {
                        builder.AppendFormat(",toolbar={0}", link.ToolBar.Value.ToYesNo().ToLower());
                    }
                    if (link.Scrollbars.HasValue)
                    {
                        builder.AppendFormat(",scrollbars={0}", link.Scrollbars.Value.ToYesNo().ToLower());
                    }
                    if (link.Resizable.HasValue)
                    {
                        builder.AppendFormat(",resizable={0}", link.Resizable.Value.ToYesNo().ToLower());
                    }

                    builder.Append("-").Append(link.Url.UrlEncode());
                    break;

                case FusionLinkMethod.Frame:
                    builder.AppendFormat(LINK_FRAME + "{0}-{1}", link.FrameName, link.Url.UrlEncode());
                    break;

                case FusionLinkMethod.NewWindow:
                    builder.Append(LINK_WINDOW).Append(link.Url.UrlEncode());
                    break;

                case FusionLinkMethod.Javascript:
                    builder.Append(LINK_JAVASCRIPT).Append(link.Url);
                    break;

                default:
                    builder.AppendFormat("{0}", link.Url.UrlEncode());
                    break;
                }
            }

            var linkStr = builder.ToString();

            if (IsDebugEnabled)
            {
                log.Debug("Fusion Link = " + linkStr);
            }

            return(linkStr);
        }