SetAtomFilter() public method

public SetAtomFilter ( FilterElementEditor fa ) : void
fa FilterElementEditor
return void
        private void setProperty(PropertyDefinitionModel selectedProperty)
        {
            gStartPanel.Visibility = Visibility.Collapsed;
            MyBorder.Visibility    = System.Windows.Visibility.Visible;
            spButtons.Visibility   = System.Windows.Visibility.Visible;
            var fge = new FilterGroupEditor(_collection, false, this.IsReadOnly, this);
            var fae = new FilterElementEditor(_collection, selectedProperty, this.IsPopupMode)
            {
                Margin = new Thickness(0, 0, 0, 0), IsReadOnly = this.IsReadOnly
            };

            fae.EditorContext = this;
            fge.SetAtomFilter(fae);
            this.FilterExpr = fge.Filter;
            SetRootGroup(fge);
        }
Example #2
0
        private void setProperty(PropertyDefinitionModel selectedField)
        {
            var fae = new FilterElementEditor(_collection, selectedField, this.IsPopupMode)
            {
                Margin = new Thickness(0, 0, 0, 0), IsReadOnly = this.IsReadOnly
            };

            fae.EditorContext = this.EditorContext;
            var fge = new FilterGroupEditor(_collection, !_vertical, IsReadOnly, EditorContext)
            {
                Background = Brushes.White
            };

            fge.SetAtomFilter(fae);
            AddGroupSubFilter(fge);
            popupFieldSelect.IsOpen = false;
        }
 private void setProperty(PropertyDefinitionModel selectedField)
 {
     var fae = new FilterElementEditor(_collection, selectedField, this.IsPopupMode) { Margin = new Thickness(0, 0, 0, 0), IsReadOnly = this.IsReadOnly };
     fae.EditorContext = this.EditorContext;
     var fge = new FilterGroupEditor(_collection, !_vertical, IsReadOnly, EditorContext)
     { Background = Brushes.White };
     fge.SetAtomFilter(fae);
     AddGroupSubFilter(fge);
     popupFieldSelect.IsOpen = false;
 }
        private void addGroupSubFilter(FilterGroupEditor fge, bool fromRemove)
        {
            fge.Parent = this;
            FltGroupExprData fgeExpr = null;
            if (this.Filter is FltGroupExprData)
                fgeExpr = this.Filter as FltGroupExprData;
            else
            {
                if (JoinType.HasValue)
                {
                    fgeExpr = new FltGroupExprData(JoinType.Value);
                }
                else
                {
                    fgeExpr = new FltGroupExprData();
                }
                if (Parent != null && Parent.Filter != null)
                {
                    var parentGroup = Parent.Filter as FltGroupExprData;
                    parentGroup.FilterExpressions.Remove(this.Filter);
                    parentGroup.FilterExpressions.Add(fgeExpr);
                }
                this.Filter = fgeExpr;
            }
            fgeExpr.FilterExpressions.Add(fge.Filter);

            if (this.SubGroups.Count > 0 || this.AtomFilter != null )
            {
                bAdd.Visibility = Visibility.Visible;
                bAnd.Visibility = Visibility.Collapsed;
                bOr.Visibility = Visibility.Collapsed;
            }
            else
            {
                SetBackground(fge.MyBackgroundIndex + FilterEditor.BackgroundIndexStep);
                bAdd.Visibility = Visibility.Collapsed;
                bAnd.Visibility = Visibility.Visible;
                bOr.Visibility = Visibility.Visible;
            }

            if (JoinType.HasValue)
            {
                if (JoinType.Value == eAndOrJoin.And)
                {
                    miChangeToOr.Visibility = System.Windows.Visibility.Visible;
                    miChangeToAnd.Visibility = System.Windows.Visibility.Collapsed;
                }
                else
                {
                    miChangeToOr.Visibility = System.Windows.Visibility.Collapsed;
                    miChangeToAnd.Visibility = System.Windows.Visibility.Visible;
                }
            }
            else
            {
                miChangeToOr.Visibility = System.Windows.Visibility.Collapsed;
                miChangeToAnd.Visibility = System.Windows.Visibility.Collapsed;
            }

            if (!fromRemove && ( AddedFirstElement != null && this.Parent == null))
            {
                this.AddedFirstElement(this, null);
            }

            if (AtomFilter!=null) //replacing existing atomfilter with groupfilter containing the atomfilter
            {
                var newFge = new FilterGroupEditor(_collection, !_vertical, this.IsReadOnly, EditorContext, AtomFilter.Filter);
                fgeExpr.FilterExpressions.Add(AtomFilter.Filter);
                newFge.Parent = this;
                ccAtom.Content = null;
                newFge.SetAtomFilter(AtomFilter);
                AtomFilter = null;
                this.Negate(false);
                spSubGroups.Children.Add(newFge);
                SubGroups.Add(newFge);
            }

            if (SubGroups.Count>0 && JoinType.HasValue)
            {
                var andOrLabel = new Label()
                                     {
                                         Content = (JoinType.Value == eAndOrJoin.And) ? "And": "Or",
                                         VerticalAlignment = VerticalAlignment.Center,
                                         HorizontalAlignment = HorizontalAlignment.Center
                                     };
                spSubGroups.Children.Add(andOrLabel);
                fge.JoinLabelOnParent = andOrLabel;
                fgeExpr.AndOr = JoinType.Value;
            }
            SubGroups.Add(fge);
            spSubGroups.Children.Add(fge);
            if (fge.AtomFilter != null)
                fge.AtomFilter.FocusControl();
        }
 private void setProperty(PropertyDefinitionModel selectedProperty)
 {
     gStartPanel.Visibility = Visibility.Collapsed;
     MyBorder.Visibility = System.Windows.Visibility.Visible;
     spButtons.Visibility = System.Windows.Visibility.Visible;
     var fge = new FilterGroupEditor(_collection, false, this.IsReadOnly, this);
     var fae = new FilterElementEditor(_collection, selectedProperty, this.IsPopupMode) { Margin = new Thickness(0, 0, 0, 0), IsReadOnly = this.IsReadOnly};
     fae.EditorContext = this;
     fge.SetAtomFilter(fae);
     this.FilterExpr = fge.Filter;
     SetRootGroup(fge);
 }
