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 60499

Summary: Viewmodel: Enhance ModelEvent
Product: debugger Reporter: Martin Entlicher <mentlicher>
Component: CodeAssignee: Martin Entlicher <mentlicher>
Status: CLOSED FIXED    
Severity: blocker Keywords: API, API_REVIEW_FAST
Priority: P2    
Version: 5.x   
Hardware: All   
OS: All   
Issue Type: TASK Exception Reporter:
Bug Depends on:    
Bug Blocks: 57835, 61082    
Attachments: The proposed API change
The changes in the implementation. Just FYI.
The API change with updated Javadoc.

Description Martin Entlicher 2005-06-24 18:24:40 UTC
It's necessary to improve the ModelEvent subclasses to allow more fine-grained
firing.

Currently one can refresh the whole tree (TreeChanged), one node (NodeChanged),
or specific node property (TableValueChanged).

It's not possible to fire just change of node's display name, icon, short
description or children, specifically. There was introduced a hack with
javax.naming.ldap.ExtendedResponse - because of fix of issues #59945 and #60022.
But it should be implemented properly by enhancing ModelEvent in viewmodel API.
Comment 1 Martin Entlicher 2005-06-24 18:33:46 UTC
I suggest to add a new constructor to ModelEvent.NodeChanged:
NodeChanged(Object source, Object node, int change)
and method: public int getChange()

The change can be a combination of constants:
int DISPLAY_CHANGE, ICON_CHANGE, SHORT_DESCRIPTION_CHANGE and CHILDREN_CHANGE.
The default change will be -1 (all above changes)

Comments?
Comment 2 Martin Entlicher 2005-07-14 16:28:16 UTC
Created attachment 23106 [details]
The proposed API change
Comment 3 Martin Entlicher 2005-07-14 16:30:04 UTC
I'm asking for the review - it should be non-controversial, only simple API
addition.
Comment 4 Martin Entlicher 2005-07-14 16:31:08 UTC
Created attachment 23107 [details]
The changes in the implementation. Just FYI.
Comment 5 Jaroslav Tulach 2005-07-15 07:05:17 UTC
What it isjavax.naming.ldap.ExtendedResponse? How and when that interface got 
into the APIs? 
 
I have not actually found the API change!? Should not there be new constructor 
in the ModelEvent.NodeChanged? I have not found that in the diff. 
 
There are debug messages in your code. 
 
There is no update to the apichanges, no increment of module version and no 
change in other module dependencies. 
 
And I am really sorry for repeating myself, there is no test. Write one. 
 
Comment 6 _ rkubacki 2005-07-15 08:07:29 UTC
Yarda, you probably missed the first attachment. The change is going to remove
an ugly hack from debugger code. The event needs additional information that was
passed using hidden contract: if the event is actually instanceof
ExtendedResponse than you can call a method getID to obtain this value. 

OK - javadoc for new constructor is missing and there is some debug message but
I agree with it. (Is it second round of refining events in debuger now?)

Tests? these will be silly unit test just to get coverage in this case unless
you start to test that certain parts of debugger UI fire just neceseary change.
However this issue probably does not solve how much functionality in debuger
will be covered by tests.
Comment 7 Martin Entlicher 2005-07-18 16:53:45 UTC
Created attachment 23143 [details]
The API change with updated Javadoc.
Comment 8 Martin Entlicher 2005-07-18 17:02:59 UTC
Thanks Radim for you comments.
I've added the missing Javadoc. The debug message in the impl. will not be
committed, of course...

There are not many tests for the viewmodel. :-( This change does not contain
tests, because there is no existing test for event firing that could be extended...
Comment 9 Martin Entlicher 2005-07-26 17:07:25 UTC
I'll commit this change shortly. There will be also a simple test for it. Other
tests that are in viewmodel module do not pass, since the event listeners are
attached multiple times. This needs to be solved separately.
Comment 10 Martin Entlicher 2005-07-26 17:36:49 UTC
Committed into trunk:

/cvs/debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/ui/models/VariablesTreeModelFilter.java,v
 <--  VariablesTreeModelFilter.java
new revision: 1.10; previous revision: 1.9

/cvs/debuggerjpda/src/org/netbeans/modules/debugger/jpda/models/WatchesModel.java,v
 <--  WatchesModel.java
new revision: 1.20; previous revision: 1.19

/cvs/debuggercore/src/org/netbeans/modules/debugger/ui/models/WatchesTreeModel.java,v
 <--  WatchesTreeModel.java
new revision: 1.7; previous revision: 1.6

/cvs/debuggercore/viewmodel/apichanges.xml,v  <--  apichanges.xml
new revision: 1.14; previous revision: 1.13

/cvs/debuggercore/viewmodel/manifest.mf,v  <--  manifest.mf
new revision: 1.12; previous revision: 1.11

/cvs/debuggerjpda/nbproject/project.xml,v  <--  project.xml
new revision: 1.11; previous revision: 1.10

/cvs/debuggercore/viewmodel/src/org/netbeans/modules/viewmodel/TreeModelNode.java,v
 <--  TreeModelNode.java
new revision: 1.37; previous revision: 1.36

/cvs/debuggercore/viewmodel/src/org/netbeans/modules/viewmodel/TreeModelRoot.java,v
 <--  TreeModelRoot.java
new revision: 1.13; previous revision: 1.12

/cvs/debuggercore/viewmodel/src/org/netbeans/modules/viewmodel/TreeTable.java,v
 <--  TreeTable.java
new revision: 1.21; previous revision: 1.20

/cvs/debuggercore/viewmodel/test/unit/src/org/netbeans/api/viewmodel/BasicTest.java,v
 <--  BasicTest.java
new revision: 1.8; previous revision: 1.7

RCS file:
/cvs/debuggercore/viewmodel/test/unit/src/org/netbeans/api/viewmodel/ModelEventTest.java,v
Checking in
debuggercore/viewmodel/test/unit/src/org/netbeans/api/viewmodel/ModelEventTest.java;
/cvs/debuggercore/viewmodel/test/unit/src/org/netbeans/api/viewmodel/ModelEventTest.java,v
 <--  ModelEventTest.java
initial revision: 1.1

/cvs/debuggercore/viewmodel/src/org/netbeans/spi/viewmodel/ModelEvent.java,v 
<--  ModelEvent.java
new revision: 1.3; previous revision: 1.2

/cvs/debuggercore/viewmodel/src/org/netbeans/spi/viewmodel/Models.java,v  <-- 
Models.java
new revision: 1.23; previous revision: 1.22
Comment 11 Quality Engineering 2010-04-29 09:23:22 UTC
Verified ... and Closing all issues resolved into NetBeans 6.7 and earlier.