コード例 #1
0
        /// <summary>
        /// Creates an in-line radio button that is part of the group.
        /// </summary>
        public EwfCheckBox CreateInlineRadioButton(
            bool isSelected, string label = "", FormAction action = null, bool autoPostBack = false, PageModificationValue <bool> pageModificationValue = null)
        {
            EwfCheckBox checkBox = null;

            checkBox = new EwfCheckBox(
                formValue,
                label,
                action,
                () =>
                checkBoxesAndSelectionStatesAndPageModificationValues.Where(i => i.Item3 != null)
                .Select(i => i.Item3.GetJsModificationStatements(i.Item1 == checkBox ? "true" : "false")))
            {
                AutoPostBack = autoPostBack
            };
            checkBoxesAndSelectionStatesAndPageModificationValues.Add(
                Tuple.Create <CommonCheckBox, bool, PageModificationValue <bool> >(checkBox, isSelected, pageModificationValue));

            if (pageModificationValue != null)
            {
                formValue.AddPageModificationValue(pageModificationValue, value => value == checkBox);
            }

            return(checkBox);
        }
コード例 #2
0
 /// <summary>
 /// Creates a check box. Do not pass null for label.
 /// </summary>
 public BlockCheckBox(bool isChecked, string label = "", bool highlightWhenChecked = false, PostBack postBack = null)
 {
     checkBoxFormValue         = EwfCheckBox.GetFormValue(isChecked, this);
     this.label                = label;
     this.highlightWhenChecked = highlightWhenChecked;
     this.postBack             = postBack;
     NestedControls            = new List <Control>();
 }
コード例 #3
0
        /// <summary>
        /// Creates an in-line radio button that is part of the group.
        /// </summary>
        public EwfCheckBox CreateInlineRadioButton(bool isSelected, string label = "", PostBack postBack = null, bool autoPostBack = false)
        {
            var checkBox = new EwfCheckBox(formValue, label, postBack)
            {
                AutoPostBack = autoPostBack
            };

            checkBoxesAndSelectionStates.Add(Tuple.Create <CommonCheckBox, bool>(checkBox, isSelected));
            return(checkBox);
        }
コード例 #4
0
        /// <summary>
        /// Creates a check box.
        /// </summary>
        /// <param name="isChecked"></param>
        /// <param name="validationMethod">The validation method. Do not pass null.</param>
        /// <param name="label">Do not pass null.</param>
        /// <param name="setup">The setup object for the check box.</param>
        public BlockCheckBox(bool isChecked, Action <PostBackValue <bool>, Validator> validationMethod, string label = "", BlockCheckBoxSetup setup = null)
        {
            this.setup = setup ?? new BlockCheckBoxSetup();

            checkBoxFormValue = EwfCheckBox.GetFormValue(isChecked, this);

            this.label = label;
            action     = this.setup.Action ?? FormState.Current.DefaultAction;

            validation = checkBoxFormValue.CreateValidation(validationMethod);

            nestedControls = this.setup.NestedControlListGetter != null?this.setup.NestedControlListGetter().ToImmutableArray() : ImmutableArray <Control> .Empty;
        }
コード例 #5
0
 /// <summary>
 /// Creates an in-line radio button that is part of the group.
 /// </summary>
 public EwfCheckBox CreateInlineRadioButton( bool isSelected, string label = "", PostBack postBack = null, bool autoPostBack = false )
 {
     var checkBox = new EwfCheckBox( formValue, label, postBack ) { AutoPostBack = autoPostBack };
     checkBoxesAndSelectionStates.Add( Tuple.Create<CommonCheckBox, bool>( checkBox, isSelected ) );
     return checkBox;
 }
