This article explains NautDrafters screen hierarchy and how screen switching occurs.
Our Screen interface
In NautDrafter the interface SubScreen is all a class has to implement to be used as a screen.
Defined in this class are the methods that are used by the Base class to get what elements to show. Read the Java documentation of the project for further explanation.
Base class
This class is the root node of our application. All screens are shown within using the SubScreen interface. Base looks like this:
The area label "Main Screen" is where the elements in the SubScreen are shown.the TitleBar is where we show the user details (right) , application logo (center) and the Screen title + menu (left). there is an optional panel that is currently not used but could be potentially used for displaying advertisements (for tournaments, etc).
A useful feature of the Base class is the use of the LockerPane used to disable the UI and display a "spinner". This is done by calling the startLoadingOverlay() and unlocked by using the stopLoadingOverlay() method. This is used when communicating with the servers and using the UI could produce errors.
Refer to the Javadocs for more information.
The screen flow diagram
In NautDrafter we are using a Screen stack to hold the current screens in the application. In the above diagram, stack levels are shown by what row the screens are on. For example the Login Screen is the first screen on the stack and when the user logs in, the server browser screen is added onto the stack. For the main three drafting screens, the new screen is not put on the stack but switched with the old screen.
To add a screen onto the screen stack call the static method NautDrafter.setScreen( "new screen", true), and to switch out the screen currently showing call NautDrafter.setScreen( "new screen", false).
Implemented Screens
As of Tuesday, September 23 2014, the current screens are
- Login Screen (Class: LoginScreen.java, fxml: Login.fxml)
- Server Browser (ServerBrowserScreen.java/fxml)
- Server Config (ServerConfigScreen.java, ServerConfig.fxml)
- Team Selection (TeamSelectionScreen.java/fxml)
- (Player) Drafting Screen (DraftingScreenPlayer.java/fxml)
- (Spectator) Drafting Screen (DraftingScreenSpectator.java/fxml)
- Versus (VersusScreen.java/fxml)