-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strategy of creating sidebar and dynamic content views #535
Comments
Hi, We don't have a special tool or API for this use-case yet. Maybe this would be a nice addtion to the framework but it's also not a simple task to implement because in desktop applications there is no such thing as a URL. So there needs to be some brain power put into planing this topic and an API. In the mean time however, you could implement the use-case by yourself. You can load views based on some actions/conditions (like a button in your sidebar is pressed) and put the loaded view node into a content pane and replace existing nodes if any. In the first approach maybe this would result in relatively tight coupling between the action and the view-loading code but you could refactor and generify this afterwards. In my experience it's often easier to first build a naive approach and then refactore generic utils out of it. |
@lestard Thank you for the complete answer. I have tried to find any examples for routing in JavaFX and Mvvmfx powered applications, however haven't found any good examples on this matter. Of course it is possible to implement this by changing content of some container dynamically. But I am looking for something called a "router", as you've already mentioned. Generally, it would be great to implement some kind of routers hierarchy, to handle complex cases when we have multiple screens and each of them has nested routing logic. Your framework, as well as JavaFX out of box, supports a lot of tools for dependency injection, binding, etc. The idea is to create some kind of an orchestrator module that will provide a convenient way for handling complex routing, hiding all details under the hood. A router object should be able to handle transitions between views, have a way to pass arguments between different views, without direct coupling. A similar idea was described by the VIPER architecture Maybe you have any ideas how to implement routing elegantly on the framework level to provide an easy way to handle transitions between views. |
I don't have a good idea yet but I would be more then happy to add such a feature to the framework. It would definitely be in the scope of the project. However, I cannot guarantee to work on such a feature in the next time by myself. Some thoughts on the router topic: I think the first step should be to think about an API to define the location of the app. In web we have URI for this. Maybe we can use URIs here too. We should think about this. Things to keep in mind:
For this we would need a good API to create and work with URIs. Maybe there is something ready to use? The next step is to think about how you define routes. I personally like the dynamic approach of react-router but I think the static approach is more suited for JavaFX and desktop applications. The next step is to create a routing-target component for JavaFX. This component takes the configuration and renderes the defined components based on the current location. And the last step is to create an API to change the current location. For example in react-router there is a As you can see there is a lot to do. In my experience it's best to first focus on API and only as a second step on the implementation. Having a good API that is easy to use is key in framework development. |
Hi, thanks for a great library.
I am hesitating to select a proper way of implementing a UI with a sidebar. It should look like the Google Analitcs WEB UI. So when you click on an option in the sidebar it changes only content view, but the sidebar, the header, the footer stay the same.
Could you please give any advice regarding this question considering MVVM approaches ?
I would be grateful for any help
The text was updated successfully, but these errors were encountered: