use of com.serotonin.m2m2.web.dwr.util.DwrPermission 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.web.dwr.util.DwrPermission 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.web.dwr.util.DwrPermission in project ma-modules-public by infiniteautomation.
the class GraphicalViewDwr method setPointComponentSettings.
@DwrPermission(user = true)
public ProcessResult setPointComponentSettings(String pointComponentId, int dataPointId, String name, boolean settable, String bkgdColorOverride, int updatePeriodType, int updatePeriods, boolean displayControls, int x, int y) {
ProcessResult response = new ProcessResult();
PointComponent pc = (PointComponent) getViewComponent(pointComponentId);
User user = Common.getUser();
DataPointVO dp = DataPointDao.instance.getDataPoint(dataPointId);
if (dp == null || !Permissions.hasDataPointReadPermission(user, dp))
response.addContextualMessage("settingsPointInfo", "validate.required");
if (!Common.TIME_PERIOD_CODES.isValidId(updatePeriodType))
response.addContextualMessage("settingsUpdatePeriodType", "validate.invalidValue");
if (updatePeriods < 0)
response.addContextualMessage("settingsUpdatePeriods", "validate.cannotBeNegative");
if (x < 0)
response.addContextualMessage("settingsX", "validate.cannotBeNegative");
if (y < 0)
response.addContextualMessage("settingsY", "validate.cannotBeNegative");
if (!response.getHasMessages()) {
pc.tsetDataPoint(dp);
pc.setNameOverride(name);
pc.setSettableOverride(settable && Permissions.hasDataPointSetPermission(user, dp));
pc.setBkgdColorOverride(bkgdColorOverride);
pc.setUpdatePeriodType(updatePeriodType);
pc.setUpdatePeriods(updatePeriods);
pc.setDisplayControls(displayControls);
pc.setLocation(x, y);
pc.validateDataPoint(user, false);
response.addData("x", x);
response.addData("y", y);
}
return response;
}
use of com.serotonin.m2m2.web.dwr.util.DwrPermission in project ma-modules-public by infiniteautomation.
the class GraphicalViewDwr method saveScriptComponent.
@DwrPermission(user = true)
public ProcessResult saveScriptComponent(String viewComponentId, String script) {
ProcessResult response = new ProcessResult();
// Validate
if (StringUtils.isBlank(script))
response.addContextualMessage("graphicRendererScriptScript", "viewEdit.graphic.missingScript");
if (!response.getHasMessages()) {
ScriptComponent c = (ScriptComponent) getViewComponent(viewComponentId);
c.setScript(script);
resetPointComponent(c);
}
return response;
}
use of com.serotonin.m2m2.web.dwr.util.DwrPermission in project ma-modules-public by infiniteautomation.
the class GraphicalViewDwr method saveSimplePointComponent.
@DwrPermission(user = true)
public ProcessResult saveSimplePointComponent(String viewComponentId, boolean displayPointName, String styleAttribute) {
SimplePointComponent c = (SimplePointComponent) getViewComponent(viewComponentId);
c.setDisplayPointName(displayPointName);
c.setStyleAttribute(styleAttribute);
resetPointComponent(c);
return new ProcessResult();
}
Aggregations