public FilterGroupEditor(CollectionVM collection, bool vertical, bool isReadOnly, FilterEditor editorContext) { InitializeComponent(); this.IsPopupMode = editorContext.IsPopupMode; EditorContext = editorContext; _collection = collection; if (collection != null) Elements = collection.AvailableProperties; else Elements = new List<PropertyDefinitionModel>(); SubGroups = new List<FilterGroupEditor>(); _vertical = vertical; this.VerticalAlignment = VerticalAlignment.Center; this.HorizontalAlignment = HorizontalAlignment.Center; if (!_vertical) Orientation = Orientation.Horizontal; else Orientation = Orientation.Vertical; IsReadOnly = false; popupFieldSelect.Opened += (sender, args) => { if (EditorContext != null) EditorContext.EntityFieldsPopups.Add(popupFieldSelect); }; this.IsReadOnly = isReadOnly; }
public FilterAtomEditor(CollectionVM collection, FltAtomExprData filter) { InitializeComponent(); var field = collection.AvailableProperties.FirstOrDefault(p => p.Path == filter.Field); Filter = filter; IsWithEntityIdFilter = false; setField(field); }
public DocumentVM(CollectionVM sourceCollection, DocumentModel model) { SourceCollection = sourceCollection; _isBusy = false; _model = model; _isEditMode = false; Stringified = _model.ToString(); JToken = _model.Json; }
public static IEnumerable<FilterElementDefinition> GetFilterEditorElements(CollectionVM collection) { if (collection != null) { var retList = new List<FilterElementDefinition>(); foreach(var prop in collection.AvailableProperties) { retList.Add(FilterElementDefinition.GetFieldFilterElement(prop)); } return retList; } return new List<FilterElementDefinition>(); }
public FilterElementEditor(CollectionVM collection, FltAtomExprData filter, bool isPopupMode) { this.IsPopupMode = isPopupMode; InitializeComponent(); this.propSelector.SelectedPropertyChanged += PropSelector_SelectedPropertyChanged; Filter = filter; this.propSelector.Properties = collection.AvailableProperties; this.propSelector.SelectedProperty = new PropertyDefinitionModel { Path = filter.Field, Name = filter.Field, Type = filter.PropertyType }; IsWithcollectionIdFilter = false; setField(this.propSelector.SelectedProperty); }
public FilterElementEditor(CollectionVM collection, PropertyDefinitionModel elementDef, bool isPopupMode) { this.IsPopupMode = isPopupMode; InitializeComponent(); this.propSelector.SelectedPropertyChanged += PropSelector_SelectedPropertyChanged; IsWithcollectionIdFilter = false; var field = elementDef; this.propSelector.Properties = collection.AvailableProperties; this.propSelector.SelectedProperty = elementDef; Filter = new FltAtomExprData() { Operator = FilterFieldOperator.Equal, PropertyType = field.Type, Field = field.Path }; setField(field); }
public FilterGroupEditor(CollectionVM collection, bool vertical, bool isReadOnly, FilterEditor editorContext, FilterExpressionData filter) : this(collection, vertical, isReadOnly, editorContext) { SetFilter(filter); }
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) { base.OnPropertyChanged(e); if (e.Property == CollectionProperty && _collection != e.NewValue as CollectionVM) { if (_fePopupControl != null) { _fePopupControl.SetCollection(e.NewValue as CollectionVM); _collection = e.NewValue as CollectionVM; if(this.FilterExpr !=null) _fePopupControl.SetFilter(_collection, FilterExpr); } else { _collection = e.NewValue as CollectionVM; } } else if (e.Property == FilterExprProperty) { if (_fePopupControl != null && this._collection != null) { _fePopupControl.SetFilter(this._collection, e.NewValue as FilterExpressionData); } else { this.FilterExpr = e.NewValue as FilterExpressionData; } if (this.FilterExpr != null && FilterExpr.HasActiveFilter) { this.ActiveBackground = Brushes.Red; } else { this.ActiveBackground = Brushes.Transparent; } } else if (e.Property == UpdateFilterFunctionProperty && this._fePopupControl != null) { this._fePopupControl.UpdateFilterFunction = UpdateFilter; } }
public void SetFilter(CollectionVM collection, FilterExpressionData filter) { _collection = collection; Elements = collection.AvailableProperties; if (filter != null) { var fge = new FilterGroupEditor(collection, false, this.IsReadOnly, this); fge.SetFilter(filter); this.FilterExpr = filter; SetRootGroup(fge); if (filter != null) { gStartPanel.Visibility = Visibility.Collapsed; MyBorder.Visibility = System.Windows.Visibility.Visible; if (!IsReadOnly) spButtons.Visibility = System.Windows.Visibility.Visible; } } else { this.setProperty(PropertyDefinitionModel.GetEmpty()); } }
public void SetCollection(CollectionVM collection) { if (collection != null) { _collection = collection; Elements = collection.AvailableProperties; } Reset(); }