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());
}
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());
}
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));
}
}
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());
}
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));
}
Aggregations