added thumbnailUrl parameter and fixed showMethod

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/image-previewer-widget@149321 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-06-06 16:17:28 +00:00
parent f4b1414c7c
commit 52ccc192ec
3 changed files with 34 additions and 27 deletions

View File

@ -28,9 +28,9 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="${webappDirectory}/WEB-INF/classes"/>

View File

@ -5,9 +5,10 @@ import org.gcube.portlets.widgets.imagepreviewerwidget.shared.Orientation;
/**
* This class allows to build the image to show within the carousel. It contains:
* <ul>
* <li>title to show: a title to show in the header of the carousel;</li>
* <li>tooltip : a tooltip shown on image hover event;</li>
* <li>download url: in case of a file, this field can be used to download it.</li>
* <li>title to show: a title to show in the header of the carousel;
* <li>tooltip : a tooltip shown on image hover event;
* <li>download url: in case of a file, this field can be used to download it.
* <li>thumbnailUrl for the thumbnail
* </ul>
* If tooltip/download url/title to show is not specified, its value will be equal to the image url.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
@ -29,6 +30,11 @@ public class EnhancedImage {
*/
private String downloadUrl;
/**
* The url of the image to show
*/
private String thumbnailUrl;
/**
* The orientation
*/
@ -44,6 +50,7 @@ public class EnhancedImage {
this.titleToShow = imageUrl;
this.toolTipToShow = imageUrl;
this.downloadUrl = imageUrl;
this.thumbnailUrl = downloadUrl;
}
@ -53,12 +60,13 @@ public class EnhancedImage {
* @param titleToShow
* @param toolTipToShow
*/
public EnhancedImage(String url, String titleToShow, String toolTipToShow) {
public EnhancedImage(String downloadUrl, String titleToShow, String toolTipToShow) {
super();
this.titleToShow = titleToShow;
this.toolTipToShow = toolTipToShow;
this.downloadUrl = url;
this.downloadUrl = downloadUrl;
this.thumbnailUrl = downloadUrl;
}
@ -69,42 +77,37 @@ public class EnhancedImage {
* @param toolTipToShow
* @param download url
*/
public EnhancedImage(String url, String titleToShow, String toolTipToShow, String downloadUrl) {
public EnhancedImage(String thumbnailUrl, String titleToShow, String toolTipToShow, String downloadUrl) {
super();
this.titleToShow = titleToShow;
this.toolTipToShow = toolTipToShow;
this.downloadUrl = url;
this.thumbnailUrl = thumbnailUrl;
this.downloadUrl = downloadUrl;
}
public String getThumbnailUrl() {
return thumbnailUrl;
}
public void setThumbnailUrl(String thumbnailUrl) {
this.thumbnailUrl = thumbnailUrl;
}
public String getTitleToShow() {
return titleToShow;
}
public void setTitleToShow(String titleToShow) {
this.titleToShow = titleToShow;
}
public String getToolTipToShow() {
return toolTipToShow;
}
public void setToolTipToShow(String toolTipToShow) {
this.toolTipToShow = toolTipToShow;
}
public String getImageUrl(){
return this.downloadUrl;
}
public String getDownloadUrl() {
@ -114,6 +117,10 @@ public class EnhancedImage {
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}
public String getImageUrl(){
return this.thumbnailUrl != null? this.thumbnailUrl: this.downloadUrl;
}
/**
* @return the orientation
@ -128,12 +135,13 @@ public class EnhancedImage {
public void setOrientation(Orientation orientation) {
this.orientation = orientation;
}
@Override
public String toString() {
return "EnhancedImage [titleToShow=" + titleToShow + ", toolTipToShow="
+ toolTipToShow + ", downloadUrl=" + downloadUrl
+ ", orientation=" + orientation + "]";
+ ", thumbnailUrl=" + thumbnailUrl + ", orientation="
+ orientation + "]";
}
}

View File

@ -278,6 +278,7 @@ public class Carousel extends Composite implements CarouselInterface {
*/
public void show(EnhancedImage image){
GWT.log("image=" + image.getDownloadUrl());
GWT.log("image=" + image.getThumbnailUrl());
// evaluate where this image is
int index = evaluateImagePosition(image);
GWT.log("index=" + index);
@ -388,8 +389,6 @@ public class Carousel extends Composite implements CarouselInterface {
// fetch the image from the url
shownImage.setUrl(url);
// change image tooltip
shownImage.setTitle(imageToShow.getToolTipToShow());