diff --git a/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/EnhancedImage.java b/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/EnhancedImage.java
index 39c8b00..df8d650 100644
--- a/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/EnhancedImage.java
+++ b/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/EnhancedImage.java
@@ -2,8 +2,6 @@ package org.gcube.portlets.widgets.imagepreviewerwidget.client;
import org.gcube.portlets.widgets.imagepreviewerwidget.shared.Orientation;
-import com.github.gwtbootstrap.client.ui.Image;
-
/**
* This class allows to build the image to show within the carousel. It contains:
*
@@ -35,11 +33,6 @@ public class EnhancedImage {
* The orientation
*/
private Orientation orientation = Orientation.UNDEFINED;
-
- /**
- * The cached image (once downloaded)
- */
- private Image cachedImage;
/**
* Build an enhanced image from a url.
@@ -136,14 +129,6 @@ public class EnhancedImage {
this.orientation = orientation;
}
- public Image getCachedImage() {
- return cachedImage;
- }
-
- public void setCachedImage(Image cachedImage) {
- this.cachedImage = cachedImage;
- }
-
@Override
public String toString() {
return "EnhancedImage [titleToShow=" + titleToShow + ", toolTipToShow="
diff --git a/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/ui/Carousel.java b/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/ui/Carousel.java
index 31f5730..ab170fd 100644
--- a/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/ui/Carousel.java
+++ b/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/ui/Carousel.java
@@ -333,53 +333,42 @@ public class Carousel extends Composite{
final EnhancedImage imageToShow = listOfAttachmentsToShow.get(index);
- // check if it was already shown before and cached...
- if(imageToShow.getCachedImage() != null){
+ final String url = imageToShow.getImageUrl();
- shownImage = imageToShow.getCachedImage();
- setOrientation(imageToShow, imageToShow.getOrientation());
+ // when image is downloaded ...
+ shownImage.addLoadHandler(new LoadHandler() {
- }else{
+ @Override
+ public void onLoad(LoadEvent event) {
- final String url = imageToShow.getImageUrl();
+ // call only if undefined
+ if(imageToShow.getOrientation().equals(Orientation.UNDEFINED)){
- // when image is downloaded ...
- shownImage.addLoadHandler(new LoadHandler() {
+ imageServices.getImageOrientation(url, new AsyncCallback() {
- @Override
- public void onLoad(LoadEvent event) {
+ @Override
+ public void onSuccess(Orientation result) {
+ imageToShow.setOrientation(result);
+ setOrientation(imageToShow, result);
+ }
- // call only if undefined
- if(imageToShow.getOrientation().equals(Orientation.UNDEFINED)){
+ @Override
+ public void onFailure(Throwable caught) {
+ imageToShow.setOrientation(Orientation.DO_NOT_ROTATE);
+ setOrientation(imageToShow, Orientation.DO_NOT_ROTATE);
+ }
+ });
- imageServices.getImageOrientation(url, new AsyncCallback() {
-
- @Override
- public void onSuccess(Orientation result) {
- imageToShow.setOrientation(result);
- setOrientation(imageToShow, result);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- imageToShow.setOrientation(Orientation.DO_NOT_ROTATE);
- setOrientation(imageToShow, Orientation.DO_NOT_ROTATE);
- }
- });
-
- }else{
- setOrientation(imageToShow, imageToShow.getOrientation());
- }
-
- // cache it
- imageToShow.setCachedImage(shownImage);
+ }else{
+ setOrientation(imageToShow, imageToShow.getOrientation());
}
- });
+ }
+ });
+
+ // fetch the image from the url
+ shownImage.setUrl(url);
- // fetch the image from the url
- shownImage.setUrl(url);
- }
// change image tooltip
shownImage.setTitle(imageToShow.getToolTipToShow());