Package com.serotonin.m2m2.i18n

Examples of com.serotonin.m2m2.i18n.ProcessResult


        try {
            importContext.getReader().readInto(watchList, watchListJson);

            // Now validate it. Use a new response object so we can distinguish errors in this user from other
            // errors.
            ProcessResult watchListResponse = new ProcessResult();
            watchList.validate(watchListResponse);
            if (watchListResponse.getHasMessages())
                // Too bad. Copy the errors into the actual response.
                importContext.copyValidationMessages(watchListResponse, "emport.watchList.prefix", xid);
            else {
                // Sweet. Save it.
                boolean isnew = watchList.getId() == Common.NEW_ID;
View Full Code Here


    }

    @DwrPermission(user = true)
    public ProcessResult setPointComponentSettings(String pointComponentId, int dataPointId, String name,
            boolean settable, String bkgdColorOverride, boolean displayControls, int x, int y) {
        ProcessResult response = new ProcessResult();
        PointComponent pc = (PointComponent) getViewComponent(pointComponentId);
        User user = Common.getUser();

        DataPointVO dp = new DataPointDao().getDataPoint(dataPointId);
        if (dp == null || !Permissions.hasDataPointReadPermission(user, dp))
            response.addContextualMessage("settingsPointInfo", "validate.required");

        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.setDisplayControls(displayControls);
            pc.setLocation(x, y);

            pc.validateDataPoint(user, false);

            response.addData("x", x);
            response.addData("y", y);
        }

        return response;
    }
View Full Code Here

    }

    @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);
View Full Code Here

    }

    @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);
View Full Code Here

    }

    @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);
View Full Code Here

    }

    @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);
View Full Code Here

        return response;
    }

    @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);
        }
View Full Code Here

        SimplePointComponent c = (SimplePointComponent) getViewComponent(viewComponentId);
        c.setDisplayPointName(displayPointName);
        c.setStyleAttribute(styleAttribute);
        resetPointComponent(c);

        return new ProcessResult();
    }
View Full Code Here

        return new ProcessResult();
    }

    @DwrPermission(user = true)
    public ProcessResult saveThumbnailComponent(String viewComponentId, int scalePercent) {
        ProcessResult response = new ProcessResult();

        // Validate
        if (scalePercent < 1)
            response.addContextualMessage("graphicRendererThumbnailScalePercent", "viewEdit.graphic.invalidScale");

        if (!response.getHasMessages()) {
            ThumbnailComponent c = (ThumbnailComponent) getViewComponent(viewComponentId);
            c.setScalePercent(scalePercent);
            resetPointComponent(c);
        }
View Full Code Here

    }

    @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);
        }
View Full Code Here

TOP

Related Classes of com.serotonin.m2m2.i18n.ProcessResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.