Author: mdryakhlenkov
Date: 2007-07-26 08:28:16 -0400 (Thu, 26 Jul 2007)
New Revision: 2674
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
Log:
EXIN-366: Adding elements on the diagram by double-click on fields of classes which have
additional information in mapping files
Bug fixed: property of component class was added to owner class
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-07-26
12:21:03 UTC (rev 2673)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-26
12:28:16 UTC (rev 2674)
@@ -390,6 +390,10 @@
}
} else {
s = getOrCreatePersistentClass(new SpecialRootClass(property), null);
+ new Connection(shape, s);
+ createConnections(s, getOrCreateDatabaseTable(property.getValue().getTable()));
+ shape.firePropertyChange(REFRESH, null, null);
+ s.firePropertyChange(REFRESH, null, null);
}
if(!shape.getParent().equals(s))
shape.setReference(s);
@@ -416,6 +420,21 @@
if (component instanceof Component) {// valueType.isComponentType()
childShape = (OrmShape)elements.get(((Component)component).getComponentClassName());
if(childShape == null) childShape = getOrCreateComponentClass(property);
+
+
+ SimpleValue value =
(SimpleValue)((Shape)componentShape.getChildren().get(0)).getOrmElement();
+ OrmShape tableShape = getOrCreateDatabaseTable(value.getTable());
+ Iterator iterator = value.getColumnIterator();
+ while (iterator.hasNext()) {
+ Column column = (Column)iterator.next();
+ Shape colShape = tableShape.getChild(column);
+ if(!isConnectionExist((Shape)(componentShape.getChildren().get(0)), colShape)){
+ new Connection((Shape)(componentShape.getChildren().get(0)), colShape);
+ ((Shape)(componentShape.getChildren().get(0))).firePropertyChange(REFRESH, null,
null);
+ childShape.firePropertyChange(REFRESH, null, null);
+ }
+ }
+
if(!isConnectionExist((Shape)(componentShape.getChildren().get(1)), childShape)){
new Connection((Shape)(componentShape.getChildren().get(1)), childShape);
((Shape)(componentShape.getChildren().get(1))).firePropertyChange(REFRESH, null,
null);
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-07-26
12:21:03 UTC (rev 2673)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-07-26
12:28:16 UTC (rev 2674)
@@ -83,23 +83,24 @@
}
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);
- }
+// 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);
- }
+// }
}
}
} else if (ormElement instanceof Subclass) {
@@ -134,19 +135,20 @@
}
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);
- }
+// 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);
- }
+// }
}
}
Iterator iter = ((Subclass)ormElement).getPropertyIterator();
Show replies by date