public void setInView(boolean isInView) { _delegate.setInView(isInView); }
public void setInView(boolean isInView) { _delegate.setInView(isInView); }
public void setInView(boolean isInView) { _delegate.setInView(isInView); }
public static void setInView(UIViewRoot root, String target, boolean in) { UIComponent container = getResourceContainer(root, target); container.setInView(in); }
private static void removeComponentResources(FacesContext context, List<UIComponent> componentResourcesToRemove, String target) { UIViewRoot view = context.getViewRoot(); for (UIComponent resourceToRemove : componentResourcesToRemove) { if (resourceToRemove != null) { UIComponent container = isMyFacesUsed() ? resourceToRemove.getParent() : resourceToRemove; // setInView(false) forces JSF to not save dynamic remove action in state. // Otherwise JSF will re-execute dynamic remove during restore view phase. // This is unnecessary as CombinedResourceHandler already takes care of it. // See also https://github.com/omnifaces/omnifaces/issues/135 container.setInView(false); view.removeComponentResource(context, resourceToRemove, target); container.setInView(true); } } }
private static void removeComponentResources(FacesContext context, List<UIComponent> componentResourcesToRemove, String target) { UIViewRoot view = context.getViewRoot(); for (UIComponent resourceToRemove : componentResourcesToRemove) { if (resourceToRemove != null) { UIComponent container = isMyFacesUsed() ? resourceToRemove.getParent() : resourceToRemove; // setInView(false) forces JSF to not save dynamic remove action in state. // Otherwise JSF will re-execute dynamic remove during restore view phase. // This is unnecessary as CombinedResourceHandler already takes care of it. // See also https://github.com/omnifaces/omnifaces/issues/135 container.setInView(false); view.removeComponentResource(context, resourceToRemove, target); container.setInView(true); } } }
public void attachRenderer() { final Resizable resizable = this; final UIComponent target = findTarget(resizable); UIOutput out = new Setup(target, resizable); out.setTransient(true); UIComponent parent = target.getParent(); parent.setInView(false); List<UIComponent> siblings = parent.getChildren(); int index = siblings.indexOf(target); siblings.add(index + 1, out); parent.setInView(true); }
public void processEvent(SystemEvent event) throws AbortProcessingException { FacesContext context = FacesContext.getCurrentInstance(); //make resource containers transient so that the removal and addition of resource is not track by the JSF state saving Collection<UIComponent> facets = context.getViewRoot().getFacets().values(); for (UIComponent c: facets) { c.setInView(false); } //add mandatory resources, replace any resources previously added by JSF addMandatoryResources(context); //jsf.js might be added already by a page or component UIComponent jsfResource = ResourceOutputUtil.createTransientScriptResourceComponent("jsf.js", "javax.faces"); //add jsf.js resource or replace it if already added by JSF addOrCollectReplacingResource(context, "jsf.js", "javax.faces", "head", jsfResource); //restore resource containers to non-transient state for (UIComponent c: facets) { c.setInView(true); } }
private static void addNewTransientForm(String id, UIComponent parent) { if( parent.findComponent(id) == null ){ UIForm uiForm = new ShortIdForm(); uiForm.setTransient(true); uiForm.setId(id); //disable capture submit for this form uiForm.getAttributes().put(FormSubmit.DISABLE_CAPTURE_SUBMIT, FormSubmit.DISABLE_CAPTURE_SUBMIT); parent.setInView(false); parent.getChildren().add(uiForm); parent.setInView(true); } }
public void apply(FaceletContext ctx, UIComponent parent) throws IOException { boolean disabled = getDisabled(ctx); if (!disabled) { FacesContext context = FacesContext.getCurrentInstance(); Map attrs = context.getAttributes(); if (!attrs.containsKey(RefreshHandler.class.getName())) { Map<String, Object> viewMap = context.getViewRoot().getViewMap(); viewMap.put(INTERVAL, getInterval(ctx)); viewMap.put(DURATION, getDuration(ctx)); UIOutput refreshSetup = new RefreshSetupOutput(); refreshSetup.setId("refreshSetup"); refreshSetup.setTransient(true); parent.setInView(false); parent.getChildren().add(0, refreshSetup); parent.setInView(true); attrs.put(RefreshHandler.class.getName(), true); } } }
private static void _updateInView(UIComponent component, boolean isInView) { component.setInView(isInView); if (component.getChildCount() > 0) { for (int i = 0, childCount = component.getChildCount(); i < childCount; i++) { UIComponent child = component.getChildren().get(i); _updateInView(child, isInView); } } if (component.getFacetCount() > 0) { for (UIComponent child : component.getFacets().values()) { _updateInView(child, isInView); } } }
private static void publishAfterViewEvents(FacesContext context, Application application, UIComponent component) { component.setInView(true); try { component.pushComponentToEL(context, component); application.publishEvent(context, PostAddToViewEvent.class, component); if (component.getChildCount() > 0) { Collection<UIComponent> clist = new ArrayList<>(component.getChildren()); for (UIComponent c : clist) { publishAfterViewEvents(context, application, c); } } if (component.getFacetCount() > 0) { Collection<UIComponent> clist = new ArrayList<>(component.getFacets().values()); for (UIComponent c : clist) { publishAfterViewEvents(context, application, c); } } } finally { component.popComponentFromEL(context); } }
private static void publishAfterViewEvents(FacesContext context, Application application, UIComponent component) { component.setInView(true); try { component.pushComponentToEL(context, component); application.publishEvent(context, PostAddToViewEvent.class, component); if (component.getChildCount() > 0) { Collection<UIComponent> clist = new ArrayList<>(component.getChildren()); for (UIComponent c : clist) { publishAfterViewEvents(context, application, c); } } if (component.getFacetCount() > 0) { Collection<UIComponent> clist = new ArrayList<>(component.getFacets().values()); for (UIComponent c : clist) { publishAfterViewEvents(context, application, c); } } } finally { component.popComponentFromEL(context); } }
private static void disconnectFromView(FacesContext context, Application application, UIComponent component) { application.publishEvent(context, PreRemoveFromViewEvent.class, component); component.setInView(false); component.compositeParent = null; if (component.getChildCount() > 0) { List<UIComponent> children = component.getChildren(); for (UIComponent c : children) { disconnectFromView(context, application, c); } } if (component.getFacetCount() > 0) { Map<String, UIComponent> facets = component.getFacets(); for (UIComponent c : facets.values()) { disconnectFromView(context, application, c); } } }
private static void disconnectFromView(FacesContext context, Application application, UIComponent component) { application.publishEvent(context, PreRemoveFromViewEvent.class, component); component.setInView(false); component.compositeParent = null; if (component.getChildCount() > 0) { List<UIComponent> children = component.getChildren(); for (UIComponent c : children) { disconnectFromView(context, application, c); } } if (component.getFacetCount() > 0) { Map<String, UIComponent> facets = component.getFacets(); for (UIComponent c : facets.values()) { disconnectFromView(context, application, c); } } }
private static void disconnectFromView(FacesContext context, Application application, UIComponent component) { application.publishEvent(context, PreRemoveFromViewEvent.class, component); component.setInView(false); component.compositeParent = null; if (component.getChildCount() > 0) { List<UIComponent> children = component.getChildren(); for (UIComponent c : children) { disconnectFromView(context, application, c); } } if (component.getFacetCount() > 0) { Map<String, UIComponent> facets = component.getFacets(); for (UIComponent c : facets.values()) { disconnectFromView(context, application, c); } } }
private static void disconnectFromView(FacesContext context, Application application, UIComponent component) { application.publishEvent(context, PreRemoveFromViewEvent.class, component); component.setInView(false); component.compositeParent = null; if (component.getChildCount() > 0) { List<UIComponent> children = component.getChildren(); for (UIComponent c : children) { disconnectFromView(context, application, c); } } if (component.getFacetCount() > 0) { Map<String, UIComponent> facets = component.getFacets(); for (UIComponent c : facets.values()) { disconnectFromView(context, application, c); } } }
private static void disconnectFromView(FacesContext context, Application application, UIComponent component) { application.publishEvent(context, PreRemoveFromViewEvent.class, component); component.setInView(false); component.compositeParent = null; if (component.getChildCount() > 0) { List<UIComponent> children = component.getChildren(); for (UIComponent c : children) { disconnectFromView(context, application, c); } } if (component.getFacetCount() > 0) { Map<String, UIComponent> facets = component.getFacets(); for (UIComponent c : facets.values()) { disconnectFromView(context, application, c); } } }
private static void disconnectFromView(FacesContext context, Application application, UIComponent component) { application.publishEvent(context, PreRemoveFromViewEvent.class, component); component.setInView(false); component.compositeParent = null; if (component.getChildCount() > 0) { List<UIComponent> children = component.getChildren(); for (UIComponent c : children) { disconnectFromView(context, application, c); } } if (component.getFacetCount() > 0) { Map<String, UIComponent> facets = component.getFacets(); for (UIComponent c : facets.values()) { disconnectFromView(context, application, c); } } }
public void buildMenuFromModel() { MenuModel model = (MenuModel) getModel(); if(model != null) { setInView(false); getChildren().clear(); for(UIComponent kid : model.getMenus()) { setTransientRecursive(kid); UIComponent p = kid.getParent(); if (p != null) { p.setInView(false); kid.setId(kid.getId()); kid.setParent(null); } getChildren().add(kid); } markAsBuiltFromModel(); setInView(true); } }