Search in sources :

Example 1 with SimpleCompoundComponent

use of com.serotonin.m2m2.gviews.component.SimpleCompoundComponent in project ma-modules-public by infiniteautomation.

the class GraphicalViewDwr method saveSimpleCompoundComponent.

@DwrPermission(user = true)
public ProcessResult saveSimpleCompoundComponent(String viewComponentId, String name, String backgroundColour, List<StringStringPair> childPointIds) {
    ProcessResult response = new ProcessResult();
    validateCompoundComponent(response, name);
    String leadPointId = null;
    for (StringStringPair kvp : childPointIds) {
        if (SimpleCompoundComponent.LEAD_POINT.equals(kvp.getKey())) {
            leadPointId = kvp.getValue();
            break;
        }
    }
    if (NumberUtils.toInt(leadPointId, 0) <= 0)
        response.addContextualMessage("compoundPointSelect" + SimpleCompoundComponent.LEAD_POINT, "dsEdit.validate.required");
    if (!response.getHasMessages()) {
        SimpleCompoundComponent c = (SimpleCompoundComponent) getViewComponent(viewComponentId);
        c.setName(name);
        c.setBackgroundColour(backgroundColour);
        saveCompoundPoints(c, childPointIds);
    }
    return response;
}
Also used : StringStringPair(com.serotonin.db.pair.StringStringPair) ProcessResult(com.serotonin.m2m2.i18n.ProcessResult) SimpleCompoundComponent(com.serotonin.m2m2.gviews.component.SimpleCompoundComponent) DwrPermission(com.serotonin.m2m2.web.dwr.util.DwrPermission)

Aggregations

StringStringPair (com.serotonin.db.pair.StringStringPair)1 SimpleCompoundComponent (com.serotonin.m2m2.gviews.component.SimpleCompoundComponent)1 ProcessResult (com.serotonin.m2m2.i18n.ProcessResult)1 DwrPermission (com.serotonin.m2m2.web.dwr.util.DwrPermission)1