Author: dazarov
Date: 2007-07-11 07:51:04 -0400 (Wed, 11 Jul 2007)
New Revision: 2381
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/ComponentFigure.java
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/parts/ComponentShapeEditPart.java
Log:
http://jira.jboss.com/jira/browse/EXIN-367
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/ComponentFigure.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/ComponentFigure.java 2007-07-11
08:33:20 UTC (rev 2380)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/figures/ComponentFigure.java 2007-07-11
11:51:04 UTC (rev 2381)
@@ -38,6 +38,11 @@
}
public void setChildsHiden(boolean childsHiden) {
+
this.childsHiden = childsHiden;
+ for(int i=0;i<getChildren().size();i++){
+ if(getChildren().get(i) instanceof TitleLabel)
+ ((TitleLabel)getChildren().get(i)).setHiden(childsHiden);
+ }
}
}
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
08:33:20 UTC (rev 2380)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-11
11:51:04 UTC (rev 2381)
@@ -344,10 +344,16 @@
Collection collection = (Collection)property.getValue();
Value component = collection.getElement();
if (component instanceof Component) {
- getOrCreateComponentClass(property);
+ Component comp = (Component)((Collection)property.getValue()).getElement();
+ if (comp != null) {
+ OrmShape classShape = createShape(property);
+ OrmShape tableShape = (OrmShape)elements.get(component.getTable().getSchema() +
"." + component.getTable().getName());
+ removeLinks(tableShape);
+ elements.remove(component.getTable().getSchema() + "." +
component.getTable().getName());
+ }
} else if (collection.isOneToMany()) {
OneToMany comp = (OneToMany)((Collection)property.getValue()).getElement();
- if (component != null){
+ if (comp != null){
Shape sh = elements.get(comp.getAssociatedClass().getTable().getSchema() +
"." + comp.getAssociatedClass().getTable().getName());
removeLinks(sh);
elements.remove(comp.getAssociatedClass().getTable().getSchema() + "." +
comp.getAssociatedClass().getTable().getName());
@@ -356,7 +362,27 @@
elements.remove(comp.getAssociatedClass().getClassName());
}
} else if (collection.isMap() || collection.isSet()) {
- getOrCreateDatabaseTable(collection.getCollectionTable());
+ Table databaseTable = collection.getCollectionTable();
+ OrmShape tableShape = null;
+ if(databaseTable != null) {
+ String tableName = databaseTable.getSchema() + "." +
databaseTable.getName();
+ tableShape = (OrmShape)elements.get(tableName);
+ if(tableShape != null) {
+ Iterator iterator = getConfiguration().getClassMappings();
+ while (iterator.hasNext()) {
+ Object clazz = iterator.next();
+ if (clazz instanceof RootClass) {
+ RootClass cls = (RootClass)clazz;
+ Table table = cls.getTable();
+ if (tableName.equals(table.getName() + "." + table.getName())) {
+ if (elements.get(cls.getClassName()) != null)
+ elements.remove(cls.getClassName());
+ }
+ }
+ }
+ elements.remove(tableName);
+ }
+ }
}
}
removeLinks(reference);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java 2007-07-11
08:33:20 UTC (rev 2380)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ComponentShapeEditPart.java 2007-07-11
11:51:04 UTC (rev 2381)
@@ -26,6 +26,7 @@
import org.eclipse.gef.RequestConstants;
import org.eclipse.swt.graphics.RGB;
import org.jboss.tools.hibernate.ui.veditor.editors.figures.ComponentFigure;
+import org.jboss.tools.hibernate.ui.veditor.editors.figures.TitleLabel;
import org.jboss.tools.hibernate.ui.veditor.editors.model.ComponentShape;
import org.jboss.tools.hibernate.ui.veditor.editors.model.OrmDiagram;
@@ -36,7 +37,7 @@
if (getModel() instanceof ComponentShape) {
IFigure figure = new ComponentFigure();
figure.setLayoutManager(new ToolbarLayout());
- Label label = new Label();
+ Label label = new TitleLabel();
label.setText(ormLabelProvider.getText(getCastedModel().getOrmElement()));
label.setBackgroundColor(getColor());
label.setOpaque(true);
@@ -63,6 +64,7 @@
if (ComponentShape.SET_CHILDS_HIDEN.equals(prop)) {
int i = figure.getPreferredSize().width;
((ComponentFigure)figure).setChildsHiden(((Boolean)evt.getNewValue()).booleanValue());
+
if(((Boolean)evt.getNewValue()).booleanValue())
figure.setSize(i,-1);
else