summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-05-22 17:24:33 +0300
committerArtur Signell <artur@vaadin.com>2013-05-23 09:40:22 +0300
commitada3311f7846e812a10547756ce7724f3d4dba6a (patch)
tree7014004fd756e5de749829dc63e7752ba930437b
parent7cced5e30efbd51bca240aa7324a7edde2b97272 (diff)
downloadvaadin-framework-ada3311f7846e812a10547756ce7724f3d4dba6a.tar.gz
vaadin-framework-ada3311f7846e812a10547756ce7724f3d4dba6a.zip
Avoid creating an instance of every view while searching for the correct view (#11722)
Change-Id: Ifab9aa0021bde58280fd75370e5df46fb5efa7a7
-rw-r--r--server/src/com/vaadin/navigator/Navigator.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/server/src/com/vaadin/navigator/Navigator.java b/server/src/com/vaadin/navigator/Navigator.java
index df05a9fbce..540a3ee302 100644
--- a/server/src/com/vaadin/navigator/Navigator.java
+++ b/server/src/com/vaadin/navigator/Navigator.java
@@ -497,19 +497,22 @@ public class Navigator implements Serializable {
*/
public void navigateTo(String navigationState) {
String longestViewName = null;
+ ViewProvider longestViewNameProvider = null;
View viewWithLongestName = null;
for (ViewProvider provider : providers) {
String viewName = provider.getViewName(navigationState);
if (null != viewName
&& (longestViewName == null || viewName.length() > longestViewName
.length())) {
- View view = provider.getView(viewName);
- if (null != view) {
- longestViewName = viewName;
- viewWithLongestName = view;
- }
+ longestViewName = viewName;
+ longestViewNameProvider = provider;
}
}
+ if (longestViewName != null) {
+ viewWithLongestName = longestViewNameProvider
+ .getView(longestViewName);
+ }
+
if (viewWithLongestName == null && errorProvider != null) {
longestViewName = errorProvider.getViewName(navigationState);
viewWithLongestName = errorProvider.getView(longestViewName);