Trouble figuring how to navigate between views in the same window.

142 views
Skip to first unread message

THC Bigshooter

unread,
Jan 28, 2015, 8:42:44 AM1/28/15
to dataf...@googlegroups.com
Hi there!

I've been trying to follow the tutorial number 2 (http://www.guigarage.com/2014/05/datafx-tutorial-2/), but I can't seem to find the method startInStage(primaryStage), how come? I'am having a lot of trouble navigating between views, so if anyone has a simple example, it would be great :-)

Cheers!

Hendrik Ebbers

unread,
Jan 28, 2015, 9:06:35 AM1/28/15
to dataf...@googlegroups.com
What version  of JavaFX are you using? You should use 8.0 that is released at maven central: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22io.datafx%22

With 8.0 the package name has changed. Now all packages start with io.datafx.* but all the rest should be the same.

THC Bigshooter

unread,
Jan 28, 2015, 10:56:16 AM1/28/15
to dataf...@googlegroups.com
I use e(fx)clise plugin at the moment, that should be 8.0.

Łukasz Drabiuk

unread,
Jan 28, 2015, 12:58:39 PM1/28/15
to dataf...@googlegroups.com
Do you have Datafx include to project?
If you included datafx-controller remove. This libary remove some method from flow.
Hendrik Ebbers this is possible to flow on click table cell, if yes can you take me example?

Hendrik Ebbers

unread,
Jan 28, 2015, 2:12:12 PM1/28/15
to dataf...@googlegroups.com
Hi,
I created a description how DataFX can be added to an application: http://www.guigarage.com/2015/01/set-datafx-application/
Please check your setup based on this tutorial. Let us know if you still have problems :)

THC Bigshooter

unread,
Jan 29, 2015, 8:31:57 AM1/29/15
to dataf...@googlegroups.com
I've now done the complete setup, and I am now able to locate the startInStage-method. I've followed the tutorial 2, but it won't seem to function.

public class MainApp extends Application {

private Stage primaryStage;

private AnchorPane rootLayout;

@Override

public void start(Stage primaryStage) throws Exception {

new Flow(RootController.class).startInStage(primaryStage);

}

public static void main(String[] args) {

launch(args);

}

}

@FXMLController("/view/StandardView.fxml")


public class RootController {


@FXML

@LinkAction(AdministrateRentalsController.class)

private Button RentalsAdministration;

}


@FXMLController("/view/AdministrateRentalsView.fxml")

public class AdministrateRentalsController {


@FXML

@LinkAction(RootController.class)

private Button backToStartView;

}

The views should be spot on, I just use the fx:id as the name of the buttons. Right now nothing happens when I click on them.


THC Bigshooter

unread,
Jan 29, 2015, 8:39:43 AM1/29/15
to dataf...@googlegroups.com
It actually looks like it is rendering the further version. The stage title is still the same, and I can't change it in main. It tell me that there are errors in the project, even it doesn't locate anyone.


Am Mittwoch, 28. Januar 2015 20:12:12 UTC+1 schrieb Hendrik Ebbers:

THC Bigshooter

unread,
Jan 29, 2015, 8:42:11 AM1/29/15
to dataf...@googlegroups.com
Oh, I forgot to clean my solution, now I get this error:

Error: Could not find or load main class application.MainApp

THC Bigshooter

unread,
Jan 29, 2015, 8:48:03 AM1/29/15
to dataf...@googlegroups.com
Sorry for all the posts. I managed to clean up, and now get this error.

Exception in Application start method

java.lang.reflect.InvocationTargetException

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(Unknown Source)

at com.sun.javafx.application.LauncherImpl.launchApplication(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)

Caused by: java.lang.RuntimeException: Exception in Application start method

at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)

at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$147(Unknown Source)

at com.sun.javafx.application.LauncherImpl$$Lambda$48/1732398722.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.NoClassDefFoundError: javax/inject/Inject

at io.datafx.controller.injection.InjectResourceType.getSupportedAnnotation(InjectResourceType.java:55)

at io.datafx.controller.context.ContextResolver.getAnnotatedControllerResourceTypes(ContextResolver.java:87)

at io.datafx.controller.context.ContextResolver.injectResources(ContextResolver.java:49)

at io.datafx.controller.ViewFactory.createByController(ViewFactory.java:171)

at io.datafx.controller.flow.FlowHandler.start(FlowHandler.java:140)

at io.datafx.controller.flow.Flow.startInStage(Flow.java:406)

at application.MainApp.start(MainApp.java:16)

at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(Unknown Source)

at com.sun.javafx.application.LauncherImpl$$Lambda$51/1285177093.run(Unknown Source)

at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(Unknown Source)

