javax.faces.event.ActionEvent类的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(176)

本文整理了Java中javax.faces.event.ActionEvent类的一些代码示例,展示了ActionEvent类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ActionEvent类的具体详情如下:
包路径:javax.faces.event.ActionEvent
类名称:ActionEvent

ActionEvent介绍

[英]An ActionEvent represents the activation of a user interface component (such as a UICommand).
[中]ActionEvent表示用户界面组件(例如UICommand的激活。

代码示例

代码示例来源:origin: primefaces/primefaces

@Override
public void decode(FacesContext context, UIComponent component) {
  RemoteCommand command = (RemoteCommand) component;
  if (context.getExternalContext().getRequestParameterMap().containsKey(command.getClientId(context))) {
    ActionEvent event = new ActionEvent(command);
    if (command.isImmediate()) {
      event.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
    }
    else {
      event.setPhaseId(PhaseId.INVOKE_APPLICATION);
    }
    command.queueEvent(event);
  }
}

代码示例来源:origin: primefaces/primefaces

@Override
public void processAction(ActionEvent event) throws AbortProcessingException {
  UIComponent source = event.getComponent();
  // don't use event#getFacesContext() - it's only available in JSF 2.3
  Map<Object, Object> attrs = FacesContext.getCurrentInstance().getAttributes();
  if (source instanceof Widget) {
    attrs.put(Constants.DIALOG_FRAMEWORK.SOURCE_WIDGET, ((Widget) source).resolveWidgetVar());
  }
  attrs.put(Constants.DIALOG_FRAMEWORK.SOURCE_COMPONENT, source.getClientId());
  base.processAction(event);
}

代码示例来源:origin: primefaces/primefaces

@Override
public void decode(FacesContext facesContext, UIComponent component) {
  Map<String, String> params = facesContext.getExternalContext().getRequestParameterMap();
  Hotkey hotkey = (Hotkey) component;
  if (params.containsKey(hotkey.getClientId(facesContext))) {
    hotkey.queueEvent(new ActionEvent(hotkey));
  }
}

代码示例来源:origin: org.icefaces/icefaces-compat

Map parameterMap = context.getExternalContext().
  getRequestParameterMap();
  clientId, phaseEvent.getFacesContext().getViewRoot());
