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 75163c5..d00c3a3 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
@@ -3,39 +3,40 @@ package org.gcube.portlets.widgets.imagepreviewerwidget.client;
import com.github.gwtbootstrap.client.ui.Image;
/**
- * This class contains the image to show within the carousel plus the following other information:
+ * This class allows to build the image to show within the carousel. Along the image itself, there are
+ * the following other information:
*
* - title to show: a title to show in the header of the carousel;
* - tooltip : a tooltip shown on image hover event;
* - download url: in case of a file, this field can be used to download it.
*
- * @author Costantino Perciante at ISTI-CNR
- *
+ * 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)
*/
public class EnhancedImage {
/**
- * The image to show: it could be also a preview image for a file
+ * The image to show.
*/
private Image image;
/**
- * Title to show in the header of the carousel
+ * Title to show in the header of the carousel.
*/
private String titleToShow;
/**
- * Tooltip shown when the user passes over the image
+ * Tooltip shown when the user passes over the image.
*/
private String toolTipToShow;
/**
- * The download url for the image/file
+ * The download url of the image/file.
*/
private String downloadUrl;
/**
- * The image/file url.
+ * Build an enhanced image from a url.
* @param imageUrl the url of the image.
*/
public EnhancedImage(String imageUrl){
@@ -49,7 +50,7 @@ public class EnhancedImage {
}
/**
- * The image to show.
+ * Build an enhanced image from another image.
* @param image the image to show
*/
public EnhancedImage(Image image){
@@ -63,7 +64,7 @@ public class EnhancedImage {
}
/**
- * This constructor accepts the image to show plus the title to show and the tooltip over the image.
+ * Build an enhanced image from an image but allows to customize the title of the image and its tooltip.
* @param image
* @param titleToShow
* @param toolTipToShow
@@ -79,7 +80,7 @@ public class EnhancedImage {
}
/**
- * This constructor accepts the image to show plus the title to show and the tooltip over the image.
+ * Build an enhanced image from an image but allows to customize the other properties.
* @param image
* @param titleToShow
* @param toolTipToShow
diff --git a/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/ImagePreviewer.java b/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/ImagePreviewer.java
index 9be6ffd..9918e28 100644
--- a/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/ImagePreviewer.java
+++ b/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/ImagePreviewer.java
@@ -21,7 +21,7 @@ public class ImagePreviewer implements EntryPoint {
public void onModuleLoad() {
// decomment for testing purpose
- //test();
+ //test();
}
diff --git a/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/resources/Resources.java b/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/resources/Resources.java
index b1eb152..3dafd7b 100644
--- a/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/resources/Resources.java
+++ b/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/resources/Resources.java
@@ -5,6 +5,6 @@ import com.google.gwt.resources.client.ImageResource;
public interface Resources extends ClientBundle {
- @Source("Loading.gif")
+ @Source("loading.gif")
ImageResource loadingImage();
}
diff --git a/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/resources/Loading.gif b/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/resources/loading.gif
similarity index 100%
rename from src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/resources/Loading.gif
rename to src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/resources/loading.gif
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 ddddf26..b5dde0e 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
@@ -21,14 +21,15 @@ import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* A carousel for image/file previews.
- * @author Costantino Perciante at ISTI-CNR
+ * @author Costantino Perciante at ISTI-CNR
+ * (costantino.perciante@isti.cnr.it)
+ *
*/
public class Carousel extends Composite{
@@ -65,7 +66,7 @@ public class Carousel extends Composite{
// list of enhanced images to show
private List listOfAttachmentsToShow;
- // show the image at currentPreviewPosition
+ // index of the image shown
private int currentPreviewPosition;
// other resources
@@ -121,9 +122,8 @@ public class Carousel extends Composite{
// set url of the loading image
loadingImage.setResource(resources.loadingImage());
- // set shownimage mouse icon to pointer
+ // set shownImage mouse icon to pointer
shownImage.getElement().getStyle().setCursor(Cursor.POINTER);
-
}
@UiHandler("closeButton")
@@ -137,7 +137,8 @@ public class Carousel extends Composite{
public void downloadOnClick(ClickEvent e){
String downloadUrl = listOfAttachmentsToShow.get(currentPreviewPosition).getDownloadUrl();
- if( downloadUrl != null){
+
+ if(downloadUrl != null){
mainModalPanel.hide();
Window.open(downloadUrl, "_blank", "");
}
@@ -148,7 +149,8 @@ public class Carousel extends Composite{
public void onClickPrev(ClickEvent e){
// evaluate prev index
- currentPreviewPosition = currentPreviewPosition == 0 ? listOfAttachmentsToShow.size() - 1 : currentPreviewPosition - 1;
+ currentPreviewPosition =
+ currentPreviewPosition == 0 ? listOfAttachmentsToShow.size() - 1 : currentPreviewPosition - 1;
// show the image
showImage(currentPreviewPosition);
@@ -159,7 +161,8 @@ public class Carousel extends Composite{
public void onClickNext(ClickEvent e){
// evaluate next index
- currentPreviewPosition= currentPreviewPosition == listOfAttachmentsToShow.size() -1 ?
+ currentPreviewPosition =
+ currentPreviewPosition == listOfAttachmentsToShow.size() -1 ?
0 : currentPreviewPosition + 1;
// show the image
@@ -174,7 +177,7 @@ public class Carousel extends Composite{
mainModalPanel.show();
- // take the first object
+ // take the first image
currentPreviewPosition = 0;
// show the image
@@ -205,7 +208,7 @@ public class Carousel extends Composite{
/**
* Retrieve the index of such image
* @param image
- * @return
+ * @return -1 if no image matches
*/
private int evaluateImagePosition(EnhancedImage image) {
@@ -273,11 +276,7 @@ public class Carousel extends Composite{
String shownTitle = listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow().length() > 50 ?
listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow().substring(0, 50) + "..." :
listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow();
- HTML title = new HTML(shownTitle);
- title.setTitle(listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow());
-
- mainModalPanel.setTitle(title.getHTML());
-
+ mainModalPanel.setTitle(shownTitle);
}
diff --git a/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/ui/Carousel.ui.xml b/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/ui/Carousel.ui.xml
index fd42bde..31c096c 100644
--- a/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/ui/Carousel.ui.xml
+++ b/src/main/java/org/gcube/portlets/widgets/imagepreviewerwidget/client/ui/Carousel.ui.xml
@@ -24,6 +24,11 @@
.modal-header {
font-family: "Helvetica Neue", Arial, sans-serif;
height: 20px;
+ color: #3B5998 !important;
+ }
+
+ .modal-header>h3 {
+ font-size: 15px;
}
@external .modal-body;
diff --git a/src/main/webapp/ImagePreviewer.css b/src/main/webapp/ImagePreviewer.css
index f41e151..e69de29 100644
--- a/src/main/webapp/ImagePreviewer.css
+++ b/src/main/webapp/ImagePreviewer.css
@@ -1,4 +0,0 @@
-h3 {
- font-size: 14px !important;
- color: #3B5998 !important;
-}