Java Code Examples for javax.faces.event.ActionEvent#getComponent()

The following examples show how to use javax.faces.event.ActionEvent#getComponent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TotalScoreUpdateListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  log.debug("Total Score Update LISTENER.");
  TotalScoresBean bean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");
  if ("4".equals(bean.getAllSubmissions()) && ae != null && ae.getComponent() != null && "applyScoreButton".equals(ae.getComponent().getId()))
  {
      // We're looking at average scores and we're applying a score to participants with no submission
      log.debug("Calling saveTotalScoresAverage.");
      if (!saveTotalScoresAverage(bean))
      {
          throw new RuntimeException("failed to call saveTotalScoresAverage.");
      }
  }
  else
  {
      log.debug("Calling saveTotalScores.");
      if (!saveTotalScores(bean))
      {
          throw new RuntimeException("failed to call saveTotalScores.");
      }
   }
 

}
 
Example 2
Source File: TotalScoreUpdateListener.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
/**
 * Standard process action method.
 * @param ae ActionEvent
 * @throws AbortProcessingException
 */
public void processAction(ActionEvent ae) throws
  AbortProcessingException
{
  log.debug("Total Score Update LISTENER.");
  TotalScoresBean bean = (TotalScoresBean) ContextUtil.lookupBean("totalScores");
  if ("4".equals(bean.getAllSubmissions()) && ae != null && ae.getComponent() != null && "applyScoreButton".equals(ae.getComponent().getId()))
  {
      // We're looking at average scores and we're applying a score to participants with no submission
      log.debug("Calling saveTotalScoresAverage.");
      if (!saveTotalScoresAverage(bean))
      {
          throw new RuntimeException("failed to call saveTotalScoresAverage.");
      }
  }
  else
  {
      log.debug("Calling saveTotalScores.");
      if (!saveTotalScores(bean))
      {
          throw new RuntimeException("failed to call saveTotalScores.");
      }
   }
 

}
 
Example 3
Source File: JsfActionListener.java    From javamelody with Apache License 2.0 5 votes vote down vote up
protected String getRequestName(ActionEvent event) {
	final String actionName;
	if (event.getComponent() instanceof ActionSource2) {
		// actionSource est une UICommand en général
		final ActionSource2 actionSource = (ActionSource2) event.getComponent();
		if (actionSource.getActionExpression() != null) {
			actionName = actionSource.getActionExpression().getExpressionString();
		} else {
			actionName = actionSource.getClass().getName();
		}
	} else {
		actionName = event.getComponent().getClass().getName();
	}
	return actionName;
}
 
Example 4
Source File: dynForm.java    From yawl with GNU Lesser General Public License v3.0 5 votes vote down vote up
public String btnOccursAction(ActionEvent event) {
    Button source = (Button) event.getComponent() ;
    SubPanel parent = (SubPanel) source.getParent();
    String btnType = (String) source.getText();
    getApplicationBean().refresh();
    getDynFormFactory().processOccursAction(parent, btnType);
    return null;
}
 
Example 5
Source File: dynForm.java    From yawl with GNU Lesser General Public License v3.0 5 votes vote down vote up
private DocComponent getDocComponentForEvent(ActionEvent event) {
    Button source = (Button) event.getComponent();
    UIComponent parent = source.getParent();
    if (parent instanceof DocComponent) {     // if doc component button clicked
        return (DocComponent) parent;
    }
    else {
        return (DocComponent) parent.getAttributes().get("docComponent");
    }
}
 
Example 6
Source File: MobileActionListener.java    From journaldev with MIT License 3 votes vote down vote up
@Override
public void processAction(ActionEvent ae) throws AbortProcessingException {

	UIComponent ui = ae.getComponent();

	System.out.println("Event source is" + ui.getClass().getName());

}