Search in sources :

Example 26 with EntityEvent

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));
    }
}
Also used : DbEntity(org.apache.cayenne.map.DbEntity) EntityEvent(org.apache.cayenne.map.event.EntityEvent)

Example 27 with EntityEvent

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));
}
Also used : DbEntity(org.apache.cayenne.map.DbEntity) EntityEvent(org.apache.cayenne.map.event.EntityEvent)

Example 28 with EntityEvent

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()));
    }
}
Also used : EntityEvent(org.apache.cayenne.map.event.EntityEvent) DbKeyGenerator(org.apache.cayenne.map.DbKeyGenerator)

Example 29 with EntityEvent

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()));
    }
}
Also used : ValidationException(org.apache.cayenne.validation.ValidationException) EntityEvent(org.apache.cayenne.map.event.EntityEvent) DbKeyGenerator(org.apache.cayenne.map.DbKeyGenerator)

Example 30 with EntityEvent

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));
}
Also used : EntityDisplayEvent(org.apache.cayenne.modeler.event.EntityDisplayEvent) EntityEvent(org.apache.cayenne.map.event.EntityEvent)

Aggregations

EntityEvent (org.apache.cayenne.map.event.EntityEvent)36 DbEntity (org.apache.cayenne.map.DbEntity)14 ObjEntity (org.apache.cayenne.map.ObjEntity)13 EntityDisplayEvent (org.apache.cayenne.modeler.event.EntityDisplayEvent)7 ProjectController (org.apache.cayenne.modeler.ProjectController)6 Entity (org.apache.cayenne.map.Entity)5 Test (org.junit.Test)5 DataChannelDescriptor (org.apache.cayenne.configuration.DataChannelDescriptor)4 ArrayList (java.util.ArrayList)3 ProcedureEvent (org.apache.cayenne.configuration.event.ProcedureEvent)3 DbAttribute (org.apache.cayenne.map.DbAttribute)3 ObjAttribute (org.apache.cayenne.map.ObjAttribute)3 AttributeEvent (org.apache.cayenne.map.event.AttributeEvent)3 ValidationException (org.apache.cayenne.validation.ValidationException)3 ItemEvent (java.awt.event.ItemEvent)2 ItemListener (java.awt.event.ItemListener)2 QueryEvent (org.apache.cayenne.configuration.event.QueryEvent)2 EntityMergeSupport (org.apache.cayenne.dbsync.merge.context.EntityMergeSupport)2 Expression (org.apache.cayenne.exp.Expression)2 DbKeyGenerator (org.apache.cayenne.map.DbKeyGenerator)2