Search in sources :

Example 1 with DbRelationshipDisplayListener

use of org.apache.cayenne.modeler.event.DbRelationshipDisplayListener in project cayenne by apache.

the class ProjectController method fireDbRelationshipDisplayEvent.

public void fireDbRelationshipDisplayEvent(RelationshipDisplayEvent e) {
    boolean changed = !Arrays.equals(e.getRelationships(), currentState.dbRels);
    if (changed) {
        if (e.getEntity() != currentState.dbEntity) {
            clearState();
            currentState.domain = e.getDomain();
            currentState.map = e.getDataMap();
            currentState.dbEntity = (DbEntity) e.getEntity();
        }
        currentState.dbRels = new DbRelationship[e.getRelationships().length];
        System.arraycopy(e.getRelationships(), 0, currentState.dbRels, 0, currentState.dbRels.length);
    }
    for (EventListener listener : listenerList.getListeners(DbRelationshipDisplayListener.class)) {
        DbRelationshipDisplayListener temp = (DbRelationshipDisplayListener) listener;
        temp.currentDbRelationshipChanged(e);
    }
}
Also used : DbRelationshipDisplayListener(org.apache.cayenne.modeler.event.DbRelationshipDisplayListener) EventListener(java.util.EventListener)

Aggregations

EventListener (java.util.EventListener)1 DbRelationshipDisplayListener (org.apache.cayenne.modeler.event.DbRelationshipDisplayListener)1