"jquery.ui.dashboardstatustable.js"));
}
@Override
public JsStatement statement() {
Options options = new Options();
options.putLiteral("dataUrl", dataResource.getCallbackUrl().toString());
List<String> conversions = new ArrayList<String>();
List<String> htmlClasses = new ArrayList<String>();
List<String> units = new ArrayList<String>();
for (Class<? extends DataSource<?>> curDataSource : dataSources
.getObject()) {
DataSourceSettings settings = DataSourceAnnotationReader
.getSettings(curDataSource);
conversions.add(settings.conversion());
htmlClasses.add(settings.htmlClass());
units.add(settings.unit());
}
ObjectMapper mapper = new ObjectMapper();
try {
options.put("conversion", mapper.writeValueAsString(conversions));
options.put("htmlClasses", mapper.writeValueAsString(htmlClasses));
options.put("units", mapper.writeValueAsString(units));
} catch (JsonGenerationException e) {
throw new RuntimeException(e);
} catch (JsonMappingException e) {
throw new RuntimeException(e);
} catch (IOException e) {
throw new RuntimeException(e);
}
JsQuery jsq = new JsQuery(this);
return jsq.$().chain("dashboardStatusTable",
options.getJavaScriptOptions());
}