コード例 #6
0
        void ControlTreeDataLoader.LoadData()
        {
            if (postBack != null || AutoPostBack)
            {
                EwfPage.Instance.AddPostBack(postBack ?? EwfPage.Instance.DataUpdatePostBack);
            }

            PreRender += delegate {
                if (highlightWhenChecked && checkBoxFormValue.GetValue(AppRequestState.Instance.EwfPageRequestState.PostBackValues))
                {
                    CssClass = CssClass.ConcatenateWithSpace("checkedChecklistCheckboxDiv");
                }
            };

            var table = TableOps.CreateUnderlyingTable();

            table.CssClass = "ewfBlockCheckBox";

            checkBox   = new WebControl(HtmlTextWriterTag.Input);
            PreRender +=
                delegate {
                EwfCheckBox.AddCheckBoxAttributes(checkBox, this, checkBoxFormValue, radioButtonFormValue, radioButtonListItemId, postBack, AutoPostBack, onClickJsMethods);
            };

            var checkBoxCell = new TableCell().AddControlsReturnThis(checkBox);

            checkBoxCell.Style.Add("width", "13px");

            var row = new TableRow();

            row.Cells.Add(checkBoxCell);

            var labelControl = new HtmlGenericControl("label")
            {
                InnerText = label
            };

            row.Cells.Add(new TableCell().AddControlsReturnThis(labelControl));
            PreRender += (s, e) => labelControl.Attributes.Add("for", checkBox.ClientID);

            table.Rows.Add(row);

            if (NestedControls.Any())
            {
                var nestedControlRow = new TableRow();
                nestedControlRow.Cells.Add(new TableCell());
                nestedControlRow.Cells.Add(new TableCell().AddControlsReturnThis(NestedControls));
                table.Rows.Add(nestedControlRow);

                if (!NestedControlsAlwaysVisible)
                {
                    CheckBoxToControlArrayDisplayLink.AddToPage(this, true, nestedControlRow);
                }
            }

            Controls.Add(table);
            if (ToolTip != null || ToolTipControl != null)
            {
                new ToolTip(ToolTipControl ?? EnterpriseWebFramework.Controls.ToolTip.GetToolTipTextControl(ToolTip), label.Length > 0 ? (Control)labelControl : checkBox);
            }
        }
コード例 #7
0
        void ControlTreeDataLoader.LoadData()
        {
            action.AddToPageIfNecessary();

            PreRender += delegate {
                if (setup.HighlightedWhenChecked && checkBoxFormValue.GetValue(AppRequestState.Instance.EwfPageRequestState.PostBackValues))
                {
                    CssClass = CssClass.ConcatenateWithSpace("checkedChecklistCheckboxDiv");
                }
            };

            var table = TableOps.CreateUnderlyingTable();

            table.CssClass = "ewfBlockCheckBox";

            checkBox   = new WebControl(HtmlTextWriterTag.Input);
            PreRender +=
                delegate {
                EwfCheckBox.AddCheckBoxAttributes(
                    checkBox,
                    this,
                    checkBoxFormValue,
                    radioButtonFormValue,
                    radioButtonListItemId,
                    action,
                    setup.TriggersPostBackWhenCheckedOrUnchecked,
                    jsClickHandlerStatementLists.SelectMany(i => i()));
            };

            var checkBoxCell = new TableCell().AddControlsReturnThis(checkBox);

            checkBoxCell.Style.Add("width", "13px");

            var row = new TableRow();

            row.Cells.Add(checkBoxCell);

            var labelControl = new HtmlGenericControl("label")
            {
                InnerText = label
            };

            row.Cells.Add(new TableCell().AddControlsReturnThis(labelControl));
            PreRender += (s, e) => labelControl.Attributes.Add("for", checkBox.ClientID);

            table.Rows.Add(row);

            if (nestedControls.Any())
            {
                var nestedControlRow = new TableRow();
                nestedControlRow.Cells.Add(new TableCell());
                nestedControlRow.Cells.Add(new TableCell().AddControlsReturnThis(nestedControls));
                table.Rows.Add(nestedControlRow);

                if (!setup.NestedControlsAlwaysVisible)
                {
                    CheckBoxToControlArrayDisplayLink.AddToPage(this, true, nestedControlRow);
                }
            }

            Controls.Add(table);
            if (ToolTip != null || ToolTipControl != null)
            {
                new Controls.ToolTip(
                    ToolTipControl ?? EnterpriseWebFramework.Controls.ToolTip.GetToolTipTextControl(ToolTip),
                    label.Length > 0 ? (Control)labelControl : checkBox);
            }
        }