return getFacesContext().getViewRoot().getViewMap();
return getFacesContext().getViewRoot().getViewMap();
/** * <p class="changed_added_2_0">This implementation simply calls through to {@link * #getViewMap(boolean)}, passing <code>true</code> as the argument, and * returns the result.</p> * <div class="changed_added_2_0"> * * @since 2.0 */ public Map<String, Object> getViewMap() { return getViewMap(true); }
/** * <p class="changed_added_2_0">This implementation simply calls through to {@link * #getViewMap(boolean)}, passing <code>true</code> as the argument, and * returns the result.</p> * <div class="changed_added_2_0"></div> * * @return the view map, or <code>null</code>. * @since 2.0 */ public Map<String, Object> getViewMap() { return getViewMap(true); }
/** * @since 2.0 */ public Map<String, Object> getViewMap() { return this.getViewMap(true); }
/** * <p class="changed_added_2_0">This implementation simply calls through to {@link * #getViewMap(boolean)}, passing <code>true</code> as the argument, and * returns the result.</p> * <div class="changed_added_2_0"> * * @since 2.0 */ public Map<String, Object> getViewMap() { return getViewMap(true); }
public void handle(String name, Object bean, FacesContext context) { Map<String, Object> viewMap = context.getViewRoot().getViewMap(); if (viewMap != null) { viewMap.put(name, bean); } }
@Override public boolean isInScope(String name, FacesContext context) { Map<String,Object> viewMap = context.getViewRoot().getViewMap(false); return ((viewMap != null) && viewMap.containsKey(name)); }
static Object getViewParam(FacesContext facesContext, String name) { UIViewRoot viewRoot = facesContext.getViewRoot(); if (null == viewRoot) { return null; } Map viewMap = viewRoot.getViewMap(); if(viewMap == null){ return null; } return viewMap.get(name); }
private static Map getOrCreateViewMap() { FacesContext facesContext = FacesContext.getCurrentInstance(); if (facesContext==null) { throw new IllegalStateException("no FacesContext bound to current thread"); } UIViewRoot viewRoot = facesContext.getViewRoot(); return viewRoot==null ? new HashMap() : viewRoot.getViewMap(); }
@Bean("viewScope") @Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE, proxyMode = ScopedProxyMode.INTERFACES) @ConditionalOnMissingBean(name = "viewScope") public Map<String, Object> viewMap() { return FacesContext.getCurrentInstance().getViewRoot().getViewMap(); }
@SuppressWarnings("unchecked") public static void setNeedsFontsAwesome(Object uiComponent) { FacesContext context = FacesContext.getCurrentInstance(); UIViewRoot root = context.getViewRoot(); Map<String, Object> viewMap = root.getViewMap(); ArrayList<Object> list = (ArrayList<Object>) viewMap.get(FONTAWESOME_USED); if (list == null) { list = new ArrayList<Object>(); viewMap.put(FONTAWESOME_USED, list); } list.add(uiComponent); }
public static String getNonce(final FacesContext facesContext) { final UIViewRoot viewRoot = facesContext.getViewRoot(); String nonce = (String) viewRoot.getViewMap().get(KEY); if (nonce == null) { nonce = RandomUtils.nextString(); LOG.debug("Creating nonce='{}'", nonce); viewRoot.getViewMap().put(KEY, nonce); } return nonce; } }
private void saveConversationViewRoot() { Map renderedViewRootAttributes = facesContext.getViewRoot().getViewMap(); if (renderedViewRootAttributes != null && conversationId != null) { Map conversationState = new HashMap(); conversationState.putAll(renderedViewRootAttributes); conversationViewRootAttributes.put(conversationId, conversationState); } }
public void saveOldDocument() throws IOException { FacesContext facesContext = FacesContext.getCurrentInstance(); if (!EnvUtils.isCompressDOM(facesContext)) { facesContext.getViewRoot().getViewMap().put(OLD_DOM, document); return; } byte[] data = serializeDocument(document); facesContext.getViewRoot().getViewMap().put(OLD_DOM, data); }
protected Map<String, Object> getViewMap() { UIViewRoot viewRoot = getViewRoot(); if (viewRoot != null) { return viewRoot.getViewMap(true); } return null; }
@Override public void processEvent(SystemEvent event) { UIViewRoot root = (UIViewRoot) event.getSource(); root.getViewMap(false).values().stream() .filter(DestructionCallbackWrapper.class::isInstance) .map(DestructionCallbackWrapper.class::cast) .forEach(DestructionCallbackWrapper::onViewDestroy); getSessionListener().cleanup(); }
@Produces @Named("viewScope") @ViewMap @ViewTransientScoped public Map<String, Object> getViewMap() { return FacesContext.getCurrentInstance().getViewRoot().getViewMap(); }
@Override public Object get(String name, ObjectFactory objectFactory) { Map<String, Object> viewMap = getViewRoot().getViewMap(); Object bean = viewMap.get(name); if (bean == null) { bean = objectFactory.getObject(); viewMap.put(name, bean); } return bean; }
@Override public void registerDestructionCallback(String name, Runnable callback) { DestructionCallbackWrapper wrapper = new DestructionCallbackWrapper(name, callback); getFacesContext().getApplication().subscribeToEvent(PreDestroyViewMapEvent.class, this.preDestroyViewMapListener); getViewRoot().getViewMap().put(DESTRUCTION_CALLBACK_NAME_PREFIX + name, wrapper); getSessionListener().register(wrapper); }