if (value == null)
result = "--";
else {
// Create the script engine.
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("js");
DataPointVO point = tgetDataPoint();
// Put the values into the engine scope.
engine.put("value", value.getValue().getObjectValue());
engine.put("htmlText", Functions.getHtmlText(point, value));
engine.put("renderedText", Functions.getRenderedText(point, value));
engine.put("time", value.getTime());
engine.put("pointComponent", this);
engine.put("point", point);
// Copy properties from the model into the engine scope.
engine.put(BaseDwr.MODEL_ATTR_EVENTS, model.get(BaseDwr.MODEL_ATTR_EVENTS));
engine.put(BaseDwr.MODEL_ATTR_HAS_UNACKED_EVENT, model.get(BaseDwr.MODEL_ATTR_HAS_UNACKED_EVENT));
engine.put(BaseDwr.MODEL_ATTR_TRANSLATIONS, model.get(BaseDwr.MODEL_ATTR_TRANSLATIONS));
// Create the script.
String evalScript = SCRIPT_PREFIX + script + SCRIPT_SUFFIX;
// Execute.
try {
Object o = engine.eval(evalScript);
if (o == null)
result = null;
else
result = o.toString();
}