Search in sources :

Example 11 with DataNodeEvent

use of org.apache.cayenne.configuration.event.DataNodeEvent in project cayenne by apache.

the class ProjectController method addDataMap.

public void addDataMap(Object src, DataMap map, boolean makeCurrent) {
    map.setDataChannelDescriptor(currentState.domain);
    // new map was added.. link it to domain (and node if possible)
    currentState.domain.getDataMaps().add(map);
    if (currentState.node != null && !currentState.node.getDataMapNames().contains(map.getName())) {
        currentState.node.getDataMapNames().add(map.getName());
        fireDataNodeEvent(new DataNodeEvent(this, currentState.node));
    }
    fireDataMapEvent(new DataMapEvent(src, map, MapEvent.ADD));
    if (makeCurrent) {
        fireDataMapDisplayEvent(new DataMapDisplayEvent(src, map, currentState.domain, currentState.node));
    }
}
Also used : DataNodeEvent(org.apache.cayenne.configuration.event.DataNodeEvent) DataMapEvent(org.apache.cayenne.configuration.event.DataMapEvent)

Example 12 with DataNodeEvent

use of org.apache.cayenne.configuration.event.DataNodeEvent in project cayenne by apache.

the class CreateNodeAction method createDataNode.

public void createDataNode(DataNodeDescriptor node) {
    DataChannelDescriptor domain = (DataChannelDescriptor) getProjectController().getProject().getRootNode();
    domain.getNodeDescriptors().add(node);
    getProjectController().fireDataNodeEvent(new DataNodeEvent(this, node, MapEvent.ADD));
    getProjectController().fireDataNodeDisplayEvent(new DataNodeDisplayEvent(this, domain, node));
}
Also used : DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) DataNodeEvent(org.apache.cayenne.configuration.event.DataNodeEvent) DataNodeDisplayEvent(org.apache.cayenne.modeler.event.DataNodeDisplayEvent)

Aggregations

DataNodeEvent (org.apache.cayenne.configuration.event.DataNodeEvent)12 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)6 ProjectController (org.apache.cayenne.modeler.ProjectController)5 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)4 ArrayList (java.util.ArrayList)3 DataMap (org.apache.cayenne.map.DataMap)3 DataMapEvent (org.apache.cayenne.configuration.event.DataMapEvent)2 DataNodeDisplayEvent (org.apache.cayenne.modeler.event.DataNodeDisplayEvent)2 EventObject (java.util.EventObject)1 Map (java.util.Map)1 DomainEvent (org.apache.cayenne.configuration.event.DomainEvent)1 ProcedureEvent (org.apache.cayenne.configuration.event.ProcedureEvent)1 QueryEvent (org.apache.cayenne.configuration.event.QueryEvent)1 JNDIDataSourceFactory (org.apache.cayenne.configuration.server.JNDIDataSourceFactory)1 XMLPoolingDataSourceFactory (org.apache.cayenne.configuration.server.XMLPoolingDataSourceFactory)1 DataSourceInfo (org.apache.cayenne.conn.DataSourceInfo)1 DbAdapter (org.apache.cayenne.dba.DbAdapter)1 EmbeddableEvent (org.apache.cayenne.map.event.EmbeddableEvent)1 EntityEvent (org.apache.cayenne.map.event.EntityEvent)1 LinkDataMapUndoableEdit (org.apache.cayenne.modeler.undo.LinkDataMapUndoableEdit)1