at com.sun.javafx.application.PlatformImpl$$Lambda$45/1051754451.run(Unknown Source)

at com.sun.javafx.application.PlatformImpl.lambda$null$164(Unknown Source)

at com.sun.javafx.application.PlatformImpl$$Lambda$47/483857893.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(Unknown Source)

at com.sun.javafx.application.PlatformImpl$$Lambda$46/1775282465.run(Unknown Source)

at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)

at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)

at com.sun.glass.ui.win.WinApplication.lambda$null$141(Unknown Source)

at com.sun.glass.ui.win.WinApplication$$Lambda$37/1109371569.run(Unknown Source)

... 1 more

Caused by: java.lang.ClassNotFoundException: javax.inject.Inject

at java.net.URLClassLoader$1.run(Unknown Source)

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

... 21 more

Exception running application application.MainApp



Am Mittwoch, 28. Januar 2015 14:42:44 UTC+1 schrieb THC Bigshooter:

Hendrik Ebbers

unread,
Jan 29, 2015, 9:19:55 AM1/29/15
to dataf...@googlegroups.com
Hi,
as described in the tutorial you need the transitive dependencies for DataFX. In your case javax.inject is missing. You can download it here: http://search.maven.org/#artifactdetails%7Cjavax.inject%7Cjavax.inject%7C1%7Cjar

THC Bigshooter

unread,
Jan 29, 2015, 9:27:17 AM1/29/15
to dataf...@googlegroups.com
Oh, that's odd. Wasn't it enough to add the injection jar described in the tutorial? I've done that.

Hendrik Ebbers

unread,
Jan 29, 2015, 9:33:00 AM1/29/15
to THC Bigshooter, dataf...@googlegroups.com
You need the injection jar only if you want to use dependency injection. This is a new feature for DataFX that will be described with the next tutorial. Normally you donÄt need it. But when adding the jar you need to add it dependencies, too.


--
You received this message because you are subscribed to the Google Groups "DataFX" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datafx-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

THC Bigshooter

unread,
Jan 29, 2015, 9:33:30 AM1/29/15
to dataf...@googlegroups.com
Now I understand, I see that i'll miss a few more, where can I find them?


Am Donnerstag, 29. Januar 2015 15:19:55 UTC+1 schrieb Hendrik Ebbers:

Hendrik Ebbers

unread,
Jan 29, 2015, 9:38:08 AM1/29/15
to THC Bigshooter, dataf...@googlegroups.com
You can download them all at Maven Central. Have a look at the pom.xml files of DataFX modules and its dependencies at Maven central. In this files is a section <dependencies>….</dependencies> that include all needed dependencies. All have defined a group-id, artifact-id and version and can be found at maven central.

THC Bigshooter

unread,
Jan 29, 2015, 9:48:38 AM1/29/15
to dataf...@googlegroups.com, dbigs...@gmail.com
Oh okay, and it's enough just to add them to build path as well?

THC Bigshooter

unread,
Jan 29, 2015, 9:54:17 AM1/29/15
to dataf...@googlegroups.com, dbigs...@gmail.com
Thanks! Now I am able to see the first stage, but when I click the button nothing happens? I've followed your tutorial completely.

Hendrik Ebbers

unread,
Jan 29, 2015, 9:59:00 AM1/29/15
to THC Bigshooter, dataf...@googlegroups.com
add the following method to you controllers:

@PostConstruct
public void init() {
System.out.println(„Value of the Button „ + RentalsAdministration);
}

if RentalsAdministration is null you have an problem with the FXML or fx:id.

They should all work. You can compare them with your code

Hendrik

THC Bigshooter

unread,
Jan 29, 2015, 10:07:33 AM1/29/15
to dataf...@googlegroups.com, dbigs...@gmail.com
Oh, it seems like there a difference in the tutorial compared to the link? Before the class definition of the controller you have @ViewController in the code, but in the tutorial you have @FXMLController? If I try to replace FXMLController with ViewController it can't seem to find it.

THC Bigshooter

unread,
Jan 29, 2015, 10:09:30 AM1/29/15
to dataf...@googlegroups.com, dbigs...@gmail.com
What are you refering to with RentalsAdministration?


Am Donnerstag, 29. Januar 2015 15:59:00 UTC+1 schrieb Hendrik Ebbers:

Hendrik Ebbers

unread,
Jan 29, 2015, 10:11:38 AM1/29/15
to THC Bigshooter, dataf...@googlegroups.com
Yes,

Next week DataFX 8 will come and in this version some annotation names changed. Therefore I already changed the tutorials in the last version of the code. The link was wrong. Here is the right one: https://bitbucket.org/datafx/datafx/src/2d65ac12083005354a7517ee14a33d799843e650/modules/tutorials/?at=8.0

