Open ctoabidmaqbool opened 1 year ago
First, the Changes in JPro Plugins are independent of the changes in the routing. So you can update them independently.
It's mentioned in the release note how to migrate the Gradle/Maven plugin: https://www.jpro.one/docs/current/3.1/2023.1.X
It looks like now there is no need to extend extends Javafx Application or extends JProApplication? JPro extends View not works anymore? And some other confusions!
You can still extend Application / JProApplication. The class RouteApp itself is an "Application" by itself.
The old "WebApp" is now called "RouteNode". But usually, the RouteApp is used instead - which internally uses the RouteNode.
But the changes in the Routing shouldn't be too complicated.
But for now - if you are stuck somewhere, just ask.
The Plan for the near future is to use the Routing framework for our HelloWorld projects. We will also add more detailed examples, which feel more like a small web application.
Then we will also add more detailed documentation to the routing as a part of the JPro documentation.
Say for example how to use JPro View?
I have tried the following code sample:
package com.jpro.hellojpro;
import com.jpro.routing.Route;
import com.jpro.routing.RouteApp;
import com.jpro.routing.View;
import javafx.scene.Node;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import static com.jpro.routing.RouteUtils.getNode;
import static com.jpro.routing.RouteUtils.redirect;
public class App extends RouteApp {
@Override
public Route createRoute() {
return Route.empty()
.and(redirect("/", "/info"))
.and(getNode("/info", (r) -> new InfoPage().content()));
}
}
class InfoPage extends View {
@Override
public String title() {
return "Sample JPro Page";
}
@Override
public String description() {
return "This is a simple page where JPro testing done.";
}
@Override
public Node content() {
StackPane root = new StackPane() ;
Label lblText = new Label("Sample JPro Page");
root.getChildren().add(lblText);
return root;
}
}
The output is:
See here for example, the title and description of page is not showing, it's means JPro -> View
is not working propperly.
Before adding <meta name="description" content="temp">
line in defaultpage, there was some error line showing in console, but now error is not showing still description's content is empty after page showing.
Console logs:
10:41:03 AM: Executing 'jproRun'...
> Configure project :
Project : => no module-info.java found
> Task :compileJava UP-TO-DATE
> Task :processResources
> Task :classes
> Task :jar
> Task :startScripts
> Task :distTar
> Task :distZip
> Task :assemble
> Task :prepareBrowser
ERROR: The process "2364" not found.
> Task :jproRun
D:\NetBeansProjects\git-projects\JPro-With-HTML-Or-PHP-1\RUNNING_PID already exists. Process with pid: 2364 is being terminated and a new process is getting created.
Process win kill failed with result: 128
[info] a.e.s.Slf4jLogger - Slf4jLogger started
[info] play.api.Play - Application started (Prod) (no global state)
[info] p.c.s.AkkaHttpServer - Enabling HTTP/2 on Akka HTTP server...
[info] p.c.s.AkkaHttpServer - Listening for HTTP on /[0:0:0:0:0:0:0:0]:8070
[info] c.jpro.activity - Starting the server
[info] c.j.i.s.Initializer$ - *** Starting JPro: https://www.jpro.one/ ***
[info] c.j.i.s.Initializer$ - OS: Windows 10
[info] c.j.i.s.Initializer$ - JPro: 2023.1.0
[info] c.j.i.s.Initializer$ - Java version: 17.0.3
[info] c.j.i.s.Initializer$ - JVM: 17.0.3 Azul Systems, Inc.
[info] c.j.i.s.Initializer$ - JavaFX jar: file:/D:/.my-gradle/caches/modules-2/files-2.1/org.openjfx/javafx-graphics/19.0.0.1-jpro+0/d1c5da6e80d214af5386424228203209d16cab/javafx-graphics-19.0.0.1-jpro+0-win.jar
[info] c.j.i.s.Initializer$ - redirected OUT / ERR
[info] c.j.i.s.Initializer$ - installed SLF4JBridge
[warn] javafx - Unsupported JavaFX configuration: classes were loaded from 'unnamed module @7b3892af'
[info] c.j.i.s.Initializer$ - JavaFX version: 19.0.0.1-jpro+0-2022-09-19-075436
[info] c.j.i.s.Initializer$ - finished init!
[info] c.jpro - application requested: default
[info] c.jpro - Creating Application: default
[info] c.jpro - remoteAddress 0:0:0:0:0:0:0:1
[info] c.jpro - host localhost:8070
[info] c.jpro - uri /app/ws/default
G1 Young Generation
G1 Old Generation
goto: http://localhost:8070/
Warning - Invalid Link: http://localhost:8070/
registering popstate
goto: /info
Warning - Invalid Link: http://localhost:8070/info
Another thing, why Warning - Invalid Link are showing, as links are valid!
Instead of .and(getNode("/info", (r) -> new InfoPage().content()));
try and(get("info", (r) -> new InfoPage()
Then also, the title/description will work.
The latest SNAPSHOT build fixes the warning - invalid link
. You can ignore it for now.
How to use SessionManager with latest routing libs e.g. 1.13.0?
As SessionManager is sometimes used by UtilLink.gotoPage(), e.g. #141;
I have tried something like this codding:
public class App extends RouteApp {
@Override
public void start(Stage pStage) {
super.start(pStage);
// SessionManager sessionManager = SessionManager.getDefault(getRouteNode(), getStage());
// sessionManager.start();
}
@Override
public Route createRoute() {
return Route.empty()
.and(redirect("/", "/info"))
.and(get("/info", (r) -> new InfoPage()));
}
}
The SessionManager is used automatically when you use the RouteNode. If you are using one of the methods, which are internally using the SesisonManager, you just have to make sure that this node is already in the SceneGraph when you make the API call.
We could provide a sample that uses the SessionManager, but I guess that would be more misleading.
Hi Devs! A lot of changes in latest JPro e.g.
one.jpro:jpro-gradle-plugin:2023.1.0
andcom.sandec.jpro:jpro-routing-core:0.13.0
with new features and new codding style. Here are some jpro-routing/example.For example, WebApp is now called RouteApp.
But most of the old codding styles are not working anymore, a lot of codding should be change to work with latest JPro plugin. Say for example, how to work with old projects, JPro-Samples/website, JPro-Samples/html-jpro and jpro-routing-sample.
Is there any release notes or specific guide line to migrate to latest plugins?
It looks like now there is no need to extend
extends Javafx Application
orextends JProApplication
?JPro extends View
not works anymore? And some other confusions!One way is to go deeply jpro-routing repository and read git history, but I think, it's long journey, especially if someone is not much know about scala!