Ejemplo n.º 1
0
 public void RemoveFilter(IListFilter <T> filter)
 {
     if (null == filter)
     {
         return;
     }
     this._filterList.Remove(filter);
 }
Ejemplo n.º 2
0
 public void AddFilter(IListFilter <T> filter)
 {
     if (null == filter)
     {
         return;
     }
     this._filterList.Add(filter);
 }
Ejemplo n.º 3
0
        public void Test_LMGroup()
        {
            var listManager = new GroupListMan(fContext);

            Assert.IsNotNull(listManager);

            var grpRec = fContext.Tree.XRefIndex_Find("G1") as GDMGroupRecord;

            listManager.Fetch(grpRec);

            listManager.QuickFilter = "*";
            Assert.IsTrue(listManager.CheckFilter());
            listManager.QuickFilter = "*roup*";
            Assert.IsTrue(listManager.CheckFilter());
            listManager.QuickFilter = "*alpha*";
            Assert.IsFalse(listManager.CheckFilter());

            var listView = Substitute.For <IListViewEx>();

            listManager.UpdateColumns(listView);
            var listItem = new GKListItem("", null);

            listManager.UpdateItem(0, listItem, grpRec);

            //
            var colVal = listManager.GetColumnInternalValue(0);

            Assert.IsNotNull(colVal);

            var data = listManager.GetItemData(grpRec);

            Assert.IsNotNull(data);
            Assert.IsTrue(data.Length > 0);

            //
            IListFilter  filter      = listManager.Filter;
            IListColumns listColumns = listManager.ListColumns;

            ListColumns copyColumns = GroupListMan.CreateGroupListColumns();

            listColumns.CopyTo(copyColumns);

            Assert.Throws(typeof(ArgumentNullException), () => { listColumns.CopyTo(null); });

            listManager.QuickFilter = "*";
            listManager.AddCondition((byte)GroupColumnType.ctName, ConditionKind.ck_Contains, "*roup*");
            Assert.IsTrue(listManager.CheckFilter());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Do the actual work of filtering
        /// </summary>
        /// <param name="objects"></param>
        /// <param name="aModelFilter"></param>
        /// <param name="aListFilter"></param>
        /// <returns></returns>
        protected virtual IEnumerable FilterObjects(IEnumerable objects, IModelFilter aModelFilter, IListFilter aListFilter)
        {
            // Being cautious
            objects = objects ?? new ArrayList();

            // Tell the world to filter the objects. If they do so, don't do anything else
            FilterEventArgs args = new FilterEventArgs(objects);
            this.OnFilter(args);
            if (args.FilteredObjects != null)
                return args.FilteredObjects;

            // Apply a filter to the list as a whole
            if (aListFilter != null)
                objects = aListFilter.Filter(objects);

            // Apply the object filter if there is one
            if (aModelFilter != null) {
                ArrayList filteredObjects = new ArrayList();
                foreach (object model in objects) {
                    if (aModelFilter.Filter(model))
                        filteredObjects.Add(model);
                }
                objects = filteredObjects;
            }

            return objects;
        }
Ejemplo n.º 5
0
 virtual public void ApplyFilters(IModelFilter modelFilter, IListFilter listFilter)
 {
 }
Ejemplo n.º 6
0
 public override void ApplyFilters(IModelFilter modelFilter, IListFilter listFilter)
 {
     filtered = filteredAddresses.ToArray();
 }
 /// <summary>
 /// Apply the given filters to this data source. One or both may be null.
 /// </summary>
 /// <param name="iModelFilter"></param>
 /// <param name="iListFilter"></param>
 public override void ApplyFilters(IModelFilter iModelFilter, IListFilter iListFilter)
 {
     this.modelFilter = iModelFilter;
     this.listFilter  = iListFilter;
     this.SetObjects(this.fullObjectList);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="modelFilter"></param>
 /// <param name="listFilter"></param>
 virtual public void ApplyFilters(IModelFilter modelFilter, IListFilter listFilter) {
 }
Ejemplo n.º 9
0
        public void Test_Lists()
        {
            ListColumn colStatic = new ListColumn(0, 0, DataType.dtString, 0, true);

            Assert.IsNotNull(colStatic);
            Assert.AreEqual(0, colStatic.Order);
            Assert.AreEqual(false, colStatic.CurActive);
            Assert.AreEqual(0, colStatic.CurWidth);

            //
            ListFilter listFilter = new ListFilter();

            Assert.IsNotNull(listFilter);
            Assert.AreEqual(0, listFilter.Conditions.Count);
            listFilter.Clear();
            Assert.AreEqual(0, listFilter.Conditions.Count);

            ListManager  listManager;
            ListViewMock lvMock = new ListViewMock();
            GKListItem   listItem;

            //
            listManager = new GroupListMan(fContext);
            Assert.IsNotNull(listManager);

            GDMGroupRecord grpRec = fContext.Tree.XRefIndex_Find("G1") as GDMGroupRecord;

            listManager.Fetch(grpRec);

            listManager.QuickFilter = "*";
            Assert.IsTrue(listManager.CheckFilter());
            listManager.QuickFilter = "*roup*";
            Assert.IsTrue(listManager.CheckFilter());
            listManager.QuickFilter = "*alpha*";
            Assert.IsFalse(listManager.CheckFilter());

            listManager.UpdateColumns(lvMock);
            listItem = new GKListItem("", null);
            listManager.UpdateItem(0, listItem, grpRec);

            //
            var colVal = listManager.GetColumnInternalValue(0);

            Assert.IsNotNull(colVal);

            var data = listManager.GetItemData(grpRec);

            Assert.IsNotNull(data);
            Assert.IsTrue(data.Length > 0);

            //
            IListFilter  filter      = listManager.Filter;
            IListColumns listColumns = listManager.ListColumns;

            ListColumns copyColumns = GroupListMan.CreateGroupListColumns();

            listColumns.CopyTo(copyColumns);

            Assert.Throws(typeof(ArgumentNullException), () => { listColumns.CopyTo(null); });

            listManager.QuickFilter = "*";
            listManager.AddCondition((byte)GroupColumnType.ctName, ConditionKind.ck_Contains, "*roup*");
            Assert.IsTrue(listManager.CheckFilter());
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Apply the given filters to this data source. One or both may be null.
 /// </summary>
 /// <param name="iModelFilter"></param>
 /// <param name="iListFilter"></param>
 public override void ApplyFilters(IModelFilter iModelFilter, IListFilter iListFilter)
 {
     modelFilter = iModelFilter;
     listFilter  = iListFilter;
     SetObjects(fullObjectList);
 }
 /// <summary>
 /// Apply the given filters to this data source. One or both may be null.
 /// </summary>
 /// <param name="iModelFilter"></param>
 /// <param name="iListFilter"></param>
 public override void ApplyFilters(IModelFilter iModelFilter, IListFilter iListFilter) {
     this.modelFilter = iModelFilter;
     this.listFilter = iListFilter;
     this.SetObjects(this.fullObjectList);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Apply the given filters to this data source. One or both may be null.
 /// </summary>
 /// <param name="iModelFilter"></param>
 /// <param name="iListFilter"></param>
 public override void ApplyFilters(IModelFilter iModelFilter, IListFilter iListFilter)
 {
     modelFilter = iModelFilter;
     listFilter = iListFilter;
     SetObjects(fullObjectList);
 }
 public override void ApplyFilters(IModelFilter modelFilter, IListFilter listFilter) => filtered = filteredAddresses.ToArray();
 public void LoadItem(IListFilter f)
 {
 }
Ejemplo n.º 15
0
 public void ConnectToList(IListFilter Filter)
 {
     itemList   = Filter.GetList();
     ActualPage = 0;
     RefreshDisplay();
 }
Ejemplo n.º 16
0
 public MpqArchive.FileInfo[] FilterFileList(string FilterPattern, IListFilter Filter)
 {
     return Filter.FilterList(this.Files, FilterPattern);
 }