catch up with branch daily

Signed-off-by: Ralf Mollik <ramollik@compex-commerce.com>
diff --git a/jenkins.build.config.xml b/jenkins.build.config.xml
index 069cbaf..fc83814 100644
--- a/jenkins.build.config.xml
+++ b/jenkins.build.config.xml
@@ -18,6 +18,8 @@
         <jenkins.build.dependencies>
                 <jenkins.build.dependency>org.eclipse.osbp.core.api</jenkins.build.dependency>
                 <jenkins.build.dependency>org.eclipse.osbp.dsl</jenkins.build.dependency>
+                <jenkins.build.dependency>org.eclipse.osbp.ecview.core</jenkins.build.dependency>
+                <jenkins.build.dependency>org.eclipse.osbp.ecview.extension.api</jenkins.build.dependency>
                 <jenkins.build.dependency>org.eclipse.osbp.jpa.services</jenkins.build.dependency>
                 <jenkins.build.dependency>org.eclipse.osbp.preferences</jenkins.build.dependency>
                 <jenkins.build.dependency>org.eclipse.osbp.runtime</jenkins.build.dependency>
diff --git a/org.eclipse.osbp.blob/META-INF/MANIFEST.MF b/org.eclipse.osbp.blob/META-INF/MANIFEST.MF
index e4c701f..faf5385 100644
--- a/org.eclipse.osbp.blob/META-INF/MANIFEST.MF
+++ b/org.eclipse.osbp.blob/META-INF/MANIFEST.MF
@@ -33,7 +33,9 @@
 Bundle-Vendor: Eclipse OSBP
 Import-Package: com.vaadin.ui,
  org.eclipse.e4.ui.di,
- org.eclipse.osbp.core.api.persistence;version="0.9.0"
+ org.eclipse.osbp.core.api.persistence;version="0.9.0",
+ org.eclipse.osbp.ecview.core.common.model.core;version="0.9.0",
+ org.eclipse.osbp.ecview.extension.model;version="0.9.0"
 Service-Component: OSGI-INF/*.xml
 Factory-Model: datatype,
  entity,
diff --git a/org.eclipse.osbp.blob/i18n/I18N_de_AT.properties b/org.eclipse.osbp.blob/i18n/I18N_de_AT.properties
new file mode 100644
index 0000000..6c73e1d
--- /dev/null
+++ b/org.eclipse.osbp.blob/i18n/I18N_de_AT.properties
@@ -0,0 +1 @@
+#de_AT
diff --git a/org.eclipse.osbp.blob/i18n/I18N_en_US.properties b/org.eclipse.osbp.blob/i18n/I18N_en_US.properties
new file mode 100644
index 0000000..d89e21c
--- /dev/null
+++ b/org.eclipse.osbp.blob/i18n/I18N_en_US.properties
@@ -0,0 +1 @@
+#en_US
diff --git a/org.eclipse.osbp.blob/src-gen/org/eclipse/osbp/blob/entities/Blob.java b/org.eclipse.osbp.blob/src-gen/org/eclipse/osbp/blob/entities/Blob.java
index d646cca..c25c9e2 100644
--- a/org.eclipse.osbp.blob/src-gen/org/eclipse/osbp/blob/entities/Blob.java
+++ b/org.eclipse.osbp.blob/src-gen/org/eclipse/osbp/blob/entities/Blob.java
@@ -27,6 +27,7 @@
   private boolean disposed;
   
   @Id
+  @Column(name = "ID")
   private String id = java.util.UUID.randomUUID().toString();
   
   @Column(name = "DATA")
diff --git a/org.eclipse.osbp.blob/src-gen/org/eclipse/osbp/blob/entities/BlobMapping.java b/org.eclipse.osbp.blob/src-gen/org/eclipse/osbp/blob/entities/BlobMapping.java
index 8394251..2fd3844 100644
--- a/org.eclipse.osbp.blob/src-gen/org/eclipse/osbp/blob/entities/BlobMapping.java
+++ b/org.eclipse.osbp.blob/src-gen/org/eclipse/osbp/blob/entities/BlobMapping.java
@@ -28,6 +28,7 @@
   private boolean disposed;
   
   @Id
+  @Column(name = "ID")
   private String id = java.util.UUID.randomUUID().toString();
   
   @Column(name = "UNIQUE_NAME")
@@ -39,7 +40,7 @@
   @Column(name = "MIME_TYPE_ID")
   private int mimeTypeId;
   
-  @JoinColumn(name = "BLOBS_REF_ID")
+  @JoinColumn(name = "BLOB_MAPPING_ID")
   @OneToMany(mappedBy = "blobMapping", cascade = { CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST }, orphanRemoval = true, fetch = FetchType.EAGER)
   private List<Blob> blobsRef;
   
diff --git a/org.eclipse.osbp.blob/src/org/eclipse/osbp/blob/PersistenceServiceBinder.java b/org.eclipse.osbp.blob/src/org/eclipse/osbp/blob/PersistenceServiceBinder.java
index 90d83a2..8a6d13f 100644
--- a/org.eclipse.osbp.blob/src/org/eclipse/osbp/blob/PersistenceServiceBinder.java
+++ b/org.eclipse.osbp.blob/src/org/eclipse/osbp/blob/PersistenceServiceBinder.java
@@ -30,14 +30,12 @@
 public class PersistenceServiceBinder {
 	/** The Constant LOGGER. */
 	private static final Logger LOGGER = LoggerFactory.getLogger("servicebinder");
-	private static String persistenceId = "blob";
 
 	private static IPersistenceService persistenceService;
 
 	@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.STATIC)
 	public synchronized void bindPersistenceService(final IPersistenceService persistenceService) {
 		PersistenceServiceBinder.persistenceService = persistenceService;
-		PersistenceServiceBinder.persistenceService.registerPersistenceUnit(persistenceId, getClass());
 		LOGGER.debug("PersistenceService bound");
 	}
 
diff --git a/org.eclipse.osbp.blob/src/org/eclipse/osbp/blob/component/BlobUploadButton.java b/org.eclipse.osbp.blob/src/org/eclipse/osbp/blob/component/BlobUploadButton.java
index 7eb3823..4874150 100644
--- a/org.eclipse.osbp.blob/src/org/eclipse/osbp/blob/component/BlobUploadButton.java
+++ b/org.eclipse.osbp.blob/src/org/eclipse/osbp/blob/component/BlobUploadButton.java
@@ -19,7 +19,7 @@
 
 import com.vaadin.server.Resource;
 import com.vaadin.ui.CustomComponent;
-import com.wcs.wcslib.vaadin.widget.multifileupload.component.SmartMultiUpload;
+import com.wcs.wcslib.vaadin.widget.multifileupload.component.UploadComponent;
 import com.wcs.wcslib.vaadin.widget.multifileupload.ui.MultiFileUpload;
 import com.wcs.wcslib.vaadin.widget.multifileupload.ui.UploadFinishedHandler;
 import com.wcs.wcslib.vaadin.widget.multifileupload.ui.UploadStateWindow;
@@ -57,8 +57,17 @@
 		if (uploadIcon != null)
 			singleUpload.setUploadButtonIcon(uploadIcon);
 	}
-
-	public SmartMultiUpload getSmartUpload() {
-		return singleUpload.getSmartUpload();
+	
+	public UploadComponent getUploadComponent() {
+		return singleUpload.getSmartUpload().getUpload();
+	}
+	
+	public void setUploadButtonId(String uploadButtonId) {
+		singleUpload.getSmartUpload().setId(uploadButtonId);
+	}
+	
+	@Override
+	public void focus() {
+		 singleUpload.getSmartUpload().focus();
 	}
 }
diff --git a/org.eclipse.osbp.blob/src/org/eclipse/osbp/blob/component/BlobUploadComponent.java b/org.eclipse.osbp.blob/src/org/eclipse/osbp/blob/component/BlobUploadComponent.java
index 84b7136..e099c5c 100644
--- a/org.eclipse.osbp.blob/src/org/eclipse/osbp/blob/component/BlobUploadComponent.java
+++ b/org.eclipse.osbp.blob/src/org/eclipse/osbp/blob/component/BlobUploadComponent.java
@@ -26,9 +26,15 @@
 import org.eclipse.osbp.ui.api.customfields.IBlobEvent;
 import org.eclipse.osbp.ui.api.customfields.IBlobService;
 import org.eclipse.osbp.ui.api.customfields.IBlobUploadEventListener;
+import org.eclipse.osbp.ui.api.customfields.ICustomComponentFocusable;
 import org.eclipse.osbp.ui.api.metadata.IDSLMetadataService;
+import org.eclipse.osbp.ui.api.themes.EnumCssClass;
 import org.eclipse.osbp.ui.api.user.IUser;
 
+import com.vaadin.event.FieldEvents.BlurEvent;
+import com.vaadin.event.FieldEvents.BlurListener;
+import com.vaadin.event.FieldEvents.FocusEvent;
+import com.vaadin.event.FieldEvents.FocusListener;
 import com.vaadin.server.Extension;
 import com.vaadin.server.FileDownloader;
 import com.vaadin.server.StreamResource;
@@ -67,19 +73,18 @@
  * @author dominguez
  * 
  */
