I can’t find any easy way of passing some parameters with my commands, for instance; open this url. The command sent from a button would be something like “openUrl” but now I have to do some ugly code to save the url in a static class known by both the sender and the receiver, and I don’t know if this is correct either? (is there any race conditions possible?)
There is a message framework, should I use that instead of commands in cases like this?
App commands aren’t really supposed to carry data, they’re just for button pushes, keypresses, etc, rather than passing data around your app. Maybe you could use an ActionListener or a Message object to send your info?
I have many classes where I broadcast messages, I have created a message structure which takes a void*, a string and integer value. The integer value is the message identifier.
And I use ChangeListener and ChangeBroadcaster to receive and deliver change messages.