private String getMessage(String format) { FacesContext facesContext = FacesContext.getCurrentInstance(); String viewId = facesContext.getViewRoot().getViewId(); UIComponent component = UIComponent.getCurrentComponent(facesContext); String clientId = component == null ? "<unknown>" : component.getClientId(facesContext); return String.format(format, getClass().getName(), clientId, viewId); }
/** * Returns the current UI component from the EL context. * @param <C> The expected component type. * @return The current UI component from the EL context. * @throws ClassCastException When <code>C</code> is of wrong type. * @see UIComponent#getCurrentComponent(FacesContext) */ @SuppressWarnings("unchecked") public static <C extends UIComponent> C getCurrentComponent() { return (C) UIComponent.getCurrentComponent(getContext()); }
@Override public Object getValue(ELContext context) { return UIComponent.getCurrentComponent(facesContext(context)); }
@Override public Object getValue(ELContext context) { return UIComponent.getCurrentComponent(facesContext(context)); }
/** * Returns the current UI component from the EL context. * @param <C> The expected component type. * @return The current UI component from the EL context. * @throws ClassCastException When <code>C</code> is of wrong type. * @see UIComponent#getCurrentComponent(FacesContext) */ @SuppressWarnings("unchecked") public static <C extends UIComponent> C getCurrentComponent() { return (C) UIComponent.getCurrentComponent(getContext()); }
@Override public Object getValue(ELContext context) { return UIComponent.getCurrentComponent(facesContext(context)); }
public static UIComponent findComponent(FacesContext context, String id) { if (id != null) { UIComponent contextComponent = UIComponent.getCurrentComponent(context); if (contextComponent == null) { contextComponent = context.getViewRoot(); } UIComponent component = locator.findComponent(context, contextComponent, id); if (component != null) { return component; } } return null; }
public static UIComponent findComponent(FacesContext context, String id) { if (id != null) { UIComponent contextComponent = UIComponent.getCurrentComponent(context); if (contextComponent == null) { contextComponent = context.getViewRoot(); } UIComponent component = locator.findComponent(context, contextComponent, id); if (component != null) { return component; } } return null; }
public void restoreState(FacesContext context, Object state) { if (context == null) { throw new NullPointerException(); } if (state == null) { return; } Object[] s = (Object[]) state; Object listener = s[0]; wrapped = (ComponentSystemEventListener) ((listener == null) ? UIComponent .getCurrentComponent(context) : ((StateHolderSaver) listener).restore(context)); instanceClass = (Class<?>) s[1]; }
public static UIComponent findComponent(FacesContext context, String id) { if (id != null) { UIComponent contextComponent = UIComponent.getCurrentComponent(context); if (contextComponent == null) { contextComponent = context.getViewRoot(); } UIComponent component = locator.findComponent(context, contextComponent, id); if (component != null) { return component; } } return null; }
public static UIComponent findComponent(FacesContext context, String id) { if (id != null) { UIComponent contextComponent = UIComponent.getCurrentComponent(context); if (contextComponent == null) { contextComponent = context.getViewRoot(); } UIComponent component = locator.findComponent(context, contextComponent, id); if (component != null) { return component; } } return null; }
public void restoreState(FacesContext context, Object state) { if (context == null) { throw new NullPointerException(); } if (state == null) { return; } Object[] s = (Object[]) state; Object listener = s[0]; wrapped = (ComponentSystemEventListener) ((listener == null) ? UIComponent .getCurrentComponent(context) : ((StateHolderSaver) listener).restore(context)); instanceClass = (Class<?>) s[1]; }
private String getMessage(String format) { FacesContext facesContext = FacesContext.getCurrentInstance(); String viewId = facesContext.getViewRoot().getViewId(); UIComponent component = UIComponent.getCurrentComponent(facesContext); String clientId = component == null ? "<unknown>" : component.getClientId(facesContext); return String.format(format, getClass().getName(), clientId, viewId); } }
/** * Restore the state. * * @param context the Faces context. * @param state the state. */ @Override public void restoreState(FacesContext context, Object state) { if (context == null) { throw new NullPointerException(); } if (state == null) { return; } Object[] s = (Object[]) state; Object listener = s[0]; wrapped = (ComponentSystemEventListener) ((listener == null) ? UIComponent .getCurrentComponent(context) : ((StateHolderSaver) listener).restore(context)); instanceClass = (Class<?>) s[1]; }
public ComponentProducer() { super.name("component") .beanClassAndType(UIComponent.class) .create(e -> getCurrentComponent(FacesContext.getCurrentInstance())); }
public ComponentProducer() { super.name("component") .beanClassAndType(UIComponent.class) .create(e -> getCurrentComponent(FacesContext.getCurrentInstance())); }
public ComponentProducer() { super.name("component") .beanClassAndType(UIComponent.class) .create(e -> getCurrentComponent(FacesContext.getCurrentInstance())); }
private boolean isForRenderedComponent() { UIComponent currentComponent = UIComponent.getCurrentComponent(facesContext); // Typically a single component writes multiple times to the response writer in quick succession. // Shortcut id matching by doing a cheaper check on the outcome of the last processed component. if (lastComponent == currentComponent) { return lastRendered; } lastComponent = currentComponent; // Check if a rendering decision already made for this component by checking the cache if (renderedIdCache.containsKey(currentComponent.getClientId())) { lastRendered = renderedIdCache.get(currentComponent.getClientId()); return lastRendered; } // No decision made, check for an explicit id match lastRendered = componentIds.contains(currentComponent.getId()) || clientIds.contains(currentComponent.getClientId()); if (renderChildren) { checkParents(currentComponent); } return lastRendered; }
/** * @param uiMediaOutput */ // TODO use ResourceComponent or exchange object as argument? @PostConstructResource public void initialize() { AbstractMediaOutput uiMediaOutput = (AbstractMediaOutput) UIComponent.getCurrentComponent(FacesContext .getCurrentInstance()); this.setCacheable(uiMediaOutput.isCacheable()); this.setContentType(uiMediaOutput.getMimeType()); this.userData = uiMediaOutput.getValue(); this.contentProducer = uiMediaOutput.getCreateContent(); this.lastModifiedExpression = uiMediaOutput.getValueExpression("lastModfied"); this.expiresExpression = uiMediaOutput.getValueExpression("expires"); this.timeToLiveExpression = uiMediaOutput.getValueExpression("timeToLive"); this.fileName = uiMediaOutput.getFileName(); }
/** * @param uiMediaOutput */ // TODO use ResourceComponent or exchange object as argument? @PostConstructResource public void initialize() { AbstractMediaOutput uiMediaOutput = (AbstractMediaOutput) UIComponent.getCurrentComponent(FacesContext .getCurrentInstance()); this.setCacheable(uiMediaOutput.isCacheable()); this.setContentType(uiMediaOutput.getMimeType()); this.userData = uiMediaOutput.getValue(); this.contentProducer = uiMediaOutput.getCreateContent(); this.lastModifiedExpression = uiMediaOutput.getValueExpression("lastModfied"); this.expiresExpression = uiMediaOutput.getValueExpression("expires"); this.timeToLiveExpression = uiMediaOutput.getValueExpression("timeToLive"); this.fileName = uiMediaOutput.getFileName(); }