本文整理匯總了Java中javax.faces.event.PhaseListener類的典型用法代碼示例。如果您正苦於以下問題:Java PhaseListener類的具體用法?Java PhaseListener怎麽用?Java PhaseListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
PhaseListener類屬於javax.faces.event包,在下文中一共展示了PhaseListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getListener
import javax.faces.event.PhaseListener; //導入依賴的package包/類
public PhaseListener getListener() {
return new PhaseListener() {
private static final long serialVersionUID = -66585096775189540L;
public PhaseId getPhaseId() {
return PhaseId.RENDER_RESPONSE;
}
public void beforePhase(PhaseEvent event) {
unselectCategory();
}
public void afterPhase(PhaseEvent arg0) {
// nothing
}
};
}
示例2: installListener
import javax.faces.event.PhaseListener; //導入依賴的package包/類
static void installListener(
FacesContext facesContext)
{
UIViewRoot viewRoot = facesContext.getViewRoot();
// See if the phase listener has already been added (only add it once)
Map<String, Object> viewAttrs = viewRoot.getAttributes();
if (!viewAttrs.containsKey(_PL_KEY))
{
PhaseListener newPhaseListener = new CleanupPhaseListener();
viewRoot.addPhaseListener(newPhaseListener);
viewAttrs.put(_PL_KEY, Boolean.TRUE);
_LOG.finer("Cleanup phase listener has been installed");
}
else
{
_LOG.finest("Cleanup phase listener has already been installed on the current view");
}
}
示例3: JsfRequestLifecycleBroadcaster
import javax.faces.event.PhaseListener; //導入依賴的package包/類
@Inject
protected JsfRequestLifecycleBroadcaster(Instance<PhaseListener> phaseListenerInstance)
{
Class phaseListenerClass;
for (PhaseListener currentPhaseListener : phaseListenerInstance)
{
phaseListenerClass = ProxyUtils.getUnproxiedClass(currentPhaseListener.getClass());
if (phaseListenerClass.isAnnotationPresent(JsfPhaseListener.class))
{
if (Deactivatable.class.isAssignableFrom(phaseListenerClass) &&
!ClassDeactivationUtils.isActivated(phaseListenerClass))
{
continue;
}
this.phaseListeners.add(currentPhaseListener);
}
}
//higher ordinals first
sortDescending(this.phaseListeners);
}
示例4: broadcastBeforeEvent
import javax.faces.event.PhaseListener; //導入依賴的package包/類
protected void broadcastBeforeEvent(PhaseEvent phaseEvent)
{
//TODO discuss exception handling
//fire to phase-observer methods
this.phaseEvent.select(createAnnotationLiteral(phaseEvent.getPhaseId(), true)).fire(phaseEvent);
this.beforeAnyPhaseEvent.fire(phaseEvent);
//fire to ds-phase-listeners
for (PhaseListener phaseListener : this.phaseListeners)
{
PhaseId targetPhase = phaseListener.getPhaseId();
if (targetPhase == PhaseId.ANY_PHASE || targetPhase == phaseEvent.getPhaseId())
{
phaseListener.beforePhase(phaseEvent);
}
}
}
示例5: broadcastAfterEvent
import javax.faces.event.PhaseListener; //導入依賴的package包/類
protected void broadcastAfterEvent(PhaseEvent phaseEvent)
{
//TODO discuss exception handling
//fire to phase-observer methods
this.phaseEvent.select(createAnnotationLiteral(phaseEvent.getPhaseId(), false)).fire(phaseEvent);
this.afterAnyPhaseEvent.fire(phaseEvent);
//fire to ds-phase-listeners
//call the listeners in reverse-order (like jsf)
ListIterator<PhaseListener> phaseListenerIterator = this.phaseListeners.listIterator(phaseListeners.size());
while (phaseListenerIterator.hasPrevious())
{
PhaseListener phaseListener = phaseListenerIterator.previous();
PhaseId targetPhase = phaseListener.getPhaseId();
if (targetPhase == PhaseId.ANY_PHASE || targetPhase == phaseEvent.getPhaseId())
{
phaseListener.afterPhase(phaseEvent);
}
}
}
示例6: doPostBringupActions
import javax.faces.event.PhaseListener; //導入依賴的package包/類
public void doPostBringupActions() {
if (deferredLoggingActions != null) {
for (DeferredLoggingAction loggingAction : deferredLoggingActions) {
loggingAction.log();
}
}
// add the HttpMethodRestrictionPhaseListener if the parameter is enabled.
boolean enabled = this.isOptionEnabled(BooleanWebContextInitParameter.EnableHttpMethodRestrictionPhaseListener);
if (enabled) {
LifecycleFactory factory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
Iterator<String> ids = factory.getLifecycleIds();
PhaseListener listener = null;
Lifecycle cur;
while (ids.hasNext()) {
cur = factory.getLifecycle(ids.next());
boolean foundExistingListenerInstance = false;
for (PhaseListener curListener : cur.getPhaseListeners()) {
if (curListener instanceof HttpMethodRestrictionsPhaseListener) {
foundExistingListenerInstance = true;
break;
}
}
if (!foundExistingListenerInstance) {
if (null == listener) {
listener = new HttpMethodRestrictionsPhaseListener();
}
cur.addPhaseListener(listener);
}
}
}
}
示例7: addPhaseListener
import javax.faces.event.PhaseListener; //導入依賴的package包/類
@Override
public void addPhaseListener(PhaseListener listener) {
if (firstPhaseListener) {
//forced order independent of any other config
firstPhaseListener = false;
wrapped.addPhaseListener(new ExtValStartupListener());
}
wrapped.addPhaseListener(listener);
}
示例8: sortDescending
import javax.faces.event.PhaseListener; //導入依賴的package包/類
private static void sortDescending(List<PhaseListener> phaseListeners)
{
Collections.sort(phaseListeners, new Comparator<PhaseListener>()
{
@Override
public int compare(PhaseListener phaseListener1, PhaseListener phaseListener2)
{
return (phaseListener1.getClass().getAnnotation(JsfPhaseListener.class).ordinal() >
phaseListener2.getClass().getAnnotation(JsfPhaseListener.class).ordinal()) ? -1 : 1;
}
});
}
示例9: addPhaseListener
import javax.faces.event.PhaseListener; //導入依賴的package包/類
@Override
public void addPhaseListener(PhaseListener newPhaseListener) {
throw new UnsupportedOperationException();
}
示例10: removePhaseListener
import javax.faces.event.PhaseListener; //導入依賴的package包/類
@Override
public void removePhaseListener(PhaseListener toRemove) {
throw new UnsupportedOperationException();
}
示例11: beforePhase
import javax.faces.event.PhaseListener; //導入依賴的package包/類
@Override
public void beforePhase(PhaseEvent event) {
for (PhaseListener listener : getDelegates(event.getFacesContext())) {
listener.beforePhase(event);
}
}
示例12: afterPhase
import javax.faces.event.PhaseListener; //導入依賴的package包/類
@Override
public void afterPhase(PhaseEvent event) {
for (PhaseListener listener : getDelegates(event.getFacesContext())) {
listener.afterPhase(event);
}
}
示例13: addPhaseListener
import javax.faces.event.PhaseListener; //導入依賴的package包/類
@Override
public void addPhaseListener(PhaseListener phaseListener) {
}
示例14: getPhaseListeners
import javax.faces.event.PhaseListener; //導入依賴的package包/類
@Override
public PhaseListener[] getPhaseListeners() {
return null;
}
示例15: removePhaseListener
import javax.faces.event.PhaseListener; //導入依賴的package包/類
@Override
public void removePhaseListener(PhaseListener phaseListener) {
}