use of com.serotonin.m2m2.view.DynamicImage in project ma-modules-public by infiniteautomation.
the class GraphicalViewDwr method saveDynamicGraphicComponent.
@DwrPermission(user = true)
public ProcessResult saveDynamicGraphicComponent(String viewComponentId, double min, double max, boolean displayText, String dynamicImageId) {
ProcessResult response = new ProcessResult();
// Validate
if (min >= max)
response.addContextualMessage("graphicRendererDynamicMin", "viewEdit.graphic.invalidMinMax");
DynamicImage dynamicImage = getDynamicImage(dynamicImageId);
if (dynamicImage == null)
response.addContextualMessage("graphicRendererDynamicImage", "viewEdit.graphic.missingDynamicImage");
if (!response.getHasMessages()) {
DynamicGraphicComponent c = (DynamicGraphicComponent) getViewComponent(viewComponentId);
c.setMin(min);
c.setMax(max);
c.setDisplayText(displayText);
c.tsetDynamicImage(dynamicImage);
resetPointComponent(c);
}
return response;
}
use of com.serotonin.m2m2.view.DynamicImage in project ma-modules-public by infiniteautomation.
the class DynamicGraphicComponent method jsonRead.
@Override
public void jsonRead(JsonReader reader, JsonObject jsonObject) throws JsonException {
super.jsonRead(reader, jsonObject);
JsonValue jsonImageId = jsonObject.get("dynamicImage");
if (jsonImageId != null) {
String id = jsonImageId.toString();
dynamicImage = Common.getDynamicImage(id);
if (dynamicImage == null)
throw new TranslatableJsonException("emport.error.component.unknownDynamicImage", id, Common.getDynamicImageIds());
}
}
Aggregations