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
This commit is contained in:
Costantino Perciante 2016-08-05 10:31:18 +00:00
parent 8cbed3e7cd
commit b25cac6a72
3 changed files with 37 additions and 28 deletions

View File

@ -1,4 +1,7 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-widgets.image-previewer-widget.1-1-1" date="2016-11-02">
<Change>Minor fix</Change>
</Changeset>
<Changeset component="org.gcube.portlets-widgets.image-previewer-widget.1-1-0" date="2016-04-02">
<Change>Removed GWT Standard css</Change>
<Change>Style changes</Change>

View File

@ -12,8 +12,7 @@
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>image-previewer-widget</artifactId>
<packaging>jar</packaging>
<version>1.1.0-SNAPSHOT</version>
<version>1.1.1-SNAPSHOT</version>
<name>gCube Image previewer widget</name>
<description>
gCube Image Previewer widget is a GWT Widget that can be used to show a preview of one or more images

View File

@ -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<Orientation>() {
@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<Orientation>() {
@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");