Пример #1
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            Page.ClientScript.RegisterClientScriptResource(typeof(BorderedPanel), "IZ.WebFileManager.resources.BorderedPanel.js");

            bool isHeader = Page.Header != null;

            if (_hoverSyle != null)
            {
                if (!isHeader)
                {
                    throw new InvalidOperationException("Using BorderedPanel.HoverStyle requires Page.Header to be non-null (e.g. <head runat=\"server\" />).");
                }
                BorderedPanelStyle s = new BorderedPanelStyle();
                s.CopyFrom(_hoverSyle);
                if (ControlStyleCreated)
                {
                    s.MergeWith(ControlStyle);
                }
                Page.Header.StyleSheet.RegisterStyle(s, this);
                _hoverCssClass = s.RegisteredCssClass;
                RegisterBorderImagesArray(s, OuterBorderHoverImagesArrayName);
            }

            if (_pressedSyle != null)
            {
                if (!isHeader)
                {
                    throw new InvalidOperationException("Using BorderedPanel.PressedSyle requires Page.Header to be non-null (e.g. <head runat=\"server\" />).");
                }
                BorderedPanelStyle s = new BorderedPanelStyle();
                s.CopyFrom(_pressedSyle);
                if (_hoverSyle != null)
                {
                    s.MergeWith(_hoverSyle);
                }
                if (ControlStyleCreated)
                {
                    s.MergeWith(ControlStyle);
                }
                Page.Header.StyleSheet.RegisterStyle(s, this);
                _pressedCssClass = s.RegisteredCssClass;
                RegisterBorderImagesArray(s, OuterBorderPressedImagesArrayName);
            }

            if (ControlStyleCreated)
            {
                if (isHeader)
                {
                    Page.Header.StyleSheet.RegisterStyle(ControlStyle, this);
                }
            }
        }
Пример #2
0
        void RegisterBorderImagesArray(BorderedPanelStyle style, String arrayName)
        {
            Page.ClientScript.RegisterArrayDeclaration(arrayName,
                                                       "'" + String.Join("','", new string[] {
                ResolveUrl(style.OuterBorderTopImageUrl),
                ResolveUrl(style.OuterBorderLeftImageUrl),
                ResolveUrl(style.OuterBorderRightImageUrl),
                ResolveUrl(style.OuterBorderBottomImageUrl),

                ResolveUrl(style.OuterBorderLeftTopCornerImageUrl),
                ResolveUrl(style.OuterBorderLeftBottomCornerImageUrl),
                ResolveUrl(style.OuterBorderRightTopCornerImageUrl),
                ResolveUrl(style.OuterBorderRightBottomCornerImageUrl)
            }) + "'");
        }
Пример #3
0
        private void RenderTextBox(HtmlTextWriter writer, string name, string value, string watermark, params string[] icons)
        {
            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, "2px");
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "relative");
            writer.AddStyleAttribute(HtmlTextWriterStyle.PaddingRight, (16 * icons.Length) + "px");
            AddressTextBoxStyle.AddAttributesToRender(writer);
            writer.RenderBeginTag(HtmlTextWriterTag.Div);

            var textBoxStyle = new BorderedPanelStyle();
            textBoxStyle.Font.MergeWith(AddressTextBoxStyle.Font);
            writer.AddAttribute(HtmlTextWriterAttribute.Id, _fileView.ClientID + name);
            writer.AddAttribute(HtmlTextWriterAttribute.Value, value, true);
            writer.AddStyleAttribute(HtmlTextWriterStyle.BorderWidth, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Padding, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "0");
            writer.AddStyleAttribute(HtmlTextWriterStyle.Width, "100%");
            textBoxStyle.AddAttributesToRender(writer);
            writer.AddStyleAttribute(HtmlTextWriterStyle.Position, "relative");
            writer.AddStyleAttribute(HtmlTextWriterStyle.ZIndex, "2");
            writer.AddStyleAttribute(HtmlTextWriterStyle.BackgroundColor, "transparent");
            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            writer.RenderEndTag();

            for (var i = 0; i < icons.Length; i++)
            {
                var icon = icons[i];
                var i1 = i;
                writer
                    .A(x => x.Id(_fileView.ClientID + name + i1).Width(16).Height(16).Href("javascript:;").Display("none").Position("absolute").Right(16 * i1).Bottom(AddressTextBoxStyle.PaddingBottom))
                        .Img(x => x.Border(0).Src(icon))
                        .EndTag()
                    .EndTag();
            }

            if (!String.IsNullOrEmpty(watermark))
            {
                writer
                    .Span(x => x.Id(_fileView.ClientID + name + "Watermark").Position("absolute").ZIndex(1).Top(AddressTextBoxStyle.PaddingTop).Left(AddressTextBoxStyle.PaddingLeft).Color(AddressTextBoxStyle.BorderColor).Italic().Cursor("text"))
                        .Text(watermark)
                    .EndTag();

            }

            writer.RenderEndTag(); // div

            writer.RenderEndTag(); // td
        }
Пример #4
0
        void RegisterBorderImagesArray(BorderedPanelStyle style, String arrayName)
        {
            Page.ClientScript.RegisterArrayDeclaration(arrayName,
                "'" + String.Join("','", new string[]{
                    ResolveUrl(style.OuterBorderTopImageUrl),
                    ResolveUrl(style.OuterBorderLeftImageUrl),
                    ResolveUrl(style.OuterBorderRightImageUrl),
                    ResolveUrl(style.OuterBorderBottomImageUrl),

                    ResolveUrl(style.OuterBorderLeftTopCornerImageUrl),
                    ResolveUrl(style.OuterBorderLeftBottomCornerImageUrl),
                    ResolveUrl(style.OuterBorderRightTopCornerImageUrl),
                    ResolveUrl(style.OuterBorderRightBottomCornerImageUrl)

                }) + "'");
        }
Пример #5
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            Page.ClientScript.RegisterClientScriptResource(typeof(BorderedPanel), "IZ.WebFileManager.resources.BorderedPanel.js");

            bool isHeader = Page.Header != null;

            if (_hoverSyle != null)
            {
                if (!isHeader)
                    throw new InvalidOperationException("Using BorderedPanel.HoverStyle requires Page.Header to be non-null (e.g. <head runat=\"server\" />).");
                BorderedPanelStyle s = new BorderedPanelStyle();
                s.CopyFrom(_hoverSyle);
                if (ControlStyleCreated)
                    s.MergeWith(ControlStyle);
                Page.Header.StyleSheet.RegisterStyle(s, this);
                _hoverCssClass = s.RegisteredCssClass;
                RegisterBorderImagesArray(s, OuterBorderHoverImagesArrayName);
            }

            if (_pressedSyle != null)
            {
                if (!isHeader)
                    throw new InvalidOperationException("Using BorderedPanel.PressedSyle requires Page.Header to be non-null (e.g. <head runat=\"server\" />).");
                BorderedPanelStyle s = new BorderedPanelStyle();
                s.CopyFrom(_pressedSyle);
                if (_hoverSyle != null)
                    s.MergeWith(_hoverSyle);
                if (ControlStyleCreated)
                    s.MergeWith(ControlStyle);
                Page.Header.StyleSheet.RegisterStyle(s, this);
                _pressedCssClass = s.RegisteredCssClass;
                RegisterBorderImagesArray(s, OuterBorderPressedImagesArrayName);
            }

            if (ControlStyleCreated)
            {
                if (isHeader)
                    Page.Header.StyleSheet.RegisterStyle(ControlStyle, this);
            }
        }
Пример #6
0
        public override void MergeWith(Style s)
        {
            base.MergeWith(s);

            BorderedPanelStyle ps = s as BorderedPanelStyle;

            if (ps == null)
            {
                return;
            }

            if (!CheckStyle(StyleKey.OuterBorderBackColor) && ps.CheckStyle(StyleKey.OuterBorderBackColor))
            {
                OuterBorderBackColor = ps.OuterBorderBackColor;
            }

            if (!CheckStyle(StyleKey.PaddingBottom) && ps.CheckStyle(StyleKey.PaddingBottom))
            {
                PaddingBottom = ps.PaddingBottom;
            }

            if (!CheckStyle(StyleKey.PaddingLeft) && ps.CheckStyle(StyleKey.PaddingLeft))
            {
                PaddingLeft = ps.PaddingLeft;
            }

            if (!CheckStyle(StyleKey.PaddingRight) && ps.CheckStyle(StyleKey.PaddingRight))
            {
                PaddingRight = ps.PaddingRight;
            }

            if (!CheckStyle(StyleKey.PaddingTop) && ps.CheckStyle(StyleKey.PaddingTop))
            {
                PaddingTop = ps.PaddingTop;
            }

            if (!CheckStyle(StyleKey.MarginBottom) && ps.CheckStyle(StyleKey.MarginBottom))
            {
                MarginBottom = ps.MarginBottom;
            }

            if (!CheckStyle(StyleKey.MarginLeft) && ps.CheckStyle(StyleKey.MarginLeft))
            {
                MarginLeft = ps.MarginLeft;
            }

            if (!CheckStyle(StyleKey.MarginRight) && ps.CheckStyle(StyleKey.MarginRight))
            {
                MarginRight = ps.MarginRight;
            }

            if (!CheckStyle(StyleKey.MarginTop) && ps.CheckStyle(StyleKey.MarginTop))
            {
                MarginTop = ps.MarginTop;
            }

            if (!CheckStyle(StyleKey.OuterBorderBottomImageUrl) && ps.CheckStyle(StyleKey.OuterBorderBottomImageUrl))
            {
                OuterBorderBottomImageUrl = ps.OuterBorderBottomImageUrl;
            }

            if (!CheckStyle(StyleKey.OuterBorderBottomWidth) && ps.CheckStyle(StyleKey.OuterBorderBottomWidth))
            {
                OuterBorderBottomWidth = ps.OuterBorderBottomWidth;
            }

            if (!CheckStyle(StyleKey.OuterBorderLeftBottomCornerImageUrl) && ps.CheckStyle(StyleKey.OuterBorderLeftBottomCornerImageUrl))
            {
                OuterBorderLeftBottomCornerImageUrl = ps.OuterBorderLeftBottomCornerImageUrl;
            }

            if (!CheckStyle(StyleKey.OuterBorderLeftImageUrl) && ps.CheckStyle(StyleKey.OuterBorderLeftImageUrl))
            {
                OuterBorderLeftImageUrl = ps.OuterBorderLeftImageUrl;
            }

            if (!CheckStyle(StyleKey.OuterBorderLeftTopCornerImageUrl) && ps.CheckStyle(StyleKey.OuterBorderLeftTopCornerImageUrl))
            {
                OuterBorderLeftTopCornerImageUrl = ps.OuterBorderLeftTopCornerImageUrl;
            }

            if (!CheckStyle(StyleKey.OuterBorderLeftWidth) && ps.CheckStyle(StyleKey.OuterBorderLeftWidth))
            {
                OuterBorderLeftWidth = ps.OuterBorderLeftWidth;
            }

            if (!CheckStyle(StyleKey.OuterBorderRightBottomCornerImageUrl) && ps.CheckStyle(StyleKey.OuterBorderRightBottomCornerImageUrl))
            {
                OuterBorderRightBottomCornerImageUrl = ps.OuterBorderRightBottomCornerImageUrl;
            }

            if (!CheckStyle(StyleKey.OuterBorderRightImageUrl) && ps.CheckStyle(StyleKey.OuterBorderRightImageUrl))
            {
                OuterBorderRightImageUrl = ps.OuterBorderRightImageUrl;
            }

            if (!CheckStyle(StyleKey.OuterBorderRightTopCornerImageUrl) && ps.CheckStyle(StyleKey.OuterBorderRightTopCornerImageUrl))
            {
                OuterBorderRightTopCornerImageUrl = ps.OuterBorderRightTopCornerImageUrl;
            }

            if (!CheckStyle(StyleKey.OuterBorderRightWidth) && ps.CheckStyle(StyleKey.OuterBorderRightWidth))
            {
                OuterBorderRightWidth = ps.OuterBorderRightWidth;
            }

            if (!CheckStyle(StyleKey.OuterBorderStyle) && ps.CheckStyle(StyleKey.OuterBorderStyle))
            {
                OuterBorderStyle = ps.OuterBorderStyle;
            }

            if (!CheckStyle(StyleKey.OuterBorderTopImageUrl) && ps.CheckStyle(StyleKey.OuterBorderTopImageUrl))
            {
                OuterBorderTopImageUrl = ps.OuterBorderTopImageUrl;
            }

            if (!CheckStyle(StyleKey.OuterBorderTopWidth) && ps.CheckStyle(StyleKey.OuterBorderTopWidth))
            {
                OuterBorderTopWidth = ps.OuterBorderTopWidth;
            }
        }