/// <summary> /// Adds a ComboBox filter that displays only rows whose boolean value /// matches the true/false or null value in the ComboBox. The column (propertyName) of data must /// have "true" or "false" as its values (boolean database fields are /// usually converted to true/false string values by the Habanero /// object manager). /// </summary> /// <param name="labelText">The label to appear before the control</param> /// <param name="propertyName">The business object property on which to filter</param> /// <param name="defaultValue">Whether the CheckBox is checked</param> /// <returns>Returns the new CheckBox added</returns> public IComboBox AddBooleanFilterComboBox(string labelText, string propertyName, bool? defaultValue) { ICustomFilter filter = _filterControlManager.AddBooleanFilterComboBox(labelText, propertyName, defaultValue); filter.ValueChanged += (sender, e) => { if (this.FilterMode == FilterModes.Filter) FireFilterEvent(); }; return (IComboBox)filter.Control; }
/// <summary> /// Adds a TextBox filter in which users can specify text that /// a string-value column will be filtered on. /// </summary> /// <param name="labelText">The label to appear before the control</param> /// <param name="propertyName">The business object property on which to filter</param> /// <param name="filterClauseOperator">The operator to use for the filter clause</param> /// <returns>Returns the new TextBox added</returns> public ITextBox AddStringFilterTextBox(string labelText, string propertyName, FilterClauseOperator filterClauseOperator) { ICustomFilter filter = _filterControlManager.AddStringFilterTextBox(labelText, propertyName, filterClauseOperator); filter.ValueChanged += (sender, e) => { if (this.FilterMode == FilterModes.Filter) FireFilterEvent(); }; return (ITextBox)filter.Control; }
public AssignmentBatchAlterModel(DateTime watchPoint, ITimeBoxRepository timeBoxRepository, ITermStyleRepository termStyleRepository) : base(watchPoint, timeBoxRepository, termStyleRepository) { _title = LanguageReader.GetValue("BatchAlterExistsOfAssignemnt"); _filters = new ICustomFilter[] { new CustomFilter("EqAssignmentType", this, (t) => { return(t.Start.Date == SearchDate.Date && t.Text.Equals(QueryType.Text)); }), new CustomFilter("EqTermStart", this, (t) => { return(t.Start == SearchDate); }), new CustomFilter("EqTermEnd", this, (t) => { return(t.End == SearchDate); }), new CustomFilter("Any", this, (t) => { return(t.Start.Date == SearchDate.Date); }) }; }
public EventBatchAlterModel(DateTime watchPoint, ITimeBoxRepository timeBoxRepository, ITermStyleRepository termStyleRepository) : base(watchPoint, timeBoxRepository, termStyleRepository) { _title = LanguageReader.GetValue("BatchAlterExistsOfSubEvent"); OptionalFilters = new ICustomFilter[] { new CustomFilter("EqEventType", this,(t)=> { return t.Text.Equals(QueryType.Text); }), new CustomFilter("EqParentType", this,(t)=> { var bottomStyle = t.GetBottomStyle(); if(bottomStyle == null) return false; return bottomStyle.Equals(QueryParentType.Text); }) }; _filters = new ICustomFilter[] { new CustomFilter("InTermRange", this,(t)=> { return t.IsInTheRange(SearchDate, End); }), new CustomFilter("EqTermStart", this ,(t)=> t.Start == SearchDate), new CustomFilter("EqTermEnd", this, (t)=> t.End == SearchDate) }; End = _searchDate.Date.AddDays(1).AddMinutes(-5); }
/// <summary> /// Adds a TextBox filter in which users can specify text that /// a string-value column will be filtered on. /// </summary> /// <param name="labelText">The label to appear before the control</param> /// <param name="propertyName">The business object property on which to filter</param> /// <param name="filterClauseOperator">The operator to use for the filter clause</param> /// <returns>Returns the new TextBox added</returns> public ITextBox AddStringFilterTextBox(string labelText, string propertyName, FilterClauseOperator filterClauseOperator) { ICustomFilter filter = _filterControlManager.AddStringFilterTextBox(labelText, propertyName, filterClauseOperator); return((ITextBox)filter.Control); }
public AssignmentBatchAlterModel(DateTime watchPoint, ITimeBoxRepository timeBoxRepository, ITermStyleRepository termStyleRepository) : base(watchPoint, timeBoxRepository, termStyleRepository) { _title = LanguageReader.GetValue("BatchAlterExistsOfAssignemnt"); _filters = new ICustomFilter[] { new CustomFilter("EqAssignmentType", this, (t)=> { return t.Start.Date == SearchDate.Date && t.Text.Equals(QueryType.Text); }), new CustomFilter("EqTermStart",this ,(t)=> { return t.Start == SearchDate; }), new CustomFilter("EqTermEnd", this ,(t)=> { return t.End == SearchDate; }), new CustomFilter("Any", this, (t)=> { return t.Start.Date == SearchDate.Date; }) }; }
/// <summary> /// Report to service if comment is really spam /// </summary> /// <param name="comment">Comment object</param> public static void ReportMistake(Comment comment) { string m = comment.ModeratedBy; DataTable dt = _customFilters.GetDataTable(); int i = 0; foreach (DataRow row in dt.Rows) { string fileterName = row[0].ToString(); if (fileterName == m) { ICustomFilter customFilter = GetCustomFilter(fileterName); if (customFilter != null) { int mistakes = int.Parse(_customFilters.Parameters[4].Values[i]); _customFilters.Parameters[4].Values[i] = (mistakes + 1).ToString(); customFilter.Report(comment); } break; } i++; } ExtensionManager.SaveSettings("MetaExtension", _customFilters); }
static void RunCustomModerators(Comment comment) { DataTable dt = _customFilters.GetDataTable(); dt.DefaultView.Sort = "Priority"; foreach (DataRowView row in dt.DefaultView) { string fileterName = row[0].ToString(); ICustomFilter customFilter = GetCustomFilter(fileterName); if (customFilter != null && customFilter.Initialize()) { comment.IsApproved = !customFilter.Check(comment); comment.ModeratedBy = fileterName; Utils.Log(string.Format("Custom filter [{0}] - setting approved to {1}", fileterName, comment.IsApproved)); UpdateCustomFilter(fileterName, comment.IsApproved); // the custom filter tells no further // validation needed. don't call others if (!customFilter.FallThrough) { break; } } } }
/// <summary> /// 注册自定义过滤器 /// </summary> /// <param name="customFilter"></param> public void Register(ICustomFilter customFilter) { if (customFilters.IndexOf(customFilter) < 0) { customFilters.Add(customFilter); } }
///<summary> /// Adds a Filter Combo box for filtering an enum data type. ///</summary> /// <param name="labelText">The label to appear before the control</param> /// <param name="propertyName">The business object property on which to filter</param> ///<param name="enumType">The Type being showen in the ComboBox</param> ///<returns></returns> public IComboBox AddEnumFilterComboBox(string labelText, string propertyName, Type enumType) { ICustomFilter filter = _filterControlManager.AddEnumFilterComboBox(labelText, propertyName, enumType); //filter.ValueChanged += (sender, e) => { if (this.FilterMode == FilterModes.Filter) FireFilterEvent(); }; return((IComboBox)filter.Control); }
/// <summary> /// Adds a TextBox filter in which users can specify text that /// a string-value column will be filtered on. This uses a "like" /// operator and accepts any strings that contain the provided clause. /// </summary> /// <param name="labelText">The label to appear before the control</param> /// <param name="propertyName">The business object property on which to filter</param> /// <returns>Returns the new TextBox added</returns> public ITextBox AddStringFilterTextBox(string labelText, string propertyName) { //ITextBox textBox = _filterControlManager.AddStringFilterTextBox(labelText, propertyName); //return textBox; ICustomFilter filter = _filterControlManager.AddStringFilterTextBox(labelText, propertyName); return((ITextBox)filter.Control); }
/// <summary> /// Adds a ComboBox filter control /// </summary> /// <param name="labelText">The label to appear before the control</param> /// <param name="propertyName">The business object property on which to filter</param> /// <param name="options">The collection of items used to fill the combo box.</param> /// <param name="strictMatch">Whether to filter the DataGridView column on a strict match or using a LIKE operator</param> /// <returns>Returns the new ComboBox added</returns> public IComboBox AddStringFilterComboBox(string labelText, string propertyName, ICollection options, bool strictMatch) { ICustomFilter filter = _filterControlManager.AddStringFilterComboBox(labelText, propertyName, options, strictMatch); IComboBox comboBox = (IComboBox)filter.Control; comboBox.Height = new TextBox().Height; return(comboBox); }
///<summary> /// Builds a custom filter. ///</summary> ///<param name="filterPropertyDef"></param> ///<returns></returns> public ICustomFilter BuildCustomFilter(IFilterPropertyDef filterPropertyDef) { Type filterType = TypeLoader.LoadType(filterPropertyDef.FilterTypeAssembly, filterPropertyDef.FilterType); ICustomFilter customFilter = (ICustomFilter)Activator.CreateInstance(filterType, _controlFactory, filterPropertyDef.PropertyName, filterPropertyDef.FilterClauseOperator); SetParametersOnFilter(filterPropertyDef, filterType, customFilter); return(customFilter); }
/// <summary> /// Adds a date-time picker that filters a date column on the date /// chosen by the user. The given operator compares the chosen date /// with the date shown in the given column name. /// </summary> /// <param name="labelText">The label to appear before the control</param> /// <param name="propertyName">The business object property on which to filter</param> /// <param name="defaultValue">The default date or null</param> /// <param name="filterClauseOperator">The operator used to compare /// with the date chosen by the user. The chosen date is on the /// right side of the equation.</param> /// <param name="nullable">Whether the datetime picker allows null values</param> /// <returns>Returns the new DateTimePicker added</returns> public IDateTimePicker AddDateFilterDateTimePicker(string labelText, string propertyName, DateTime? defaultValue, FilterClauseOperator filterClauseOperator, bool nullable) { ICustomFilter filter = _filterControlManager.AddDateFilterDateTimePicker(labelText, propertyName, filterClauseOperator, defaultValue); filter.ValueChanged += delegate { if (this.FilterMode == FilterModes.Filter) FireFilterEvent(); }; return (IDateTimePicker)filter.Control; }
/// <summary> /// Adds a DateRangeComboBox filter which provides common date ranges such as "Today" or "This Year", /// so that the grid will only show rows having a date property in the given range /// </summary> /// <param name="labelText">The label to appear before the control</param> /// <param name="columnName">The business object property on which to filter</param> /// <param name="options">Provides a specific set of date range options to show</param> /// <param name="includeStartDate">Includes all dates that match the start date exactly</param> /// <param name="includeEndDate">Includes all dates that match the end date exactly</param> /// <returns>Returns the new DateRangeComboBox added</returns> public IDateRangeComboBox AddDateRangeFilterComboBox(string labelText, string columnName, List<DateRangeOptions> options, bool includeStartDate, bool includeEndDate) { ICustomFilter filter = _filterControlManager.AddDateRangeFilterComboBox(labelText, columnName, options, includeStartDate, includeEndDate); filter.ValueChanged += delegate { if (this.FilterMode == FilterModes.Filter) FireFilterEvent(); }; return (IDateRangeComboBox)filter.Control; }
/// <summary> /// Adds a date-time picker that filters a date column on the date /// chosen by the user. The given operator compares the chosen date /// with the date shown in the given column name. /// </summary> /// <param name="labelText">The label to appear before the control</param> /// <param name="propertyName">The business object property on which to filter</param> /// <param name="defaultValue">The default date or null</param> /// <param name="filterClauseOperator">The operator used to compare /// with the date chosen by the user. The chosen date is on the /// right side of the equation.</param> /// <param name="nullable">Whether the datetime picker allows null values</param> /// <returns>Returns the new DateTimePicker added</returns> public IDateTimePicker AddDateFilterDateTimePicker(string labelText, string propertyName, DateTime?defaultValue, FilterClauseOperator filterClauseOperator, bool nullable) { //IDateTimePicker dtPicker = // _filterControlManager.AddDateFilterDateTimePicker(labelText, propertyName, filterClauseOperator, nullable, // defaultValue); ICustomFilter customFilter = _filterControlManager.AddDateFilterDateTimePicker(labelText, propertyName, filterClauseOperator, defaultValue); return((IDateTimePicker)customFilter.Control); }
/// <summary> /// Adds a ComboBox filter control /// </summary> /// <param name="labelText">The label to appear before the control</param> /// <param name="propertyName">The business object property on which to filter</param> /// <param name="options">The collection of items used to fill the combo box.</param> /// <param name="strictMatch">Whether to filter the DataGridView column on a strict match or using a LIKE operator</param> /// <returns>Returns the new ComboBox added</returns> public IComboBox AddStringFilterComboBox(string labelText, string propertyName, ICollection options, bool strictMatch) { ICustomFilter filter = _filterControlManager.AddStringFilterComboBox(labelText, propertyName, options, strictMatch); filter.ValueChanged += (sender, e) => { if (this.FilterMode == FilterModes.Filter) FireFilterEvent(); }; var cmb = filter.Control as ComboBox; cmb.DropDownStyle = ComboBoxStyle.DropDownList; //comboBox.TextChanged += delegate { if (this.FilterMode == FilterModes.Filter) FireFilterEvent(); }; //comboBox.SelectedIndexChanged += delegate { if (this.FilterMode == FilterModes.Filter) FireFilterEvent(); }; return (IComboBox) filter.Control; }
public void Test_BuildCustomFilter_CustomAssembly() { //---------------Set up test pack------------------- FilterControlBuilder builder = new FilterControlBuilder(GetControlFactory()); FilterPropertyDef filterPropertyDef1 = CreateFilterPropertyDefWithType ("Habanero.Faces.Test.Base.FilterController.SimpleFilterStub", "Habanero.Faces.Test.Base"); //---------------Execute Test ---------------------- ICustomFilter customFilter = builder.BuildCustomFilter(filterPropertyDef1); //---------------Test Result ----------------------- Assert.IsInstanceOf(typeof(SimpleFilterStub), customFilter); }
public void TearDown() { foreach (var item in _filters) item.Dispose(); _filters = null; if(_timeBoxFilter != null) { _timeBoxFilter.Dispose(); _timeBoxFilter = null; } this.SaftyInvoke<IDisposable>(d => d.Dispose()); }
public void Test_BuildCustomFilter_FilterClauseOperator() { //---------------Set up test pack------------------- FilterControlBuilder builder = new FilterControlBuilder(GetControlFactory()); const FilterClauseOperator op = FilterClauseOperator.OpLessThanOrEqualTo; FilterPropertyDef filterPropertyDef1 = CreateFilterPropertyDef(op); //---------------Execute Test ---------------------- ICustomFilter customFilter = builder.BuildCustomFilter(filterPropertyDef1); //---------------Test Result ----------------------- Assert.AreEqual(op, customFilter.FilterClauseOperator); }
public void TearDown() { foreach (var item in _filters) { item.Dispose(); } _filters = null; if (_timeBoxFilter != null) { _timeBoxFilter.Dispose(); _timeBoxFilter = null; } this.SaftyInvoke <IDisposable>(d => d.Dispose()); }
/// <summary> /// Create a new lossless transform instance with the given parameters. /// </summary> /// <param name="x">The left boundary of the cropping region. This must be evenly divisible by the MCU block /// width (see <see cref="TurboJpegUtilities.GetMcuWidth" />).</param> /// <param name="y">The upper boundary of the cropping region. This must be evenly divisible by the MCU block /// height (see <see cref="TurboJpegUtilities.GetMcuHeight" />).</param> /// <param name="width">The width of the cropping region. Setting this to 0 is the equivalent of setting it to /// (width of the source JPEG image - <paramref name="x"/>).</param> /// <param name="height">The height of the cropping region. Setting this to 0 is the equivalent of setting it to /// (height of the source JPEG image - <paramref name="y"/>).</param> /// <param name="operation">The transform operation.</param> /// <param name="options">One or more of the transform options.</param> /// <param name="customFilter">An instance of an object that implements the <see cref="ICustomFilter"/> /// interface, or <c>null</c> if no custom filter is needed.</param> public TurboJpegTransform(int x, int y, int width, int height, TransformOperation operation, TransformOptions options, ICustomFilter customFilter = null) : this(new Rectangle(x, y, width, height), operation, options, customFilter) { Contract.Requires(x >= 0, "x must be non-negative"); Contract.Requires(y >= 0, "y must be non-negative"); Contract.Requires(width >= 0, "width must be non-negative"); Contract.Requires(height >= 0, "height must be non-negative"); Contract.Requires(Enum.IsDefined(typeof(TransformOperation), operation)); Contract.Requires(Enum.IsDefined(typeof(TransformOptions), options)); }
/// <summary>Create a new lossless transform instance with the given parameters.</summary> /// <param name="r">A <see cref="Rectangle"/>> instance that specifies the cropping region. See /// <see cref="TurboJpegTransform (int, int, int, int, TransformOperation, TransformOptions, ICustomFilter)"/> /// for more detail.</param> /// <param name="operation">The transform operation.</param> /// <param name="options">One or more of the transform options.</param> /// <param name="customFilter">An instance of an object that implements the <see cref="ICustomFilter"/> /// interface, or <c>null</c> if no custom filter is needed.</param> public TurboJpegTransform(Rectangle r, TransformOperation operation, TransformOptions options, ICustomFilter customFilter = null) { Contract.Requires(r.X >= 0, "Rectangle X must be non-negative"); Contract.Requires(r.Y >= 0, "Rectangle Y must be non-negative"); Contract.Requires(r.Width >= 0, "Rectangle width must be non-negative"); Contract.Requires(r.Height >= 0, "Rectangle height must be non-negative"); Contract.Requires(Enum.IsDefined(typeof(TransformOperation), operation)); Contract.Requires(Enum.IsDefined(typeof(TransformOptions), options)); this.rect = r; this.operation = operation; this.options = options; this.customFilter = customFilter; }
/// <summary> /// See <see cref="IFilterControl.GetFilterClause"/> /// </summary> public IFilterClause GetFilterClause() { if (_filterControls.Count == 0) { return(_clauseFactory.CreateNullFilterClause()); } ICustomFilter filterUi = _filterControls[0]; IFilterClause clause = filterUi.GetFilterClause(_clauseFactory); for (int i = 1; i < _filterControls.Count; i++) { filterUi = _filterControls[i]; clause = _clauseFactory.CreateCompositeFilterClause(clause, FilterClauseCompositeOperator.OpAnd, filterUi.GetFilterClause(_clauseFactory)); } return(clause); }
public void CreateTimeBoxFilter(IEnumerable agents, DateTime targetDate) { var avaliableTypes = new List<string>(); foreach (var item in agents) { var agent = item as IAgent; if (agent == null) break; avaliableTypes.AddRange(agent.Schedule.TermSet.Where( o => o is IAssignment && o.Start.Date == targetDate) .Select(o => o.Text)); } if (avaliableTypes.Count == 0) return; _timeBoxFilter = new TimeBoxFilter(this, avaliableTypes.Distinct().OrderBy(o => o).ToList()); }
public void Test_AddStaticFilterClause() { //---------------Set up test pack------------------- IFilterControl filterControl = GetControlFactory().CreateFilterControl(); //---------------Execute Test ---------------------- const string propertyName = "TestColumn2"; const string filtervalue = "FilterValue"; filterControl.AddStaticStringFilterClause(propertyName, FilterClauseOperator.OpGreaterThan, filtervalue); //---------------Test Result ----------------------- Assert.AreEqual(1, filterControl.FilterControls.Count); ICustomFilter control = filterControl.FilterControls[0]; Assert.AreEqual(propertyName, control.PropertyName); Assert.AreEqual(FilterClauseOperator.OpGreaterThan, control.FilterClauseOperator); IFilterClause filterClause = control.GetFilterClause(new DataViewFilterClauseFactory()); Assert.AreEqual(string.Format("{0} > '{1}'", propertyName, filtervalue), filterClause.GetFilterClauseString()); }
/// <summary> /// See <see cref="IFilterControl.AddCustomFilter(string,ICustomFilter)"/> /// </summary> public void AddCustomFilter(string labelText, ICustomFilter customFilter) { ILabel label = _controlFactory.CreateLabel(labelText); IControlHabanero control = customFilter.Control; if (control != null) { AddControlToLayoutManager(label, control); } _filterControls.Add(customFilter); var chk = control as ICheckBox; if (chk != null) { label.Click += (sender, e) => { chk.Checked = !chk.Checked; }; } }
private static void SetParametersOnFilter(IFilterPropertyDef filterPropertyDef, Type filterType, ICustomFilter customFilter) { if (filterPropertyDef.Parameters == null) return; foreach (KeyValuePair<string, string> parameter in filterPropertyDef.Parameters) { System.Reflection.PropertyInfo propertyInfo = filterType.GetProperty (parameter.Key, BindingFlags.Instance | BindingFlags.Public); if (propertyInfo == null) { throw new HabaneroDeveloperException (string.Format ("The property '{0}' was not found on a filter of type '{1}' for property '{2}'", parameter.Key, filterPropertyDef.FilterType, filterPropertyDef.PropertyName), ""); } propertyInfo.SetValue (customFilter, Convert.ChangeType(parameter.Value, propertyInfo.PropertyType), null); } }
public void Test_BuildCustomFilter_SetParametersViaReflection() { //---------------Set up test pack------------------- FilterControlBuilder builder = new FilterControlBuilder(GetControlFactory()); Dictionary <string, string> parameters = new Dictionary <string, string> { { "IsChecked", "true" } }; FilterPropertyDef filterPropertyDef = new FilterPropertyDef (TestUtil.GetRandomString(), TestUtil.GetRandomString(), "BoolCheckBoxFilter", "", FilterClauseOperator.OpEquals, parameters); //---------------Assert PreConditions--------------- //---------------Execute Test ---------------------- ICustomFilter customFilter = builder.BuildCustomFilter(filterPropertyDef); //---------------Test Result ----------------------- Assert.IsInstanceOf(typeof(BoolCheckBoxFilter), customFilter); BoolCheckBoxFilter checkBoxFilter = (BoolCheckBoxFilter)customFilter; Assert.IsTrue(checkBoxFilter.IsChecked); }
public EventBatchAlterModel(DateTime watchPoint, ITimeBoxRepository timeBoxRepository, ITermStyleRepository termStyleRepository) : base(watchPoint, timeBoxRepository, termStyleRepository) { _title = LanguageReader.GetValue("BatchAlterExistsOfSubEvent"); OptionalFilters = new ICustomFilter[] { new CustomFilter("EqEventType", this, (t) => { return(t.Text.Equals(QueryType.Text)); }), new CustomFilter("EqParentType", this, (t) => { var bottomStyle = t.GetBottomStyle(); if (bottomStyle == null) { return(false); } return(bottomStyle.Equals(QueryParentType.Text)); }) }; _filters = new ICustomFilter[] { new CustomFilter("InTermRange", this, (t) => { return(t.IsInTheRange(SearchDate, End)); }), new CustomFilter("EqTermStart", this, (t) => t.Start == SearchDate), new CustomFilter("EqTermEnd", this, (t) => t.End == SearchDate) }; End = _searchDate.Date.AddDays(1).AddMinutes(-5); }
public void CreateTimeBoxFilter(IEnumerable agents, DateTime targetDate) { var avaliableTypes = new List <string>(); foreach (var item in agents) { var agent = item as IAgent; if (agent == null) { break; } avaliableTypes.AddRange(agent.Schedule.TermSet.Where( o => o is IAssignment && o.Start.Date == targetDate) .Select(o => o.Text)); } if (avaliableTypes.Count == 0) { return; } _timeBoxFilter = new TimeBoxFilter(this, avaliableTypes.Distinct().OrderBy(o => o).ToList()); }
///<summary> /// Adds a custom filter which allows filtering using an ICustomFilter ///</summary> ///<param name="labelText">The Label to appear before the control</param> ///<param name="customFilter">The custom filter</param> public void AddCustomFilter(string labelText, ICustomFilter customFilter) { //Removed Debug.Assert see Redmine Bug_ #614 _filterControlManager.AddCustomFilter(labelText, customFilter); }
public IControlHabanero AddCustomFilter(string labelText,string propertyName, ICustomFilter customFilter) { AddCustomFilter(labelText, customFilter); return customFilter.Control; }
///<summary> /// Adds a custom filter which allows filtering using an ICustomFilter ///</summary> ///<param name="labelText">The Label to appear before the control</param> ///<param name="customFilter">The custom filter</param> public void AddCustomFilter(string labelText, ICustomFilter customFilter) { _filterControlManager.AddCustomFilter(labelText, customFilter); customFilter.ValueChanged += delegate { if (this.FilterMode == FilterModes.Filter) FireFilterEvent(); }; }
/// <summary> /// See <see cref="IFilterControl.AddCustomFilter(string,ICustomFilter)"/> /// </summary> public void AddCustomFilter(string labelText, ICustomFilter customFilter) { ILabel label = _controlFactory.CreateLabel(labelText); IControlHabanero control = customFilter.Control; if(control != null) AddControlToLayoutManager(label, control); _filterControls.Add(customFilter); var chk = control as ICheckBox; if (chk != null) { label.Click += (sender, e) => { chk.Checked = !chk.Checked; }; } }
private static void SetParametersOnFilter(IFilterPropertyDef filterPropertyDef, Type filterType, ICustomFilter customFilter) { if (filterPropertyDef.Parameters == null) { return; } foreach (KeyValuePair <string, string> parameter in filterPropertyDef.Parameters) { System.Reflection.PropertyInfo propertyInfo = filterType.GetProperty (parameter.Key, BindingFlags.Instance | BindingFlags.Public); if (propertyInfo == null) { throw new HabaneroDeveloperException (string.Format ("The property '{0}' was not found on a filter of type '{1}' for property '{2}'", parameter.Key, filterPropertyDef.FilterType, filterPropertyDef.PropertyName), ""); } propertyInfo.SetValue (customFilter, Convert.ChangeType(parameter.Value, propertyInfo.PropertyType), null); } }
private void addICustomFilter(ICustomFilter filter) { Add(new DelegatingFilter(filter)); lElement.Add(filter); }
public IControlHabanero AddCustomFilter(string labelText, string propertyName, ICustomFilter customFilter) { AddCustomFilter(labelText, customFilter); return(customFilter.Control); }
/// <summary> /// Adds a DateRangeComboBox filter which provides common date ranges such as "Today" or "This Year", /// so that the grid will only show rows having a date property in the given range /// </summary> /// <param name="labelText">The label to appear before the control</param> /// <param name="columnName">The business object property on which to filter</param> /// <param name="options">Provides a specific set of date range options to show</param> /// <param name="includeStartDate">Includes all dates that match the start date exactly</param> /// <param name="includeEndDate">Includes all dates that match the end date exactly</param> /// <returns>Returns the new DateRangeComboBox added</returns> public IDateRangeComboBox AddDateRangeFilterComboBox(string labelText, string columnName, List <DateRangeOptions> options, bool includeStartDate, bool includeEndDate) { ICustomFilter filter = _filterControlManager.AddDateRangeFilterComboBox(labelText, columnName, options, includeStartDate, includeEndDate); return((IDateRangeComboBox)filter.Control); }