I have three actions defined like so:
public class A extends AbstractAction;
public class B extends AbstractAction;
public class C extends AbstractAction;
Now I want to define a jumbo action that does these three actions in order. I am sure there is a better way to do this than to do the following:
public class JumboAction extends AbstractAction {
...
public void actionPerformed(ActionEvent e) {
new A().actionPerformed(null);
new B().actionPerformed(null);
new C().actionPerformed(null);
}
}
I just dont know what the better way is. Can someone please point me to that?
To add more context as suggested in answers, my application has some UI elements (like nodes and edges), and the user can select a bunch of nodes and perform A, B, C, or JumboAction on them.
This idea of one control calling others as you're doing doesn't smell right to me, as if you're confusing the control with the model (ignoring also your use of null for the ActionEvents). The control should change the state of the model by calling model methods. Why not have your jumbo control call three (or more) model methods or whatever else is required, in order to complete its needs.
Perhaps you can give us a better understanding of your problem by giving more information about the concrete specifics of your problem as they may be just as or more important than the abstract ideas.