Search in sources :

Example 31 with EventListener

use of java.util.EventListener in project cayenne by apache.

the class ProjectController method fireProcedureDisplayEvent.

public void fireProcedureDisplayEvent(ProcedureDisplayEvent e) {
    boolean changed = e.getProcedure() != currentState.procedure;
    if (!e.isRefired()) {
        e.setProcedureChanged(changed);
        if (changed) {
            clearState();
            currentState.domain = e.getDomain();
            currentState.map = e.getDataMap();
            currentState.procedure = e.getProcedure();
        }
    }
    if (changed) {
        saveState(e);
    }
    for (EventListener eventListener : listenerList.getListeners(ProcedureDisplayListener.class)) {
        ProcedureDisplayListener listener = (ProcedureDisplayListener) eventListener;
        listener.currentProcedureChanged(e);
    }
}
Also used : EventListener(java.util.EventListener) ProcedureDisplayListener(org.apache.cayenne.modeler.event.ProcedureDisplayListener)

Example 32 with EventListener

use of java.util.EventListener in project cayenne by apache.

the class ProjectController method fireProjectOnSaveEvent.

public void fireProjectOnSaveEvent(ProjectOnSaveEvent e) {
    for (EventListener listener : listenerList.getListeners(ProjectOnSaveListener.class)) {
        ProjectOnSaveListener temp = (ProjectOnSaveListener) listener;
        temp.beforeSaveChanges(e);
    }
}
Also used : ProjectOnSaveListener(org.apache.cayenne.modeler.event.ProjectOnSaveListener) EventListener(java.util.EventListener)

Example 33 with EventListener

use of java.util.EventListener in project cayenne by apache.

the class ProjectController method fireQueryDisplayEvent.

public void fireQueryDisplayEvent(QueryDisplayEvent e) {
    boolean changed = e.getQuery() != currentState.query;
    if (!e.isRefired()) {
        e.setQueryChanged(changed);
        if (changed) {
            clearState();
            currentState.domain = e.getDomain();
            currentState.map = e.getDataMap();
            currentState.query = e.getQuery();
        }
    }
    if (changed) {
        saveState(e);
    }
    for (EventListener eventListener : listenerList.getListeners(QueryDisplayListener.class)) {
        QueryDisplayListener listener = (QueryDisplayListener) eventListener;
        listener.currentQueryChanged(e);
    }
}
Also used : QueryDisplayListener(org.apache.cayenne.modeler.event.QueryDisplayListener) EventListener(java.util.EventListener)

Example 34 with EventListener

use of java.util.EventListener in project cayenne by apache.

the class ProjectController method fireDataNodeDisplayEvent.

public void fireDataNodeDisplayEvent(DataNodeDisplayEvent e) {
    boolean changed = e.getDataNode() != currentState.node;
    if (!changed) {
        changed = currentState.map != null || currentState.dbEntity != null || currentState.objEntity != null || currentState.procedure != null || currentState.query != null || currentState.embeddable != null;
    }
    if (!e.isRefired()) {
        e.setDataNodeChanged(changed);
        if (changed) {
            clearState();
            currentState.domain = e.getDomain();
            currentState.node = e.getDataNode();
        }
    }
    if (changed) {
        saveState(e);
    }
    EventListener[] list = listenerList.getListeners(DataNodeDisplayListener.class);
    for (EventListener listener : list) {
        ((DataNodeDisplayListener) listener).currentDataNodeChanged(e);
    }
}
Also used : DataNodeDisplayListener(org.apache.cayenne.modeler.event.DataNodeDisplayListener) EventListener(java.util.EventListener)

Example 35 with EventListener

use of java.util.EventListener in project cayenne by apache.

the class ProjectController method fireObjRelationshipDisplayEvent.

public void fireObjRelationshipDisplayEvent(RelationshipDisplayEvent e) {
    boolean changed = !Arrays.equals(e.getRelationships(), currentState.objRels);
    e.setRelationshipChanged(changed);
    if (changed) {
        if (e.getEntity() != currentState.objEntity) {
            clearState();
            currentState.domain = e.getDomain();
            currentState.map = e.getDataMap();
            currentState.objEntity = (ObjEntity) e.getEntity();
        }
        currentState.objRels = new ObjRelationship[e.getRelationships().length];
        System.arraycopy(e.getRelationships(), 0, currentState.objRels, 0, currentState.objRels.length);
    }
    EventListener[] list = listenerList.getListeners(ObjRelationshipDisplayListener.class);
    for (EventListener listener : list) {
        ObjRelationshipDisplayListener temp = (ObjRelationshipDisplayListener) listener;
        temp.currentObjRelationshipChanged(e);
    }
}
Also used : ObjRelationshipDisplayListener(org.apache.cayenne.modeler.event.ObjRelationshipDisplayListener) EventListener(java.util.EventListener)

Aggregations

EventListener (java.util.EventListener)71 Test (org.junit.Test)11 ListenerInfo (io.undertow.servlet.api.ListenerInfo)5 ServletRequestListener (javax.servlet.ServletRequestListener)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 ServletContextListener (javax.servlet.ServletContextListener)3 HttpSessionListener (javax.servlet.http.HttpSessionListener)3 ServletHolder (org.eclipse.jetty.servlet.ServletHolder)3 EventListenerList (org.eclipse.scout.rt.platform.util.EventListenerList)3 Bundle (org.osgi.framework.Bundle)3 BundleContext (org.osgi.framework.BundleContext)3 EntryListenerConfig (com.hazelcast.config.EntryListenerConfig)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 EventObject (java.util.EventObject)2 List (java.util.List)2 NamingException (javax.naming.NamingException)2 ServletRequestEvent (javax.servlet.ServletRequestEvent)2 HttpSessionIdListener (javax.servlet.http.HttpSessionIdListener)2