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 102055 - "Handler for ..." dialog not showing existing handlers
Summary: "Handler for ..." dialog not showing existing handlers
Status: RESOLVED INVALID
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-21 06:33 UTC by dmiller
Modified: 2007-05-17 04:55 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dmiller 2007-04-21 06:33:40 UTC
When I was using 5.5beta I created several panels where I reused an event
handler for multiple components. This does not work in the released 5.5.

For example, I have 3 fields that cannot be zero length and the value must be
numeric.

For the first one, I went to Properties > Events > focusLost and created a
handler (something like "textFieldFocusLost") and added some code that would
highlight the field as being invalid.

For the other 2 fields, when I clicked the focusLost event button the "Handlers
for FocusLostEvent" dialog displayed the previously defined handler and let me
select it.

As a result, I have a form with 3 fields with code in the protected block that
looks like this:
        fieldName.addFocusListener(new java.awt.event.FocusAdapter()
        {
            public void focusLost(java.awt.event.FocusEvent evt)
            {
                textFieldFocusLost(evt);
            }
       };

All 3 fields each have an anonymous inner class derived from FocusAdapter
registered for FocusLostEvent and all 3  adapters call textFieldFocusLost() to
do the work.

In the final 5.5 release the "Handlers for xxx" dialog never shows me an
existing handler.

I've resorted to defining my own method, then generating multiple event handler
stubs, but this is messy and adds an extra, unnecessary function call.
Comment 1 Jan Stola 2007-05-15 17:42:11 UTC
This is a misunderstanding the Handlers for xxx dialog shows just the handlers 
assigned to the selected component. So, it is correct that the dialog is empty 
for a newly added component. If you want to share the same handler among more 
components, press Add button and specify the name of existing handler - for 
example 'textFieldFocusLost' in your case.
Comment 2 dmiller 2007-05-16 13:36:30 UTC
Ok, that makes sense, it's showing what *is* assigned, not what *can* be assigned.

Would it be possible to add a "Select" button to the "Add", "Rename", "Remove"
already present in the dialog?  It would present the developer with a list of
methods having the correct signature that can be assigned to this event.

It would make it a lot easier than having to enter the name. In complex forms
you can wind up with a lot of these and picking from a list would be easier.
Especially in light of the fact that when you are making the choice you are in
the Design view and cannot simply browse the code for the correct name.

Should I reopen this as an enhancement request or enter a new enh req?
Comment 3 Jan Stola 2007-05-16 15:11:12 UTC
I agree that besides possibility to enter the name of a new handler it would be 
nice to be able to select from the existing handlers. Please, fill a separate 
issue (enhancement) for that, thanks.
Comment 4 dmiller 2007-05-17 04:55:35 UTC
Ok, done enhancement request added as issue# 104134