Hello a stupid question again about flow.

779 views
Skip to first unread message

Rage Guy

unread,
Jul 31, 2014, 8:36:51 AM7/31/14
to dataf...@googlegroups.com
I just started learning the Data-fx Flow API this is at my pom

        <dependency>
            <groupId>org.javafxdata</groupId>
            <artifactId>datafx-flow</artifactId>
            <version>8.0b5</version>
            <type>jar</type>
        </dependency>


at main Main class start method
    public void start(Stage primaryStage) throws Exception {


        Flow flow  = new Flow(MainViewController.class);

        FlowHandler flowHandler = flow.createHandler();

        StackPane pane = flowHandler.start(new DefaultFlowContainer());
        primaryStage.setScene(new Scene(pane));
        primaryStage.show();
}

my .fxml file
<AnchorPane id="AnchorPane" minHeight="640.0" minWidth="1136.0" prefHeight="640.0" prefWidth="1136.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8">
   <children>
      <StackPane fx:id="centerPane" layoutY="30.0" prefHeight="610.0" prefWidth="1136.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="30.0">
         <children>
            <Button fx:id="loginButton" mnemonicParsing="false" onAction="#goToLogin" text="Clickhere to login" />
         </children>
      </StackPane>
   </children>
</AnchorPane>

my main controller class
@FXMLController("Main.fxml")
public class MainViewController {
    
    @FXML
    @ActionTrigger("goToLogin")
    private Button loginButton;
    
    @FXML
    private StackPane centerPane;
    
    private FlowHandler flowHandler;
    
    /**
     * Initializes the controller class.
     * @throws org.datafx.controller.flow.FlowException
     */

    @PostConstruct
    public void init()throws FlowException{
        Flow flow = new Flow(MainViewController.class).
                withLink(MainViewController.class, "goToLogin",LoginViewController.class);
        flowHandler = flow.createHandler();
        centerPane.getChildren().add(flowHandler.start
        (new AnimatedFlowContainer(Duration.millis(320), ContainerAnimations.ZOOM_IN)));
    }
    
    @ActionMethod("goToLogin")
    public void goLogin() throws VetoException, FlowException{
        flowHandler.handle("goToLogin");
    }
    
}

my other controller class
@FXMLController("Login.fxml")
public class LoginViewController{
... ... .. 
    
}

iv'e also got another fxml for this one. but these are the errors when i build / run my application btw i am using NETBEANS 8 with jdk8 and maven(i created the project as a new maven javafx project with netbeans.)
The problem is at line 35, but i don't see something is wrong there.
Exception in Application start method
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Application start method
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:894)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.datafx.controller.flow.FlowException: org.datafx.controller.FxmlLoadException: java.lang.IllegalStateException: Location is not set.
at org.datafx.controller.flow.FlowHandler.start(FlowHandler.java:138)
at org.datafx.controller.flow.Flow.start(Flow.java:274)
at org.datafx.controller.flow.Flow.start(Flow.java:249)
at org.datafx.controller.flow.Flow.startInStage(Flow.java:253)
at com.creamylatte.datafxt.MainApp.start(MainApp.java:35)
at com.sun.javafx.application.LauncherImpl$8.run(LauncherImpl.java:837)
at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
... 1 more
Caused by: org.datafx.controller.FxmlLoadException: java.lang.IllegalStateException: Location is not set.
at org.datafx.controller.ViewFactory.createByController(ViewFactory.java:116)
at org.datafx.controller.flow.FlowHandler.start(FlowHandler.java:135)
... 15 more
Caused by: java.lang.IllegalStateException: Location is not set.
at javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2434)
at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2409)
at org.datafx.controller.ViewFactory.createByController(ViewFactory.java:100)
... 16 more
Exception running application com.creamylatte.datafxt.MainApp

Please respond.




Nicolas Zhang

unread,
Nov 27, 2014, 10:50:36 AM11/27/14
to dataf...@googlegroups.com
I think the key error is 'FxmlLoadException: java.lang.IllegalStateException: Location is not set' which means your fxml path is not correct.
Usually, the fxml file created by netbeans is located at /fxml/yourFileName.fxml, so try to change @FXMLController("Main.fxml") to @FXMLController("/fxml/Main.fxml").

Hendrik Ebbers

unread,
Dec 21, 2014, 9:57:46 AM12/21/14
to dataf...@googlegroups.com
Yes, the path to your fxml file is wrong.
Reply all
Reply to author
Forward
0 new messages