use of org.apache.cayenne.map.event.EntityEvent in project cayenne by apache.
the class SuperclassUpdateController method updateSuperclass.
protected void updateSuperclass() {
boolean doAll = isAllEntities();
String defaultSuperclass = getSuperclass();
for (ObjEntity entity : dataMap.getObjEntities()) {
if (doAll || Util.isEmptyString(getSuperClassName(entity))) {
if (!Util.nullSafeEquals(defaultSuperclass, getSuperClassName(entity))) {
setSuperClassName(entity, defaultSuperclass);
// any way to batch events, a big change will flood the app with
// entity events..?
mediator.fireDbEntityEvent(new EntityEvent(this, entity));
}
}
}
view.dispose();
}
use of org.apache.cayenne.map.event.EntityEvent in project cayenne by apache.
the class EntityEventTest method testConstructor2.
@Test
public void testConstructor2() throws Exception {
Object src = new Object();
Entity d = new DbEntity("abc");
EntityEvent e = new EntityEvent(src, d, "oldname");
assertSame(src, e.getSource());
assertSame(d, e.getEntity());
assertEquals("oldname", e.getOldName());
}
use of org.apache.cayenne.map.event.EntityEvent in project cayenne by apache.
the class EntityEventTest method testNameChange1.
@Test
public void testNameChange1() throws Exception {
Entity d = new DbEntity("abc");
EntityEvent e = new EntityEvent(new Object(), d, "xyz");
assertEquals(d.getName(), e.getNewName());
assertTrue(e.isNameChange());
}
use of org.apache.cayenne.map.event.EntityEvent in project cayenne by apache.
the class ObjEntityTab method setSuperClassName.
void setSuperClassName(String text) {
if (text != null && text.trim().length() == 0) {
text = null;
}
ObjEntity ent = mediator.getCurrentObjEntity();
if (ent != null && !Util.nullSafeEquals(ent.getSuperClassName(), text)) {
ent.setSuperClassName(text);
mediator.fireObjEntityEvent(new EntityEvent(this, ent));
}
}
use of org.apache.cayenne.map.event.EntityEvent in project cayenne by apache.
the class ObjEntityTab method setClientClassName.
void setClientClassName(String className) {
if (className != null && className.trim().length() == 0) {
className = null;
}
ObjEntity entity = mediator.getCurrentObjEntity();
// "ent" may be null if we quit editing by changing tree selection
if (entity != null && !Util.nullSafeEquals(entity.getClientClassName(), className)) {
entity.setClientClassName(className);
mediator.fireObjEntityEvent(new EntityEvent(this, entity));
}
}
Aggregations