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 138717 - Controller.isValid() clashes with java.awt.Component.isValid()
Summary: Controller.isValid() clashes with java.awt.Component.isValid()
Status: CLOSED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker (vote)
Assignee: Martin Entlicher
URL:
Keywords: API, API_REVIEW_FAST
Depends on:
Blocks:
 
Reported: 2008-07-01 14:53 UTC by Martin Entlicher
Modified: 2010-04-29 09:40 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
The proposed API change. (5.86 KB, text/plain)
2008-07-04 07:39 UTC, Martin Entlicher
Details
The new API change that modifies both AttachType and BreakpointType. (9.54 KB, text/plain)
2008-09-17 11:01 UTC, Martin Entlicher
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Entlicher 2008-07-01 14:53:17 UTC
AttachType.getCustomizer() returns a JComponent, which can optionally implement Controller interface. However, both
java.awt.Component and Controller define isValid() method and every class have it for a different purpose.
Therefore Controller.isValid() becomes useless.
Comment 1 Martin Entlicher 2008-07-01 15:33:05 UTC
AttachType is abstract class, therefore we can solve this by adding:

public Controller getController() {
   JComponent c = getCustomizer();
   if (c instanceof Controller) {
      return ((Controller) c);
   } else {
      return null;
   }
}

Subclasses of AttachType could override getController() method and return a different class from JComponent.

The advantage is that this is a compatible solution.
The disadvantage is that the client have to create a special class to implement Controller.

Thoughts?
Comment 2 Martin Entlicher 2008-07-04 07:39:11 UTC
Created attachment 63925 [details]
The proposed API change.
Comment 3 Martin Entlicher 2008-07-04 07:41:22 UTC
Please review this simple API change. AttachType.getController() method was added to solve clash of isValid() methods.
Comment 4 ivan 2008-07-04 20:32:45 UTC
For symmetry, shouldn't the same be done for BreakpointType?
Comment 5 Jaroslav Tulach 2008-07-07 14:46:30 UTC
Nice. 

Y01 Test for default behaviour of public Controller getController()?
Y02 Test for ConnectorPanel really calling getController()?

Comment 6 Martin Entlicher 2008-09-17 10:22:33 UTC
Thanks for your reminder, we'll do the same change for BreakpointType.
Comment 7 Martin Entlicher 2008-09-17 11:01:45 UTC
Created attachment 70022 [details]
The new API change that modifies both AttachType and BreakpointType.
Comment 8 Martin Entlicher 2008-09-17 11:03:31 UTC
I'd like to integrate this shortly, since it already went through review for AttachType and the change for
BreakpointType is identical. Thanks.
Comment 9 Jaroslav Tulach 2008-09-17 15:18:34 UTC
Y01 typo in "intarface"
Comment 10 Martin Entlicher 2008-09-19 00:27:13 UTC
Thanks for noticing the typo, it was in the code already. I'll fix that as well.

Thanks for the review, I'll integrate the change this Friday during business hours CEST.
Comment 11 Martin Entlicher 2008-09-19 13:10:01 UTC
Fixed in changeset:   102828:555019f44b55
getController() method added to AttachType and BreakpointType
http://hg.netbeans.org/main/rev/555019f44b55
Comment 12 Quality Engineering 2008-09-20 05:30:52 UTC
Integrated into 'main-golden', will be available in build *200809200201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/555019f44b55
User: mentlicher@netbeans.org
Log: #138717 - getController() method added to AttachType and BreakpointType to solve clash of isValid() methods.
Comment 13 Quality Engineering 2010-04-29 09:40:40 UTC
Verified ... and Closing all issues resolved into NetBeans 6.7 and earlier.