This is an example where a MainView contains two child views, AllAccessView and AdminOnlyView. All of the views are in .fxml and AllAccessView and AdminOnlyView are fx:included in MainView.
A setRole() method is provided by MainViewController. This method sets an internal field which is tied to a ChangeListener. The ChangeListener will decide, based on role, whether or not to show both views (for Admin) or just one (for User).
The fx:include code is wrapped up in Boxes to make the adding and removing easier.
I'll expand upon this later.
The code will explain things better.
SecuredApp Source
No comments:
Post a Comment