This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 44368 - Add ChangeAble DataFilter
Summary: Add ChangeAble DataFilter
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Data Systems (show other bugs)
Version: 4.x
Hardware: All All
: P1 blocker (vote)
Assignee: apireviews
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2004-06-05 12:50 UTC by Petr Hrebejk
Modified: 2008-12-22 15:52 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Proposed new interface (1.14 KB, text/plain)
2004-06-05 13:00 UTC, Petr Hrebejk
Details
Diff for FolderChildren and it's test (5.88 KB, patch)
2004-06-05 13:03 UTC, Petr Hrebejk
Details | Diff
Newer diff for FolderChildren (does not collapse nodes on filter change) (3.01 KB, patch)
2004-06-10 17:02 UTC, Petr Hrebejk
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr Hrebejk 2004-06-05 12:50:42 UTC
DataFolder currently offers to crate the
presentation of it's children with a given filter.
Although this filter can not be changed during the
lifecycle of the children.

With the introduction of VisibilityQiery (where
the list of ignored files can be changed by the
user) this API becomes insufficient.

Sugessted solution is to add ChangeableDataFilter
which will be able to fire events when the
filtering semantics get changed.
Comment 1 Petr Hrebejk 2004-06-05 13:00:53 UTC
Created attachment 15493 [details]
Proposed new interface
Comment 2 Petr Hrebejk 2004-06-05 13:03:41 UTC
Created attachment 15494 [details]
Diff for FolderChildren and it's test
Comment 3 Jaroslav Tulach 2004-06-07 07:12:09 UTC
Hrebejku have you thought about memory leaks? 

public void testChildrenCanGC () {
  Filter f = new Filter ();

  DataFolder folder = DataFolder.findFolder (bb);
       
  Children ch = folder.createNodeChildren( filter );        
  Node[] arr = ch.getNodes (true);

  WeakReference ref = new WeakReference (ch);
  ch = null;
  arr = null;

  assertGC ("Children can disappear even we hold the filter", ch);
}

Comment 4 Petr Hrebejk 2004-06-07 13:38:23 UTC
The test now looks like:
public void testChildrenCanGC () {
        Filter filter = new Filter ();
        
        FileSystem fs = Repository.getDefault ().getDefaultFileSystem();
        FileObject bb = fs.findResource("/BB");
        DataFolder folder = DataFolder.findFolder (bb);
           
        Children ch = folder.createNodeChildren( filter );        
        Node[] arr = ch.getNodes (true);
        
        WeakReference ref = new WeakReference (ch);
        ch = null;
        arr = null;
        
        assertGC ("Children can disappear even we hold the filter", ref);
    }

and it passes. 
Comment 5 Petr Hrebejk 2004-06-10 17:02:37 UTC
Created attachment 15638 [details]
Newer diff for FolderChildren (does not collapse nodes on filter change)
Comment 6 Petr Hrebejk 2004-06-11 09:35:06 UTC
Changeable data filter added.

RCS file:
/cvs/openide/loaders/src/org/openide/loaders/ChangeableDataFilter.java,v
done
Checking in
openide/loaders/src/org/openide/loaders/ChangeableDataFilter.java;
/cvs/openide/loaders/src/org/openide/loaders/ChangeableDataFilter.java,v
 <--  ChangeableDataFilter.java
initial revision: 1.1
done
Checking in openide/loaders/src/org/openide/loaders/FolderChildren.java;
/cvs/openide/loaders/src/org/openide/loaders/FolderChildren.java,v 
<--  FolderChildren.java
new revision: 1.5; previous revision: 1.4
done
Processing log script arguments...
More commits to come...
Checking in
openide/test/unit/src/org/openide/loaders/FolderChildrenTest.java;
/cvs/openide/test/unit/src/org/openide/loaders/FolderChildrenTest.java,v
 <--  FolderChildrenTest.java
new revision: 1.3; previous revision: 1.2
done