void ri_QueryResultValue(object sender, DevExpress.XtraEditors.Controls.QueryResultValueEventArgs e) { e.Value = dateEdit1.EditValue; DateTime date = Convert.ToDateTime(e.Value); PropertyInfo pi = typeof(FilterControl).GetProperty("FocusInfo", BindingFlags.Instance | BindingFlags.NonPublic); FilterControlFocusInfo focus = (FilterControlFocusInfo)pi.GetValue(filterControl1, null); ClauseNode cnode = focus.Node as ClauseNode; if (cnode == null) { return; } if (cnode.Operation == ClauseType.Between) { if (focus.ElementIndex == 2) { PatchOperator(cnode.AdditionalOperands[1] as OperandValue, date, comboBoxEdit1.Text, true); } else if (focus.ElementIndex == 3) { PatchOperator(cnode.AdditionalOperands[0] as OperandValue, date, comboBoxEdit1.Text, false); } cnode.RecalcLabelInfo(); } }
private void OnOnNotifyControl(FilterChangedEventArgs info) { if (info.Action == FilterChangedAction.RebuildWholeTree && info.CurrentNode == null && !_isUpdating) { _isUpdating = true; BeginUpdate(); RootNode = null; var processor = new XpandCriteriaToTreeProcessor(CreateNodesFactory(), new List <CriteriaOperator>()); var criteriaOperator = ((IXpandFilterControl)Control).Criteria(); var node = (Node)processor.ProcessX(criteriaOperator); if (AllowCreateDefaultClause && node == null) { node = CreateCriteriaByDefaultProperty(); } RootNode = node as GroupNode; if (RootNode == null) { RootNode = CreateGroupNode(null); if (node != null) { RootNode.AddNode(node); } } FocusInfo = new FilterControlFocusInfo(RootNode, 0); EndUpdate(FilterChangedAction.RebuildWholeTree); _isUpdating = false; } }
void AddLabelInfoText(string text, FilterControlFocusInfo focusInfo, Color activeColor, ElementType type, bool active) { if (active) { LabelInfoText info = Texts.Add(text, activeColor, true); info.Tag = new NodeElement(focusInfo, type); } else { Texts.Add(text, activeColor, active); } }
public static void OnClauseClick(this IXpandFilterControl filterControl, object sender, EventArgs e) { var filterControlFocusInfo = filterControl.FocusInfo; var node = (ClauseNode)filterControlFocusInfo.Node; node.Operation = (ClauseType)((DXMenuItem)sender).Tag; filterControl.RefreshTreeAfterNodeChange(); filterControl.RaiseFilterChanged(new FilterChangedEventArgs(FilterChangedAction.OperationChanged, node)); FilterControlFocusInfo fi = filterControlFocusInfo.OnRight(); if (fi.Node == filterControlFocusInfo.Node) { filterControl.FocusInfo = fi; } }
protected override void ChangeElement(NodeEditableElement element, object value) { if (element.ElementType == ElementType.Operation && !Enum.IsDefined(typeof(ClauseType), value)) { Model.BeginUpdate(); Operation = (ClauseType)value; var clauseType = (int)value; if (clauseType == ClauseTypeEnumHelper.FullText) { FilterControlHelpers.ForceAdditionalParamsCount(AdditionalOperands, 1); } Model.EndUpdate(FilterChangedAction.OperationChanged, this); FilterControlFocusInfo fi = FocusInfo.OnRight(); if (fi.Node == FocusInfo.Node) { FocusInfo = fi; } } else { base.ChangeElement(element, value); } }
public NodeElement(FilterControlFocusInfo focusInfo, ElementType type) { this.focusInfo = focusInfo; this.type = type; }
void AddAdditionalOperands(ClauseNode node) { List <CriteriaOperator> list = node.AdditionalOperands; ClauseNode cNode = node as ClauseNode; bool collection = IsCollectionClause(cNode.Operation); bool twoFields = IsTwoFieldsClause(cNode.Operation); if (list.Count > 1 && collection) { AddLabelInfoText("(", new FilterControlFocusInfo(node, 2), Owner.OwnerControl.FilterViewInfo.PaintAppearance.ForeColor, ElementType.None, false); } for (int i = 0; i < list.Count; i++) { CriteriaOperator op = list[i]; FilterControlFocusInfo fi = new FilterControlFocusInfo(node, i + 2); string text = StringAdaptation(GetDisplayText(node.FirstOperand, op)); if (text == null || text.Length == 0) { text = "''"; } Color color; ElementType elementType; if (op is OperandProperty) { color = Owner.OwnerControl.AppearanceFieldNameColor; elementType = ElementType.Property; } else { color = Owner.OwnerControl.AppearanceValueColor; elementType = ElementType.Value; if (op.ToString() == "?") { text = ("<请输入值>"); color = Owner.OwnerControl.AppearanceEmptyValueColor; } } AddLabelInfoText(text, fi, color, elementType, true); if (node.ShowOperandTypeIcon) { AddLabelInfoText("@#", fi, Color.Empty, ElementType.FieldAction, true); } if (i < list.Count - 1 && collection) { AddLabelInfoText(", ", new FilterControlFocusInfo(node, 1), Owner.OwnerControl.FilterViewInfo.PaintAppearance.ForeColor, ElementType.None, false); } if (i < list.Count - 1 && twoFields) { AddLabelInfoText(" " + "到" + " ", new FilterControlFocusInfo(node, 1), Owner.OwnerControl.AppearanceOperatorColor, ElementType.None, false); //AddLabelInfoText(" " + Localizer.Active.GetLocalizedString(StringId.FilterClauseBetweenAnd) + " ", new FilterControlFocusInfo(node, 1), Owner.OwnerControl.AppearanceOperatorColor, ElementType.None, false); } } if (collection) { if (list.Count > 1) { AddLabelInfoText(")", new FilterControlFocusInfo(node, list.Count + 1), Owner.OwnerControl.FilterViewInfo.PaintAppearance.ForeColor, ElementType.None, false); } AddLabelInfoText("@+", new FilterControlFocusInfo(node, 0), Color.Empty, ElementType.CollectionAction, true); } }
private void OnOnNotifyControl(FilterChangedEventArgs info){ if (info.Action == FilterChangedAction.RebuildWholeTree && info.CurrentNode == null&&!_isUpdating){ var criteriaOperator = ((IXpandFilterControl)Control).Criteria(); if (criteriaOperator!=null){ _isUpdating = true; BeginUpdate(); RootNode = null; var processor = new XpandCriteriaToTreeProcessor(CreateNodesFactory(), new List<CriteriaOperator>()); var node = (Node) processor.ProcessX(criteriaOperator); if (AllowCreateDefaultClause && node == null){ node = CreateCriteriaByDefaultProperty(); } RootNode = node as GroupNode; if (RootNode == null){ RootNode = CreateGroupNode(null); if (node != null){ RootNode.AddNode(node); } } FocusInfo = new FilterControlFocusInfo(RootNode, 0); EndUpdate(FilterChangedAction.RebuildWholeTree); _isUpdating = false; } } }