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 3de8a45..088792f 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 @@ -22,6 +22,8 @@ import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.HorizontalPanel; +import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; /** @@ -58,6 +60,9 @@ public class Carousel extends Composite{ @UiField Image loadingImage; + + @UiField + HorizontalPanel commands; // list of enhanced images to show private List listOfAttachmentsToShow; @@ -76,9 +81,22 @@ public class Carousel extends Composite{ initWidget(uiBinder.createAndBindUi(this)); - // set buttons width - closeButton.setWidth("100px"); - downloadButton.setWidth("100px"); + // set vertical alignment + commands.setCellVerticalAlignment(nextButton, VerticalPanel.ALIGN_MIDDLE); + commands.setCellVerticalAlignment(prevButton, VerticalPanel.ALIGN_MIDDLE); + + // set alignment of the horizontal panel's children + commands.setCellHorizontalAlignment(closeButton, HorizontalPanel.ALIGN_CENTER); + commands.setCellHorizontalAlignment(downloadButton, HorizontalPanel.ALIGN_CENTER); + commands.setCellHorizontalAlignment(prevButton, HorizontalPanel.ALIGN_LEFT); + commands.setCellHorizontalAlignment(nextButton, HorizontalPanel.ALIGN_RIGHT); + + // set central buttons' cell widths to be equal as well as their widths + commands.setCellWidth(downloadButton, "20%"); + commands.setCellWidth(closeButton, "20%"); + + downloadButton.setWidth("80px"); + closeButton.setWidth("80px"); // set icons downloadButton.setIcon(IconType.DOWNLOAD); @@ -264,8 +282,8 @@ public class Carousel extends Composite{ shownImage.setTitle(listOfAttachmentsToShow.get(currentPreviewPosition).getToolTipToShow()); // change the title to the modal - String shownTitle = listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow().length() > 50 ? - listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow().substring(0, 50) + "..." : + String shownTitle = listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow().length() > 40 ? + listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow().substring(0, 40) + "..." : listOfAttachmentsToShow.get(currentPreviewPosition).getTitleToShow(); mainModalPanel.setTitle(shownTitle); 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 50d7973..2d091a6 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 @@ -4,31 +4,20 @@ - + - - - - - - - - - Download - - - Close - - - - - - + + + + Download + Close + +