catch up with branch development

Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
diff --git a/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/TrimBarRenderer.java b/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/TrimBarRenderer.java
index 8b37da2..027893a 100644
--- a/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/TrimBarRenderer.java
+++ b/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/TrimBarRenderer.java
@@ -39,6 +39,7 @@
 import org.eclipse.e4.ui.workbench.modeling.EModelService;
 import org.eclipse.osbp.vaaclipse.api.VaadinExecutorService;
 import org.eclipse.osbp.vaaclipse.presentation.widgets.TrimmedWindowContent;
+import org.eclipse.osbp.vaaclipse.presentation.widgets.TrimmedWindowContent.TopBarPosition;
 
 import com.vaadin.server.Sizeable.Unit;
 import com.vaadin.ui.AbstractLayout;
@@ -198,10 +199,14 @@
 			MWindow window = modelService.getTopLevelWindowFor(trimBar);
 			TrimmedWindowContent windowContent = (TrimmedWindowContent) ((Panel) window
 					.getWidget()).getContent();
-
-			Component topbar = windowContent.getTopbar();
-			if (topbar != null)
-				topbar.setVisible(trimBarWidget.getComponentCount() != 0);
+//			Component topbar = windowContent.getTopbar();
+//			if (topbar != null)
+//				topbar.setVisible(trimBarWidget.getComponentCount() != 0);
+			if(trimBar.getContainerData() != null) {
+				Component topbar = windowContent.getTopbar(TopBarPosition.valueOf(trimBar.getContainerData()));
+				if (topbar != null)
+					topbar.setVisible(trimBarWidget.getComponentCount() != 0);
+			}
 		}
 	}
 
diff --git a/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/WorkbenchWindowRenderer.java b/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/WorkbenchWindowRenderer.java
index 27b1ffe..77aaa77 100644
--- a/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/WorkbenchWindowRenderer.java
+++ b/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/renderers/WorkbenchWindowRenderer.java
@@ -40,6 +40,7 @@
 import org.eclipse.osbp.commons.general.Condition;
 import org.eclipse.osbp.vaaclipse.presentation.engine.PresentationEngine;
 import org.eclipse.osbp.vaaclipse.presentation.widgets.TrimmedWindowContent;
+import org.eclipse.osbp.vaaclipse.presentation.widgets.TrimmedWindowContent.TopBarPosition;
 import org.eclipse.osbp.vaaclipse.publicapi.editor.SavePromptSetup;
 import org.eclipse.osbp.vaaclipse.publicapi.model.Tags;
 import org.eclipse.osbp.vaadin.optiondialog.OptionDialog;
@@ -117,7 +118,10 @@
 				vWindow.setRightBar(c);
 				break;
 			case TOP:
-				vWindow.setTopBar(c);
+//				vWindow.setTopBar(c);
+				if(trimBar.getContainerData() != null) {
+					vWindow.setTopBar(c, TopBarPosition.valueOf(trimBar.getContainerData()));
+				}
 				break;
 			}
 		}
@@ -340,7 +344,10 @@
 						vWindow.setRightBar(c);
 						break;
 					case TOP:
-						vWindow.setTopBar(c);
+//						vWindow.setTopBar(c);
+						if(trim.getContainerData() != null) {
+							vWindow.setTopBar(c, TopBarPosition.valueOf(trim.getContainerData()));
+						}
 						break;
 					}
 				}
diff --git a/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/widgets/TrimmedWindowContent.java b/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/widgets/TrimmedWindowContent.java
index 6ea9889..1ce352d 100644
--- a/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/widgets/TrimmedWindowContent.java
+++ b/org.eclipse.osbp.vaaclipse.presentation/src/org/eclipse/osbp/vaaclipse/presentation/widgets/TrimmedWindowContent.java
@@ -36,6 +36,8 @@
 	private HorizontalLayout bottomBarContainer = new HorizontalLayout();
 
 	private boolean boundsValide = false;
+	
+	public enum TopBarPosition {TOPBAR_LEFT, TOPBAR_RIGHT};
 
 	public TrimmedWindowContent() {
 		leftBarContainer.setWidth(-1, Unit.PIXELS);
@@ -68,9 +70,10 @@
 
 		// Top panel - it contains the top trimbar and the perspective stack
 		// panel
-		topContainerPanel = new GridLayout(2, 1);
-		topContainerPanel.setColumnExpandRatio(0, 0);
-		topContainerPanel.setColumnExpandRatio(1, 100);
+		topContainerPanel = new GridLayout(3, 1);
+		topContainerPanel.setColumnExpandRatio(0, 15);
+		topContainerPanel.setColumnExpandRatio(1, 0);
+		topContainerPanel.setColumnExpandRatio(2, 85);
 		topContainerPanel.setSizeUndefined();
 		topContainerPanel.setWidth("100%");
 
@@ -104,15 +107,15 @@
 	}
 
 	public HorizontalLayout getPerspectiveStackPanel() {
-		return (HorizontalLayout) topContainerPanel.getComponent(0, 0);
+		return (HorizontalLayout) topContainerPanel.getComponent(1, 0);
 	}
 
 	public void setPerspectiveStackPanel(HorizontalLayout perspectiveStackPanel) {
 		if (perspectiveStackPanel == null) {
-			this.topContainerPanel.removeComponent(0, 0);
+			this.topContainerPanel.removeComponent(1, 0);
 		} else {
 			perspectiveStackPanel.setSizeUndefined();
-			this.topContainerPanel.addComponent(perspectiveStackPanel, 0, 0);
+			this.topContainerPanel.addComponent(perspectiveStackPanel, 1, 0);
 		}
 	}
 
@@ -146,27 +149,37 @@
 		bottomBarContainer.addComponent(bar);
 	}
 
-	public void setTopBar(Component bar) {
+	public void setTopBar(Component bar, TopBarPosition pos) {
+		int col = 0;
+		Alignment align = Alignment.MIDDLE_LEFT; 
+		if(pos == TopBarPosition.TOPBAR_RIGHT) {
+			col = 2;
+			align = Alignment.MIDDLE_RIGHT;			
+		}
 		if (bar == null) {
-			this.topContainerPanel.removeComponent(1, 0);
+			this.topContainerPanel.removeComponent(col, 0);
 			return;
 		}
 
-		if (this.topContainerPanel.getComponent(1, 0) != null) {
-			this.topContainerPanel.removeComponent(1, 0);
+		if (this.topContainerPanel.getComponent(col, 0) != null) {
+			this.topContainerPanel.removeComponent(col, 0);
 		}
 
 		HorizontalLayout topBarWrapper = new HorizontalLayout();
 		topBarWrapper.setWidth("100%");
 		topBarWrapper.addComponent(bar);
-		topBarWrapper.setComponentAlignment(bar, Alignment.MIDDLE_RIGHT);
+		topBarWrapper.setComponentAlignment(bar, align);
 		bar.setSizeUndefined();
 		
-		this.topContainerPanel.addComponent(topBarWrapper, 1, 0);
+		this.topContainerPanel.addComponent(topBarWrapper, col, 0);
 	}
 
-	public Component getTopbar() {
-		return this.topContainerPanel.getComponent(1, 0);
+	public Component getTopbar(TopBarPosition pos) {
+		int col = 0;
+		if(pos == TopBarPosition.TOPBAR_RIGHT) {
+			col = 2;
+		}
+		return this.topContainerPanel.getComponent(col, 0);
 	}
 
 	// -----------------------------------