This is a simple demonstration of integrating a GI user interface with Reverse Ajax. Data from DWR is published into GI with DWR's GI integration.
The stock data above is static for a dynamic version see the Reverse Ajax example.
The HTML includes a div which loads a GI component
<div style="width:100%; height:220px;">
<script
type="text/javascript"
src="JSX/js/JSX30.js"
jsxapppath="JSXAPPS/gidemo" jsxlt="true"> </script>
</div>
This causes GI to render the Matrix component from config.xml and the component declaration: appCanvas.xml. So far this is identical to the Reverse Ajax / OpenAjax Hub example.
Once these are loaded, the init function is called by GI:
function giLoaded() {
Corporations.getCorporations(function(corporations) {
var cdf = dwr.gi.toCdfDocument(countries);
giApp.getCache().setDocument("corporations", corporations);
giApp.getJSXByName('matrix').repaint();
});
}
This uses a Java method remoted by DWR - Countries.getCountries()
and a DWR/GI utility method dwr.gi.toCdfDocument() to convert
Javascript data into a GI CDF Document. We then insert this data into the
data cache, and tell the matrix component to repaint itself.