Remove arrows of the image-preview widget if there is no more than one image to show

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/user/news-feed@122583 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2016-01-28 10:57:31 +00:00
parent 2aa721710f
commit a1fcab00c9
2 changed files with 14 additions and 1 deletions

View File

@ -210,6 +210,9 @@ public class TweetTemplate extends Composite {
// create first attachment previewer and pass it the carousel
AttachmentPreviewer firstAttachmentPreviewer = new AttachmentPreviewer(firstAttachment);
// determine if the left/right arrows must be removed
int imagesAvailableInCarousel = 0;
// check if it is an image
if(firstAttachment.getMimeType().contains("image/")){
@ -224,6 +227,9 @@ public class TweetTemplate extends Composite {
listOfEnhancedImages.add(enhancedImage);
firstAttachmentPreviewer.onImageClickOpenCarousel(carousel, enhancedImage);
// increment the images
imagesAvailableInCarousel ++;
}
// add the first attachment to the panel
@ -249,11 +255,18 @@ public class TweetTemplate extends Composite {
// pass the carousel
attachmentPreviewer.onImageClickOpenCarousel(carousel, enhancedImage);
// increment the images
imagesAvailableInCarousel ++;
}
// try to build the attachment viewer
attachmentPreviewPanel.add(attachmentPreviewer);
// hide arrows if there are no more than 1 images
if(imagesAvailableInCarousel <= 1)
carousel.hideArrows();
}
// update the carousel's images

View File

@ -124,7 +124,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
*/
public String getDevelopmentUser() {
String user = NewsConstants.TEST_USER;
//user = "costantino.perciante";
user = "costantino.perciante";
return user;
}
/**