Refine search
@Override public void apply(FaceletContext faceletContext, UIComponent parent) throws IOException, FacesException, FaceletException, ELException { if (ComponentHandler.isNew(parent)) { ValueExpression targetVE = target.getValueExpression(faceletContext, Object.class); ValueExpression typeVE = type.getValueExpression(faceletContext, Object.class); ValueExpression fileNameVE = fileName.getValueExpression(faceletContext, Object.class); ValueExpression pageOnlyVE = null; ValueExpression selectionOnlyVE = null; dataExporter.setRepeat(repeatVE); dataExporter.setCustomExporter(customExporterVE); actionSource.addActionListener(dataExporter);
private boolean isImmediate(UIComponent component, AjaxBehavior ajaxBehavior) { boolean immediate = false; if (ajaxBehavior.isImmediateSet()) { immediate = ajaxBehavior.isImmediate(); } else if (component instanceof EditableValueHolder) { immediate = ((EditableValueHolder) component).isImmediate(); } else if (component instanceof ActionSource) { immediate = ((ActionSource) component).isImmediate(); } return immediate; } }
public void processAction(ActionEvent actionEvent) throws AbortProcessingException FacesContext facesContext = FacesContext.getCurrentInstance(); Application application = facesContext.getApplication(); MethodBinding methodBinding = actionSource.getAction(); throw new FacesException("Error calling action method of component with id " + actionEvent.getComponent().getClientId(facesContext), e); throw new FacesException("Error calling action method of component with id " + actionEvent.getComponent().getClientId(facesContext), e); outcome); facesContext.renderResponse();
event.getComponent().getId())); FacesContext context = FacesContext.getCurrentInstance(); Application application = context.getApplication(); MethodBinding binding; binding = actionSource.getAction(); if (binding != null) { try { context.renderResponse();
public UIComponent processWidget( UIComponent component, String elementName, Map<String, String> attributes, UIMetawidget metawidget ) { FacesContext context = FacesContext.getCurrentInstance(); Application application = context.getApplication(); String name = attributes.get( NAME ); MethodBinding methodBinding = actionSource.getAction(); actionSource.setAction( methodBinding ); ValueBinding valueBinding = component.getValueBinding( "value" ); Object[] valueExpression = new Object[] { application.getExpressionFactory().createValueExpression( context.getELContext(), valueBindingExpression, Object.class ) }; attachValueExpression( component, valueExpression[0], attributes ); } catch ( NoSuchMethodError e ) {
public static void setActionProperty(FacesContext context, UIComponent component, String action) { if (action != null) { if (!(component instanceof ActionSource)) { throw new IllegalArgumentException("Component " + component.getClientId(context) + " is no ActionSource"); } MethodBinding mb; if (isValueReference(action)) { mb = context.getApplication().createMethodBinding(action, null); } else { mb = new SimpleActionMethodBinding(action); } ((ActionSource)component).setAction(mb); } }
public static void setActionListenerProperty(FacesContext context, UIComponent component, String actionListener) { if (actionListener != null) { if (!(component instanceof ActionSource)) { throw new IllegalArgumentException("Component " + component.getClientId(context) + " is no ActionSource"); } if (isValueReference(actionListener)) { MethodBinding mb = context.getApplication().createMethodBinding(actionListener, ACTION_LISTENER_ARGS); /** if(! Void.class.equals(mb.getType(context))) { throw new IllegalArgumentException( actionListener + " : Return types for action listeners must be void, see JSF spec. 3.2.1.1"); } */ ((ActionSource)component).setActionListener(mb); } else { log.error("Component " + component.getClientId(context) + " has invalid actionListener value: " + actionListener); } } }
return; if (context.getExternalContext().getRequestParameterMap().containsKey(componentId)) { source = componentId; || (("input_" + source).equals(componentId)) || source.equals(componentId + "Inner") || (source + "_Input").equals(componentId))) { String event = context.getExternalContext().getRequestParameterMap().get("javax.faces.partial.event"); ajaxEvent.setPhaseId(PhaseId.INVOKE_APPLICATION); if (component instanceof ActionSource) { if (((ActionSource) component).isImmediate()) ajaxEvent.setPhaseId(PhaseId.APPLY_REQUEST_VALUES); } else if (component instanceof IAJAXComponent) { if (component instanceof ActionSource) { ActionSource b = (ActionSource) component; ActionListener[] actionListeners = b.getActionListeners(); if (null != actionListeners && actionListeners.length > 0) { addEventToQueue = true; ActionEvent ae = new ActionEvent(component); if (component instanceof ActionSource) { if (((ActionSource) component).isImmediate()) { ae.setPhaseId(PhaseId.APPLY_REQUEST_VALUES); } else {
public void removeMessagesForImmediateComponents(UIComponent uiComponent) { FacesContext facesContext = FacesContext.getCurrentInstance(); if (uiComponent instanceof ActionSource) { ActionSource actionSource = (ActionSource) uiComponent; if (actionSource.isImmediate()) { removeMessages(uiComponent.getClientId(facesContext)); } } else if (uiComponent instanceof EditableValueHolder) { EditableValueHolder editableValueHolder = (EditableValueHolder) uiComponent; if (editableValueHolder.isImmediate()) { removeMessages(uiComponent.getClientId(facesContext)); } } List<UIComponent> childComponents = uiComponent.getChildren(); for (UIComponent childComponent : childComponents) { removeMessagesForImmediateComponents(childComponent); } }
public void processAction(ActionEvent actionEvent) throws AbortProcessingException { FacesContext context = FacesContext.getCurrentInstance(); ActionSource actionSource = (ActionSource) actionEvent.getComponent(); MethodBinding mb = actionSource.getAction(); String fromAction = null; String outcome = null; Throwable cause = ex.getCause(); try { ExternalContext extContext = context.getExternalContext(); if (errorPageManager.handleException(cause, context, extContext)) { context.responseComplete(); } else { throw ex;
FacesContext facesContext = FacesContext.getCurrentInstance(); if (e.getCause() != null) { FacesMessage facesMessage = new FacesMessage(e.getCause().toString()); facesContext.addMessage(null, facesMessage); Application application = facesContext.getApplication(); MethodBinding binding = actionSource.getAction();
public void processAction(ActionEvent actionEvent) throws AbortProcessingException { if (!JsfUtils.isFlowRequest()) { delegate.processAction(actionEvent); return; } FacesContext context = FacesContext.getCurrentInstance(); ActionSource source = (ActionSource) actionEvent.getSource(); String eventId = null; if (source.getAction() != null) { if (logger.isDebugEnabled()) { logger.debug("Invoking action " + source.getAction()); } eventId = (String) source.getAction().invoke(context, null); } if (StringUtils.hasText(eventId)) { if (logger.isDebugEnabled()) { logger.debug("Event '" + eventId + "' detected"); } if (source.isImmediate() || validateModel(context, eventId)) { context.getExternalContext().getRequestMap().put(JsfView.EVENT_KEY, eventId); } } else { logger.debug("No action event detected"); context.getExternalContext().getRequestMap().remove(JsfView.EVENT_KEY); } // tells JSF lifecycle that rendering should now happen and any subsequent phases should be skipped // required in the case of this action listener firing immediately (immediate=true) before validation context.renderResponse(); }
/** * @deprecated since 2.0.0 */ @Deprecated public static void setActionMethodBinding(final UIComponent component, final String value, final Class[] args) { if (value != null) { if (UIComponentTag.isValueReference(value)) { final MethodBinding methodBinding = FacesContext.getCurrentInstance().getApplication().createMethodBinding(value, args); ((ActionSource) component).setAction(methodBinding); } else { ((ActionSource) component).setAction(new ConstantMethodBinding(value)); } } }
/** * @deprecated since 2.0.0 */ @Deprecated public static void setActionListenerMethodBinding( final UIComponent component, final String value, final Class[] args) { if (value != null && UIComponentTag.isValueReference(value)) { final MethodBinding methodBinding = FacesContext.getCurrentInstance().getApplication() .createMethodBinding(value, args); ((ActionSource) component).setActionListener(methodBinding); } }
for ( UIComponent child : component.getChildren() ) { MethodBinding childMethodBinding = ( (ActionSource) child ).getAction(); if ( expressionString.equals( childMethodBinding.getExpressionString() ) && child.isRendered() ) { return child; if ( child.getAttributes().containsKey( UIMetawidget.COMPONENT_ATTRIBUTE_SECTION_DECORATOR ) ) {
@Override public void applyAttachedObject(FacesContext context, UIComponent parent) { FaceletContext ctx = (FaceletContext) context.getAttributes() .get(FaceletContext.FACELET_CONTEXT_KEY); ActionSource as = (ActionSource) parent; ValueExpression b = null; if (this.binding != null) { b = this.binding.getValueExpression(ctx, ActionListener.class); } ActionListener listener = new LazyActionListener(this.listenerType, b); as.addActionListener(listener); }
public void processAction(ActionEvent actionEvent) throws AbortProcessingException { final FacesContext context = FacesContext.getCurrentInstance(); if (actionEvent instanceof TActionEvent) { bindRowIndices(context, (TActionEvent) actionEvent); } final ActionSource actionSource = (ActionSource) actionEvent .getComponent(); final MethodBinding mb = actionSource.getAction(); if (mb == null) { NavigationHandlerUtil.handleNoNavigation(context); context.renderResponse(); return; } final String fromAction = mb.getExpressionString(); if (fromAction != null) { final String componentName = MethodBindingUtil .getComponentName(fromAction); final String methodName = MethodBindingUtil .getMethodName(fromAction); htmlComponentInvoker.invoke(context, componentName, methodName); } else { super.processAction(actionEvent); } }
public void processAction(ActionEvent actionEvent) throws AbortProcessingException { UIComponent component = actionEvent.getComponent(); EtmPoint etmRootPoint = (EtmPoint) FacesContext.getCurrentInstance().getAttributes().get(EtmJsfPlugin.ROOT_ETM_POINT); if (etmRootPoint != null) { MethodExpression methodExpression = null; if (component instanceof ActionSource2) { methodExpression = ((ActionSource2) component).getActionExpression(); if (methodExpression != null) { etmRootPoint.alterName("JSF Action " + methodExpression.getExpressionString()); } } if (methodExpression == null && component instanceof ActionSource) { MethodBinding methodBinding = ((ActionSource) component).getAction(); if (methodBinding != null) { etmRootPoint.alterName("JSF Action " + methodBinding.getExpressionString()); } } } delegate.processAction(actionEvent); } }
public UIComponent processWidget( UIComponent component, String elementName, Map<String, String> attributes, UIMetawidget metawidget ) { // Does widget need an id? // // Note: it is very dangerous to reassign an id if the widget already has one, // as it will create duplicates in the child component list if ( component.getId() != null ) { return component; } // Base action ids on the methodBinding if ( ACTION.equals( elementName ) ) { MethodBinding methodBinding = ( (ActionSource) component ).getAction(); if ( methodBinding != null ) { setUniqueId( component, methodBinding.getExpressionString(), metawidget ); } else { component.setId( FacesUtils.createUniqueId() ); } } else { // Base property ids on the valueBinding ValueBinding valueBinding = component.getValueBinding( "value" ); if ( valueBinding != null ) { setUniqueId( component, valueBinding.getExpressionString(), metawidget ); } else { component.setId( FacesUtils.createUniqueId() ); } } return component; }
@Override public void removeMessagesForImmediateComponents(FacesContext facesContext, UIComponent uiComponent) { if (uiComponent instanceof ActionSource) { ActionSource actionSource = (ActionSource) uiComponent; if (actionSource.isImmediate()) { removeMessages(facesContext, uiComponent.getClientId(facesContext)); } } else if (uiComponent instanceof EditableValueHolder) { EditableValueHolder editableValueHolder = (EditableValueHolder) uiComponent; if (editableValueHolder.isImmediate()) { removeMessages(facesContext, uiComponent.getClientId(facesContext)); } } List<UIComponent> childComponents = uiComponent.getChildren(); for (UIComponent childComponent : childComponents) { removeMessagesForImmediateComponents(facesContext, childComponent); } }