Search in sources :

Example 1 with DomainDisplayListener

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

the class ProjectController method fireDomainDisplayEvent.

public void fireDomainDisplayEvent(DomainDisplayEvent e) {
    boolean changed = e.getDomain() != currentState.domain;
    if (!changed) {
        changed = currentState.node != null || currentState.map != null || currentState.dbEntity != null || currentState.objEntity != null || currentState.procedure != null || currentState.query != null || currentState.embeddable != null;
    }
    if (!e.isRefired()) {
        e.setDomainChanged(changed);
        if (changed) {
            clearState();
            currentState.domain = e.getDomain();
        }
    }
    if (changed) {
        saveState(e);
    }
    for (EventListener listener : listenerList.getListeners(DomainDisplayListener.class)) {
        DomainDisplayListener temp = (DomainDisplayListener) listener;
        temp.currentDomainChanged(e);
    }
    // closed
    if (e.getDomain() == null) {
        getApplication().getActionManager().projectOpened();
    } else {
        getApplication().getActionManager().domainSelected();
    }
}
Also used : DomainDisplayListener(org.apache.cayenne.modeler.event.DomainDisplayListener) EventListener(java.util.EventListener)

Aggregations

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