Example #6
0
        private void addGroupSubFilter(FilterGroupEditor fge, bool fromRemove)
        {
            fge.Parent = this;
            FltGroupExprData fgeExpr = null;

            if (this.Filter is FltGroupExprData)
            {
                fgeExpr = this.Filter as FltGroupExprData;
            }
            else
            {
                if (JoinType.HasValue)
                {
                    fgeExpr = new FltGroupExprData(JoinType.Value);
                }
                else
                {
                    fgeExpr = new FltGroupExprData();
                }
                if (Parent != null && Parent.Filter != null)
                {
                    var parentGroup = Parent.Filter as FltGroupExprData;
                    parentGroup.FilterExpressions.Remove(this.Filter);
                    parentGroup.FilterExpressions.Add(fgeExpr);
                }
                this.Filter = fgeExpr;
            }
            fgeExpr.FilterExpressions.Add(fge.Filter);



            if (this.SubGroups.Count > 0 || this.AtomFilter != null)
            {
                bAdd.Visibility = Visibility.Visible;
                bAnd.Visibility = Visibility.Collapsed;
                bOr.Visibility  = Visibility.Collapsed;
            }
            else
            {
                SetBackground(fge.MyBackgroundIndex + FilterEditor.BackgroundIndexStep);
                bAdd.Visibility = Visibility.Collapsed;
                bAnd.Visibility = Visibility.Visible;
                bOr.Visibility  = Visibility.Visible;
            }

            if (JoinType.HasValue)
            {
                if (JoinType.Value == eAndOrJoin.And)
                {
                    miChangeToOr.Visibility  = System.Windows.Visibility.Visible;
                    miChangeToAnd.Visibility = System.Windows.Visibility.Collapsed;
                }
                else
                {
                    miChangeToOr.Visibility  = System.Windows.Visibility.Collapsed;
                    miChangeToAnd.Visibility = System.Windows.Visibility.Visible;
                }
            }
            else
            {
                miChangeToOr.Visibility  = System.Windows.Visibility.Collapsed;
                miChangeToAnd.Visibility = System.Windows.Visibility.Collapsed;
            }

            if (!fromRemove && (AddedFirstElement != null && this.Parent == null))
            {
                this.AddedFirstElement(this, null);
            }

            if (AtomFilter != null) //replacing existing atomfilter with groupfilter containing the atomfilter
            {
                var newFge = new FilterGroupEditor(_collection, !_vertical, this.IsReadOnly, EditorContext, AtomFilter.Filter);
                fgeExpr.FilterExpressions.Add(AtomFilter.Filter);
                newFge.Parent  = this;
                ccAtom.Content = null;
                newFge.SetAtomFilter(AtomFilter);
                AtomFilter = null;
                this.Negate(false);
                spSubGroups.Children.Add(newFge);
                SubGroups.Add(newFge);
            }

            if (SubGroups.Count > 0 && JoinType.HasValue)
            {
                var andOrLabel = new Label()
                {
                    Content             = (JoinType.Value == eAndOrJoin.And) ? "And": "Or",
                    VerticalAlignment   = VerticalAlignment.Center,
                    HorizontalAlignment = HorizontalAlignment.Center
                };
                spSubGroups.Children.Add(andOrLabel);
                fge.JoinLabelOnParent = andOrLabel;
                fgeExpr.AndOr         = JoinType.Value;
            }
            SubGroups.Add(fge);
            spSubGroups.Children.Add(fge);
            if (fge.AtomFilter != null)
            {
                fge.AtomFilter.FocusControl();
            }
        }