vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.78k stars 729 forks source link

View naming in Navigator API could be more 'statically typed' #2519

Open vaadin-bot opened 12 years ago

vaadin-bot commented 12 years ago

Originally by @emarc


In the new Navigator API, Views are registered using a string, and the API does not help in handling these. This is not ideal.

However, it's not clear how the problem could be adressed; the fragment will obviously always be a String.

One convenient practice is to add a static to each View: MyView.NAME, but this can't be APIfied.

Adding View.getViewName() would remove the need to tell the Navigator explicitly when adding instances, i.e navigator.addView(new MyView()), but would not work when adding classes as navigator.addView("name", MyView.class). One possibility is to provide all of addView(View), addView(String, View), addView(String, Class), where the latter two would 'override' getViewName() - this might be overly complex, though.


Imported from https://dev.vaadin.com/ issue #9057

vaadin-bot commented 12 years ago

Originally by @jdahlstrom


IMO view identifiers should be completely separate from the actual views, to facilitate composability, reuse and eg. localization of URIs.

vaadin-bot commented 12 years ago

Originally by @jdahlstrom


There should be navigateTo(Class<? extends View>) and navigateTo(View). If there are multiple view names mapping to the same View class or instance, the first one should be used to build the navigation state string.

vaadin-bot commented 12 years ago

Originally by @jdahlstrom


Another option could be that addView() return a ViewMapping instance, representing a (viewname, view) pair that can be stored and subsequently used for navigation.

vaadin-bot commented 12 years ago

Originally by @jdahlstrom


Deferring this for now. Needs more real-world usage experience and some careful design decisions.

stale[bot] commented 6 years ago

Hello there!

It looks like this issue hasn't progressed lately. There are so many issues that we just can't deal them all within a reasonable timeframe.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!