summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2013-08-08 06:24:30 (EDT)
committerJuergen Haug2013-08-08 06:34:08 (EDT)
commit6e504f9ad53cd3f442a96bf4c1fb07f23a7b9c08 (patch)
treec4da33e81ca0bd767dd9232264d5013ec210f5fb
parent3b077b417cfe120a1d6ac0133c9981f5c36d1208 (diff)
downloadorg.eclipse.etrice-6e504f9ad53cd3f442a96bf4c1fb07f23a7b9c08.zip
org.eclipse.etrice-6e504f9ad53cd3f442a96bf4c1fb07f23a7b9c08.tar.gz
org.eclipse.etrice-6e504f9ad53cd3f442a96bf4c1fb07f23a7b9c08.tar.bz2
[ui.structure] improved initial layoutrefs/changes/38/15238/1
-rw-r--r--plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/provider/DefaultPositionProvider.java23
1 files changed, 15 insertions, 8 deletions
diff --git a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/provider/DefaultPositionProvider.java b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/provider/DefaultPositionProvider.java
index 04c555a..b1f11a3 100644
--- a/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/provider/DefaultPositionProvider.java
+++ b/plugins/org.eclipse.etrice.ui.structure/src/org/eclipse/etrice/ui/structure/support/provider/DefaultPositionProvider.java
@@ -94,7 +94,7 @@ public class DefaultPositionProvider implements IPositionProvider {
int width = parent.inner.getW();
int height = parent.inner.getH();
- int y = ActorContainerRefSupport.MARGIN;
+ int y = - InterfaceItemSupport.MARGIN + 2*ActorContainerRefSupport.MARGIN;
List<ActorContainerRef> refs = new ArrayList<ActorContainerRef>();
List<InterfaceItem> ifItems = new ArrayList<InterfaceItem>();
@@ -112,10 +112,10 @@ public class DefaultPositionProvider implements IPositionProvider {
layoutInterfaceItems(ifItems, width, height, -InterfaceItemSupport.MARGIN);
- layoutActorRefs(refs, width, height, y);
-
- y = height - (InterfaceItemSupport.ITEM_SIZE + 2*InterfaceItemSupport.MARGIN);
layoutInterfaceItems(intPorts, width, height, y);
+
+ y += InterfaceItemSupport.ITEM_SIZE + 2*ActorContainerRefSupport.MARGIN;
+ layoutActorRefs(refs, width, height, y);
}
public DefaultPositionProvider(StructureClass sc) {
@@ -124,12 +124,10 @@ public class DefaultPositionProvider implements IPositionProvider {
int width = StructureClassSupport.DEFAULT_SIZE_X;
int height = StructureClassSupport.DEFAULT_SIZE_Y;
- int y = ActorContainerRefSupport.MARGIN;
+ int y = - InterfaceItemSupport.MARGIN + 2*ActorContainerRefSupport.MARGIN;
layoutInterfaceItems(RoomHelpers.getInterfaceItems(sc, true), width, height, -InterfaceItemSupport.MARGIN);
- layoutActorRefs(RoomHelpers.getAllActorContainerRefs(sc), width, height, y);
-
List<InterfaceItem> intPorts = new ArrayList<InterfaceItem>();
if(sc instanceof ActorClass){
ActorClass base = (ActorClass)sc;
@@ -138,9 +136,11 @@ public class DefaultPositionProvider implements IPositionProvider {
base = base.getBase();
}
}
- y = height - (InterfaceItemSupport.ITEM_SIZE + 2*InterfaceItemSupport.MARGIN);
layoutInterfaceItems(intPorts, width, height, y);
+ y += InterfaceItemSupport.ITEM_SIZE + 2*ActorContainerRefSupport.MARGIN;
+ layoutActorRefs(RoomHelpers.getAllActorContainerRefs(sc), width, height, y);
+
}
@Override
@@ -237,6 +237,13 @@ public class DefaultPositionProvider implements IPositionProvider {
int row = i/ncols;
int col = i%ncols;
+ int nLastRow = actorRefs.size()%ncols;
+ if(row >= actorRefs.size()/ncols && nLastRow > 0){
+ gap = (width-(nLastRow*ActorContainerRefSupport.DEFAULT_SIZE_X))/(nLastRow+1);
+ delta = gap+ActorContainerRefSupport.DEFAULT_SIZE_X;
+ x0 = - ActorContainerRefSupport.MARGIN + gap;
+ }
+
int x = x0+delta*col;
int y = y0+(ActorContainerRefSupport.MARGIN+ActorContainerRefSupport.DEFAULT_SIZE_Y)*row;
obj2pos.put(getKey(ar), new Position((double)x/width, (double)y/height));