Search in sources :

Example 1 with ObjRelationshipDisplayListener

use of org.apache.cayenne.modeler.event.ObjRelationshipDisplayListener 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)1 ObjRelationshipDisplayListener (org.apache.cayenne.modeler.event.ObjRelationshipDisplayListener)1