I tend to overengineer. Why? Because I had a view in JavaFX with its controller that had a bunch of key listeners which changed the UI. I wanted to change the view based on wifi connection/no connection with a server, which was managed in a Client class. The controller took the client to give it a message that client then had to send. For "separation of concerns" I created a separate view + controller for the "not connected" state.
Now the Client knew all about the connection, so I put up the Observer pattern and wanted the Main (Application) class to swap the layouts as an Observer of the Client. After an Exception on FX thread and Platform.runLater(), to solve the issue, I faced a new problem: the key presses weren't executed anymore. I still don't know why this happens. Maybe I'm missing something.🤷
Then met with one of my group partners (it's a uni project):
Let's attach the Observer to the original controller. Have only the original view that changes due to the controller updates as Observer. Let's see if that might even remotely work...🤔
It worked🤦😂

Add Comment