List of usage examples for com.google.gwt.query.client GQuery $$
public static Properties $$(String properties)
From source file:org.mindinformatics.gwt.domeo.plugins.persistence.annotopia.src.AnnotopiaPersistenceManager.java
License:Apache License
@Override public void retrieveExistingAnnotationSetList(IRetrieveExistingAnnotationSetListHandler handler) { _application.getLogger().debug(this, "Retrieving list of existing annotation sets..."); _application.getProgressPanelContainer() .setProgressMessage("Retrieving list of existing annotation sets from Annotopia..."); try {// w ww . jav a 2 s . c o m Ajax.ajax(Ajax.createSettings().setUrl(URL + "s/annotationset").setHeaders(getAnnotopiaOAuthToken()) .setDataType("json") // txt, json, jsonp, xml .setType("get") // post, get .setData(GQuery.$$("apiKey: " + ApplicationUtils.getAnnotopiaApiKey() + ",outCmd:frame,tgtUrl:" + ((IDomeo) _application).getPersistenceManager().getCurrentResource().getUrl())) // parameters for the query-string .setTimeout(10000).setSuccess(new Function() { // callback to be run if the request success public void f() { IDomeo _domeo = ((IDomeo) _application); JsAnnotopiaSetsResultWrapper wrapper = (JsAnnotopiaSetsResultWrapper) parseJson( getDataProperties().toJsonString()); AnnotopiaConverter unmarshaller = new AnnotopiaConverter(_domeo); List<MAnnotopiaAnnotationSet> sets = unmarshaller.unmarshallAnnotationSetsList(wrapper); _application.getLogger() .debug(this, "Completed Execution of retrieveExistingAnnotationSetList() in " + (System.currentTimeMillis() - ((IDomeo) _application).getDocumentPipelineTimer()) + "ms"); if (sets.size() == 0) { // TODO message no annotation found _application.getLogger().info(this, "No annotation sets found"); _application.getProgressPanelContainer() .setCompletionMessage("No annotation exist for this document"); } else { _application.getProgressPanelContainer().hide(); try { ExistingAnnotationViewerPanel lwp = new ExistingAnnotationViewerPanel( (IDomeo) _application, sets); new EnhancedGlassPanel((IDomeo) _application, lwp, lwp.getTitle(), false, false, false); } catch (Exception e) { _application.getLogger().exception(this, "Exeption in visualizing existing annotation"); } } } }).setError(new Function() { // callback to be run if the request fails public void f() { _application.getLogger().exception(this, "Couldn't complete existing annotation sets list retrieval process"); _application.getProgressPanelContainer().setErrorMessage( "Couldn't complete existing annotation sets list retrieval process"); } })); } catch (Exception e) { _application.getLogger().exception(this, "Couldn't complete existing annotation sets list retireval"); } }
From source file:org.mindinformatics.gwt.domeo.plugins.persistence.annotopia.src.AnnotopiaPersistenceManager.java
License:Apache License
@Override public void retrieveExistingAnnotationSets(List<String> urls, IRetrieveExistingAnnotationSetHandler handler) { _application.getLogger().debug(this, "Retrieving requested annotation sets..."); _application.getProgressPanelContainer() .setProgressMessage("Retrieving requested annotation sets from Annotopia..."); for (String url : urls) { try {//from w w w . j av a2s .c o m Ajax.ajax(Ajax.createSettings().setUrl(url).setHeaders(getAnnotopiaOAuthToken()).setDataType("json") // txt, json, jsonp, xml .setType("get") // post, get .setData(GQuery.$$("apiKey: " + ApplicationUtils.getAnnotopiaApiKey() + ",outCmd:frame")) // parameters for the query-string .setTimeout(10000).setSuccess(new Function() { // callback to be run if the request success public void f() { IDomeo _domeo = ((IDomeo) _application); JsAnnotopiaAnnotationSetGraph wrapper = (JsAnnotopiaAnnotationSetGraph) parseJson( getDataProperties().toJsonString()); AnnotopiaConverter unmarshaller = new AnnotopiaConverter(_domeo); MAnnotationSet set = unmarshaller.unmarshallAnnotationSet(wrapper, true); if (set == null) { // TODO message no annotation found _application.getLogger().info(this, "No annotation set found"); _application.getProgressPanelContainer() .setCompletionMessage("Annotation Set not found"); } else { ((AnnotationPersistenceManager) _domeo.getPersistenceManager()) .loadAnnotationSet(set); _application.getProgressPanelContainer().hide(); _application.getLogger().debug(this, "Completed Execution of retrieveExistingAnnotationSets() in " + (System.currentTimeMillis() - ((IDomeo) _application).getDocumentPipelineTimer()) + "ms"); _domeo.refreshAllComponents(); } } }).setError(new Function() { // callback to be run if the request fails public void f() { _application.getLogger().exception(this, "Couldn't complete existing annotation sets list retrieval process"); _application.getProgressPanelContainer().setErrorMessage( "Couldn't complete existing annotation sets list retrieval process"); } })); } catch (Exception e) { _application.getLogger().exception(this, "Couldn't complete existing annotation sets list retrieval"); } } }