Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Highlighted
Frequent Contributor
Posts: 119
Registered: ‎04-05-2016
Accepted Solution

GMSC 2016 Java SDK: Can not addRow in DataGrid

Hello,

 

I am currently working on migrating a couple of GMSC 2015 plugins to GMSC 2016 and therefore I am using the GMSC 2016 Java SDK to compile and test in GMSC 2016. One of the plugins includes that the user is able to (temporally) digitize points in the map and output some result (ID, count, XY coordinates) into the datagrid.

 

The plugin used to run fine in GMSC 2015 but there seems to be an issue with the addRow(List<Array>)-Method in GMSC 2016 which isn't adding the contents into the dataRows-ArrayList of a searchresult anymore.

 

	private void addToSearch(GText text) {
		if (this.pointSearch != null
				&& this.pointSearch.getSearchResult() != null) {
			List<Object> row = new ArrayList<>();
			row.add(text.getID());
			row.add(new Integer(Integer.parseInt(text.getText())));
			GCoordinate coord = GPrimitive.getMBR(text).getCenter();
			row.add(new Double(coord.getX()));
			row.add(new Double(coord.getY()));
					
			this.pointSearch.getSearchResult().addRow(row);
		}
	}

When debugging I can see that the "row" element is correctly filled with data, but it's just not getting added as a dataRow into the searchResult. Any idea on what has changed regarding this operation between v. 2015 and 2016?

 

Thanks you for your help and kind regards,

Sven Möller

Highlighted
Frequent Contributor
Posts: 119
Registered: ‎04-05-2016

Re: GMSC 2016 Java SDK: Can not addRow in DataGrid

Hello again,

 

I learned that the addRow-method only works on non-empty searchResults. There has to be at least one dataRow so that the method adds more objects.

Instead I use the add-method now like this:

 

this.pointSearch.getSearchResult().getDataRows().add(row);

This works, regardless of the current number dataRows in the searchResult.

 

Regards,

Sven Möller