Author: mdryakhlenkov
Date: 2007-07-17 10:34:06 -0400 (Tue, 17 Jul 2007)
New Revision: 2470
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/parts/ConnectionEditPart.java
Log:
EXIN-366: Adding elements on the diagram by double-click on fields of classes which have
additional information in mapping files
Bugs of adding subclasses fixed
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-17
14:22:31 UTC (rev 2469)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-17
14:34:06 UTC (rev 2470)
@@ -201,6 +201,8 @@
if(!isConnectionExist(subclassShape, shape))
new Connection(subclassShape, shape);
}
+ OrmShape ownerTableShape =
getOrCreateDatabaseTable(((Subclass)element).getRootTable());
+ createConnections(subclassShape, ownerTableShape);
}
}
@@ -317,29 +319,29 @@
if (clazz instanceof RootClass) {
RootClass rootClass = (RootClass)clazz;
s = getOrCreatePersistentClass(rootClass, null);
- HashMap targets = new HashMap();
- Iterator iterator = shape.getSourceConnections().iterator();
- while (iterator.hasNext()) {
- Connection connection = (Connection)iterator.next();
- connection.setHiden(shape.getHide());
- Object el = connection.getTarget().getOrmElement();
- if (el instanceof Column) {
- targets.put(((Column)el).getName(), connection.getTarget());
- } else if (el instanceof RootClass) {
- targets.put(((RootClass)el).getEntityName(), connection.getTarget());
- }
- }
- KeyValue id = rootClass.getIdentifier();
- iterator = id.getColumnIterator();
- while (iterator.hasNext()) {
- Column column = (Column)iterator.next();
- if (targets.get(column.getName()) != null && !isConnectionExist(s,
(Shape)targets.get(column.getName()))) {
- new Connection(s, (Shape)targets.get(column.getName()));
- }
- }
+// HashMap targets = new HashMap();
+// Iterator iterator = shape.getSourceConnections().iterator();
+// while (iterator.hasNext()) {
+// Connection connection = (Connection)iterator.next();
+// connection.setHiden(shape.getHide());
+// Object el = connection.getTarget().getOrmElement();
+// if (el instanceof Column) {
+// targets.put(((Column)el).getName(), connection.getTarget());
+// } else if (el instanceof RootClass) {
+// targets.put(((RootClass)el).getEntityName(), connection.getTarget());
+// }
+// }
+// KeyValue id = rootClass.getIdentifier();
+// iterator = id.getColumnIterator();
+// while (iterator.hasNext()) {
+// Column column = (Column)iterator.next();
+// if (targets.get(column.getName()) != null && !isConnectionExist(s,
(Shape)targets.get(column.getName()))) {
+// new Connection(s, (Shape)targets.get(column.getName()));
+// }
+// }
if(!isConnectionExist(shape, s))
new Connection(shape, s);
- } else if (clazz instanceof SingleTableSubclass) {
+ } else if (clazz instanceof Subclass) {
s = getOrCreatePersistentClass(((SingleTableSubclass)clazz).getRootClass(), 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-17
14:22:31 UTC (rev 2469)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-07-17
14:34:06 UTC (rev 2470)
@@ -79,7 +79,9 @@
Iterator iter = component.getPropertyIterator();
while (iter.hasNext()) {
Property property = (Property)iter.next();
- if (property.getValue().getType().isEntityType()) {
+/* if (property.getValue().isSimpleValue()) {
+ bodyOrmShape = new Shape(property);
+ } else */if (property.getValue().getType().isEntityType()) {
bodyOrmShape = new ExpandeableShape(property);
} else if (property.getValue().getType().isCollectionType()) {
bodyOrmShape = new ComponentShape(property);
@@ -111,7 +113,9 @@
while (iterator.hasNext()) {
Property field = (Property)iterator.next();
if (!field.isComposite()) {
- if (field.getValue().getType().isEntityType()) {
+ if (field.getValue().isSimpleValue()) {
+ bodyOrmShape = new Shape(field);
+ } else if (field.getValue().getType().isEntityType()) {
bodyOrmShape = new ExpandeableShape(field);
} else if (field.getValue().getType().isCollectionType()) {
bodyOrmShape = new ComponentShape(field);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ConnectionEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ConnectionEditPart.java 2007-07-17
14:22:31 UTC (rev 2469)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ConnectionEditPart.java 2007-07-17
14:34:06 UTC (rev 2470)
@@ -26,6 +26,7 @@
import org.hibernate.mapping.Property;
import org.hibernate.mapping.RootClass;
import org.hibernate.mapping.SingleTableSubclass;
+import org.hibernate.mapping.Subclass;
import org.hibernate.mapping.Table;
import org.jboss.tools.hibernate.ui.veditor.editors.figures.RoundPolylineConnection;
import org.jboss.tools.hibernate.ui.veditor.editors.model.Connection;
@@ -78,7 +79,7 @@
private Color getColor() {
Object element = getCastedModel().getTarget().getOrmElement();
- if (element instanceof RootClass || element instanceof SingleTableSubclass)
+ if (element instanceof RootClass || element instanceof Subclass)
return ResourceManager.getInstance().getColor(new RGB(210,155,100));
else if (element instanceof Column || element instanceof Table || element instanceof
Property)
return ResourceManager.getInstance().getColor(new RGB(160, 160, 160));
@@ -87,7 +88,8 @@
}
private Color getSelectionColor() {
- if (getCastedModel().getTarget().getOrmElement() instanceof RootClass)
+ if (getCastedModel().getTarget().getOrmElement() instanceof RootClass ||
+ getCastedModel().getTarget().getOrmElement() instanceof Subclass)
return ResourceManager.getInstance().getColor(new RGB(112,161,99));
else if (getCastedModel().getTarget().getOrmElement() instanceof Column ||
getCastedModel().getTarget().getOrmElement() instanceof Table ||
Show replies by date