use of java.util.EventListener in project cayenne by apache.
the class ProjectController method fireObjEntityDisplayEvent.
public void fireObjEntityDisplayEvent(EntityDisplayEvent e) {
boolean changed = e.getEntity() != currentState.objEntity;
if (!e.isRefired()) {
e.setEntityChanged(changed);
if (changed) {
clearState();
currentState.domain = e.getDomain();
currentState.node = e.getDataNode();
currentState.map = e.getDataMap();
currentState.objEntity = (ObjEntity) e.getEntity();
}
}
if (changed) {
saveState(e);
}
for (EventListener listener : listenerList.getListeners(ObjEntityDisplayListener.class)) {
ObjEntityDisplayListener temp = (ObjEntityDisplayListener) listener;
temp.currentObjEntityChanged(e);
}
}
use of java.util.EventListener in project cayenne by apache.
the class ProjectController method fireObjAttributeDisplayEvent.
public void fireObjAttributeDisplayEvent(AttributeDisplayEvent e) {
boolean changed = !Arrays.equals(e.getAttributes(), currentState.objAttrs);
if (changed) {
if (e.getEntity() != currentState.objEntity) {
clearState();
currentState.domain = e.getDomain();
currentState.map = e.getDataMap();
currentState.objEntity = (ObjEntity) e.getEntity();
}
currentState.objAttrs = new ObjAttribute[e.getAttributes().length];
System.arraycopy(e.getAttributes(), 0, currentState.objAttrs, 0, currentState.objAttrs.length);
}
EventListener[] list = listenerList.getListeners(ObjAttributeDisplayListener.class);
for (EventListener listener : list) {
ObjAttributeDisplayListener temp = (ObjAttributeDisplayListener) listener;
temp.currentObjAttributeChanged(e);
}
}
use of java.util.EventListener in project cayenne by apache.
the class ProjectController method fireEmbeddableAttributeDisplayEvent.
public void fireEmbeddableAttributeDisplayEvent(EmbeddableAttributeDisplayEvent ev) {
boolean changed = !Arrays.equals(ev.getEmbeddableAttributes(), currentState.embAttrs);
if (changed) {
if (ev.getEmbeddable() != currentState.embeddable) {
clearState();
currentState.domain = ev.getDomain();
currentState.map = ev.getDataMap();
currentState.embeddable = ev.getEmbeddable();
}
currentState.embAttrs = new EmbeddableAttribute[ev.getEmbeddableAttributes().length];
System.arraycopy(ev.getEmbeddableAttributes(), 0, currentState.embAttrs, 0, currentState.embAttrs.length);
}
EventListener[] list = listenerList.getListeners(EmbeddableAttributeDisplayListener.class);
for (EventListener listener : list) {
EmbeddableAttributeDisplayListener temp = (EmbeddableAttributeDisplayListener) listener;
temp.currentEmbeddableAttributeChanged(ev);
}
}
use of java.util.EventListener in project Payara by payara.
the class StandardContext method fireRequestInitializedEvent.
@Override
public void fireRequestInitializedEvent(ServletRequest request) {
List<EventListener> listeners = getApplicationEventListeners();
ServletRequestEvent event = null;
if (!listeners.isEmpty()) {
event = new ServletRequestEvent(getServletContext(), request);
// create pre-service event
Iterator<EventListener> iter = listeners.iterator();
while (iter.hasNext()) {
EventListener eventListener = iter.next();
if (!(eventListener instanceof ServletRequestListener)) {
continue;
}
ServletRequestListener listener = (ServletRequestListener) eventListener;
// START SJSAS 6329662
fireContainerEvent(ContainerEvent.BEFORE_REQUEST_INITIALIZED, listener);
// END SJSAS 6329662
try {
listener.requestInitialized(event);
} catch (Throwable t) {
String msg = MessageFormat.format(rb.getString(LogFacade.REQUEST_INIT_EXCEPTION), listener.getClass().getName());
log.log(Level.WARNING, msg, t);
request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t);
// START SJSAS 6329662
} finally {
fireContainerEvent(ContainerEvent.AFTER_REQUEST_INITIALIZED, listener);
// END SJSAS 6329662
}
}
}
}
use of java.util.EventListener in project Payara by payara.
the class StandardContext method fireRequestDestroyedEvent.
@Override
public void fireRequestDestroyedEvent(ServletRequest request) {
List<EventListener> listeners = getApplicationEventListeners();
if (!listeners.isEmpty()) {
// create post-service event
ServletRequestEvent event = new ServletRequestEvent(getServletContext(), request);
int len = listeners.size();
for (int i = 0; i < len; i++) {
EventListener eventListener = listeners.get((len - 1) - i);
if (!(eventListener instanceof ServletRequestListener)) {
continue;
}
ServletRequestListener listener = (ServletRequestListener) eventListener;
// START SJSAS 6329662
fireContainerEvent(ContainerEvent.BEFORE_REQUEST_DESTROYED, listener);
// END SJSAS 6329662
try {
listener.requestDestroyed(event);
} catch (Throwable t) {
String msg = MessageFormat.format(rb.getString(LogFacade.REQUEST_DESTROY_EXCEPTION), listener.getClass().getName());
log.log(Level.WARNING, msg, t);
request.setAttribute(RequestDispatcher.ERROR_EXCEPTION, t);
// START SJSAS 6329662
} finally {
fireContainerEvent(ContainerEvent.AFTER_REQUEST_DESTROYED, listener);
// END SJSAS 6329662
}
}
}
}
Aggregations