本文整理了Java中javax.faces.event.ActionEvent.getComponent()
方法的一些代码示例,展示了ActionEvent.getComponent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ActionEvent.getComponent()
方法的具体详情如下:
包路径:javax.faces.event.ActionEvent
类名称:ActionEvent
方法名:getComponent
暂无
代码示例来源:origin: javamelody/javamelody
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;
}
}
代码示例来源: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 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: primefaces/primefaces
List components = SearchExpressionFacade.resolveComponents(context, event.getComponent(), tables);
代码示例来源:origin: stackoverflow.com
public void selectSingleRow(ActionEvent event) {
String vehicleName = (String) event.getComponent().getAttributes().get("selectedVehicleName");
for (Vehicle v : vehicleList) {
if (!v.getVehicleName.equals(vehicleName)) {
v.setSelected(false);
}
}
}
代码示例来源:origin: stackoverflow.com
<h:commandButton id="test1" value="Test 1" actionListener="#{bean.action}" />
<h:commandButton id="test2" value="Test 2" actionListener="#{bean.action}" />
public void action(ActionEvent event)
{
System.out.println(event.getComponent().getClientId());
}
代码示例来源:origin: stackoverflow.com
<h:commandLink action="start" actionListener="#{clController.actionListener}">
<f:attribute name="item" value="#{item}" />
</h:commandLink>
public void actionListener(ActionEvent event)
{
ClDataModel item = (ClDataModel)event.getComponent().getAttributes().get("item");
System.out.print(item.getTaxDept());
System.out.print(item.getAddress());
System.out.print(item.getName());
}
代码示例来源:origin: stackoverflow.com
public void prepareToDownload(ActionEvent actionEvent){
String fileName = (String)actionEvent.getComponent().getAttributes().get("fileName");
InputStream stream = FacesContext.getCurrentInstance().getExternalContext().getResourceAsStream("/tmp/" + fileName);
file = new DefaultStreamedContent(stream, "text/plain", fileName);
}
代码示例来源: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.rhq/rhq-core-gui
public void processAction(ActionEvent event) throws AbortProcessingException {
SortableColumnHeaderComponent sortableColumnHeader = (SortableColumnHeaderComponent)event.getComponent();
sort(sortableColumnHeader);
}
代码示例来源: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.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.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.tobago/tobago-core
@Override
public void processAction(final ActionEvent actionEvent) throws AbortProcessingException {
UIComponent component = actionEvent.getComponent();
while ((component = component.getParent()) != null) {
if (component instanceof UIForm) {
resetChildren(component);
return;
}
}
}
}
代码示例来源:origin: org.apache.myfaces.tobago/tobago-core
@Override
public void processAction(final ActionEvent event) {
for (final String clientId : clientIds) {
final UIComponent component = ComponentUtils.findComponent(event.getComponent(), clientId);
if (component != null) {
resetChildren(component);
}
}
}
代码示例来源:origin: org.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: org.apache.myfaces.tomahawk/tomahawk-sandbox
public void processAction(ActionEvent actionEvent) throws AbortProcessingException
{
AbstractConversationComponent startOrEndconversation = ConversationUtils.findStartOrEndConversationComponent(actionEvent.getComponent(), getConversationName());
doConversationAction(startOrEndconversation);
}
代码示例来源: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: toutatice-services.dafpic/toutatice-dafpic-ecm
public void listenerAddTraining(ActionEvent event) {
UIComponent component = event.getComponent();
UIComponent trainingInput = component.findComponent(":document_create:nxl_LayoutStage:objectDocumentTrainingFieldInput");
if(trainingInput == null){
trainingInput = component.findComponent(":document_edit:nxl_LayoutStage:objectDocumentTrainingFieldInput");
}
if(trainingInput != null){
String newContactRef = (String) ((UIInput) trainingInput).getSubmittedValue();
addTraining(newContactRef);
}
}
代码示例来源:origin: org.apache.myfaces.tomahawk/tomahawk
/**
* @see javax.faces.event.ActionListener#processAction(javax.faces.event.ActionEvent)
*/
public void processAction(ActionEvent event)
throws AbortProcessingException
{
UISchedule schedule = (UISchedule) event.getComponent();
ScheduleEntry entry = schedule.getSubmittedEntry();
schedule.getModel().setSelectedEntry(entry);
schedule.setSubmittedEntry(null);
}
}
内容来源于网络,如有侵权,请联系作者删除!