Search in sources :

Example 6 with DataNodeEvent

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

the class AdapterEditor method setAdapterName.

public void setAdapterName(String name) {
    if (node == null) {
        return;
    }
    // ModelerDbAdapter adapter = new ModelerDbAdapter(name, node.getDataSource());
    // adapter.validate();
    node.setAdapterType(name);
    DataNodeEvent e = new DataNodeEvent(AdapterEditor.this, node);
    ((ProjectController) getParent()).fireDataNodeEvent(e);
}
Also used : DataNodeEvent(org.apache.cayenne.configuration.event.DataNodeEvent) ProjectController(org.apache.cayenne.modeler.ProjectController)

Example 7 with DataNodeEvent

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

the class LinkDataMapUndoableEdit method undo.

@Override
public void undo() throws CannotUndoException {
    if (node != null) {
        node.getDataMapNames().remove(map.getName());
        mediator.fireDataNodeEvent(new DataNodeEvent(this, node));
    }
    if (!unlinkedNodes.isEmpty()) {
        for (DataNodeDescriptor unlinkedNode : unlinkedNodes) {
            unlinkedNode.getDataMapNames().add(map.getName());
            mediator.fireDataNodeEvent(new DataNodeEvent(this, unlinkedNode));
        }
    }
}
Also used : DataNodeEvent(org.apache.cayenne.configuration.event.DataNodeEvent) DataNodeDescriptor(org.apache.cayenne.configuration.DataNodeDescriptor)

Example 8 with DataNodeEvent

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

the class LinkDataMapsUndoableEdit method redo.

@Override
public void redo() throws CannotRedoException {
    for (DataMap dataMap : ((DataChannelDescriptor) mediator.getProject().getRootNode()).getDataMaps()) {
        if (!linkedDataMaps.contains(dataMap.getName())) {
            dataNodeDescriptor.getDataMapNames().add(dataMap.getName());
            mediator.fireDataNodeEvent(new DataNodeEvent(this, dataNodeDescriptor));
        }
    }
}
Also used : DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) DataNodeEvent(org.apache.cayenne.configuration.event.DataNodeEvent) DataMap(org.apache.cayenne.map.DataMap)

Example 9 with DataNodeEvent

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

the class RemoveAction method removeDataNode.

public void removeDataNode(DataNodeDescriptor node) {
    ProjectController mediator = getProjectController();
    DataChannelDescriptor domain = (DataChannelDescriptor) mediator.getProject().getRootNode();
    DataNodeEvent e = new DataNodeEvent(Application.getFrame(), node, MapEvent.REMOVE);
    e.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
    domain.getNodeDescriptors().remove(node);
    mediator.fireDataNodeEvent(e);
}
Also used : DataChannelDescriptor(org.apache.cayenne.configuration.DataChannelDescriptor) DataNodeEvent(org.apache.cayenne.configuration.event.DataNodeEvent) ProjectController(org.apache.cayenne.modeler.ProjectController)

Example 10 with DataNodeEvent

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

the class RemoveAction method removeDataMapFromDataNode.

public void removeDataMapFromDataNode(DataNodeDescriptor node, DataMap map) {
    ProjectController mediator = getProjectController();
    DataNodeEvent e = new DataNodeEvent(Application.getFrame(), node);
    e.setDomain((DataChannelDescriptor) mediator.getProject().getRootNode());
    node.getDataMapNames().remove(map.getName());
    // Force reloading of the data node in the browse view
    mediator.fireDataNodeEvent(e);
}
Also used : DataNodeEvent(org.apache.cayenne.configuration.event.DataNodeEvent) ProjectController(org.apache.cayenne.modeler.ProjectController)

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