472,146 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 software developers and data experts.

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 1668

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
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.