use of com.serotonin.m2m2.view.ImageSet in project ma-modules-public by infiniteautomation.
the class GraphicalViewDwr method saveAnalogGraphicComponent.
@DwrPermission(user = true)
public ProcessResult saveAnalogGraphicComponent(String viewComponentId, double min, double max, boolean displayText, String imageSetId) {
ProcessResult response = new ProcessResult();
// Validate
if (min >= max)
response.addContextualMessage("graphicRendererAnalogMin", "viewEdit.graphic.invalidMinMax");
ImageSet imageSet = getImageSet(imageSetId);
if (imageSet == null)
response.addContextualMessage("graphicRendererAnalogImageSet", "viewEdit.graphic.missingImageSet");
if (!response.getHasMessages()) {
AnalogGraphicComponent c = (AnalogGraphicComponent) getViewComponent(viewComponentId);
c.setMin(min);
c.setMax(max);
c.setDisplayText(displayText);
c.tsetImageSet(imageSet);
resetPointComponent(c);
}
return response;
}
use of com.serotonin.m2m2.view.ImageSet in project ma-modules-public by infiniteautomation.
the class GraphicalViewDwr method saveMultistateGraphicComponent.
@DwrPermission(user = true)
public ProcessResult saveMultistateGraphicComponent(String viewComponentId, List<IntStringPair> imageStates, int defaultImage, boolean displayText, String imageSetId) {
ProcessResult response = new ProcessResult();
// Validate
ImageSet imageSet = getImageSet(imageSetId);
if (imageSet == null)
response.addContextualMessage("graphicRendererMultistateImageSet", "viewEdit.graphic.missingImageSet");
if (!response.getHasMessages()) {
MultistateGraphicComponent c = (MultistateGraphicComponent) getViewComponent(viewComponentId);
c.setImageStateList(imageStates);
c.setDefaultImage(defaultImage);
c.setDisplayText(displayText);
c.tsetImageSet(imageSet);
resetPointComponent(c);
}
return response;
}
use of com.serotonin.m2m2.view.ImageSet in project ma-modules-public by infiniteautomation.
the class GraphicalViewDwr method saveBinaryGraphicComponent.
@DwrPermission(user = true)
public ProcessResult saveBinaryGraphicComponent(String viewComponentId, int zeroImage, int oneImage, boolean displayText, String imageSetId) {
ProcessResult response = new ProcessResult();
// Validate
ImageSet imageSet = getImageSet(imageSetId);
if (imageSet == null)
response.addContextualMessage("graphicRendererBinaryImageSet", "viewEdit.graphic.missingImageSet");
else {
if (zeroImage == -1)
response.addContextualMessage("graphicRendererBinaryImageSetZeroMsg", "viewEdit.graphic.missingZeroImage");
if (oneImage == -1)
response.addContextualMessage("graphicRendererBinaryImageSetOneMsg", "viewEdit.graphic.missingOneImage");
}
if (!response.getHasMessages()) {
BinaryGraphicComponent c = (BinaryGraphicComponent) getViewComponent(viewComponentId);
c.tsetImageSet(imageSet);
c.setZeroImage(zeroImage);
c.setOneImage(oneImage);
c.setDisplayText(displayText);
resetPointComponent(c);
}
return response;
}
use of com.serotonin.m2m2.view.ImageSet in project ma-modules-public by infiniteautomation.
the class ImageSetComponent method jsonRead.
@Override
public void jsonRead(JsonReader reader, JsonObject jsonObject) throws JsonException {
super.jsonRead(reader, jsonObject);
JsonValue jsonImageId = jsonObject.get("imageSet");
if (jsonImageId != null) {
String id = jsonImageId.toString();
imageSet = Common.getImageSet(id);
if (imageSet == null)
throw new TranslatableJsonException("emport.error.component.unknownImageSet", id, Common.getImageSetIds());
}
}
Aggregations