Refine search
@Override public void processAction(ActionEvent actionEvent) throws AbortProcessingException { if (value == null) { throw new AbortProcessingException("Value has not been set"); } ELContext elContext = FacesContext.getCurrentInstance().getELContext(); Object val = value.getValue(elContext); if (addTo != null) { Collection collection = (Collection) addTo.getValue(elContext); Object uniqueValue = (unique != null) ? unique.getValue(elContext) : null; boolean checkUniqueness = (uniqueValue == null) ? true : Boolean.parseBoolean(uniqueValue.toString()); if (checkUniqueness) { if (!collection.contains(val)) { collection.add(val); } } else { collection.add(val); } } else if (removeFrom != null) { Collection collection = (Collection) removeFrom.getValue(elContext); collection.remove(val); } else { throw new IllegalArgumentException("Specify either addTo or removeFrom as collection reference"); } }
public void processAction(ActionEvent e) throws AbortProcessingException { FacesContext facesContext = FacesContext.getCurrentInstance(); ELContext elContext = facesContext.getELContext(); try { Object value = source.getValue(elContext); if (value != null) { ExpressionFactory factory = facesContext.getApplication().getExpressionFactory(); value = factory.coerceToType(value, target.getType(elContext)); } target.setValue(elContext, value); } catch (ELException ele) { throw new AbortProcessingException(ele); } }
public void processTreeToggle(org.richfaces.event.TreeToggleEvent actionEvent) throws AbortProcessingException { if (actionEvent == null) { throw new NullPointerException(); } FacesContext context = FacesContext.getCurrentInstance(); ELContext elContext = context.getELContext(); try { methodExpression.invoke(elContext, new Object[] { actionEvent }); } catch (Exception e) { new AbortProcessingException(e); } } }
FacesContext initFacesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = initFacesContext.getExternalContext(); Map<String, Object> applicationMap = externalContext.getApplicationMap(); String appConfigAttrName = ApplicationConfig.class.getName(); throw new AbortProcessingException(e);
public void proxyChange(AjaxBehaviorEvent event) { UIComponent select = event.getComponent(); if (select instanceof ValueHolder) { proxyType = (String) ((ValueHolder) select).getValue(); } else { log.error("Bad component returned " + select); throw new AbortProcessingException("Bad component returned " + select); } Contexts.getEventContext().remove("setupParams"); FacesContext context = FacesContext.getCurrentInstance(); context.renderResponse(); }
FacesContext context = FacesContext.getCurrentInstance(); PrimeApplicationContext applicationContext = PrimeApplicationContext.getCurrentInstance(context); try { UIViewRoot viewRoot = context.getViewRoot(); if (viewRoot != null) { if (context.isPostback() && !context.getPartialViewContext().isRenderAll() && !applicationContext.getEnvironment().isAtLeastJsf23()) { throw new AbortProcessingException(e);
@Override public void endDocument() throws IOException { FacesContext context = FacesContext.getCurrentInstance(); PrimeRequestContext requestContext = PrimeRequestContext.getCurrentInstance(context); if (requestContext != null) { try { if (context.isValidationFailed()) { requestContext.getCallbackParams().put("validationFailed", true); } encodeCallbackParams(requestContext.getCallbackParams()); encodeScripts(requestContext); } catch (Exception e) { throw new AbortProcessingException(e); } } wrapped.endDocument(); }
public void processEvent( SystemEvent event ) { // Don't do unnecessary work if none of our child components are to be rendered anyway // (work around for https://issues.apache.org/jira/browse/MYFACES-3293) if ( !getMetawidget().isRendered() ) { return; } // Don't run if we are not actually part of the View (HtmlWidgetBuilder uses us as a // dummy Metawidget) if ( getMetawidget().getParent() == null ) { return; } // PartialViewContext (JSF 2-specific) if ( !getMetawidget().mBuildWidgetsOnAjaxRequest ) { PartialViewContext partialViewContext = FacesContext.getCurrentInstance().getPartialViewContext(); if ( partialViewContext.isAjaxRequest() ) { Collection<String> executeIds = partialViewContext.getExecuteIds(); if ( !executeIds.contains( getMetawidget().getClientId() ) ) { return; } } } try { buildWidgets(); } catch ( Exception e ) { // At this level, it is more 'proper' to throw an AbortProcessingException than // a MetawidgetException, as that is what the layers above are expecting throw new AbortProcessingException( e ); } } }
/** {@inheritDoc} */ @Override public void processAction(final ActionEvent actionEvent) { Validate.notNull(this.facesContext, DefaultValidationListener.FACES_CONTEXT_NOT_INJECTED); final Model<?> model = (Model<?>) this.state.getModelExpression().getValue(this.facesContext.getELContext()); if (!CheckUtil.isNull(model.getExtension(EntityValidator.class))) { final Collection<PropertyViolation<Object, ?>> violations = this.validate(); for (final PropertyViolation<Object, ?> violation : violations) { this.processViolation(violation); } if (!violations.isEmpty()) { throw new AbortProcessingException(String.format("Validation failed, %d violations.", violations.size())); } } }
public void processEvent(SystemEvent event) throws AbortProcessingException { FacesContext context = FacesContext.getCurrentInstance(); try { calculateExtensionMapping(); calculateMappings(context, allResources, cssResources, imageResources); } catch (UnsupportedEncodingException e) { throw new AbortProcessingException(e); } }
public static void invokeMethodExpression( final FacesContext facesContext, final MethodExpression methodExpression, final FacesEvent event) { if (methodExpression != null && event != null) { try { methodExpression.invoke(facesContext.getELContext(), new Object[]{event}); } catch (final Exception e) { throw new AbortProcessingException(e); } } }
protected UIDataTableBase findParent(AbstractCollapsibleSubTable subTable) { UIComponent parent = subTable.getParent(); while (parent != null && !(parent instanceof UIDataTableBase)) { parent = parent.getParent(); } if (parent == null) { // TODO: anton -> do we need this? throw new AbortProcessingException("UISubTable should be a child of UIDataTable or UISubTable"); } return (UIDataTableBase) parent; } }
@Override public void processAction(ActionEvent e) throws AbortProcessingException { FacesContext facesContext = FacesContext.getCurrentInstance(); ELContext elContext = facesContext.getELContext(); try { Object value = source.getValue(elContext); if (value != null) { ExpressionFactory factory = facesContext.getApplication().getExpressionFactory(); value = factory.coerceToType(value, target.getType(elContext)); } target.setValue(elContext, value); } catch (ELException ele) { throw new AbortProcessingException(ele); } }
public void processTreeToggle(org.richfaces.event.TreeToggleEvent actionEvent) throws AbortProcessingException { if (actionEvent == null) { throw new NullPointerException(); } FacesContext context = FacesContext.getCurrentInstance(); ELContext elContext = context.getELContext(); try { methodExpression.invoke(elContext, new Object[] { actionEvent }); } catch (Exception e) { new AbortProcessingException(e); } } }
FacesContext initFacesContext = FacesContext.getCurrentInstance(); ExternalContext externalContext = initFacesContext.getExternalContext(); Map<String, Object> applicationMap = externalContext.getApplicationMap(); String appConfigAttrName = ApplicationConfig.class.getName(); throw new AbortProcessingException(e);
public void proxyChange(AjaxBehaviorEvent event) { UIComponent select = event.getComponent(); if (select instanceof ValueHolder) { proxyType = (String) ((ValueHolder) select).getValue(); } else { log.error("Bad component returned " + select); throw new AbortProcessingException("Bad component returned " + select); } Contexts.getEventContext().remove("setupParams"); FacesContext context = FacesContext.getCurrentInstance(); context.renderResponse(); }
@Override public void endDocument() throws IOException { FacesContext context = FacesContext.getCurrentInstance(); RequestContext requestContext = RequestContext.getCurrentInstance(context); if (requestContext != null) { try { if (context.isValidationFailed()) { requestContext.addCallbackParam("validationFailed", true); } encodeCallbackParams(requestContext.getCallbackParams()); encodeScripts(requestContext); } catch (Exception exception) { throw new AbortProcessingException(exception); } } wrapped.endDocument(); }
public void processEvent( SystemEvent event ) { // Don't do unnecessary work if none of our child components are to be rendered anyway // (work around for https://issues.apache.org/jira/browse/MYFACES-3293) if ( !getMetawidget().isRendered() ) { return; } // Don't run if we are not actually part of the View (HtmlWidgetBuilder uses us as a // dummy Metawidget) if ( getMetawidget().getParent() == null ) { return; } // PartialViewContext (JSF 2-specific) if ( !getMetawidget().mBuildWidgetsOnAjaxRequest ) { PartialViewContext partialViewContext = FacesContext.getCurrentInstance().getPartialViewContext(); if ( partialViewContext.isAjaxRequest() ) { Collection<String> executeIds = partialViewContext.getExecuteIds(); if ( !executeIds.contains( getMetawidget().getClientId() ) ) { return; } } } try { buildWidgets(); } catch ( Exception e ) { // At this level, it is more 'proper' to throw an AbortProcessingException than // a MetawidgetException, as that is what the layers above are expecting throw new AbortProcessingException( e ); } } }
public static void invokeMethodExpression( FacesContext facesContext, MethodExpression methodExpression, FacesEvent event) { if (methodExpression != null && event != null) { try { methodExpression.invoke(facesContext.getELContext(), new Object[]{event}); } catch (Exception e) { throw new AbortProcessingException(e); } } }