Search in sources :

Example 6 with DataMapEvent

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

the class DataMapEventTest method testConstructor1.

@Test
public void testConstructor1() throws Exception {
    Object src = new Object();
    DataMap d = new DataMap("abc");
    DataMapEvent e = new DataMapEvent(src, d);
    assertSame(src, e.getSource());
    assertSame(d, e.getDataMap());
}
Also used : DataMapEvent(org.apache.cayenne.configuration.event.DataMapEvent) DataMap(org.apache.cayenne.map.DataMap) Test(org.junit.Test)

Example 7 with DataMapEvent

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

the class DataMapEventTest method testConstructor2.

@Test
public void testConstructor2() throws Exception {
    Object src = new Object();
    DataMap d = new DataMap("abc");
    DataMapEvent e = new DataMapEvent(src, d, "oldname");
    assertSame(src, e.getSource());
    assertSame(d, e.getDataMap());
    assertEquals("oldname", e.getOldName());
}
Also used : DataMapEvent(org.apache.cayenne.configuration.event.DataMapEvent) DataMap(org.apache.cayenne.map.DataMap) Test(org.junit.Test)

Example 8 with DataMapEvent

use of org.apache.cayenne.configuration.event.DataMapEvent 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) DataMapDisplayEvent(org.apache.cayenne.modeler.event.DataMapDisplayEvent) DataMapEvent(org.apache.cayenne.configuration.event.DataMapEvent)

Example 9 with DataMapEvent

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

the class DataMapEventTest method testDataMap.

@Test
public void testDataMap() throws Exception {
    Object src = new Object();
    DataMap d = new DataMap("abc");
    DataMapEvent e = new DataMapEvent(src, null);
    e.setDataMap(d);
    assertSame(d, e.getDataMap());
}
Also used : DataMapEvent(org.apache.cayenne.configuration.event.DataMapEvent) DataMap(org.apache.cayenne.map.DataMap) Test(org.junit.Test)

Example 10 with DataMapEvent

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

the class DataMapView method setDefaultClientPackage.

void setDefaultClientPackage(String newDefaultPackage) {
    DataMap dataMap = eventController.getCurrentDataMap();
    if (dataMap == null) {
        return;
    }
    if (newDefaultPackage != null && newDefaultPackage.trim().length() == 0) {
        newDefaultPackage = null;
    }
    String oldPackage = dataMap.getDefaultClientPackage();
    if (Util.nullSafeEquals(newDefaultPackage, oldPackage)) {
        return;
    }
    dataMap.setDefaultClientPackage(newDefaultPackage);
    // TODO: (andrus, 09/10/2005) - add the same logic for the client package
    // update class generation preferences
    // eventController.getDataMapPreferences().setSuperclassPackage(
    // newDefaultPackage,
    // DataMapDefaults.DEFAULT_SUPERCLASS_PACKAGE);
    eventController.fireDataMapEvent(new DataMapEvent(this, dataMap));
}
Also used : DataMapEvent(org.apache.cayenne.configuration.event.DataMapEvent) DataMap(org.apache.cayenne.map.DataMap)

Aggregations

DataMapEvent (org.apache.cayenne.configuration.event.DataMapEvent)19 DataMap (org.apache.cayenne.map.DataMap)15 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)3 Test (org.junit.Test)3 DataNodeEvent (org.apache.cayenne.configuration.event.DataNodeEvent)2 ProjectController (org.apache.cayenne.modeler.ProjectController)2 DataMapDisplayEvent (org.apache.cayenne.modeler.event.DataMapDisplayEvent)2 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 EventObject (java.util.EventObject)1 DataNodeDescriptor (org.apache.cayenne.configuration.DataNodeDescriptor)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 EmbeddableEvent (org.apache.cayenne.map.event.EmbeddableEvent)1 EntityEvent (org.apache.cayenne.map.event.EntityEvent)1 DataNodeDisplayEvent (org.apache.cayenne.modeler.event.DataNodeDisplayEvent)1 DomainDisplayEvent (org.apache.cayenne.modeler.event.DomainDisplayEvent)1 EmbeddableDisplayEvent (org.apache.cayenne.modeler.event.EmbeddableDisplayEvent)1 EntityDisplayEvent (org.apache.cayenne.modeler.event.EntityDisplayEvent)1