Ok, I don’t have a habit of writing on forums, but I’m working alone now and I need some help, so let’s give it a try.
So I’m developing a plug-in, which has a pretty sophisticated GUI, and in general is “more on the GUI side” then on signal processing in terms of complexity. Since I am not exactly a GUI wizard, I’m having trouble deciding on what is the best, most cleanest, or let’s even call it, the “right” way to implement the Observer Pattern, by using all the available Listener classes.
Alright, practical example:
I have my AudioProcessorEditor class which holds everything GUI-wise together. I have created a menu using the Toolbar class, and filled it up with some buttons (and some other components). Now, I also have other parts of the GUI created - a side bar, for example. The AudioProcessorEditor is the parent class for all these classes and there I create the objects and make them visible - the menu object, instantiate the class that holds items that go to the menu, and the side bar object. Now let’s say I want to click on a button in the menu, and the side bar is supposed to listen to the changes and something happens on the side bar.
This is a basic example I made here. So this kind of situation is supposed to happen in many places in the plug-in. Changes made to some object are supposed to change something in other objects, which may be of a parent class or even higher in hierarchy.
“I want to press a button in my room, and the light turns on in your kitchen.”
I just hope I made some sense. All the info about Events and Listeners in the tutorial is very basic so it doesn’t help me much when I need to create a complex guy with different objects interacting. I would appreciate any kind of relevant explanation or maybe a simple code example! I was thinking about creating a separate “interface” class and point to that class so it can handle all the events, but it is pretty complex for me to do alone, I’ve got nobody to ask about this, and I’m not even sure if that is the “best” way to do it.
Thanks guys for all the help,