From 077268ded86fe1a01371366fafb01568075b64d9 Mon Sep 17 00:00:00 2001 From: Costantino Perciante Date: Thu, 21 Jan 2016 17:50:30 +0000 Subject: [PATCH] Stylesheet changes git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portlets/widgets/image-previewer-widget@122436 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/ImagePreviewer.java | 2 +- .../client/ui/Carousel.java | 52 ++++++++++++++++--- .../client/ui/Carousel.ui.xml | 26 +++++++++- src/main/webapp/ImagePreviewer.css | 6 +-- 4 files changed, 72 insertions(+), 14 deletions(-) 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 72cd509..76cf350 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 @@ -25,6 +25,6 @@ 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)); + RootPanel.get("image-previewer-div").add(Carousel.getImagePreviewerInstance(images)); } } 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 b942001..fb06901 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 @@ -26,12 +26,7 @@ public class Carousel extends Composite{ interface CarouselUiBinder extends UiBinder { } - - public Carousel() { - initWidget(uiBinder.createAndBindUi(this)); - - } - + @UiField Modal mainModalPanel; @@ -50,8 +45,23 @@ public class Carousel extends Composite{ private List listOfAttachmentsToShow; private int currentPreviewPosition; + + private static Carousel instance; + + public static Carousel getImagePreviewerInstance(List imagesToShow){ + + if(instance == null){ + + instance = new Carousel(imagesToShow); + + } + + return instance; + + } + + private Carousel(List imagesToShow) { - public Carousel(List imagesToShow) { initWidget(uiBinder.createAndBindUi(this)); // prev button @@ -59,7 +69,7 @@ public class Carousel extends Composite{ // next button nextButton.setText(">>"); - + // save the attachments list listOfAttachmentsToShow = imagesToShow; @@ -141,4 +151,30 @@ public class Carousel extends Composite{ } + /** + * Update the underneath set of enhanced images. + * @param imagesToShow the new set of images + */ + public void changeUnderneathImageSet(List imagesToShowNew){ + + // hide the modal + mainModalPanel.hide(); + + // change the set + listOfAttachmentsToShow = imagesToShowNew; + + // 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()); + + } + } 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 11cd7ff..107b2b4 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 @@ -20,9 +20,31 @@ font-weight: bold; } - .modal-text-size { + @external .modal-header; + .modal-header { + text-align: center; font-family: "Helvetica Neue", Arial, sans-serif; - font-size: 14px; + height: 20px; + } + + @external .modal-body; + .modal-body { + position: relative; + max-height: 400px; + padding: 0; + overflow-y: auto; + } + + @external .modal-footer; + .modal-footer { + padding: 10px 10px 10px; + margin-bottom: 0px; + text-align: right; + background-color: #F5F5F5; + border-top: 1px solid #DDD; + border-radius: 0px 0px 6px 6px; + box-shadow: 0px 1px 0px #FFF inset; + } } diff --git a/src/main/webapp/ImagePreviewer.css b/src/main/webapp/ImagePreviewer.css index b45c86c..db098d8 100644 --- a/src/main/webapp/ImagePreviewer.css +++ b/src/main/webapp/ImagePreviewer.css @@ -1,4 +1,4 @@ -.modal-style { - font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; - font-size: 14px; +h3 { + font-size: 14px !important; + color: #3B5998!important; } \ No newline at end of file