From 0a21bd0d3f26edf7d74baf152097a3b0cf295ea0 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 6 May 2022 09:59:50 +0200 Subject: [PATCH] fixing x-multiple in the Tab UI --- .../client/ui/MainTabPanel.java | 42 +++++++++---------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/ui/MainTabPanel.java b/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/ui/MainTabPanel.java index 777a027..abbf0db 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/ui/MainTabPanel.java +++ b/src/main/java/org/gcube/portlets/widgets/ckancontentmoderator/client/ui/MainTabPanel.java @@ -3,7 +3,6 @@ package org.gcube.portlets.widgets.ckancontentmoderator.client.ui; import java.util.ArrayList; import java.util.List; -import org.gcube.portlets.widgets.ckancontentmoderator.client.resources.ContentModeratorWidgetResources; import org.gcube.portlets.widgets.ckancontentmoderator.client.ui.util.UtilFunct; import com.github.gwtbootstrap.client.ui.Icon; @@ -21,7 +20,6 @@ import com.google.gwt.event.dom.client.LoadHandler; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.Element; -import com.google.gwt.user.client.ui.AbstractImagePrototype; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Widget; @@ -91,26 +89,6 @@ public class MainTabPanel extends Composite { public void onLoad(LoadEvent event) { tab.setIcon(IconType.BOOK); setNoSpinner(tab); - - Icon icon = new Icon(IconType.REMOVE); - icon.setTitle("Close this tab"); - icon.getElement().getStyle().setCursor(Cursor.POINTER); - ClickHandler clickHandler = new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - try { - mainTabPanel.remove(tab); - results.remove(tab); - mainTabPanel.selectTab(results.size() - 1); - }catch (Exception e) { - //silent - } - } - }; - - icon.addDomHandler(clickHandler, ClickEvent.getType()); - tab.addDecorate(icon); } }); } @@ -122,6 +100,26 @@ public class MainTabPanel extends Composite { } }); + Icon icon = new Icon(IconType.REMOVE); + icon.setTitle("Close this tab"); + icon.getElement().getStyle().setCursor(Cursor.POINTER); + ClickHandler clickHandler = new ClickHandler() { + + @Override + public void onClick(ClickEvent event) { + try { + mainTabPanel.remove(tab); + results.remove(tab); + mainTabPanel.selectTab(results.size() - 1); + } catch (Exception e) { + // silent + } + } + }; + + icon.addDomHandler(clickHandler, ClickEvent.getType()); + tab.addDecorate(icon); + String shortTitle = UtilFunct.ellipsis(heading, 20, false); tab.asWidget().setTitle(heading); tab.setHeading(shortTitle);