if (inputFile != null) {
  inputFile.getAttributes().put("fileInfo", fileInfo);
  inputFile.queueEvent( new InputFileProgressEvent(inputFile) );
  if (fileInfo.isSaved()) {
    inputFile.queueEvent( new InputFileSetFileEvent(inputFile) );
    ActionEvent event = new ActionEvent(inputFile);
    event.setPhaseId(PhaseId.INVOKE_APPLICATION);
    inputFile.queueEvent(event);

代码示例来源:origin: primefaces/primefaces

@Override
public void processAction(ActionEvent event) {
  FacesContext context = FacesContext.getCurrentInstance();
  ELContext elContext = context.getELContext();
  if (repeat != null) {
    repeating = repeat.isLiteralText()
          ? Boolean.parseBoolean(repeat.getValue(context.getELContext()).toString())
          : (Boolean) repeat.getValue(context.getELContext());
      List components = SearchExpressionFacade.resolveComponents(context, event.getComponent(), tables);

代码示例来源:origin: se.vgregion.javg/javg-rt-support

public void afterPhase(PhaseEvent event) {
 if (JsfUtils.isFlowRequest()) {
  FacesContext context = event.getFacesContext();
  if (context.getExternalContext().getRequestParameterMap().containsKey("_eventId")) {
   UICommand eventSource = new UICommand();
   eventSource.setTransient(true);
   eventSource.setParent(context.getViewRoot());
   eventSource.setId("_eventId");
   String eventId = context.getExternalContext().getRequestParameterMap().get("_eventId");
   eventSource.setActionExpression(convertEventIdToMethodExpression(context, eventId));
   context.getViewRoot().queueEvent(new ActionEvent(eventSource));
  }
 }
}

代码示例来源:origin: primefaces/primefaces

@Override
  public void processAction(ActionEvent event) throws AbortProcessingException {
    FacesContext context = FacesContext.getCurrentInstance();
    ELContext elContext = context.getELContext();
    VisitContext visitContext = VisitContext.createVisitContext(context, null, ComponentUtils.VISIT_HINTS_SKIP_UNRENDERED);

    String expressions = (String) target.getValue(elContext);
    boolean resetModel = false;
    if (clearModel != null) {
      resetModel = clearModel.isLiteralText()
             ? Boolean.parseBoolean(clearModel.getValue(context.getELContext()).toString())
             : (Boolean) clearModel.getValue(context.getELContext());
    }

    ResetInputVisitCallback visitCallback = resetModel
                        ? ResetInputVisitCallback.INSTANCE_CLEAR_MODEL
                        : ResetInputVisitCallback.INSTANCE;

    List<UIComponent> components = SearchExpressionFacade.resolveComponents(context, event.getComponent(), expressions);
    for (int i = 0; i < components.size(); i++) {
      UIComponent component = components.get(i);
      component.visitTree(visitContext, visitCallback);
    }
  }
}

代码示例来源:origin: org.richfaces/richfaces

@Override
public void broadcast(FacesEvent event) throws AbortProcessingException {
  FacesContext facesContext = FacesContext.getCurrentInstance();
  if (event instanceof ItemChangeEvent) {
    String newItemName = ((ItemChangeEvent) event).getNewItemName();
    updateModel(facesContext);
    if (event.getPhaseId() != PhaseId.UPDATE_MODEL_VALUES) {
      facesContext.renderResponse();
        ActionEvent actionEvent = new ActionEvent(childCommand);
          childCommand.broadcast(actionEvent);
        } else {
          actionEvent.queue();

代码示例来源:origin: org.apache.myfaces.tobago/tobago-jsf-compat

@Override
protected UIComponent getPopup(ActionEvent actionEvent) {
 String id = (String) popupIdExpression.getValue(FacesContext.getCurrentInstance().getELContext());
 UIComponent popup = FindComponentUtils.findComponent(actionEvent.getComponent(), id);
 if (popup == null) {
  LOG.error("Found no popup for \""
    + popupIdExpression.getExpressionString() + "\" := \""
    + id + "\"! Search base componentId : "
    + actionEvent.getComponent().getClientId(FacesContext.getCurrentInstance()));
 }
 return popup;
}

代码示例来源:origin: org.icefaces/icefaces-compat

public void decode(FacesContext context) {
  super.decode(context);
  Map map = context.getExternalContext().getRequestParameterMap();
  String clickedNodeName = getClientId(context) + "ClickedNodeName";
  boolean ignoreClick = "input".equalsIgnoreCase((String) map.get(clickedNodeName)) && !isToggleOnInput();
  String clientId = getClientId(context)+"Expanded";
  if (map.containsKey(clientId) && !map.get(clientId).toString().equals("") && !ignoreClick) {
    getAttributes().put(getMatureClientId()+"changedByDecode", "true");
    boolean exp = Boolean.valueOf(map.get(clientId).toString()).booleanValue();
    exp = !exp;
    setExpanded(exp);
    queueEvent(new ActionEvent(this));
  }
}

代码示例来源:origin: org.apache.myfaces.tobago/tobago-jsf-compat

@Override
protected UIComponent getPopup(ActionEvent actionEvent) {
 String id = (String) popupIdBinding.getValue(FacesContext.getCurrentInstance());
 UIComponent popup = FindComponentUtils.findComponent(actionEvent.getComponent(), id);
 if (popup == null) {
  LOG.error("Found no popup for \""
    + popupIdBinding.getExpressionString() + "\" := \""
    + id + "\"! Search base componentId : "
    + actionEvent.getComponent().getClientId(FacesContext.getCurrentInstance()));
 }
 return popup;
}

代码示例来源:origin: org.apache.myfaces.tomahawk/tomahawk

public void broadcast(FacesEvent event) throws AbortProcessingException {
    if (event instanceof ActionEvent) {
      ActionEvent actionEvent = (ActionEvent) event;
      if (actionEvent.getPhaseId() == PhaseId.APPLY_REQUEST_VALUES) {
        AbstractHtmlCommandNavigationItem navItem = (AbstractHtmlCommandNavigationItem) actionEvent.getComponent();
        navItem.toggleOpen();
        FacesContext.getCurrentInstance().renderResponse();
      }
    }
    super.broadcast(event);
  }
}

代码示例来源:origin: eclipse-ee4j/mojarra

@Override
public void decode(FacesContext context, UIComponent component) {
  rendererParamsNotNull(context, component);
  if (!shouldDecode(component)) {
    return;
  }
  String clientId = component.getClientId(context);
  if (RenderKitUtils.isPartialOrBehaviorAction(context, clientId)) {
    UICommand command = (UICommand) component;
    ActionEvent event = new ActionEvent(command);
    event.setPhaseId(command.isImmediate() ? PhaseId.APPLY_REQUEST_VALUES : PhaseId.INVOKE_APPLICATION);
    command.queueEvent(event);
    if (logger.isLoggable(Level.FINE)) {
      logger.fine("This commandScript resulted in form submission ActionEvent queued.");
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/acaren-nuxeo-dafpic

public void listenerAddContact(ActionEvent event) {
  UIComponent component = event.getComponent();
  List<UIComponent> childs = component.getChildren();
  String pattern = "^objectDocumentContactUidInput$|.*[:\\.]objectDocumentContactUidInput$";
  for (UIComponent child : childs) {
    if (child.getId().matches(pattern)) {
      String newContactRef = (String) ((UIInput) child).getSubmittedValue();
      addContact(newContactRef);
      break;
    }
  }
}

代码示例来源:origin: javax/javaee-web-api

if ((context.isPostback() && !isOnPostback()) || !isRendered()) {
  return;
ActionEvent e = new ActionEvent(context, this);
PhaseId phaseId = getPhaseId();
if (phaseId != null) {
  e.setPhaseId(phaseId);
} else if (isImmediate()) {
  e.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
} else {
  e.setPhaseId(PhaseId.INVOKE_APPLICATION);

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-webapp-base

private ChainSelect getChainSelect(ActionEvent event) {
  UIComponent component = event.getComponent();
  while (!(component instanceof ChainSelect)) {
    component = component.getParent();
  }
  return (ChainSelect) component;
}

代码示例来源:origin: org.richfaces.ui.core/richfaces-ui-core-ui

@Override
protected void doDecode(FacesContext facesContext, UIComponent uiComponent) {
  if (isSubmitted(facesContext, uiComponent)) {
    new ActionEvent(uiComponent).queue();
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/acaren-nuxeo-dafpic

public void toggleCreateForm(ActionEvent event) {
  UIComponent cmp = event.getComponent();
  String id = cmp.getId();
  if ("ToggleTrainingForm".equals(id)) {
    showCreateForm = !showCreateForm;
    showCreateContactForm = false;
  } else {
    showCreateContactForm = !showCreateContactForm;
    showCreateForm = false;
  }
}

代码示例来源:origin: org.apache.myfaces.tomahawk/tomahawk

public void decode(FacesContext facesContext, UIComponent uiComponent) {
  org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.checkParamValidity(facesContext, uiComponent, UICommand.class);
  //super.decode must not be called, because value is handled here
  if (!isReset(uiComponent) && isSubmitted(facesContext, uiComponent)) {
    uiComponent.queueEvent(new ActionEvent(uiComponent));
    org.apache.myfaces.shared_tomahawk.renderkit.RendererUtils.initPartialValidationAndModelUpdate(uiComponent, facesContext);
  }
}

代码示例来源:origin: org.apache.myfaces.core/myfaces-api

if (context.isPostback() && !isOnPostback())
PhaseId phaseId = (phase != null) ? PhaseId.phaseIdValueOf(phase) :
  isImmediate() ? PhaseId.APPLY_REQUEST_VALUES : PhaseId.INVOKE_APPLICATION;
evt.setPhaseId(phaseId);
this.queueEvent(evt);
Integer count = (Integer) context.getAttributes().get(EVENT_COUNT_KEY);
count = (count == null) ? 1 : count + 1;
context.getAttributes().put(EVENT_COUNT_KEY, count);

相关文章