Matthias Meid
Matthias Meid

Reputation: 12523

JavaFX View Navigation

I'm working on a Desktop JavaFX 2 application. We're using FXML, an MVC architecture to build a tabbed UI. Now I'm struggling to find an elegant way for this scenario:

  1. User clicks button on View 1, which is in a tab on the Main View.
  2. Controller creates a new model object.
  3. New model object is shown through View 2, which is opened in another tab on the Main View.

Would it be suitable to implement a class similar to GWT's com.google.gwt.user.client.History, handling all navigation request. First I'd have to register the main view. Or am I overseeing a JavaFX mechanism?

Upvotes: 1

Views: 894

Answers (1)

jewelsea
jewelsea

Reputation: 159536

I implemented a tabbed web browser with history management which sounds a bit similar to your situation. The code is a bit of a mess, but you could look through it if you like to see if there is anything worthwhile there which is applicable to your situation.

For the next release (2.2) of JavaFX there will be a generic pagination control (anybody can register at that link to view the issue) which will probably help encapsulate some of the functionality you require as it mentions TabPane like functionality.

There has also been some discussion of JavaFX history functionality on the open-jfx development mailing list.

The jfx-flow project was created to enable weblike interfaces (e.g. views with history navigation) on JavaFX. Not sure if it's completely developed for your use case, but you could take a look at that too.

Upvotes: 1

Related Questions