Featured Post

Applying Email Validation to a JavaFX TextField Using Binding

This example uses the same controller as in a previous post but adds a use case to support email validation.  A Commons Validator object is ...

Sunday, November 6, 2016

Securing JavaFX Content Based on Role

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