Search in sources :

Example 1 with BinaryGraphicComponent

use of com.serotonin.m2m2.gviews.component.BinaryGraphicComponent 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;
}
Also used : BinaryGraphicComponent(com.serotonin.m2m2.gviews.component.BinaryGraphicComponent) ProcessResult(com.serotonin.m2m2.i18n.ProcessResult) ImageSet(com.serotonin.m2m2.view.ImageSet) DwrPermission(com.serotonin.m2m2.web.dwr.util.DwrPermission)

Aggregations

BinaryGraphicComponent (com.serotonin.m2m2.gviews.component.BinaryGraphicComponent)1 ProcessResult (com.serotonin.m2m2.i18n.ProcessResult)1 ImageSet (com.serotonin.m2m2.view.ImageSet)1 DwrPermission (com.serotonin.m2m2.web.dwr.util.DwrPermission)1