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.Attribute; 63 import org.objectstyle.cayenne.map.DataMap; 64 import org.objectstyle.cayenne.map.DbEntity; 65 import org.objectstyle.cayenne.map.Entity; 66 import org.objectstyle.cayenne.map.ObjEntity; 67 import org.objectstyle.cayenne.modeler.ProjectController; 68 import org.objectstyle.cayenne.modeler.event.AttributeDisplayEvent; 69 import org.objectstyle.cayenne.project.validator.ValidationInfo; 70 71 77 public class AttributeErrorMsg extends ValidationDisplayHandler { 78 79 protected DataMap map; 80 protected Entity entity; 81 protected Attribute attribute; 82 83 88 public AttributeErrorMsg(ValidationInfo result) { 89 super(result); 90 91 Object [] path = result.getPath().getPath(); 92 int len = path.length; 93 94 if (len >= 1) { 95 attribute = (Attribute) path[len - 1]; 96 } 97 98 if (len >= 2) { 99 entity = (Entity) path[len - 2]; 100 } 101 102 if (len >= 3) { 103 map = (DataMap) path[len - 3]; 104 } 105 106 if (len >= 4) { 107 domain = (DataDomain) path[len - 4]; 108 } 109 110 } 111 112 public void displayField(ProjectController mediator, JFrame frame) { 113 AttributeDisplayEvent event = new AttributeDisplayEvent( 114 frame, 115 attribute, 116 entity, 117 map, 118 domain); 119 120 if (entity instanceof ObjEntity) { 123 mediator.fireObjEntityDisplayEvent(event); 124 mediator.fireObjAttributeDisplayEvent(event); 125 } 126 else if (entity instanceof DbEntity) { 127 mediator.fireDbEntityDisplayEvent(event); 128 mediator.fireDbAttributeDisplayEvent(event); 129 } 130 } 131 } | Popular Tags |