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 135258 - Freeform Java Desktop projects, form designer unable to add @Actions defined in other classes to buttons/menus/etc
Summary: Freeform Java Desktop projects, form designer unable to add @Actions defined ...
Status: RESOLVED DUPLICATE of bug 130461
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Binding (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-17 00:14 UTC by crusoe
Modified: 2008-07-01 17:57 UTC (History)
1 user (show)

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 crusoe 2008-05-17 00:14:29 UTC
I have a application that started out as a Java desktop application project under netbeans, but I converted it to use a
simpler freeform ant build as I integrated it into our build system. I then opened up this as a new freeform project
inside NetBeans

The desktop application is called "TemplateBuilder", and contains a TemplateBuilderApp and TemplateBuilderView classes
which were created by netbeans, back when this was a netbeans managed project. I also defined several menuitems and
buttons making use of @Action annotated methods in both of these classes.

The netbeans designer still works after the conversion to a freeform ant script, and I made sure to preserve all the
.form classes. Adding/editing components works fine.

The problem is, I subsequently refactored many of the actions into a separate class, as I didn't want them to be
ballooning out the App and View classes. This broke the actions for the menuitems and buttons affected by the move. When
run, the entries in the menu have disappeared and do not work. I try to go into the netbeans form designer, and re-add
the action, but it doesn't let me select the new classes. It only allows me to pick TemplateBuilderView or
TemplateBuilderApp as the source classes of @Action annotated methods! I can't point it to, or select another class that
contains @Action methods.

Apparently netbeans doesn't do any ongoing scanning for @Action methods in a non-netbeans freeform java project, and
there is no method to manually add such methods as actions to menuitems/buttons/etc. You can create them from scratch
inside the editor, but netbeans has no idea what to do if you moved them, it won't even scan for or find them, or let
you pick the class.
Comment 1 Jan Lahoda 2008-05-19 08:24:41 UTC
Not quite sure where the problem may be, but it certainly does not look like a java/editor problem.
Comment 2 Tomas Pavek 2008-07-01 17:57:51 UTC
The GUI builder currently does not support using actions from other classes (i.e. other than the form class itself and
the application class). Note it is not that easy - you need an instance, not just a class, to be able to use the
actions. Note there is already issue 130461 asking for support for actions from other classes.

One possible approach is to allow to use all known instances in the form class to be sources of actions (i.e. scanning
their classes for action methods and being able to set them). We could allow the user to specify any code expression for
the instance and arbitrary name of action. This would be possible with the current version of Swing App Framework.

There was also another idea - to use some kind of expressions to specify where the action method should be found without
specifying the target instance directly (e.g. "someActionObject.myAction"). This could even combine actions with beans
binding, but note sure how useful it could be. It would require changes in Swing App Framework, is more complicated, so
unlikely to happen.


*** This issue has been marked as a duplicate of 130461 ***