10-25-2017 01:24 AM
Hello,
How can I run a predefined query (created in GMSC Administrator) from a JAVA plugin?
Thank you!
Yohann.
Solved! Go to Solution.
10-30-2017 04:39 AM
Hello,
Anyone has an idea?
I can access list of predefinied searches and run one.
I get a SearchResult. How can I open a datagrid filled by this result?
Thank you!
Yohann.
10-30-2017 08:11 AM
Hi Yohann,
so you are using already the SearchController to get the PredefinedSearch and executing it?
Regards,
Steve
10-30-2017 08:15 AM
Hello Steve,
Yes, my code looks like this :
List<PredefinedSearch> searches = ApplicationContext.getProject().getFeatureByTitle("MyFeatureName").getPredefinedSearches();
Map<String, String> searchCriterias = new HashMap<String, String>();
SearchResult searchResult = searches.get(0).execute(searchCriterias, selectedElements);
Thank you.
Yohann.
10-30-2017 08:22 AM
change it to:
SearchController searchController = ApplicationContext.getProject().getSearchController(); // use searchController.getAllSearchesForFeature(FeatureID) or searchController.getAllSearches() or searchController.getSearchForFeatureAndName(FeatureID, String) to get the PredefinedSearch PredefinedSearch searchToExecute = .... Map<String, String> searchCriterias = new HashMap<String, String>(); Object[] selectedElements = ApplicationContext.getBrowser().getMapSelectionCurator().getSelectedElements(); searchController.executeSearch(searchToExecute, searchCriterias, selectedElements;
Please keep in mind, I didn't tested it ;-) Therefore it could be possible that you will find some Syntax-Errors.
10-30-2017 08:30 AM
Perfect!
Thank you Steve!
Yohann.
01-17-2019 01:07 AM - edited 01-17-2019 01:19 AM
Hi,
I have a problem with executing a search in my plugin. The datagrid is not rendered correctly when I run the execute and the datagrid is not open yet. Only when I mouseover the datagrid the elements get rendered.
When the datagrid is already open or I run the method twice, it gets rendered correctly.
Maybe this is also connected with the method being called during a GeometryCaptureAdapter run method?
I think it has to do with the executeSearch method being async but I don't know how to resolve the problem. Any ideas?
Thanks
01-20-2019 11:23 PM
The problem was caused by a TableModelListener which fired events in itself when it shouldn't and caused a circular effect