I have some problems with my design for the presentation layer of my application. Let's assume there are two screens. First a login screen, and then a main screen is shown when the user logs in successfully.
The application looks like:
GUI <---> Business/service layer <---> Server <---> Database
To first simplify the problem let's remove the server layer.
GUI <---> Business/service layer <---> Database
The business layer can now access the database directly. Logging in from the GUI would simply be something like:
SomeReturnObject s = myGUIClass.getBusinessLayerClass().doLogin(...)
From here I can update the GUI if I want.
When we add the server layer again (that uses Sockets for communication between the server and its clients), the situation isn't much more difficult IF the business layer login method does something like:
- create a request
- write the request to the server
- receive the response from the server for this request
- return the response to the caller
But this is not the way I want it to be. My GUI will have more events that are send to the server and some of them should update other parts of the GUI. Compare it to the idea of an asynchronous call, where the login method example above was a synchronous call, because the response was received in the same method.
So my first question is: How do I setup my design such that data/events/responses from the server are properly handled in my GUI (in a single place?) in such a way that every desired node can be updated?
And my second question is about stages and custom nodes. What's the best practice in JavaFX: create one stage and update it's scene/content or create a new Stage for every screen (like one for login screen and one for main window). The problem with using a custom node (class that extends Parent) is that I can't close the window, because of this:
Let's say loginNode has an FadeTransition that should close the stage when finished. It can't now...
Any ideas / suggestions are welcome.
SCJP, SCWCD, SCJD
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Problems with GUI design and eventhandling