Ejemplo n.º 1
0
        protected virtual void EditFilterDescriptor(RadFilterComposeMenuItem menuItem)
        {
            RadFilterComposeMenuItem filterComposeMenuItem = menuItem;

            this.clickedBetweenItem = false;
            if (menuItem.Text == LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("FilterFunctionsBetween") || menuItem.Text == LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("FilterFunctionNotBetween"))
            {
                this.clickedBetweenItem = true;
            }
            string themeName = this.ThemeName;

            using (BaseCompositeFilterDialog compositeFilterForm = this.CreateCompositeFilterForm())
            {
                compositeFilterForm.Initialize(this.dataColumn, filterComposeMenuItem.FilterDescriptor, true);
                compositeFilterForm.ThemeName = themeName;
                if (compositeFilterForm.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                FilterDescriptor filterDescriptor = compositeFilterForm.FilterDescriptor;
                if (!GridFilterCellElement.ValidateUserFilter(filterDescriptor))
                {
                    return;
                }
                this.filterDescriptor = filterDescriptor;
                this.OnFilterConfirmed();
            }
        }
Ejemplo n.º 2
0
        private float GetFilterCellDesiredWidth(GridFilterCellElement filterCell, float contentWidth)
        {
            float  num             = 0.0f;
            string localizedString = LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("FilterFunctionNoFilter");

            if (filterCell.FilterOperatorText != null && filterCell.FilterOperatorText.Text != localizedString)
            {
                SizeF      availableSize = new SizeF(float.MaxValue, float.MaxValue);
                TextParams textParams    = filterCell.FilterOperatorText.TextParams;
                num = filterCell.FilterOperatorText.Impl.MeasureOverride(availableSize, textParams).Width;
            }
            float width = filterCell.FilterButton.DesiredSize.Width;

            return(contentWidth + num + width);
        }
Ejemplo n.º 3
0
        protected override bool OnMouseDownLeft(MouseEventArgs e)
        {
            GridFilterCellElement cellAtPoint = this.GetCellAtPoint(e.Location) as GridFilterCellElement;

            if (cellAtPoint == null || !cellAtPoint.FilterButton.ControlBoundingRectangle.Contains(e.Location))
            {
                return(base.OnMouseDownLeft(e));
            }
            if (cellAtPoint.Children.Count > 2 && cellAtPoint.Children[2] is RadCheckBoxEditorElement && cellAtPoint.Children[2].ControlBoundingRectangle.Contains(e.Location))
            {
                return(base.OnMouseDownLeft(e));
            }
            this.GridViewElement.EditorManager.CloseEditor();
            return(false);
        }
Ejemplo n.º 4
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);
            if (this.DialogResult != DialogResult.OK)
            {
                return;
            }
            this.UpdateValues();
            RadGridLocalizationProvider currentProvider = LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider;

            if (GridFilterCellElement.ValidateUserFilter(this.FilterDescriptor))
            {
                return;
            }
            e.Cancel = true;
            string themeName = RadMessageBox.Instance.ThemeName;

            RadMessageBox.SetThemeName(this.ThemeName);
            RadMessageBox.Instance.RightToLeft = this.RightToLeft;
            int num = (int)RadMessageBox.Show(currentProvider.GetLocalizedString("CompositeFilterFormInvalidFilter"), currentProvider.GetLocalizedString("CompositeFilterFormErrorCaption"), MessageBoxButtons.OK, RadMessageIcon.Error);

            RadMessageBox.SetThemeName(themeName);
        }
Ejemplo n.º 5
0
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);
            if (this.DialogResult == DialogResult.OK)
            {
                Exception exception = this.UpdateValues();
                RadGridLocalizationProvider currentProvider = LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider;
                if (exception != null)
                {
                    e.Cancel = true;
                    string themeName = RadMessageBox.Instance.ThemeName;
                    RadMessageBox.SetThemeName(this.ThemeName);
                    int num = (int)RadMessageBox.Show(exception.Message, currentProvider.GetLocalizedString("CompositeFilterFormErrorCaption"), MessageBoxButtons.OK, RadMessageIcon.Error);
                    RadMessageBox.SetThemeName(themeName);
                }
                if (!GridFilterCellElement.ValidateUserFilter(this.GetFilterDescriptor(this.compositeFilterDescriptor.Clone() as CompositeFilterDescriptor)))
                {
                    e.Cancel = true;
                    string themeName = RadMessageBox.Instance.ThemeName;
                    RadMessageBox.SetThemeName(this.ThemeName);
                    int num = (int)RadMessageBox.Show(currentProvider.GetLocalizedString("CompositeFilterFormInvalidFilter"), currentProvider.GetLocalizedString("CompositeFilterFormErrorCaption"), MessageBoxButtons.OK, RadMessageIcon.Error);
                    RadMessageBox.SetThemeName(themeName);
                }
            }
            RadCheckBox rightEditor = this.rightEditor as RadCheckBox;
            RadCheckBox leftEditor  = this.leftEditor as RadCheckBox;

            if (rightEditor != null)
            {
                rightEditor.ToggleStateChanged -= new StateChangedEventHandler(this.CheckBoxEditor_ToggleStateChanged);
            }
            if (leftEditor == null)
            {
                return;
            }
            leftEditor.ToggleStateChanged -= new StateChangedEventHandler(this.CheckBoxEditor_ToggleStateChanged);
        }
Ejemplo n.º 6
0
        public static bool ValidateUserFilter(FilterDescriptor descriptor)
        {
            if (descriptor == null)
            {
                return(true);
            }
            CompositeFilterDescriptor filterDescriptor1 = descriptor as CompositeFilterDescriptor;

            if (filterDescriptor1 == null)
            {
                return(descriptor.Value != null);
            }
            if (filterDescriptor1.FilterDescriptors.Count == 1 && filterDescriptor1.NotOperator)
            {
                return(filterDescriptor1.FilterDescriptors[0].Value != null);
            }
            bool flag = true;

            foreach (FilterDescriptor filterDescriptor2 in (Collection <FilterDescriptor>)filterDescriptor1.FilterDescriptors)
            {
                CompositeFilterDescriptor filterDescriptor3 = filterDescriptor2 as CompositeFilterDescriptor;
                if (filterDescriptor3 != null)
                {
                    if (!GridFilterCellElement.ValidateUserFilter((FilterDescriptor)filterDescriptor3))
                    {
                        flag = false;
                        break;
                    }
                }
                else if (!GridFilterCellElement.ValidateFilterDescriptor(filterDescriptor2))
                {
                    flag = false;
                    break;
                }
            }
            return(flag);
        }
Ejemplo n.º 7
0
 protected virtual bool ValidateUserFilter(FilterDescriptor descriptor)
 {
     return(GridFilterCellElement.ValidateUserFilter(descriptor));
 }