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:
parent
2aa721710f
commit
a1fcab00c9
|
@ -210,6 +210,9 @@ public class TweetTemplate extends Composite {
|
||||||
// create first attachment previewer and pass it the carousel
|
// create first attachment previewer and pass it the carousel
|
||||||
AttachmentPreviewer firstAttachmentPreviewer = new AttachmentPreviewer(firstAttachment);
|
AttachmentPreviewer firstAttachmentPreviewer = new AttachmentPreviewer(firstAttachment);
|
||||||
|
|
||||||
|
// determine if the left/right arrows must be removed
|
||||||
|
int imagesAvailableInCarousel = 0;
|
||||||
|
|
||||||
// check if it is an image
|
// check if it is an image
|
||||||
if(firstAttachment.getMimeType().contains("image/")){
|
if(firstAttachment.getMimeType().contains("image/")){
|
||||||
|
|
||||||
|
@ -224,6 +227,9 @@ public class TweetTemplate extends Composite {
|
||||||
listOfEnhancedImages.add(enhancedImage);
|
listOfEnhancedImages.add(enhancedImage);
|
||||||
firstAttachmentPreviewer.onImageClickOpenCarousel(carousel, enhancedImage);
|
firstAttachmentPreviewer.onImageClickOpenCarousel(carousel, enhancedImage);
|
||||||
|
|
||||||
|
// increment the images
|
||||||
|
imagesAvailableInCarousel ++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the first attachment to the panel
|
// add the first attachment to the panel
|
||||||
|
@ -249,11 +255,18 @@ public class TweetTemplate extends Composite {
|
||||||
// pass the carousel
|
// pass the carousel
|
||||||
attachmentPreviewer.onImageClickOpenCarousel(carousel, enhancedImage);
|
attachmentPreviewer.onImageClickOpenCarousel(carousel, enhancedImage);
|
||||||
|
|
||||||
|
// increment the images
|
||||||
|
imagesAvailableInCarousel ++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to build the attachment viewer
|
// try to build the attachment viewer
|
||||||
attachmentPreviewPanel.add(attachmentPreviewer);
|
attachmentPreviewPanel.add(attachmentPreviewer);
|
||||||
|
|
||||||
|
// hide arrows if there are no more than 1 images
|
||||||
|
if(imagesAvailableInCarousel <= 1)
|
||||||
|
carousel.hideArrows();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// update the carousel's images
|
// update the carousel's images
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class NewsServiceImpl extends RemoteServiceServlet implements NewsService
|
||||||
*/
|
*/
|
||||||
public String getDevelopmentUser() {
|
public String getDevelopmentUser() {
|
||||||
String user = NewsConstants.TEST_USER;
|
String user = NewsConstants.TEST_USER;
|
||||||
//user = "costantino.perciante";
|
user = "costantino.perciante";
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue