Author: mdryakhlenkov
Date: 2007-07-11 09:16:45 -0400 (Wed, 11 Jul 2007)
New Revision: 2384
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/OrmShapeEditPart.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 subclass elements
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-11
13:06:56 UTC (rev 2383)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-11
13:16:45 UTC (rev 2384)
@@ -290,35 +290,45 @@
public void processExpand(ExpandeableShape shape) {
Object element = shape.getOrmElement();
if (element instanceof Property) {
- Type type = ((Property)element).getType();
- if (type.isEntityType()) {
- EntityType et = (EntityType) type;
- RootClass rootClass =
(RootClass)getConfiguration().getClassMapping(et.getAssociatedEntityName());
- OrmShape 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).getClassName(), connection.getTarget());
+ Property property = (Property)element;
+ if (!property.isComposite()) {
+ Type type = ((Property)element).getType();
+ if (type.isEntityType()) {
+ EntityType et = (EntityType) type;
+ Object clazz = getConfiguration().getClassMapping(et.getAssociatedEntityName());
+ if (clazz instanceof RootClass) {
+ RootClass rootClass = (RootClass)clazz;
+ OrmShape 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).getClassName(), 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) {
+ OrmShape s =
getOrCreatePersistentClass(((SingleTableSubclass)clazz).getRootClass(), null);
}
}
- 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);
- firePropertyChange(REFRESH, null, null);
+ } else {
+ OrmShape s = getOrCreatePersistentClass(new SpecialRootClass(property), null);
}
+ 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-11
13:06:56 UTC (rev 2383)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmShape.java 2007-07-11
13:16:45 UTC (rev 2384)
@@ -60,8 +60,9 @@
Iterator iterator = rootClass.getPropertyIterator();
while (iterator.hasNext()) {
Property field = (Property)iterator.next();
- if (!field.isComposite()) {
- if (field.getValue().isSimpleValue() &&
!((SimpleValue)field.getValue()).isTypeSpecified()) {
+ if (field.isComposite()) {
+ bodyOrmShape = new ExpandeableShape(field);
+ } else if (field.getValue().isSimpleValue() &&
!((SimpleValue)field.getValue()).isTypeSpecified()) {
bodyOrmShape = new Shape(field);
} else if (field.getValue().getType().isEntityType()) {
bodyOrmShape = new ExpandeableShape(field);
@@ -71,67 +72,67 @@
bodyOrmShape = new Shape(field);
}
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);
- }
- 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);
+// }
+// getChildren().add(bodyOrmShape);
+// }
+// }
}
} else if (ormElement instanceof SingleTableSubclass) {
RootClass rootClass = ((SingleTableSubclass)ormElement).getRootClass();
- Property identifierProperty = rootClass.getIdentifierProperty();
- if (identifierProperty != null) {
- getChildren().add(new Shape(identifierProperty));
- }
+// Property identifierProperty = rootClass.getIdentifierProperty();
+// if (identifierProperty != null) {
+// getChildren().add(new Shape(identifierProperty));
+// }
- KeyValue identifier = rootClass.getIdentifier();
- if (identifier instanceof Component) {
- Iterator iterator = ((Component)identifier).getPropertyIterator();
- while (iterator.hasNext()) {
- Property property = (Property) iterator.next();
- getChildren().add(new Shape(property));
- }
- }
+// KeyValue identifier = rootClass.getIdentifier();
+// if (identifier instanceof Component) {
+// Iterator iterator = ((Component)identifier).getPropertyIterator();
+// while (iterator.hasNext()) {
+// Property property = (Property) iterator.next();
+// getChildren().add(new Shape(property));
+// }
+// }
- Iterator iterator = rootClass.getPropertyIterator();
- while (iterator.hasNext()) {
- Property field = (Property)iterator.next();
- if (!field.isComposite()) {
- if (field.getValue().getType().isEntityType()) {
- bodyOrmShape = new ExpandeableShape(field);
- } else if (field.getValue().getType().isCollectionType()) {
- bodyOrmShape = new ComponentShape(field);
- } else {
- bodyOrmShape = new Shape(field);
- }
- 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);
- }
- getChildren().add(bodyOrmShape);
- }
- }
- }
+// Iterator iterator = rootClass.getPropertyIterator();
+// while (iterator.hasNext()) {
+// Property field = (Property)iterator.next();
+// if (!field.isComposite()) {
+// if (field.getValue().getType().isEntityType()) {
+// bodyOrmShape = new ExpandeableShape(field);
+// } else if (field.getValue().getType().isCollectionType()) {
+// bodyOrmShape = new ComponentShape(field);
+// } else {
+// bodyOrmShape = new Shape(field);
+// }
+// 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);
+// }
+// getChildren().add(bodyOrmShape);
+// }
+// }
+// }
Iterator iter = ((SingleTableSubclass)ormElement).getPropertyIterator();
while (iter.hasNext()) {
Property property = (Property)iter.next();
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmShapeEditPart.java 2007-07-11
13:06:56 UTC (rev 2383)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/OrmShapeEditPart.java 2007-07-11
13:16:45 UTC (rev 2384)
@@ -55,6 +55,8 @@
} else if (element instanceof Table) {
Table table = (Table)element;
text = table.getSchema() + "." + table.getName();
+ } else if (element instanceof SingleTableSubclass) {
+ text = ormLabelProvider.getText((SingleTableSubclass)element);
}
label.setText(text);
label.setIcon(ormLabelProvider.getImage(getCastedModel().getOrmElement()));
Show replies by date