469,271 Members | 1,008 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

Menu, Toolbar and Popup actions - <Mapping to command class>

With all the Menu items, toolbar items and popup items that can total to
about 50-75 choices in a gui design, what the 'easiest' way to map the
action names with the class to call.

Like to use the Command design pattern to do this generically:
Somehow get the "action string" and map it to a "command class".

Is this possible with Command, Reflection etc?
Somehow:

Command c = new <ReflectCallCommandClass> ();
c.execute();

How do the reflection part? More important if their is a better way
than this...
public interface Command {
public void execute();
}
public class MyCommandClass1 extends Command {
public void execute() {
// code for action 1,
// could be from Menu, Toolbar, popups doesn't matter...
}
}
Jul 17 '05 #1
0 1591

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by lestat | last post: by
reply views Thread by Dan Trowbridge | last post: by
1 post views Thread by Birthe Gebhardt | last post: by
10 posts views Thread by jason.cipriani | last post: by
2 posts views Thread by =?Utf-8?B?Unlhbg==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.