Ejemplo n.º 1
0
        private WebControl getIconButton()
        {
            var parent = new EwfLabel {
                CssClass = "fa-stack datetimepickerIcon"
            };
            var iconCal  = new FontAwesomeIcon("fa-calendar-o", "fa-stack-2x");
            var iconTime = new FontAwesomeIcon("fa-clock-o", "fa-stack-1x");

            iconTime.Style.Add(HtmlTextWriterStyle.Position, "relative");
            iconTime.Style.Add(HtmlTextWriterStyle.Top, ".20em");
            parent.AddControlsReturnThis(iconCal, iconTime);

            var style = new CustomActionControlStyle(control => control.AddControlsReturnThis(parent));

            return(new CustomButton(() => "$( '#{0}' ).datetimepicker( 'show' )".FormatWith(textBox.TextBoxClientId))
            {
                ActionControlStyle = style,
                CssClass = "icon"
            });
        }
        void ControlTreeDataLoader.LoadData()
        {
            if( postBack != null || AutoPostBack )
                EwfPage.Instance.AddPostBack( postBack ?? EwfPage.Instance.DataUpdatePostBack );

            CssClass = CssElementCreator.CssClass.ConcatenateWithSpace( CssClass );

            checkBox = new WebControl( HtmlTextWriterTag.Input );
            PreRender += delegate {
                AddCheckBoxAttributes( checkBox, this, checkBoxFormValue, radioButtonFormValue, radioButtonListItemId, postBack, AutoPostBack, onClickJsMethods );
                checkBox.Attributes.Add( "class", CssElementCreator.CssClass );
            };
            Controls.Add( checkBox );

            EwfLabel labelControl = null;
            if( label.Any() ) {
                labelControl = new EwfLabel { Text = label, CssClass = CssElementCreator.CssClass };
                Controls.Add( labelControl );
            }

            if( ToolTip != null || ToolTipControl != null )
                new ToolTip( ToolTipControl ?? EnterpriseWebFramework.Controls.ToolTip.GetToolTipTextControl( ToolTip ), label.Any() ? labelControl : checkBox );
        }
        private Control getProcessingDialog()
        {
            /*
             * We switched from an animated GIF to a JavaScript-based spinner due to a number of benefits.
             * First, IE stops animating all GIFs when a request is made, even with the latest version. They do not believe this is a bug.
             * Firefox stops animating GIFs in other situations, such as when we hide the processing dialog when the user wants to attempt
             * the request again.
             * In both of the above situations, there are a number of convoluted hacks that fix the problem in some situations, but not all. One example is
             * enumerating the images in the document in JavaScript and setting the src attribute to the value of the src attribute.
             * The above problems still exist even if you use CSS to display the image, using the background-image style.
             * An alternate situation may be to use a PNG and use CSS3 animations to rotate the image, making it spin. However browser support still
             * isn't solid for CSS3 animations, such as all IE versions before IE10.
             * Another point against images is that you have to prevent dragging and disable selection, to make the interface look more professional.
             * Spin.js also has the benefit of being fully compatible with all browsers across the board.
             */

            // These are used by the EWF JavaScript file.
            const string dialogId = "ewfProcessingDialog";
            const string spinnerId = "ewfSpinner";

            var spinnerParent = new EwfLabel { ClientIDMode = ClientIDMode.Static, ID = spinnerId };
            spinnerParent.Style.Add( HtmlTextWriterStyle.Position, "relative" );
            spinnerParent.Style.Add( HtmlTextWriterStyle.MarginLeft, "25px" );
            spinnerParent.Style.Add( HtmlTextWriterStyle.MarginRight, "40px" );

            return
                new Block(
                    new Paragraph(
                        spinnerParent,
                        Translation.Processing.GetLiteralControl(),
                        getProcessingDialogEllipsisDot( 1 ),
                        getProcessingDialogEllipsisDot( 2 ),
                        getProcessingDialogEllipsisDot( 3 ) ) { CssClass = processingDialogProcessingParagraphClass },
                    new Paragraph(
                        new CustomButton( () => "stopPostBackRequest()" ) { ActionControlStyle = new TextActionControlStyle( Translation.ThisSeemsToBeTakingAWhile ) } )
                        {
                            CssClass = processingDialogTimeOutParagraphClass
                        } ) { ClientIDMode = ClientIDMode.Static, ID = dialogId, CssClass = processingDialogBlockInactiveClass };
        }