That's because the GUI and its connections to the controllers are
loaded from an abstract definition in an XML file. The abstract
definition is cross-platform, so it cannot suppose the availiability
of
Actions, therefore simple references to the menu items are used to
change states.
If the description is abstract, then it doesn't need to know anything
about
the implementation. Whether an Action or anything else is used is an
implementation detail. The abstraction DOESN'T suppose anything about
the
implementation. It doesn't know whether it's dealing with an Action,
JMenuItem, or even perhaps the Eclipse equivalents of those classes.
Or is it abstract, but not THAT abstract?
The description contains a list of abstract visual component and
controller descriptions. These are interconnected with reference
relations, which, at runtime, result in references being set to link to
the actual visual components.
The concept is pretty much what .nib files do in cocoa, but with an
extra mapping between abstract types and their actual types in the
current runtime environment.
There are abstract Menu and Menu Item types that are being mapped to
JMenu and JMenuItem in Java/Swing, but could be mapped to NSMenu and
NSMenuItem in Cocoa. The controller implementation in Java/Swing will
use references to the actual JMenu and JMenuItem instances to change
these instances' states. If a Java/Swing implementation decides to
change some aspect of a menu at runtime, it needs the reference to the
actual instance, and that would not be possible if there are multiple
copies of these objects.
I'm not entirely familiar with the Actions concept in Java/Swing, but
to my knowledge it would be hard to map the Menu and Menu Item abstract
types to Actions, because adding or removing menu items would not be
possible this way...
--Lieven
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden