Fixed a problem relative to the modal's title whose css was missing on the portal

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/image-previewer-widget@122490 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-01-25 14:21:00 +00:00
parent 16ed07f3d1
commit 3de389a870
7 changed files with 33 additions and 32 deletions

View File

@ -3,39 +3,40 @@ package org.gcube.portlets.widgets.imagepreviewerwidget.client;
import com.github.gwtbootstrap.client.ui.Image; 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:
* <ul> * <ul>
* <li>title to show: a title to show in the header of the carousel;</li> * <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>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>download url: in case of a file, this field can be used to download it.</li>
* </ul> * </ul>
* @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 { public class EnhancedImage {
/** /**
* The image to show: it could be also a preview image for a file * The image to show.
*/ */
private Image image; private Image image;
/** /**
* Title to show in the header of the carousel * Title to show in the header of the carousel.
*/ */
private String titleToShow; private String titleToShow;
/** /**
* Tooltip shown when the user passes over the image * Tooltip shown when the user passes over the image.
*/ */
private String toolTipToShow; private String toolTipToShow;
/** /**
* The download url for the image/file * The download url of the image/file.
*/ */
private String downloadUrl; private String downloadUrl;
/** /**
* The image/file url. * Build an enhanced image from a url.
* @param imageUrl the url of the image. * @param imageUrl the url of the image.
*/ */
public EnhancedImage(String imageUrl){ 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 * @param image the image to show
*/ */
public EnhancedImage(Image image){ 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 image
* @param titleToShow * @param titleToShow
* @param toolTipToShow * @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 image
* @param titleToShow * @param titleToShow
* @param toolTipToShow * @param toolTipToShow

View File

@ -21,7 +21,7 @@ public class ImagePreviewer implements EntryPoint {
public void onModuleLoad() { public void onModuleLoad() {
// decomment for testing purpose // decomment for testing purpose
//test(); //test();
} }

View File

@ -5,6 +5,6 @@ import com.google.gwt.resources.client.ImageResource;
public interface Resources extends ClientBundle { public interface Resources extends ClientBundle {
@Source("Loading.gif") @Source("loading.gif")
ImageResource loadingImage(); ImageResource loadingImage();
} }

View File

@ -21,14 +21,15 @@ import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window; import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite; 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.HorizontalPanel;
import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
/** /**
* A carousel for image/file previews. * 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{ public class Carousel extends Composite{
@ -65,7 +66,7 @@ public class Carousel extends Composite{
// list of enhanced images to show // list of enhanced images to show
private List<EnhancedImage> listOfAttachmentsToShow; private List<EnhancedImage> listOfAttachmentsToShow;
// show the image at currentPreviewPosition // index of the image shown
private int currentPreviewPosition; private int currentPreviewPosition;
// other resources // other resources
@ -121,9 +122,8 @@ public class Carousel extends Composite{
// set url of the loading image // set url of the loading image
loadingImage.setResource(resources.loadingImage()); loadingImage.setResource(resources.loadingImage());
// set shownimage mouse icon to pointer // set shownImage mouse icon to pointer
shownImage.getElement().getStyle().setCursor(Cursor.POINTER); shownImage.getElement().getStyle().setCursor(Cursor.POINTER);
} }
@UiHandler("closeButton") @UiHandler("closeButton")
@ -137,7 +137,8 @@ public class Carousel extends Composite{
public void downloadOnClick(ClickEvent e){ public void downloadOnClick(ClickEvent e){
String downloadUrl = listOfAttachmentsToShow.get(currentPreviewPosition).getDownloadUrl(); String downloadUrl = listOfAttachmentsToShow.get(currentPreviewPosition).getDownloadUrl();
if( downloadUrl != null){
if(downloadUrl != null){
mainModalPanel.hide(); mainModalPanel.hide();
Window.open(downloadUrl, "_blank", ""); Window.open(downloadUrl, "_blank", "");
} }
@ -148,7 +149,8 @@ public class Carousel extends Composite{
public void onClickPrev(ClickEvent e){ public void onClickPrev(ClickEvent e){
// evaluate prev index // evaluate prev index
currentPreviewPosition = currentPreviewPosition == 0 ? listOfAttachmentsToShow.size() - 1 : currentPreviewPosition - 1; currentPreviewPosition =
currentPreviewPosition == 0 ? listOfAttachmentsToShow.size() - 1 : currentPreviewPosition - 1;
// show the image // show the image
showImage(currentPreviewPosition); showImage(currentPreviewPosition);
@ -159,7 +161,8 @@ public class Carousel extends Composite{
public void onClickNext(ClickEvent e){ public void onClickNext(ClickEvent e){
// evaluate next index // evaluate next index
currentPreviewPosition= currentPreviewPosition == listOfAttachmentsToShow.size() -1 ? currentPreviewPosition =
currentPreviewPosition == listOfAttachmentsToShow.size() -1 ?
0 : currentPreviewPosition + 1; 0 : currentPreviewPosition + 1;
// show the image // show the image
@ -174,7 +177,7 @@ public class Carousel extends Composite{
mainModalPanel.show(); mainModalPanel.show();
// take the first object // take the first image
currentPreviewPosition = 0; currentPreviewPosition = 0;
// show the image // show the image
@ -205,7 +208,7 @@ public class Carousel extends Composite{
/** /**
* Retrieve the index of such image * Retrieve the index of such image
* @param image * @param image
* @return * @return -1 if no image matches
*/ */
private int evaluateImagePosition(EnhancedImage image) { private int evaluateImagePosition(EnhancedImage image) {
@ -273,11 +276,7 @@ public class Carousel extends Composite{
String shownTitle = listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow().length() > 50 ? String shownTitle = listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow().length() > 50 ?
listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow().substring(0, 50) + "..." : listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow().substring(0, 50) + "..." :
listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow(); listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow();
HTML title = new HTML(shownTitle); mainModalPanel.setTitle(shownTitle);
title.setTitle(listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow());
mainModalPanel.setTitle(title.getHTML());
} }

View File

@ -24,6 +24,11 @@
.modal-header { .modal-header {
font-family: "Helvetica Neue", Arial, sans-serif; font-family: "Helvetica Neue", Arial, sans-serif;
height: 20px; height: 20px;
color: #3B5998 !important;
}
.modal-header>h3 {
font-size: 15px;
} }
@external .modal-body; @external .modal-body;

View File

@ -1,4 +0,0 @@
h3 {
font-size: 14px !important;
color: #3B5998 !important;
}