本文整理汇总了Java中javax.faces.event.ActionListener类的典型用法代码示例。如果您正苦于以下问题:Java ActionListener类的具体用法?Java ActionListener怎么用?Java ActionListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ActionListener类属于javax.faces.event包,在下文中一共展示了ActionListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: broadcast
import javax.faces.event.ActionListener; //导入依赖的package包/类
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException
{
super.broadcast(event);
// Notify the specified action listener method (if any),
// and the default action listener
if (event instanceof ActionEvent)
{
FacesContext context = getFacesContext();
MethodBinding mb = getActionListener();
if (mb != null)
mb.invoke(context, new Object[] { event });
ActionListener defaultActionListener =
context.getApplication().getActionListener();
if (defaultActionListener != null)
{
defaultActionListener.processAction((ActionEvent) event);
}
}
}
示例2: processEvent
import javax.faces.event.ActionListener; //导入依赖的package包/类
@Override
public void processEvent(SystemEvent event) throws AbortProcessingException {
if (event instanceof PreValidateEvent) {
UIViewRoot viewRoot = getUIViewRoot(event);
if (null != viewRoot) {
ActionListener listener
= createActionEventListener(event, PROP_VALIDATOR_PREFIX);
if (null != listener) {
// PreValidaeEventは必要な場合だけ登録されるので、存在しない場合でも
// エラーではありません.
ActionEvent ae = new ActionEvent(viewRoot);
listener.processAction(ae);
}
}
}
}
示例3: initJsfActionListener
import javax.faces.event.ActionListener; //导入依赖的package包/类
static void initJsfActionListener() {
// cette indirection entre FilterContext et JsfActionListener est probablement nécessaire pour la JVM IBM J9
// afin de ne pas dépendre des classes FacesContext et ActionListenerImpl et afin de ne pas avoir de ClassNotFound dans J9
try {
final FacesContext facesContext = FacesContext.getCurrentInstance();
if (facesContext != null && facesContext.getApplication() != null) {
// ceci est a priori équivalent à l'ajout d'un action-listener dans WEB-INF/faces-config.xml de l'application :
// <application><action-listener>net.bull.javamelody.JsfActionListener</action-listener></application>
// et on ne peut pas avoir un fichier META-INF/faces-config.xml dans le jar de javamelody avec cet action-listener
// car dans Apache MyFaces, cela ferait certainement une ClassNotFoundException rendant javamelody inutilisable
final ActionListener delegateActionListener = facesContext.getApplication()
.getActionListener();
final JsfActionListener jsfActionListener = new JsfActionListener(
delegateActionListener);
facesContext.getApplication().setActionListener(jsfActionListener);
}
} catch (final Exception e) {
// issue 204: initialisation du JsfActionListener échouée, tant pis, il n'y aura pas les statistiques pour JSF.
// no stack-trace, because in JBoss 7 because in some cases the class com.sun.faces.application.ActionListenerImpl is available but the ApplicationFactory isn't (issue 393)
LOG.info("initialization of jsf action listener failed, skipping");
}
}
示例4: broadcast
import javax.faces.event.ActionListener; //导入依赖的package包/类
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException
{
// Perform standard superclass processing
super.broadcast(event);
FacesContext context = getFacesContext();
// Notify the specified listener method (if any)
if (event instanceof ActionEvent)
{
if (getActionType() == PREVIOUS_ACTION_TYPE)
{
broadcastToMethodBinding(event, getPreviousActionListener());
}
else
{
broadcastToMethodBinding(event, getNextActionListener());
}
ActionListener defaultActionListener =
context.getApplication().getActionListener();
if (defaultActionListener != null)
defaultActionListener.processAction((ActionEvent) event);
}
}
示例5: JsfActionListener
import javax.faces.event.ActionListener; //导入依赖的package包/类
/**
* Constructeur.
* @param delegateActionListener ActionListener
*/
public JsfActionListener(ActionListener delegateActionListener) {
super();
// quand cet ActionListener est utilisé, le compteur est affiché
// sauf si le paramètre displayed-counters dit le contraire
JSF_COUNTER.setDisplayed(!COUNTER_HIDDEN);
JSF_COUNTER.setUsed(true);
LOG.debug("jsf action listener initialized");
this.delegateActionListener = delegateActionListener;
}
示例6: bindCommand
import javax.faces.event.ActionListener; //导入依赖的package包/类
public void bindCommand(final EmptyEventHandler handler) {
if (handler == null)
return;
((UICommand) component).addActionListener(new ActionListener() {
@Override
public void processAction(ActionEvent event)
throws AbortProcessingException {
handler.handle();
}
});
}
示例7: actionListener
import javax.faces.event.ActionListener; //导入依赖的package包/类
/**
* Execute action listeners on a tab.
* @param index the index of the tab to execute action listeners.
*/
private void actionListener(final int index) {
final UIComponent component = getItemComponent(index);
final ActionListener[] actions = (ActionListener[]) component.getAttributes().get("actionListeners");
if (actions != null && actions.length > 0) {
final ActionEvent event = new ActionEvent(component);
for (final ActionListener action : actions) {
action.processAction(event);
}
}
}
示例8: getWrappedActionListener
import javax.faces.event.ActionListener; //导入依赖的package包/类
private ActionListener getWrappedActionListener()
{
//TODO re-visit it
//was:
//SecurityViolationAwareActionListener securityViolationAwareActionListener =
// new SecurityViolationAwareActionListener(this.wrapped);
return new ViewControllerActionListener(this.wrapped);
}
示例9: ExceptionActionListener
import javax.faces.event.ActionListener; //导入依赖的package包/类
public ExceptionActionListener(ActionListener delegate) {
this.delegate = delegate;
}
示例10: getActionListener
import javax.faces.event.ActionListener; //导入依赖的package包/类
@Override
public ActionListener getActionListener() {
throw new UnsupportedOperationException();
}
示例11: setActionListener
import javax.faces.event.ActionListener; //导入依赖的package包/类
@Override
public void setActionListener(ActionListener arg0) {
throw new UnsupportedOperationException();
}
示例12: getActionListener
import javax.faces.event.ActionListener; //导入依赖的package包/类
@Override
public ActionListener getActionListener()
{
throw new UnsupportedOperationException("Should not be called during rendering");
}
示例13: setActionListener
import javax.faces.event.ActionListener; //导入依赖的package包/类
@Override
public void setActionListener(ActionListener listener)
{
throw new UnsupportedOperationException("Should not be called during rendering");
}
示例14: broadcast
import javax.faces.event.ActionListener; //导入依赖的package包/类
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException
{
// Perform special processing for ActionEvents: tell
// the RequestContext to remember this command instance
// so that the NavigationHandler can locate us to queue
// a LaunchEvent.
if (event instanceof ActionEvent)
{
RequestContext afContext = RequestContext.getCurrentInstance();
afContext.getDialogService().setCurrentLaunchSource(this);
try
{
// Perform standard superclass processing
super.broadcast(event);
// Notify the specified action listener method (if any),
// and the default action listener
broadcastToMethodBinding(event, getActionListener());
FacesContext context = getFacesContext();
ActionListener defaultActionListener =
context.getApplication().getActionListener();
if (defaultActionListener != null)
{
defaultActionListener.processAction((ActionEvent) event);
}
}
finally
{
afContext.getDialogService().setCurrentLaunchSource(null);
}
}
else
{
// Perform standard superclass processing
super.broadcast(event);
if (event instanceof LaunchEvent)
{
broadcastToMethodExpression(event, getLaunchListener());
boolean useWindow =
Boolean.TRUE.equals(getAttributes().get("useWindow"));
((LaunchEvent) event).launchDialog(useWindow);
}
else if (event instanceof ReturnEvent)
{
broadcastToMethodExpression(event, getReturnListener());
// =-=AEW: always jump to render response??? Seems the safest
// option, because we don't want to immediately update a model
// or really perform any validation.
getFacesContext().renderResponse();
}
}
}
示例15: broadcast
import javax.faces.event.ActionListener; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void broadcast(FacesEvent event) throws AbortProcessingException
{
if (event instanceof ActionEvent)
{
RequestContext afContext = RequestContext.getCurrentInstance();
afContext.getDialogService().setCurrentLaunchSource(this);
try
{
// Perform standard superclass processing
super.broadcast(event);
// Notify the specified action listener method (if any),
// and the default action listener
broadcastToMethodBinding(event, getActionListener());
FacesContext context = getFacesContext();
ActionListener defaultActionListener =
context.getApplication().getActionListener();
if (defaultActionListener != null)
{
defaultActionListener.processAction((ActionEvent) event);
}
}
finally
{
afContext.getDialogService().setCurrentLaunchSource(null);
}
}
else if (event instanceof LaunchEvent)
{
// =-=AEW Support launch listeners on SelectInput?
// super.broadcast(event);
//
// __broadcast(event, getLaunchListener());
((LaunchEvent) event).launchDialog(true);
}
else if (event instanceof ReturnEvent)
{
super.broadcast(event);
broadcastToMethodExpression(event, getReturnListener());
Object returnValue = ((ReturnEvent) event).getReturnValue();
if (returnValue != null)
{
setSubmittedValue(returnValue);
}
// =-=AEW: always jump to render response??? Seems the safest
// option, because we don't want to immediately update a model
// or really perform any validation.
getFacesContext().renderResponse();
}
else
{
super.broadcast(event);
}
}