@Override public void beforePhase(PhaseEvent event) { FacesContext context = event.getFacesContext(); if (!context.isPostback() || PrimeRequestContext.getCurrentInstance(context).isIgnoreAutoUpdate()) { return; } List<String> clientIds = AutoUpdateListener.getAutoUpdateComponentClientIds(context); if (clientIds != null && !clientIds.isEmpty()) { for (int i = 0; i < clientIds.size(); i++) { String clientId = clientIds.get(i); if (!context.getPartialViewContext().getRenderIds().contains(clientId)) { context.getPartialViewContext().getRenderIds().add(clientId); } } } }
if (context.isPostback() && !context.getPartialViewContext().isRenderAll() && !applicationContext.getEnvironment().isAtLeastJsf23()) {
protected void encodeScript(FacesContext context, ContentFlow cf) throws IOException { WidgetBuilder wb = getWidgetBuilder(context); if (context.isPostback()) { wb.init("ContentFlow", cf.resolveWidgetVar(), cf.getClientId(context)); } else { wb.initWithWindowLoad("ContentFlow", cf.resolveWidgetVar(), cf.getClientId(context)); } wb.finish(); }
public WidgetBuilder init(String widgetClass, String widgetVar, String id) throws IOException { this.renderScriptBlock(id); // AJAX case: since jQuery 3 document ready ($(function() {})) are executed async // this would mean that our oncomplete handlers are probably called before the scripts in the update nodes // or // we can also skip it when MOVE_SCRIPTS_TO_BOTTOM is enabled as the scripts are already executed when everything is ready if ((context.isPostback() && context.getPartialViewContext().isAjaxRequest()) || configuration.isMoveScriptsToBottom()) { this.init(widgetClass, widgetVar, id, false); } else { context.getResponseWriter().write("$(function(){"); this.init(widgetClass, widgetVar, id, true); } return this; }
@Override public void afterPhase(PhaseEvent event) { FacesContext context = event.getFacesContext(); // we only need to collect resources on ajax requests // for non ajax, the head will always be rendered again if (context.getViewRoot() == null || !context.getPartialViewContext().isAjaxRequest()) { return; } // we can also skip non-postback ajax requests, which occurs e.g. without a form if (!context.isPostback()) { return; } // skip update=@all as the head, with all resources, will already be rendered if (context.getPartialViewContext().isRenderAll()) { return; } // JSF 2.3 contains a own dynamic resource handling if (PrimeApplicationContext.getCurrentInstance(context).getEnvironment().isAtLeastJsf23()) { return; } // collect all current resources before new components can be added to the view in later phases List<ResourceUtils.ResourceInfo> initialResources = ResourceUtils.getComponentResources(context); putInitialResources(context, initialResources); }
/** * @deprecated use {@link startTaskForm()} instead * * @param taskId * @param callbackUrl */ @Deprecated public void startTask(String taskId, String callbackUrl) { if (taskId==null || callbackUrl == null) { if (FacesContext.getCurrentInstance().isPostback()) { // if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added // as preRenderView event // see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some return; } // return it anyway but log an info message log.log(Level.INFO, "Called startTask method without proper parameter (taskId='"+taskId+"'; callbackUrl='"+callbackUrl+"') even if it seems we are not called by an AJAX Postback. Are you using the camundaTaskForm bean correctly?"); return; } // Note that we always run in a conversation this.url = callbackUrl; businessProcess.startTask(taskId, true); }
/** * Get processDefinitionKey and callbackUrl from request and start a conversation * to start the form * */ public void startProcessInstanceByKeyForm() { if (FacesContext.getCurrentInstance().isPostback()) { // if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added // as preRenderView event // see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some return; } Map<String, String> requestParameterMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String processDefinitionKey = requestParameterMap.get("processDefinitionKey"); String callbackUrl = requestParameterMap.get("callbackUrl"); this.url = callbackUrl; this.processDefinitionKey = processDefinitionKey; beginConversation(); }
/** * Get processDefinitionId and callbackUrl from request and start a conversation * to start the form * */ public void startProcessInstanceByIdForm() { if (FacesContext.getCurrentInstance().isPostback()) { // if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added // as preRenderView event // see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some return; } Map<String, String> requestParameterMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String processDefinitionId = requestParameterMap.get("processDefinitionId"); String callbackUrl = requestParameterMap.get("callbackUrl"); this.url = callbackUrl; this.processDefinitionId = processDefinitionId; beginConversation(); }
/** * Get taskId and callBackUrl from request and start a conversation * to start the form * */ public void startTaskForm() { Map<String, String> requestParameterMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap(); String taskId = requestParameterMap.get("taskId"); String callbackUrl = requestParameterMap.get("callbackUrl"); if (taskId==null || callbackUrl == null) { if (FacesContext.getCurrentInstance().isPostback()) { // if this is an AJAX request ignore it, since we will receive multiple calls to this bean if it is added // as preRenderView event // see http://stackoverflow.com/questions/2830834/jsf-fevent-prerenderview-is-triggered-by-fajax-calls-and-partial-renders-some return; } // return it anyway but log an info message log.log(Level.INFO, "Called startTask method without proper parameter (taskId='"+taskId+"'; callbackUrl='"+callbackUrl+"') even if it seems we are not called by an AJAX Postback. Are you using the camundaTaskForm bean correctly?"); return; } // Note that we always run in a conversation this.url = callbackUrl; businessProcess.startTask(taskId, true); }
public void encodeScript(FacesContext context, UIComponent component) throws IOException { Galleria galleria = (Galleria) component; String clientId = galleria.getClientId(context); WidgetBuilder wb = getWidgetBuilder(context); if (context.isPostback()) { wb.init("Galleria", galleria.resolveWidgetVar(), clientId); } else { wb.initWithWindowLoad("Galleria", galleria.resolveWidgetVar(), clientId); } wb.attr("showFilmstrip", galleria.isShowFilmstrip(), true) .attr("frameWidth", galleria.getFrameWidth(), 60) .attr("frameHeight", galleria.getFrameHeight(), 40) .attr("autoPlay", galleria.isAutoPlay(), true) .attr("transitionInterval", galleria.getTransitionInterval(), 4000) .attr("effect", galleria.getEffect(), "fade") .attr("effectSpeed", galleria.getEffectSpeed(), 500) .attr("showCaption", galleria.isShowCaption(), false) .attr("panelWidth", galleria.getPanelWidth(), Integer.MIN_VALUE) .attr("panelHeight", galleria.getPanelHeight(), Integer.MIN_VALUE) .attr("custom", (galleria.getFacet("content") != null)); wb.finish(); }
/** * <p>The default behavior of this method is to * call {@link FacesContext#isPostback()} * on the wrapped {@link FacesContext} object.</p> * * @see javax.faces.context.FacesContext#isPostback() */ @Override public boolean isPostback() { return getWrapped().isPostback(); }
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException { if (isAutoUpdate()) { if (FacesContext.getCurrentInstance().isPostback()) { FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(getClientId()); } super.processEvent(event); } }
@Override public void processEvent(ComponentSystemEvent event) throws AbortProcessingException { if (isAutoUpdate()) { if (FacesContext.getCurrentInstance().isPostback()) { FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(getClientId()); } super.processEvent(event); } }
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException { if (isAutoUpdate()) { if (FacesContext.getCurrentInstance().isPostback()) { FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(getClientId()); } super.processEvent(event); } }
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException { if (isAutoUpdate()) { if (FacesContext.getCurrentInstance().isPostback()) { FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(getClientId()); } super.processEvent(event); } }
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException { if (isAutoUpdate()) { if (FacesContext.getCurrentInstance().isPostback()) { FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(getClientId()); } super.processEvent(event); } }
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException { if (isAutoUpdate()) { if (FacesContext.getCurrentInstance().isPostback()) { FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(getClientId()); } super.processEvent(event); } }
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException { if (isAutoUpdate()) { if (FacesContext.getCurrentInstance().isPostback()) { FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(getClientId()); } super.processEvent(event); } }
@Override public void processEvent(ComponentSystemEvent event) throws AbortProcessingException { if (isAutoUpdate()) { if (FacesContext.getCurrentInstance().isPostback()) { FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(getClientId()); } super.processEvent(event); } }
public void processEvent(ComponentSystemEvent event) throws AbortProcessingException { if (isAutoUpdate()) { if (FacesContext.getCurrentInstance().isPostback()) { FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(getClientId()); } super.processEvent(event); } }