Author: dazarov
Date: 2007-07-19 06:25:19 -0400 (Thu, 19 Jul 2007)
New Revision: 2517
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Groups.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/DiagramEditPart.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
Log:
http://jira.jboss.com/jira/browse/EXIN-365
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Groups.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Groups.java 2007-07-19
10:09:03 UTC (rev 2516)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/autolayout/impl/Groups.java 2007-07-19
10:25:19 UTC (rev 2517)
@@ -175,6 +175,10 @@
if(c >= yDeltas.length) continue;
int sz = items[i].outputs.length - 1;
if(sz > yDeltas[c]) yDeltas[c] = sz;
+ int[] shape = items[i].getObject().getShape();
+ if(shape == null || shape.length < 4) continue;
+ int wi = (shape[3] - (constants.deltaY / 2)) / constants.incY;
+ if(wi > yDeltas[c]) yDeltas[c] = wi;
}
for (int i = 1; i < yDeltas.length; i++) yDeltas[i] += yDeltas[i - 1];
}
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-19
10:09:03 UTC (rev 2516)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/model/OrmDiagram.java 2007-07-19
10:25:19 UTC (rev 2517)
@@ -373,6 +373,10 @@
}
}
+ public void update(){
+ firePropertyChange(REFRESH, null, null);
+ }
+
protected Configuration getConfiguration() {
return configuration;
}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2007-07-19
10:09:03 UTC (rev 2516)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/DiagramEditPart.java 2007-07-19
10:25:19 UTC (rev 2517)
@@ -121,8 +121,8 @@
if (getCastedModel().getOrmElement() instanceof RootClass) {
RootClass persistentClass = (RootClass) getCastedModel()
.getOrmElement();
- ormShape = (OrmShape) hashMap
- .remove(persistentClass.getEntityName());
+ ormShape = (OrmShape) hashMap.remove(persistentClass
+ .getEntityName());
if (ormShape != null) {
ormShape.setLocation(new Point(20, 20));
tempPoint = 40 + getChildrenFigurePreferredHeight(ormShape);
@@ -272,38 +272,43 @@
}
}
+ class DiagramInfo implements IDiagramInfo {
-class DiagramInfo implements IDiagramInfo {
+ ArrayList items = new ArrayList();
+ OrmDiagram diagram;
- ArrayList items = new ArrayList();
- OrmDiagram diagram;
+ public DiagramInfo(OrmDiagram diagram) {
+ IItemInfo item;
+ this.diagram = diagram;
+ OrmShapeEditPart part;
- public DiagramInfo(OrmDiagram diagram) {
- IItemInfo item;
- this.diagram = diagram;
+ for (int i = 0; i < diagram.getChildren().size(); i++) {
+ part = (OrmShapeEditPart) getViewer().getEditPartRegistry()
+ .get(diagram.getChildren().get(i));
+ if (part != null && part.getFigure().isVisible()) {
+ item = new DiagramElementInfo((OrmShape) diagram
+ .getChildren().get(i));
+ addItem(item);
+ }
+ }
+ }
- for (int i = 0; i < diagram.getChildren().size(); i++) {
- item = new DiagramElementInfo((OrmShape) diagram.getChildren().get(
- i));
- addItem(item);
+ /**
+ *
+ */
+ public IItemInfo[] getItems() {
+ return (IItemInfo[]) items.toArray(new IItemInfo[0]);
}
- }
- /**
- *
- */
- public IItemInfo[] getItems() {
- return (IItemInfo[]) items.toArray(new IItemInfo[0]);
+ /**
+ *
+ * @param item
+ */
+ public void addItem(IItemInfo item) {
+ items.add(item);
+ }
}
- /**
- *
- * @param item
- */
- public void addItem(IItemInfo item) {
- items.add(item);
- }
-
class DiagramElementInfo implements IItemInfo {
OrmShape element;
@@ -357,14 +362,15 @@
int[] shape = new int[4];
shape[0] = element.getLocation().x;
shape[1] = element.getLocation().y;
- OrmShapeEditPart part =
(OrmShapeEditPart)getViewer().getEditPartRegistry().get(element);
- if(part != null){
+ OrmShapeEditPart part = (OrmShapeEditPart) getViewer()
+ .getEditPartRegistry().get(element);
+ if (part != null) {
IFigure fig = part.getFigure();
shape[2] = fig.getPreferredSize().width;
shape[3] = fig.getPreferredSize().height;
- }else{
- shape[2] = 600;
- shape[3] = 100;
+ } else {
+ shape[2] = 6000;
+ shape[3] = 1000;
}
return shape;
}
@@ -432,4 +438,4 @@
public void setLinkShape(int[] vs) {
}
}
-}}
+}
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2007-07-19
10:09:03 UTC (rev 2516)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate.ui.veditor/src/org/jboss/tools/hibernate/ui/veditor/editors/parts/ExpandeableShapeEditPart.java 2007-07-19
10:25:19 UTC (rev 2517)
@@ -109,6 +109,7 @@
}
}
referenceList.remove(refShape);
+ shape.getOrmDiagram().update();
}
private boolean isReferencesCorrect(OrmShape shape){