Package javax.faces.component

Examples of javax.faces.component.ActionSource2


      if (e.getCause() != null) {
         FacesMessage facesMessage = new FacesMessage(e.getCause().toString());
         facesContext.addMessage(null, facesMessage);
      }
      UIComponent source = event.getComponent();
      ActionSource2 actionSource = (ActionSource2) source;
      Application application = facesContext.getApplication();
      MethodExpression expression = actionSource.getActionExpression();
      // Retrieve the NavigationHandler instance..
      NavigationHandler navHandler = application.getNavigationHandler();
      // Invoke nav handling..
      String navBinding = (null != expression) ? expression.getExpressionString() : null;
      navHandler.handleNavigation(facesContext, navBinding, errorOutcome);
View Full Code Here


        assertNotNull("cmd", c);
       
        Object v = c.getAttributes().get("id");
        assertEquals("id", "cmd", v);
       
        ActionSource2 as2 = (ActionSource2) c;
        MethodExpression me = as2.getActionExpression();
        assertNotNull("method", me);
       
        String result = (String) me.invoke(faces.getELContext(), null);
        System.out.println(result);
    }
View Full Code Here

  private static final LogProvider log = Logging.getLogProvider(UIComponentELTagBase.class);
 
  protected void setActionListenerProperty(UIComponent component, MethodExpression actionListener) {
    if (actionListener != null) {
      if (component instanceof ActionSource2) {
        ActionSource2 actionSource2 = (ActionSource2) component;
        actionSource2.addActionListener(new MethodExpressionActionListener(actionListener));
      } else {
        throw new IllegalArgumentException(Messages.getMessage(Messages.NO_ACTION_SOURCE2_ERROR, component.getClientId(getFacesContext())));
      }
    }
  }
View Full Code Here

  }
 
  protected void setActionProperty(UIComponent component, MethodExpression action) {
    if (action != null) {
      if (component instanceof ActionSource2) {
        ActionSource2 actionSource2 = (ActionSource2) component;
        actionSource2.setActionExpression(action);
      } else {
        throw new IllegalArgumentException(Messages.getMessage(Messages.NO_ACTION_SOURCE2_ERROR, component.getClientId(getFacesContext())));
      }
    }
  }
View Full Code Here

    if (!JsfUtils.isFlowRequest()) {
      this.delegate.processAction(actionEvent);
      return;
    }
    FacesContext context = FacesContext.getCurrentInstance();
    ActionSource2 source = (ActionSource2) actionEvent.getSource();
    String eventId = null;
    if (source.getActionExpression() != null) {
      if (logger.isDebugEnabled()) {
        logger.debug("Invoking action " + source.getActionExpression());
      }
      eventId = (String) source.getActionExpression().invoke(context.getELContext(), 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);
View Full Code Here

      if (e.getCause() != null) {
         final FacesMessage facesMessage = new FacesMessage(e.getCause().toString());
         facesContext.addMessage(null, facesMessage);
      }
      final UIComponent source = event.getComponent();
      final ActionSource2 actionSource = (ActionSource2) source;
      final Application application = facesContext.getApplication();
      final MethodExpression expression = actionSource.getActionExpression();
      // Retrieve the NavigationHandler instance..
      final NavigationHandler navHandler = application.getNavigationHandler();
      // Invoke nav handling..
      final String navBinding = (null != expression) ? expression.getExpressionString() : null;
      navHandler.handleNavigation(facesContext, navBinding, errorOutcome);
View Full Code Here

  private static final Log log = LogFactory.getLog(UIComponentELTagBase.class);
 
  protected void setActionListenerProperty(UIComponent component, MethodExpression actionListener) {
    if (actionListener != null) {
      if (component instanceof ActionSource2) {
        ActionSource2 actionSource2 = (ActionSource2) component;
        actionSource2.addActionListener(new MethodExpressionActionListener(actionListener));
      } else {
        throw new IllegalArgumentException(Messages.getMessage(Messages.NO_ACTION_SOURCE2_ERROR, component.getClientId(getFacesContext())));
      }
    }
  }
View Full Code Here

  }
 
  protected void setActionProperty(UIComponent component, MethodExpression action) {
    if (action != null) {
      if (component instanceof ActionSource2) {
        ActionSource2 actionSource2 = (ActionSource2) component;
        actionSource2.setActionExpression(action);
      } else {
        throw new IllegalArgumentException(Messages.getMessage(Messages.NO_ACTION_SOURCE2_ERROR, component.getClientId(getFacesContext())));
      }
    }
  }
View Full Code Here

        Assert.assertNotNull("cmd", c);
       
        Object v = c.getAttributes().get("id");
        Assert.assertEquals("id", "cmd", v);
       
        ActionSource2 as2 = (ActionSource2) c;
        MethodExpression me = as2.getActionExpression();
        Assert.assertNotNull("method", me);
       
        String result = (String) me.invoke(facesContext.getELContext(), null);
        //System.out.println(result);
    }
View Full Code Here

  private static final Log log = LogFactory.getLog(UIComponentELTagBase.class);
 
  protected void setActionListenerProperty(UIComponent component, MethodExpression actionListener) {
    if (actionListener != null) {
      if (component instanceof ActionSource2) {
        ActionSource2 actionSource2 = (ActionSource2) component;
        actionSource2.addActionListener(new MethodExpressionActionListener(actionListener));
      } else {
        throw new IllegalArgumentException(Messages.getMessage(Messages.NO_ACTION_SOURCE2_ERROR, component.getClientId(getFacesContext())));
      }
    }
  }
View Full Code Here

TOP

Related Classes of javax.faces.component.ActionSource2

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.