Fixed error when tabular resource has not name
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-mainbox-widget@111408 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
4abf4f5613
commit
8957f19d4c
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue