jQuery issues in

Forum Home Forums Development and Integration jQuery issues in

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #14259
    ipqiusheng
    Participant

    Issues description:
    in schememodel this javascript file, it define below property, but we can’t find RenderConext() functions in scheme namespace. does anybody find that?
    this.renderContext = new scada.scheme.RenderContext();

    var scada = scada || {};
    // Scheme namespace
    scada.scheme = scada.scheme || {};

    /********** Base Component **********/

    // Abstract parent type for scheme and its components
    scada.scheme.BaseComponent = function (type) {
    // Name of the component type
    this.type = type;
    // Component properties received from a server. They are different depending on component type
    this.props = null;
    // jQuery objects representing DOM content
    this.dom = null;
    // Renderer of the component
    this.renderer = null;
    };

    /********** Scheme Loading States **********/

    // Scheme loading states enumeration
    scada.scheme.LoadStates = {
    UNDEFINED: 0,
    DOC_LOADING: 1,
    COMPONENTS_LOADING: 2,
    IMAGES_LOADING: 3,
    ERRORS_LOADING: 4,
    COMPLETE: 5
    };

    /********** Scheme **********/

    // Scheme type
    scada.scheme.Scheme = function () {
    scada.scheme.BaseComponent.call(this);
    this.renderer = new scada.scheme.SchemeRenderer();

    // Count of components received by a one request
    this.LOAD_COMP_CNT = 100;
    // Total data size of images received by a one request, 1 MB
    this.LOAD_IMG_SIZE = 1048576;
    // Timeout of command frame closing, ms
    this.CLOSE_CMD_TIMEOUT = 1000;

    // Input channel filter for request current data
    this._cnlFilter = null;

    // Indicates whether the scheme is used by an editor
    this.editMode = false;
    // Scheme environment
    this.schemeEnv = null;
    // Ajax queue used for request sequencing. Must be not null
    this.ajaxQueue = scada.ajaxQueueLocator.getAjaxQueue();
    // WCF-service URL
    this.serviceUrl = this.ajaxQueue.rootPath + “plugins/Scheme/SchemeSvc.svc/”;
    // Scheme loading state
    this.loadState = scada.scheme.LoadStates.UNDEFINED;
    // Scheme view ID
    this.viewID = 0;
    // Scheme editor ID
    this.editorID = “”;
    // Stamp of the view, unique within application scope
    this.viewStamp = 0;
    // Scheme components indexed by ID
    this.componentMap = new Map();
    // Scheme images indexed by name
    this.imageMap = new Map();
    // Scheme loading errors when it is loaded on server side
    this.loadErrors = [];
    // Render context
    this.renderContext = new scada.scheme.RenderContext();

    #14260
    ipqiusheng
    Participant

    scada.scheme.UnknownComponentRenderer = function () {
    scada.scheme.Renderer.call(this);
    };

    scada.scheme.UnknownComponentRenderer.prototype = Object.create(scada.scheme.Renderer.prototype);
    scada.scheme.UnknownComponentRenderer.constructor = scada.scheme.UnknownComponentRenderer;

    /********** Render Context **********/

    // Render context type
    scada.scheme.RenderContext = function () {
    this.curCnlDataMap = null;
    this.editMode = false;
    this.schemeEnv = null;
    this.viewID = 0;
    this.imageMap = null;
    this.controlRight = true;
    };

    have find the defination in schemerender, mark here

    #14263
    ipqiusheng
    Participant

    hi
    All Guys
    I meet some issues in schemerender.js file, it seems curCnlDataMap/imageMap are Map object, but I can’t find the inilization seems like imageMap=new map;
    scada.scheme.RenderContext = function () {
    this.curCnlDataMap = null;
    this.editMode = false;
    this.schemeEnv = null;
    this.viewID = 0;
    this.imageMap = null;
    this.controlRight = true;
    };

    #14276
    Mikhail
    Moderator

    Hi,

    RenderContext is created here.
    imageMap is initialized here.

    #14348
    ipqiusheng
    Participant

    scada.scheme.SchemeRenderer.prototype._setTitle = function (title, renderContext) {
    if (title && renderContext.schemeEnv.viewHub) {
    document.title = title + ” – ” + renderContext.schemeEnv.viewHub.getEnv().productName;

    // set title of a popup in case the scheme is in the popup
    var popup = scada.popupLocator.getPopup();
    if (popup) {
    popup.setModalTitle(window, document.title);
    }

    // send notification about title change
    renderContext.schemeEnv.viewHub.notify(scada.EventTypes.VIEW_TITLE_CHANGED, window, document.title);
    }
    };

    Hi
    Mikhail, thank you for your kind comment, how about this popupLocator, it is under scada namespace, but I can’t find that define

    #14358
    Mikhail
    Moderator

    Hi,
    I cannot find the above lines in scheme-render.js

    #14360
    ipqiusheng
    Participant

    Hi
    Mikhail
    sorry, I haven’t use version 6.0, I still look at your version 5.0 code, your code is very elegant,I still look at that, this is version 5.0 code, the popupLocator existed in schemerender.js. not sure where it is defined, but it looks like define in viewhub.js, but I can’t find that.
    https://github.com/RapidScada/scada/blob/master/ScadaWeb/ScadaScheme/PlgScheme/plugins/Scheme/js/schemerender.js

    #14362
    ipqiusheng
    Participant

    also, in basiccomprender.js, it also existed

    #14365
    ipqiusheng
    Participant

    hi
    Mikhail
    I put the link below my comments

    #14367
    ipqiusheng
    Participant

    thanks for your reply
    Mikhail, I have used github to find this popup.js in webshell project, so I can’t find that in plscheme files. just mark here for other guys if someone have interesting in your code

    #14375
    Mikhail
    Moderator

    Hi,
    The popupLocator object is declared in popup.js, which is referenced by the web pages.

    #14408
    ipqiusheng
    Participant

    Hi
    Mikhail and other guys, do you know what’s parsedData define?, it has property of ViewStamp and SchemeDoc object?
    scada.scheme.Scheme.prototype._obtainSchemeDoc = function (parsedData) {
    try {
    if (typeof parsedData.ViewStamp === “undefined”) {
    throw { message: “ViewStamp property is missing.” };
    }

    if (typeof parsedData.SchemeDoc === “undefined”) {
    throw { message: “SchemeDoc property is missing.” };
    }

    if (this._viewStampsMatched(this.viewStamp, parsedData.ViewStamp)) {
    this.type = “”;
    this.props = parsedData.SchemeDoc;
    this.viewStamp = parsedData.ViewStamp;
    return true;
    } else {
    return false;
    }
    }
    catch (ex) {
    console.error(scada.utils.getCurTime() + ” Error obtaining scheme properties:”, ex.message);
    return false;
    }
    };

    #14416
    Mikhail
    Moderator

    Hi,
    You should open the development tools in Chrome by pressing F12, set a breakpoint and check the actual data in the debugger.

    ViewStamp is a stamp provided by server code to check that the client and server view data match.
    SchemeDoc is a part of scheme object.

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.