-public class BlobUploadComponent extends CustomField<String> implements IBlobUploadEventListener, IUser.UserLocaleListener {
-
+public class BlobUploadComponent extends CustomField<String> implements IBlobUploadEventListener,
+		IUser.UserLocaleListener, ICustomComponentFocusable {
+	
 	private static final String DOWNLOAD = "download";
 	private static final String UPLOAD = "upload";
-	/**
-	 * 
-	 */
 	private static final long serialVersionUID = -3890298210810421764L;
 	private static final String ICONPATH = "plugin/org.eclipse.osbp.blob/images/%s.png";
-	
+
 	public enum BUTTON_ALIGNMENT {
-		TOP, BUTTOM, LEFT, RIGHT, DEFAULT
+		TOP, BOTTOM, LEFT, RIGHT, DEFAULT
 	}
+
 	private transient IEventBroker eventBroker = null;
 
 	private static final int DEFAULT_RESOLUTION_ID = 0;
@@ -95,11 +100,15 @@
 	private transient IBlobService blobService;
 	private transient IDSLMetadataService dslMetadataService;
 	private transient IUser user;
+	
+	private boolean focusOnUpload = false;
+	
 
 	public BlobUploadComponent(IBlobService blobService, IDSLMetadataService dslMetadataService, IUser user) {
 		this.dslMetadataService = dslMetadataService;
 		this.user = user;
 		this.blobService = blobService;
+		addStyleName(EnumCssClass.IMAGE_UPLOAD.toString());
 	}
 
 	@Override
@@ -125,7 +134,6 @@
 
 	public void createSingleUpload() {
 		UploadFinishedHandler handler = new UploadFinishedHandler() {
-
 			private static final long serialVersionUID = 1L;
 
 			@Override
@@ -136,13 +144,12 @@
 				BlobUploadComponent.this.lastUploadedFilename = fileName;
 				blobService.createBlobMapping(stream, fileName, mimeType);
 			}
-
 		};
 
 		singleUpload = new BlobUploadButton(handler);
 		singleUpload.setUploadButtonIcon(new ThemeResource(String.format(ICONPATH, UPLOAD)));
 		singleUpload.setDescription(dslMetadataService.translate(user.getLocale().toLanguageTag(), UPLOAD));
-		singleUpload.setUploadButtonCaption(" ");
+		singleUpload.setUploadButtonCaption("");
 
 		// a Button is still active if the component is read only.
 		if (isReadOnly()) {
@@ -153,7 +160,7 @@
 		downloadButton.setVisible(false);
 		downloadButton.setEnabled(false);
 	}
-
+	
 	@Override
 	protected Component initContent() {
 		// Initialization of BlobUpload required before the
@@ -176,7 +183,7 @@
 			layout.addComponent(singleUpload);
 			layout.addComponent(downloadButton);
 			break;
-		case BUTTOM:
+		case BOTTOM:
 			layout = new GridLayout(1, rows);
 			layout.addComponent(displayImageLabel);
 			layout.addComponent(singleUpload);
@@ -192,6 +199,18 @@
 		return layout;
 	}
 
+    @Override
+    public void focus() {
+        if (!isFocusOnUpload()) {
+       		singleUpload.focus();
+       		setFocusOnUpload(true);
+        }
+        else if (isFocusOnUpload() && downloadButton.isVisible()) {
+        	downloadButton.focus();
+        	setFocusOnUpload(false);
+        }
+    }
+
 	@Override
 	public Class<String> getType() {
 		return String.class;
@@ -323,15 +342,69 @@
 	}
 
 	@Override
-	public void focus() {
-		super.focus();
-	}
-
-	@Override
 	public void localeChanged(Locale locale) {
-		if(singleUpload != null && downloadButton != null) {
+		if (singleUpload != null && downloadButton != null) {
 			singleUpload.setDescription(dslMetadataService.translate(user.getLocale().toLanguageTag(), UPLOAD));
 			downloadButton.setDescription(dslMetadataService.translate(user.getLocale().toLanguageTag(), DOWNLOAD));
 		}
 	}
+
+	@Override
+	public void addFocusListener(FocusListener listener) {
+		addListener(FocusEvent.EVENT_ID, FocusEvent.class, listener, FocusListener.focusMethod);
+	}
+
+	@Override
+	public void addListener(FocusListener listener) {
+		addFocusListener(listener);
+	}
+
+	@Override
+	public void removeFocusListener(FocusListener listener) {
+		removeListener(FocusEvent.EVENT_ID, FocusEvent.class, listener);
+	}
+
+	@Override
+	public void removeListener(FocusListener listener) {
+		removeFocusListener(listener);
+	}
+	
+	@Override
+	public void addBlurListener(BlurListener listener) {
+		addListener(BlurEvent.EVENT_ID, BlurEvent.class, listener, BlurListener.blurMethod);
+	}
+
+	@Override
+	public void addListener(BlurListener listener) {
+		addBlurListener(listener);
+	}
+
+	@Override
+	public void removeBlurListener(BlurListener listener) {
+		removeListener(BlurEvent.EVENT_ID, BlurEvent.class, listener);
+	}
+
+	@Override
+	public void removeListener(BlurListener listener) {
+		removeBlurListener(listener);
+	}
+
+	public boolean isFocusOnUpload() {
+		return focusOnUpload;
+	}
+
+	public void setFocusOnUpload(boolean focusOnUpload) {
+		this.focusOnUpload = focusOnUpload;
+	}
+
+	@Override
+	public boolean isFirstFocusable(Object element) {
+		return element.equals(singleUpload.getUploadComponent());
+	}
+
+	@Override
+	public boolean isLastFocusable(Object element) {
+		return element.equals(downloadButton);
+	}
+	
 }