diff --git a/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBox.java b/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBox.java index 464ce6b..f0b4348 100644 --- a/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBox.java +++ b/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBox.java @@ -21,6 +21,8 @@ import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.core.client.GWT; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; +import com.google.gwt.safehtml.shared.SafeHtml; +import com.google.gwt.safehtml.shared.SafeHtmlUtils; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Widget; import com.google.web.bindery.event.shared.EventBus; @@ -213,6 +215,7 @@ public class MainBox extends TabPanel { if (dataView instanceof TabularResourceDataView) { TabularResourceDataView tabularResourceDataView = (TabularResourceDataView) dataView; + boolean found = false; for (TDXPanel tdxPanel : tdxPanelList) { @@ -226,7 +229,8 @@ public class MainBox extends TabPanel { } } if (!found) { - addTDXPanel(tabularResourceDataView); + retrieveTRName(tabularResourceDataView); + // addTDXPanel(tabularResourceDataView); } } @@ -255,9 +259,16 @@ public class MainBox extends TabPanel { protected void addContentTDXPanel( TabularResourceDataView tabularResourceDataView, TabResource tabResource) { - + SafeHtml nameTR; + if(tabResource!=null && (tabResource.getName()==null + ||tabResource.getName().isEmpty())){ + nameTR=SafeHtmlUtils.fromString("NoName"); + } else { + nameTR=SafeHtmlUtils.fromString(tabResource.getName()); + } + TabItemConfig tdxPanelItemConf = new TabItemConfig( - tabResource.getName(), true); + nameTR.asString(), true); tdxPanelItemConf.setIcon(MainboxResources.INSTANCE.tabularResource()); final TDXPanel tdxPanel = new TDXPanel(eventBus); tdxPanel.open(tabularResourceDataView); @@ -338,7 +349,7 @@ public class MainBox extends TabPanel { } return rowsId; } - + /** * Retrieve ColumnName of column selected * @@ -355,20 +366,20 @@ public class MainBox extends TabPanel { } return columnName; } - + /** * Retrieve ColumnLocalId of column selected * * @param columnSelected * @return */ - public String getColumnLocalId(int columnSelected){ + public String getColumnLocalId(int columnSelected) { String columnName = null; Widget active = getActiveWidget(); if (active instanceof TDXPanel) { TDXPanel tdxPanel = (TDXPanel) active; - columnName = tdxPanel.getTabularData() - .getColumnLocalId(columnSelected); + columnName = tdxPanel.getTabularData().getColumnLocalId( + columnSelected); } return columnName; }