Author: mdryakhlenkov
Date: 2007-08-02 09:40:10 -0400 (Thu, 02 Aug 2007)
New Revision: 2848
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java
Log:
EXIN-413: Incorrect relations between elements of diagram
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-08-02
11:23:23 UTC (rev 2847)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-08-02
13:40:10 UTC (rev 2848)
@@ -228,6 +228,8 @@
Property property = (Property)iterator.next();
OrmShape tableShape = getOrCreateDatabaseTable(property.getValue().getTable());
createConnections(subclassShape, tableShape);
+ subclassShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
}
}
}
@@ -239,9 +241,20 @@
OrmShape componentClassShape = elements.get(identifier.getComponentClassName());
if (componentClassShape == null && persistentClass instanceof RootClass) {
componentClassShape =
getOrCreateComponentClass(((RootClass)persistentClass).getIdentifierProperty());
+
+ Shape idPropertyShape =
classShape.getChild(persistentClass.getIdentifierProperty());
+ if (idPropertyShape != null) {
+ new Connection(idPropertyShape, componentClassShape);
+ idPropertyShape.firePropertyChange(REFRESH, null, null);
+ componentClassShape.firePropertyChange(REFRESH, null, null);
+ }
+
OrmShape tableShape = getOrCreateDatabaseTable(identifier.getTable());
- if (componentClassShape != null)
+ if (componentClassShape != null) {
createConnections(componentClassShape, tableShape);
+ componentClassShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
+ }
}
}
}
@@ -254,6 +267,8 @@
Property property = (Property)iterator.next();
OrmShape tableShape = getOrCreateDatabaseTable(property.getValue().getTable());
createConnections(classShape, tableShape);
+ classShape.firePropertyChange(REFRESH, null, null);
+ tableShape.firePropertyChange(REFRESH, null, null);
}
}
}
@@ -501,7 +516,8 @@
}
}
} else if (property.getValue() instanceof Component) {
- classShape = createShape(property);
+ classShape =
(OrmShape)elements.get(((Component)property.getValue()).getComponentClassName());
+ if (classShape == null) classShape = createShape(property);
}
}
return classShape;
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-08-02
11:23:23 UTC (rev 2847)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-08-02
13:40:10 UTC (rev 2848)
@@ -17,6 +17,7 @@
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Component;
import org.hibernate.mapping.KeyValue;
+import org.hibernate.mapping.List;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.SimpleValue;
@@ -70,9 +71,7 @@
typeIsAccessible = false;
}
}
-/* if (field.isComposite()) {
- bodyOrmShape = new ExpandeableShape(field);
- } else */if (field.getValue().isSimpleValue() &&
!((SimpleValue)field.getValue()).isTypeSpecified()) {
+ if (field.getValue().isSimpleValue() &&
!((SimpleValue)field.getValue()).isTypeSpecified()) {
bodyOrmShape = new Shape(field);
} else if (typeIsAccessible && field.getValue().getType().isEntityType()) {
bodyOrmShape = new ExpandeableShape(field);
@@ -83,24 +82,8 @@
}
getChildren().add(bodyOrmShape);
} else {
-// Component component = (Component)field.getValue();
-// Iterator iter = component.getPropertyIterator();
-// while (iter.hasNext()) {
-// Property property = (Property)iter.next();
-// boolean typeIsAccesible = true;
-// try {property.getValue().getType();} catch (Exception e) {typeIsAccesible =
false;}
-///* if (property.isComposite()) {
-// bodyOrmShape = new ExpandeableShape(property);
-// } else */if (typeIsAccesible &&
property.getValue().getType().isEntityType()) {
-// bodyOrmShape = new ExpandeableShape(property);
-// } else if (typeIsAccesible &&
property.getValue().getType().isCollectionType()) {
-// bodyOrmShape = new ComponentShape(property);
-// } else {
-// bodyOrmShape = new Shape(property);
-// }
- bodyOrmShape = new ExpandeableShape(field);
- getChildren().add(bodyOrmShape);
-// }
+ bodyOrmShape = new ExpandeableShape(field);
+ getChildren().add(bodyOrmShape);
}
}
} else if (ormElement instanceof Subclass) {
@@ -135,20 +118,8 @@
}
getChildren().add(bodyOrmShape);
} else {
-// Component component = (Component)field.getValue();
-// Iterator iter = component.getPropertyIterator();
-// while (iter.hasNext()) {
-// Property property = (Property)iter.next();
-// if (property.getValue().getType().isEntityType()) {
-// bodyOrmShape = new ExpandeableShape(property);
-// } else if (property.getValue().getType().isCollectionType()) {
-// bodyOrmShape = new ComponentShape(property);
-// } else {
-// bodyOrmShape = new Shape(property);
-// }
- bodyOrmShape = new ExpandeableShape(field);
- getChildren().add(bodyOrmShape);
-// }
+ bodyOrmShape = new ExpandeableShape(field);
+ getChildren().add(bodyOrmShape);
}
}
Iterator iter = ((Subclass)ormElement).getPropertyIterator();
@@ -190,6 +161,19 @@
return shape;
}
+ public Shape getChild(Property ormElement) {
+ Shape shape = null;
+ Iterator iter = getChildren().iterator();
+ while (iter.hasNext()) {
+ Shape child = (Shape)iter.next();
+ Object childElement = child.getOrmElement();
+ if (childElement instanceof Property &&
ormElement.getName().equals(((Property)childElement).getName())) {
+ return child;
+ }
+ }
+ return shape;
+ }
+
protected void setHidden(boolean hiden) {
super.setHidden(hiden);
for (int i = 0; i < getChildren().size(); i++)
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java 2007-08-02
11:23:23 UTC (rev 2847)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/SpecialRootClass.java 2007-08-02
13:40:10 UTC (rev 2848)
@@ -41,18 +41,12 @@
}
if (component != null) {
setClassName(component.getComponentClassName());
+ setEntityName(component.getComponentClassName());
PersistentClass ownerClass = component.getOwner();
if (component.getParentProperty() != null) {
parentProperty = new Property();
parentProperty.setName(component.getParentProperty());
parentProperty.setPersistentClass(ownerClass);
-// Property property = null;
-// try {
-// property = ownerClass.getProperty(component.getParentProperty());
-// } catch (Exception e) {
-// property = ownerClass.getIdentifierProperty();
-// }
-// if (property != null) parentProperty = ownerClass.getIdentifierProperty();
}
Iterator iterator = component.getPropertyIterator();
while (iterator.hasNext()) {
Show replies by date