Java Code Examples for com.vaadin.flow.server.VaadinSession#getAttribute()
The following examples show how to use
com.vaadin.flow.server.VaadinSession#getAttribute() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebComponentUI.java From flow with Apache License 2.0 | 6 votes |
static SessionEmbeddedComponentRegistry getSessionRegistry( VaadinSession session) { Objects.requireNonNull(session, "Null session is not supported for session route registry"); SessionEmbeddedComponentRegistry registry = session .getAttribute(SessionEmbeddedComponentRegistry.class); if (registry == null) { registry = new SessionEmbeddedComponentRegistry(session); session.setAttribute(SessionEmbeddedComponentRegistry.class, registry); } if (!registry.session.equals(session)) { throw new IllegalStateException(String.format( "Session has an attribute for %s registered for " + "another session!", SessionEmbeddedComponentRegistry.class .getSimpleName())); } return registry; }
Example 2
Source File: AbstractNavigationStateRenderer.java From flow with Apache License 2.0 | 5 votes |
static boolean hasPreservedChainOfLocation(VaadinSession session, Location location) { final PreservedComponentCache cache = session .getAttribute(PreservedComponentCache.class); return cache != null && cache.values().stream() .anyMatch(entry -> entry.getFirst().equals(location.getPath())); }
Example 3
Source File: AbstractNavigationStateRenderer.java From flow with Apache License 2.0 | 5 votes |
static Optional<ArrayList<HasElement>> getPreservedChain( VaadinSession session, String windowName, Location location) { final PreservedComponentCache cache = session .getAttribute(PreservedComponentCache.class); if (cache != null && cache.containsKey(windowName) && cache .get(windowName).getFirst().equals(location.getPath())) { return Optional.of(cache.get(windowName).getSecond()); } else { return Optional.empty(); } }
Example 4
Source File: AbstractNavigationStateRenderer.java From flow with Apache License 2.0 | 5 votes |
static void setPreservedChain(VaadinSession session, String windowName, Location location, ArrayList<HasElement> chain) { PreservedComponentCache cache = session .getAttribute(PreservedComponentCache.class); if (cache == null) { cache = new PreservedComponentCache(); } cache.put(windowName, new Pair<>(location.getPath(), chain)); session.setAttribute(PreservedComponentCache.class, cache); }
Example 5
Source File: AbstractNavigationStateRenderer.java From flow with Apache License 2.0 | 4 votes |
static boolean hasPreservedChain(VaadinSession session) { final PreservedComponentCache cache = session .getAttribute(PreservedComponentCache.class); return cache != null && !cache.isEmpty(); }