Hi all,
I read something in the documentation but am not quite sure I understand it correctly. Could someone please show me on an example when is the ApplicationCommandManager useful? I can use Listeners for the same thing, can’t I?
It’s useful, honestly. Otherwise I wouldn’t have wasted so much time writing it!
It makes it easy to route commands to the appropriate targets, e.g. a “copy” command might be mapped to one key-press, but would go to different targets depending on which UI component is focused. It also means you can use the same mechanism to trigger commands by key-presses, buttons, menus, or other things.
Sure you could do everything with low-level listeners, but in a medium-sized app you’ll find that quickly becomes very messy.
[quote=“jules”]It’s useful, honestly. Otherwise I wouldn’t have wasted so much time writing it!
[/quote]
:lol: Yeah exactly, I saw it was pretty complicated and I somehow “knew” it must be useful although I couldn’t quite grasp how…
So it works that the ACM sends message to the first ApplicationCommandTarget which then issues commands through its perform() method. If it can’t handle it it, the getNextCommandTarget() determines who is the next to try it.
Do I get this right? Or am I still missing something?
Thanks.
Y.