use of org.apache.cayenne.map.event.EntityEvent in project cayenne by apache.
the class DbEntityTab method setSchema.
void setSchema(String text) {
if (text != null && text.trim().length() == 0) {
text = null;
}
DbEntity ent = mediator.getCurrentDbEntity();
if (ent != null && !Util.nullSafeEquals(ent.getSchema(), text)) {
ent.setSchema(text);
mediator.fireDbEntityEvent(new EntityEvent(this, ent));
}
}
use of org.apache.cayenne.map.event.EntityEvent in project cayenne by apache.
the class DbEntityTab method setComment.
private void setComment(String value) {
DbEntity entity = mediator.getCurrentDbEntity();
if (entity == null) {
return;
}
ObjectInfo.putToMetaData(mediator.getApplication().getMetaData(), entity, ObjectInfo.COMMENT, value);
mediator.fireDbEntityEvent(new EntityEvent(this, entity));
}
use of org.apache.cayenne.map.event.EntityEvent in project cayenne by apache.
the class PKCustomSequenceGeneratorPanel method setPKName.
protected void setPKName(String text) {
if (mediator.getCurrentDbEntity() == null || mediator.getCurrentDbEntity().getPrimaryKeyGenerator() == null) {
return;
}
if (text != null && text.trim().length() == 0) {
text = null;
}
DbKeyGenerator generator = mediator.getCurrentDbEntity().getPrimaryKeyGenerator();
if (!Util.nullSafeEquals(text, generator.getName())) {
generator.setGeneratorName(text);
mediator.fireDbEntityEvent(new EntityEvent(this, generator.getDbEntity()));
}
}
use of org.apache.cayenne.map.event.EntityEvent in project cayenne by apache.
the class PKCustomSequenceGeneratorPanel method setPKSize.
protected void setPKSize(String text) {
if (mediator.getCurrentDbEntity() == null || mediator.getCurrentDbEntity().getPrimaryKeyGenerator() == null) {
return;
}
int cacheSize = 0;
if (text != null && text.trim().length() > 0) {
try {
cacheSize = Integer.parseInt(text);
} catch (NumberFormatException nfex) {
throw new ValidationException("Invalid number");
}
}
DbKeyGenerator generator = mediator.getCurrentDbEntity().getPrimaryKeyGenerator();
if (!Util.nullSafeEquals(generator.getKeyCacheSize(), new Integer(cacheSize))) {
generator.setKeyCacheSize(new Integer(cacheSize));
mediator.fireDbEntityEvent(new EntityEvent(this, generator.getDbEntity()));
}
}
use of org.apache.cayenne.map.event.EntityEvent in project cayenne by apache.
the class ChangePKGeneratorUndoableEdit method fireEvents.
private void fireEvents() {
controller.fireDbEntityEvent(new EntityEvent(this, dbEntity));
controller.fireDbEntityDisplayEvent(new EntityDisplayEvent(this, dbEntity));
}
Aggregations