Carousel's constructor changed
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/image-previewer-widget@122477 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c412bfabf2
commit
fdc03577dd
|
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.imagepreviewerwidget.client.ui.Carousel;
|
||||
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
|
||||
|
@ -20,6 +21,7 @@ public class ImagePreviewer implements EntryPoint {
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private void test(){
|
||||
|
||||
// random images for test
|
||||
|
@ -29,6 +31,8 @@ public class ImagePreviewer implements EntryPoint {
|
|||
images.add(new EnhancedImage("http://nerdist.com/wp-content/uploads/2014/07/ned-stark-970x545.jpg"));
|
||||
images.add(new EnhancedImage("http://vignette2.wikia.nocookie.net/gameofthrones/images/2/25/Eddard's_Head.png/revision/latest?cb=20121205211321"));
|
||||
images.add(new EnhancedImage("https://upload.wikimedia.org/wikipedia/it/1/17/Il_grande_Lebowski.jpg"));
|
||||
RootPanel.get("image-previewer-div").add(new Carousel(images));
|
||||
Carousel c = new Carousel();
|
||||
c.updateImages(images);
|
||||
RootPanel.get("image-previewer-div").add(c);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class Carousel extends Composite{
|
|||
* Build a carousel that shows imagesToShow images.
|
||||
* @param imagesToShow
|
||||
*/
|
||||
public Carousel(List<EnhancedImage> imagesToShow) {
|
||||
public Carousel() {
|
||||
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
|
@ -89,21 +89,6 @@ public class Carousel extends Composite{
|
|||
// next button
|
||||
nextButton.setText(">>");
|
||||
|
||||
// save the attachments list
|
||||
listOfAttachmentsToShow = imagesToShow;
|
||||
|
||||
// take the first object
|
||||
currentPreviewPosition = 0;
|
||||
|
||||
// show it
|
||||
shownImage.setUrl(listOfAttachmentsToShow.get(currentPreviewPosition).getImageUrl());
|
||||
|
||||
// change image tooltip
|
||||
shownImage.setTitle(listOfAttachmentsToShow.get(currentPreviewPosition).getToolTipToShow());
|
||||
|
||||
// change the title to the modal
|
||||
mainModalPanel.setTitle(listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow());
|
||||
|
||||
}
|
||||
|
||||
@UiHandler("showButton")
|
||||
|
@ -167,6 +152,18 @@ public class Carousel extends Composite{
|
|||
*/
|
||||
public void show(){
|
||||
|
||||
// take the first object
|
||||
currentPreviewPosition = 0;
|
||||
|
||||
// show it
|
||||
shownImage.setUrl(listOfAttachmentsToShow.get(currentPreviewPosition).getImageUrl());
|
||||
|
||||
// change image tooltip
|
||||
shownImage.setTitle(listOfAttachmentsToShow.get(currentPreviewPosition).getToolTipToShow());
|
||||
|
||||
// change the title to the modal
|
||||
mainModalPanel.setTitle(listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow());
|
||||
|
||||
mainModalPanel.show();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue