1 56 57 package org.objectstyle.cayenne.modeler.dialog.validator; 58 59 import javax.swing.JFrame ; 60 61 import org.objectstyle.cayenne.access.DataDomain; 62 import org.objectstyle.cayenne.map.DataMap; 63 import org.objectstyle.cayenne.map.DbEntity; 64 import org.objectstyle.cayenne.map.Entity; 65 import org.objectstyle.cayenne.map.ObjEntity; 66 import org.objectstyle.cayenne.modeler.ProjectController; 67 import org.objectstyle.cayenne.modeler.event.EntityDisplayEvent; 68 import org.objectstyle.cayenne.project.validator.ValidationInfo; 69 70 76 public class EntityErrorMsg extends ValidationDisplayHandler { 77 protected DataMap map; 78 protected Entity entity; 79 80 84 public EntityErrorMsg(ValidationInfo result) { 85 super(result); 86 87 Object [] path = result.getPath().getPath(); 88 int len = path.length; 89 90 if (len >= 1) { 91 entity = (Entity) path[len - 1]; 92 } 93 94 if (len >= 2) { 95 map = (DataMap) path[len - 2]; 96 } 97 98 if (len >= 3) { 99 domain = (DataDomain) path[len - 3]; 100 } 101 } 102 103 public void displayField(ProjectController mediator, JFrame frame) { 104 EntityDisplayEvent event = new EntityDisplayEvent(frame, entity, map, domain); 105 if (entity instanceof ObjEntity) { 106 mediator.fireObjEntityDisplayEvent(event); 107 } else if (entity instanceof DbEntity) { 108 mediator.fireDbEntityDisplayEvent(event); 109 } 110 } 111 } | Popular Tags |