@Override public void processEvent(SystemEvent event) throws AbortProcessingException { Columns columns = (Columns) event.getSource(); UIComponent parent = columns.getParent(); if (parent instanceof DataTable) { ((DataTable) parent).setDynamicColumns(columns); } else if (parent instanceof TreeTable) { ((TreeTable) parent).setDynamicColumns(columns); } }
@Override public boolean isAppropriateListener(FacesListener listener) { return listener instanceof ComponentSystemEventListener || super.isAppropriateListener(listener); }
/** * Iterate through and invoke the listeners. If the passed event was <code>null</code>, create * the event, and return it. */ private SystemEvent processListeners(Collection<SystemEventListener> listeners, SystemEvent event, Object source, EventInfo eventInfo) { if (listeners != null && !listeners.isEmpty()) { ArrayList<SystemEventListener> list = new ArrayList<>(listeners); for (SystemEventListener curListener : list) { if (curListener != null && curListener.isListenerForSource(source)) { if (event == null) { event = eventInfo.createSystemEvent(source); } assert event != null; if (event.isAppropriateListener(curListener)) { event.processListener(curListener); } } } } return event; }
@Override public void processListener(FacesListener listener) { if (listener instanceof SystemEventListener) { super.processListener(listener); } else if (listener instanceof ComponentSystemEventListener) { ((ComponentSystemEventListener)listener).processEvent(this); } } }
@Override public void processEvent(SystemEvent event) throws AbortProcessingException { FacesContext facesContext = event.getFacesContext(); for (FlowDefinitionDocument flowDefinition : FacesFlowDefinitionConfigProcessor.this.getSavedFlowDefinitions(facesContext)) { try { FacesFlowDefinitionConfigProcessor.this.processFacesFlowDefinitions( facesContext, flowDefinition.definingDocumentURI, flowDefinition.flowDefinitions); } catch (XPathExpressionException ex) { throw new FacesException(ex); } } FacesFlowDefinitionConfigProcessor.this.clearSavedFlowDefinitions(facesContext); } }
/** * Iterate through and invoke the listeners. If the passed event was <code>null</code>, create * the event, and return it. */ private SystemEvent processListeners(Collection<SystemEventListener> listeners, SystemEvent event, Object source, EventInfo eventInfo) { if (listeners != null && !listeners.isEmpty()) { ArrayList<SystemEventListener> list = new ArrayList<>(listeners); for (SystemEventListener curListener : list) { if (curListener != null && curListener.isListenerForSource(source)) { if (event == null) { event = eventInfo.createSystemEvent(source); } assert event != null; if (event.isAppropriateListener(curListener)) { event.processListener(curListener); } } } } return event; }
super.processListener(listener); } else if (listener instanceof ComponentSystemEventListener) { ((ComponentSystemEventListener)listener).processEvent(this);
@Override public void processEvent(SystemEvent event) throws AbortProcessingException { FacesContext facesContext = event.getFacesContext(); for (FlowDefinitionDocument flowDefinition : FacesFlowDefinitionConfigProcessor.this.getSavedFlowDefinitions(facesContext)) { try { FacesFlowDefinitionConfigProcessor.this.processFacesFlowDefinitions( facesContext, flowDefinition.definingDocumentURI, flowDefinition.flowDefinitions); } catch (XPathExpressionException ex) { throw new FacesException(ex); } } FacesFlowDefinitionConfigProcessor.this.clearSavedFlowDefinitions(facesContext); } }
@Override public void processEvent(SystemEvent cse) throws AbortProcessingException { FacesContext context = FacesContext.getCurrentInstance(); Timeline timeline = (Timeline) cse.getSource(); String widgetVar = timeline.resolveWidgetVar(); Map<String, TimelineUpdater> map = (Map<String, TimelineUpdater>) context.getAttributes().get(TimelineUpdater.class.getName()); if (map == null) { map = new HashMap<>(); context.getAttributes().put(TimelineUpdater.class.getName(), map); } boolean alreadyRegistred = false; for (PhaseListener listener : context.getViewRoot().getPhaseListeners()) { if (listener instanceof DefaultTimelineUpdater && ((DefaultTimelineUpdater) listener).getWidgetVar().equals(widgetVar)) { if (!map.containsKey(widgetVar)) { map.put(widgetVar, (DefaultTimelineUpdater) listener); } alreadyRegistred = true; } } if (!alreadyRegistred) { DefaultTimelineUpdater timelineUpdater = new DefaultTimelineUpdater(); timelineUpdater.setWidgetVar(widgetVar); map.put(widgetVar, timelineUpdater); context.getViewRoot().addPhaseListener(timelineUpdater); } }
/** * Iterate through and invoke the listeners. If the passed event was <code>null</code>, create * the event, and return it. */ private SystemEvent processListeners(Collection<SystemEventListener> listeners, SystemEvent event, Object source, EventInfo eventInfo) { if (listeners != null && !listeners.isEmpty()) { ArrayList<SystemEventListener> list = new ArrayList<>(listeners); for (SystemEventListener curListener : list) { if (curListener != null && curListener.isListenerForSource(source)) { if (event == null) { event = eventInfo.createSystemEvent(source); } assert event != null; if (event.isAppropriateListener(curListener)) { event.processListener(curListener); } } } } return event; }
/** * <p class="changed_added_2_2">Return <code>true</code> if the argument * {@link FacesListener} is an instance of the appropriate listener class that this event * supports. The default implementation returns true if the listener * is a {@link ComponentSystemEventListener} or if <code>super.isAppropriateListener()</code> * returns true.</p> * * @param listener {@link FacesListener} to evaluate * @since 2.2 */ @Override public boolean isAppropriateListener(FacesListener listener) { boolean result = (listener instanceof ComponentSystemEventListener); if (!result) { result = super.isAppropriateListener(listener); } return result; }
super.processListener(listener); } else if (listener instanceof ComponentSystemEventListener) { ((ComponentSystemEventListener)listener).processEvent(this);
@Override public void processEvent(SystemEvent event) throws AbortProcessingException { FacesContext facesContext = event.getFacesContext(); for (FlowDefinitionDocument flowDefinition : FacesFlowDefinitionConfigProcessor.this.getSavedFlowDefinitions(facesContext)) { try { FacesFlowDefinitionConfigProcessor.this.processFacesFlowDefinitions( facesContext, flowDefinition.definingDocumentURI, flowDefinition.flowDefinitions); } catch (XPathExpressionException ex) { throw new FacesException(ex); } } FacesFlowDefinitionConfigProcessor.this.clearSavedFlowDefinitions(facesContext); } }
public class SystemEventListenerImpl implements SystemEventListener { @Override public void processEvent(SystemEvent event) throws AbortProcessingException { Application application = (Application) event.getSource(); //TODO } @Override public boolean isListenerForSource(Object source) { return (source instanceof Application); } }
/** * Iterate through and invoke the listeners. If the passed event was * <code>null</code>, create the event, and return it. */ private SystemEvent processListeners(Collection<SystemEventListener> listeners, SystemEvent event, Object source, EventInfo eventInfo) { if (listeners != null && !listeners.isEmpty()) { ArrayList<SystemEventListener> list = new ArrayList<SystemEventListener>(listeners); for (SystemEventListener curListener : list) { if (curListener != null && curListener.isListenerForSource(source)) { if (event == null) { event = eventInfo.createSystemEvent(source); } assert (event != null); if (event.isAppropriateListener(curListener)) { event.processListener(curListener); } } } } return event; }
/** * <p class="changed_added_2_2">Return <code>true</code> if the argument * {@link FacesListener} is an instance of the appropriate listener class that this event * supports. The default implementation returns true if the listener * is a {@link ComponentSystemEventListener} or if <code>super.isAppropriateListener()</code> * returns true.</p> * * @param listener {@link FacesListener} to evaluate * @since 2.2 */ @Override public boolean isAppropriateListener(FacesListener listener) { boolean result = (listener instanceof ComponentSystemEventListener); if (!result) { result = super.isAppropriateListener(listener); } return result; }
super.processListener(listener); } else if (listener instanceof ComponentSystemEventListener) { ((ComponentSystemEventListener)listener).processEvent(this);
public void processEvent(SystemEvent event) { UIComponent addedComponent = (UIComponent) event.getSource(); if ("submit".equals(addedComponent.getId())) { log.warning("Component " + addedComponent.getClass().getName() + " uses the 'submit' string for the ID attribute. This is known to cause problems in Internet Explorer."); } } }
private static SystemEvent _traverseListenerList(List<? extends SystemEventListener> listeners, Class<? extends SystemEvent> systemEventClass, Object source, SystemEvent event) { if (listeners != null && !listeners.isEmpty()) { for (SystemEventListener listener : listeners) { // Call SystemEventListener.isListenerForSource(java.lang.Object), passing the source argument. // If this returns false, take no action on the listener. if (listener.isListenerForSource(source)) { // Otherwise, if the event to be passed to the listener instances has not yet been constructed, // construct the event, passing source as the argument to the one-argument constructor that takes // an Object. This same event instance must be passed to all listener instances. event = _createEvent(systemEventClass, source, event); // Call SystemEvent.isAppropriateListener(javax.faces.event.FacesListener), passing the listener // instance as the argument. If this returns false, take no action on the listener. if (event.isAppropriateListener(listener)) { // Call SystemEvent.processListener(javax.faces.event.FacesListener), passing the listener // instance. event.processListener(listener); } } } } return event; }
/** * <p class="changed_added_2_2">Return <code>true</code> if the argument * {@link FacesListener} is an instance of the appropriate listener class that this event * supports. The default implementation returns true if the listener * is a {@link ComponentSystemEventListener} or if <code>super.isAppropriateListener()</code> * returns true.</p> * * @param listener {@link FacesListener} to evaluate * @since 2.2 */ @Override public boolean isAppropriateListener(FacesListener listener) { boolean result = (listener instanceof ComponentSystemEventListener); if (!result) { result = super.isAppropriateListener(listener); } return result; }