nalukit / nalu Goto Github PK
View Code? Open in Web Editor NEWRouting based application framework for GWT & J2CL
License: Apache License 2.0
Routing based application framework for GWT & J2CL
License: Apache License 2.0
Looking forward when Nalu will have modules, the context will be the only class that all sub modules must know. To avoid having a core module containing the context class, create an abstract context class containing a HashMap<String, Object> to store the data o f the context.
The simplest way to use it, will be extending AbstractContext.
In this case you need to cast the return every time you get data from the context.
A more likely method will be writing a getter method for each data expected inside the data store and cast the data inide the return statement.
Looking for native english speakers to improve documentation
Using different version for the client and the processor may leads to bugs that are hard to find.
To check it, generate the processor version into the generated applilcationImpl class and compare it with the version of client framework. In case they are not the same, log an error message to the browser console and stop starting the application.
Right now controllers, components, and composites have to have a public, zero-argument constructor. This works well with APT and code generation but limits the possible use cases.
For instance, I'd like to use Elemento templates as components. This is currently not possible since Elemento templates don't have a public, zero-argument constructor. Instead, they have to be created using a static factory method (which returns the generated template class).
As a workaround, I have two "views":
render
method of the component.I use this technique in one of my projects. See the code in package org.jboss.schlawiner.client.settings as an example.
If Nalu provided a way to customize the creation of the component, I could get rid of the extra "view" class.
Create the possibility to log all user actions.
User actions are:
Nalu supports caching of a controller. But, there is no chance to ask the router, if a controlle ris cached.
Add a method to the router, which accepts a controller instance, that will return the caching state of a controller.
Use case:
The component was destroyed and created a new one so the last status is lost. We should have a way to conditionally avoid this behaviour.
Can be similar to this: https://github.com/gilberto-torrezan/gwt-views#caching
On Vue we can obtain a similar results using keep-alive feature: https://vuejs.org/v2/api/#keep-alive
Angular has too this feature: https://medium.com/@gerasimov.pk/how-to-reuse-rendered-component-in-angular-2-3-with-routereusestrategy-64628e1ca3eb
Please add the route to the RoutingEvent.
Currently, I can listen for the event, but I do not know where the user routed to.
At the moment Nalu does not support controllers that does not have a route. The only Nalu component are handlers, which have by definition no visible part.
Create a feature in Nalu, that a controller can be triggered by an event.
The controller of this new feature
This feature will make it quite easy to deal with popups using Nalu.
In some cases it might be necessary to compare routes. Depending on the context of the route, parameters might be differently marked.
Provided methods that handle these different notations.
Blocks are visible components which does not depend on an event nor a route.
Blocks have a relative position to there parent element (must be coded by the dev)
A filter policy describes when the filter will be used.
Default will be every time, so that in case of a routing the filter will be used.
The policy will tell Nalu, that the filter will be used only for some routes or depending on a condition.
A controller uses the variable name inside the name. A definition looks like that:
/application/:token/dashboard
To route to this controller a String like this is expected:
/application/*/dashboard
This needs more coding in case the routes are gather inside another class, cause this required to entries for one routing.
Using the first string to route causes an error. Allow using the first String to route.
Starting with Java 9 the SimpleTypeVisitor6
-class gets deprecated.
Replace it with SimpleTypeVisitor8.
The Loader (AbstractApplicationLoader
) enables the application to load data from server and wait for finishing the load process with finishLoadCommand.finishLoading();
A same idea can be used within the Controller (AbstractComponentController
) in the bind
-function with loader.continueLoading();
In my case I need to load data from the server during the change of the Shell (AbstractShell
), so that the retrieved data can be added to the context and used in every Controller in this Shell.
The change of the bind
-function seems to be a breaking change. Maybe a bindTillFinished
-function would be a possibility to implement this without any breaks.
As reported here: https://blog.travis-ci.com/2018-11-19-required-linux-infrastructure-migration, Travis CI does no longer support 'sudo: false' and requested to remove it.
Remove 'sudo:false' from travis.yml.
Add HandlerManager to the controller, so that event handler registrations can be added.
Once the controller stops, Nalu can remove all handler registrations from the event bus automatically. (as long they are registered at the HandlerManager)
In a multi module envirement. a generic event is needed to enable a communication between modules without sharing a common module.
This event shout have an event type (String) and a store.
In some cases it might be necessary to inject the router instance into some application classes that are created during application load.
Nalu is moving forward for the first release and to be deployed on Maven Central with version 1.0.0.
Because of the dependency to "org.gwtproject.event:gwt-event", there are problems using Nalu because of the vertispan repo - where gwt-event is currently hosted. Some enterprises do not allow to use repo, that are not Maven Central or Maven Central SNAPSHOT.
To solve this problem, the gwt-event source files are (temporally) added to Nalu.
Once gwt-event is deployed on Maven Central, the source files of gwt-event will be removed and the dependency to gwt-event will be added (again).
The new feature "caching composites" doesn't work as expected.
If you have two components A and B configured with a cached composite the following happens:
In both controllers of the components the same composite configuration is used:
@composite(name = "searchComposite", compositeController = SearchComposite.class, selector = "searchId")
Can you please add a method called onLoaded maybe, which is called AFTER the component was added to the DOM.
Background: I have to add a 3rd party app which is looking for DIV with a certain ID to render some stuff.
Thank you
Nalu redirect to error page when there is no hash passed. It should instead redirect to starturl/home which is declared in Nalu Applicatio Configuration.
This is happening only when You start app with no hash url like https://host or https://host/index.html and then go to nalu subpage and then go back using back browser button url back android button.
at the moment the error gets represented by using the error route. This is limited.
Instead using the error route, fire an error event, which can be catched by a controller, PopUpController, Handler, etc. and handles the error.
It would be grate, if Nalu allowed the creation of "Items" (Sorry, I do not have a better name).
It would be something like a Composite, so a sub-unit/item with context/eventbus (maybe without router). But I want to create multiple of these items with code, and not like a composite with an annotation.
Think about it like a "BasketComponent" which has several "BasketItems" with their one logic like changing the quantity, removing etc.
It would be nice if composite component could be conditional. For example, if you have one page with the same content and depending on who has been logged in, you can have one composite component or another
This issue extends the solution of #51 .
Add a new attribute to the Application annotation: stayOnSide
. Default value is false. In this case Nalu will behave like a web application using the back button.
In case the value is true, Nalu will replace the url.
It would be nice, if you would add getContext() and getRouter() in AbstractController to use it more comfortable in anonymous Classes.
In some cases (caching controllers) there is a need to get control over activation state of contollers. For example if you route from one controller to another while caching is enabled. If the controller is already cached the method start would't be called. In this cases it would be useful to have methods activate()
and deactivate()
to do things when the component will be shown or hidden.
Controllers can be cached for reusing.
router.storeInCache({controller instance});
It would be useful to also have this caching feature for composites.
The onAttach()-method of composites gets not called.
The onAttach()-method of a method should be called, once a composite gets attached to a component.
mark plugin feature as deprecated ...
In case a composite is added to the shell, it will no be removed in case a routing occurs.
Solution:
provide an easy way to access query parameters of the start url.
Inside the controller and composites, the attach- and detach-methods are called onAttach
and onDetach
.
Inside a shell these methods are called attachShell
and detachShell
.
Rename this methods to onAttach
and onDetach
to be consistent with controller- and composites-classes.
create the possibility to add more than one Nalu application to a host page.
implement a sub module feature where Nalu work with independent modules.
once sub modules (#62) are implemented, there is no longer a need for the plugin feature.
Remove the plugin feature from Nalu.
Controller in Nalu provide a automatic handler registration feature to automatically remove handler registrations onDetach of a component.
Add this feature also to Components.
Please add support for rest api like routing. Currently we have to add parameters at the end of resource url. It will be great to have dynamic url like: app/users/23/adressess.
So we could add variables/ parameters inside the url. Not only at the end.
Please add a "RoutingEvent" in Nalu, which I can listen for.
Background is: The "current menu" items is highlighted, but when the route changes, the old menu item is still highlighted. I want to change that.
In a Nalu PopupController I do a router.route("xxxxx")
and I get an
Exception: com.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot read property 'route_5_g$' of undefined
This seems to be a bug in Nalu,b ecause routing outside a PopupController
works.
Nalu has an error route to communicate internal errors. Therefore the router has an internal Nalu Error Message class. This class can not be used, caused it is not accessable.
It would be nice to have the opportunity to add application error messages to the router, so that they can be requested inside an error controller.
Add a bind method to the controller, that will be called before the component is created.
This method enables the controller todo some things before the start method is called. This is f.e.: useful in case working with composites.
The newly implemented bind method should be asynchron, so that it is possible to do a server call inside this method.
In case a composite is added to the shell, it will no be removed in case a routing occurs.
Solution:
As example see https://github.com/errai/errai/blob/master/errai-navigation/src/main/java/org/jboss/errai/ui/nav/client/local/HistoryWrapper.java
I have slightly improved version of Errai class, see attached zip.
browserhistory.zip
The generation of the Composite registration is generated two times for every:
@Override
public void loadCompositeController() {
// create Composite for: com.github.nalukit.nalu.processor.common.ui.controllerWithComposite03.composite.CompositeController03
CompositeFactory.get().registerComposite("com.github.nalukit.nalu.processor.common.ui.controllerWithComposite03.composite.CompositeController03", new com.github.nalukit.nalu.processor.common.ui.controllerWithComposite03.composite.CompositeController03CreatorImpl(router, context, eventBus));
// create Composite for: com.github.nalukit.nalu.processor.common.ui.controllerWithComposite03.composite.CompositeController03
CompositeFactory.get().registerComposite("com.github.nalukit.nalu.processor.common.ui.controllerWithComposite03.composite.CompositeController03", new com.github.nalukit.nalu.processor.common.ui.controllerWithComposite03.composite.CompositeController03CreatorImpl(router, context, eventBus));
}
This does not create any issues, cause the factory uses a map and an existing key will be replaced!
Avoid the duplicate code generation.
Thanks David for reporting ...
In case a controller uses the caching feature, caching does not work.
I am developing a little Nalu app. It will be an order form "living" in an existing webpage.
I think a div displayed as a popup or so.
This means I have no control over the URL which Nalu uses for routing. On the other side, I do not need to support deeplinking or "reload"ing the page and preserve states.
According to Frank, "the current version does not support it. But it should be easy to do. "
So I am asking for this feature to be implemented!
Thank you,
Bernhard
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.