From b25cac6a725c5b6a5cd189558623358acf71e71f Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Fri, 5 Aug 2016 10:31:18 +0000 Subject: [PATCH] minor fix and moved to 1.1.1 version (now loading image is removed after that the orientation has been retrieved from the server side) git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/image-previewer-widget@130977 82a268e6-3cf1-43bd-a215-b396298e98cf --- distro/changelog.xml | 3 + pom.xml | 3 +- .../client/ui/Carousel.java | 59 +++++++++++-------- 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/distro/changelog.xml b/distro/changelog.xml index 67a7f7b..ffab205 100644 --- a/distro/changelog.xml +++ b/distro/changelog.xml @@ -1,4 +1,7 @@ + + Minor fix + Removed GWT Standard css Style changes diff --git a/pom.xml b/pom.xml index 48a7def..dc4b6b2 100644 --- a/pom.xml +++ b/pom.xml @@ -12,8 +12,7 @@ org.gcube.portlets.widgets image-previewer-widget - jar - 1.1.0-SNAPSHOT + 1.1.1-SNAPSHOT gCube Image previewer widget gCube Image Previewer widget is a GWT Widget that can be used to show a preview of one or more images 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 287d291..a9f8553 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,26 +333,7 @@ public class Carousel extends Composite{ shownImage.setVisible(false); final EnhancedImage imageToShow = listOfAttachmentsToShow.get(index); - String url = imageToShow.getImageUrl(); - - // call only if undefined - if(imageToShow.getOrientation().equals(Orientation.UNDEFINED)){ - - imageServices.getImageOrientation(url, new AsyncCallback() { - - @Override - public void onSuccess(Orientation result) { - setOrientation(imageToShow, result); - } - - @Override - public void onFailure(Throwable caught) { - setOrientation(imageToShow, Orientation.DO_NOT_ROTATE); - } - }); - - }else - setOrientation(imageToShow, imageToShow.getOrientation()); + final String url = imageToShow.getImageUrl(); // when image is downloaded ... shownImage.addLoadHandler(new LoadHandler() { @@ -360,10 +341,28 @@ public class Carousel extends Composite{ @Override public void onLoad(LoadEvent event) { - // swap - shownImage.setVisible(true); - loadingImage.setVisible(false); + // call only if undefined + if(imageToShow.getOrientation().equals(Orientation.UNDEFINED)){ + imageServices.getImageOrientation(url, new AsyncCallback() { + + @Override + public void onSuccess(Orientation result) { + setOrientation(imageToShow, result); + removeLoader(); + } + + @Override + public void onFailure(Throwable caught) { + setOrientation(imageToShow, Orientation.DO_NOT_ROTATE); + removeLoader(); + } + }); + + }else{ + setOrientation(imageToShow, imageToShow.getOrientation()); + removeLoader(); + } } }); @@ -387,19 +386,27 @@ public class Carousel extends Composite{ ((Element)mainModalPanel.getElement().getChildNodes().getItem(0)).addClassName("modal-header-custom"); } - + + /** + * Remove image loader + */ + protected void removeLoader() { + shownImage.setVisible(true); + loadingImage.setVisible(false); + } + /** * Set the orientation * @param img * @param o */ private void setOrientation(EnhancedImage img, Orientation o){ - + GWT.log("Rotation is " + o); // set to the img img.setOrientation(o); - + // remove all the possible secondary styles.. shownImage.removeStyleName("rotate-0"); shownImage.removeStyleName("rotate-90");