THC Bigshooter

unread,
Jan 29, 2015, 10:18:13 AM1/29/15
to dataf...@googlegroups.com, dbigs...@gmail.com
Still doesn't seem to work, even though I copied every single line of code :/

Hendrik Ebbers

unread,
Jan 29, 2015, 10:24:17 AM1/29/15
to THC Bigshooter, dataf...@googlegroups.com
Any errors or messages on the console?

THC Bigshooter

unread,
Jan 29, 2015, 10:27:40 AM1/29/15
to dataf...@googlegroups.com, dbigs...@gmail.com
Nothing at all, the button just doesn't react.

THC Bigshooter

unread,
Jan 29, 2015, 10:36:21 AM1/29/15
to dataf...@googlegroups.com, dbigs...@gmail.com
I tried to add the postContruct to the View2Controller to make it print something when called, but the button doesn't seem to call it. If you set the View2Controller to the startup view, it work thoug,h.


Am Donnerstag, 29. Januar 2015 16:24:17 UTC+1 schrieb Hendrik Ebbers:

THC Bigshooter

unread,
Jan 29, 2015, 10:47:03 AM1/29/15
to dataf...@googlegroups.com, dbigs...@gmail.com
I've now tried to copy Toturial 3 as well, and same result, no reaction when pressen the button.


Am Donnerstag, 29. Januar 2015 16:24:17 UTC+1 schrieb Hendrik Ebbers:

Hendrik Ebbers

unread,
Jan 29, 2015, 11:01:40 AM1/29/15
to THC Bigshooter, dataf...@googlegroups.com
Can you create zip and upload it?

THC Bigshooter

unread,
Jan 29, 2015, 11:08:32 AM1/29/15
to dataf...@googlegroups.com, dbigs...@gmail.com
There you go, it's the tutorial 3 :)
dataFXTutorial.zip

Hendrik Ebbers

unread,
Jan 29, 2015, 11:15:01 AM1/29/15
to THC Bigshooter, dataf...@googlegroups.com
Will have a look at it later.

<dataFXTutorial.zip>

THC Bigshooter

unread,
Jan 29, 2015, 11:15:21 AM1/29/15
to dataf...@googlegroups.com, dbigs...@gmail.com
Thanks! I really appreciate it!

THC Bigshooter

unread,
Jan 30, 2015, 8:29:23 AM1/30/15
to dataf...@googlegroups.com, dbigs...@gmail.com
I tried to contact one of my professors to look at it, and he couldn't figure it out either, so I'm pretty much relying on you guys :D

Hendrik Ebbers

unread,
Jan 30, 2015, 11:22:41 AM1/30/15
to dataf...@googlegroups.com, dbigs...@gmail.com
Hi, you are mixing dependencies with different version. When using DataFX you should always use the same version for all DataFX dependencies. 
In your project you have flow-8.0.7 and injection-8.0 for example
Use 8.0 for all DataFX dependencies.

THC Bigshooter

unread,
Jan 30, 2015, 11:46:12 AM1/30/15
to dataf...@googlegroups.com, dbigs...@gmail.com
Oh thanks! Can you provide me a link for those? I must have mixed up

THC Bigshooter

unread,
Jan 30, 2015, 11:47:45 AM1/30/15
to dataf...@googlegroups.com, dbigs...@gmail.com
I used this link from the tutorial, that seems to be the 8.0.7: http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22io.datafx%22

Łukasz Drabiuk

unread,
Jan 30, 2015, 11:49:16 AM1/30/15
to dataf...@googlegroups.com, dbigs...@gmail.com
http://mvnrepository.com/artifact/io.datafx
link for repository this is my pom now for some dependency what i need
  <dependencies>
      <dependency>
        <groupId>io.datafx</groupId>
        <artifactId>flow</artifactId>
        <version>8.0</version>
    </dependency>
    <dependency>
        <groupId>io.datafx</groupId>
        <artifactId>injection</artifactId>
        <version>8.0</version>
    </dependency>
    <dependency>
        <groupId>io.datafx</groupId>
        <artifactId>datasources</artifactId>
        <version>8.0</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.34</version>
    </dependency>
   </dependencies>

THC Bigshooter

unread,
Jan 30, 2015, 11:54:08 AM1/30/15
to dataf...@googlegroups.com, dbigs...@gmail.com
Thanks! It seems to work now! Why should I use 8.0 instead of 8.0.7 btw?

Hendrik Ebbers

unread,
Feb 3, 2015, 4:34:51 AM2/3/15
to dataf...@googlegroups.com, dbigs...@gmail.com
8.0.7. is a wrong / broken release and I don't know how to remove it from maven central. 
Reply all
Reply to author
Forward
0 new messages