diff --git a/htdocs/WebApplicationFramework/FrameworkMain.js b/htdocs/WebApplicationFramework/FrameworkMain.js index e8a6fcee025fd5509e15594ba71a3b44fbfd0d24..f5534b69513a13d7af5cc668c8164caeb04889ec 100644 --- a/htdocs/WebApplicationFramework/FrameworkMain.js +++ b/htdocs/WebApplicationFramework/FrameworkMain.js @@ -200,9 +200,11 @@ $(document).ready(function() { } var browser = browserCheck(); - if ((browser[0].toLowerCase() == "firefox" && parseInt(browser[1].split(".")[0]) >= 38) || browser[0].toLowerCase() == "chrome") { + var not_first_run = localStorage.getItem('_not_first_run_'); + if ((not_first_run == 'true') || ((browser[0].toLowerCase() == "firefox" && parseInt(browser[1].split(".")[0]) >= 38) || browser[0].toLowerCase() == "chrome")) { start(); } else { + localStorage.setItem('_not_first_run_', 'true'); var html = '' + '<div id="UnsupportedBrowser">' + '<p>This browser is not supported: ' + browser[0] + ' ' + browser[1] + '</p>' + @@ -249,4 +251,4 @@ function WebAppBase() { }); taskList.taskOperation(); }; -} \ No newline at end of file +} diff --git a/htdocs/WebApplicationFramework/Views/View_MultipliedViewAligner.js b/htdocs/WebApplicationFramework/Views/View_MultipliedViewAligner.js index e05c64bc45efaec917d017c6c9c8aef32ce49dae..7cdad4adb7cb677532228ae9148de8f9476adcd8 100644 --- a/htdocs/WebApplicationFramework/Views/View_MultipliedViewAligner.js +++ b/htdocs/WebApplicationFramework/Views/View_MultipliedViewAligner.js @@ -19,23 +19,39 @@ function CView_MultipliedViewAligner(p_viewmodels, p_mainId, p_parentId, p_data) var v_multipliedSubviews = []; var v_alignerSize = 0; - + + var v_last_viewmodelBundle; + var v_this = this; - + /** public functions */ this.applicationCreated = function() { preprocessSubviewDescriptors(v_customData, 0); }; + this.setSelection = function(selection) { + $("#" + v_mainId + " .Aligner").removeClass("Selected"); + if (selection != undefined) + for (var i = 0; i < selection.length; ++i) + $("#" + v_mainId + "_" + selection[i] + " .Aligner").addClass("Selected"); + }; + this.refresh = function(p_fullRefresh) { if (p_fullRefresh) { - $("#" + v_parentId).empty(); - v_multipliedSubviews = []; - fullRefresh(); + var viewmodelBundle = v_dataViewmodel.getViewmodelBundle(); + if (v_last_viewmodelBundle != viewmodelBundle) + { + v_last_viewmodelBundle = viewmodelBundle; + $("#" + v_parentId).empty(); + v_multipliedSubviews = []; + fullRefresh(); + v_this.setSelection(v_dataViewmodel.getSelectionIndx()); + } } else if (ViewUtils.checkVisibility(v_conditionViewmodel, v_mainId)) { for (var i = 0; i < v_multipliedSubviews.length; ++i) { v_multipliedSubviews[i].refresh(); + v_this.setSelection(v_dataViewmodel.getSelectionIndx()); } } }; @@ -55,15 +71,14 @@ function CView_MultipliedViewAligner(p_viewmodels, p_mainId, p_parentId, p_data) } function fullRefresh() { - var viewmodelBundle = v_dataViewmodel.getViewmodelBundle(); - v_alignerSize = viewmodelBundle.length; + v_alignerSize = v_last_viewmodelBundle.length; v_customData.idsCreating = []; - for (var i = 0; i < viewmodelBundle.length; ++i) { + for (var i = 0; i < v_last_viewmodelBundle.length; ++i) { v_customData.idsCreating.push(v_mainId + "_" + i); } createAligner(); - for (var i = 0; i < viewmodelBundle.length; ++i) { - createSubviews(viewmodelBundle[i], v_customData.multipliedSubviews, [v_customData.idsCreating[i]], v_mainId + "_" + i + "_"); + for (var i = 0; i < v_last_viewmodelBundle.length; ++i) { + createSubviews(v_last_viewmodelBundle[i], v_customData.multipliedSubviews, [v_customData.idsCreating[i]], v_mainId + "_" + i + "_"); } } diff --git a/htdocs/WebApplications/CustomizableApp/ViewModels/ViewModel_FSM_SVG.js b/htdocs/WebApplications/CustomizableApp/ViewModels/ViewModel_FSM_SVG.js index 38e4af7e49580762dc5515b9c02177b557bdecae..38b88bf9f7897354bd372f9f465661bbe1de60f3 100644 --- a/htdocs/WebApplications/CustomizableApp/ViewModels/ViewModel_FSM_SVG.js +++ b/htdocs/WebApplications/CustomizableApp/ViewModels/ViewModel_FSM_SVG.js @@ -54,9 +54,18 @@ function CViewModel_FSM_SVG(p_viewmodel, p_options) { if (state != undefined) { state = state.node.val; - var activeIndx = lsvgdec.indexOf(state); - var colorindx = lsvgdec.lastIndexOf("<rect fill=\"#FEFECE\"", activeIndx); - lsvgdec = replaceAt(lsvgdec, colorindx, "<rect fill=\"#ffafaf\""); + if (state.indexOf(',') != -1) + state = state.split(','); + else + state = [state]; + + for (var i = 0; i < state.length; ++i) + if (!i || (state[i] != state[i - 1])) + { + var activeIndx = lsvgdec.indexOf(state[i]); + var colorindx = lsvgdec.lastIndexOf("<rect fill=\"#FEFECE\"", activeIndx); + lsvgdec = replaceAt(lsvgdec, colorindx, "<rect fill=\"#ffafaf\""); + } } lValues[0] = {val: lsvgdec}; } diff --git a/htdocs/WebApplications/CustomizableApp/ViewModels/ViewModel_Multiplier.js b/htdocs/WebApplications/CustomizableApp/ViewModels/ViewModel_Multiplier.js index 1ca73d4afed99e1f605ee836f01e7273bd9f2c00..4a8b21b388840304a2ede5714d43d169f86af03f 100644 --- a/htdocs/WebApplications/CustomizableApp/ViewModels/ViewModel_Multiplier.js +++ b/htdocs/WebApplications/CustomizableApp/ViewModels/ViewModel_Multiplier.js @@ -16,9 +16,10 @@ function CViewModel_Multiplier(p_viewmodel, p_options) { var v_selections = []; var v_currentBundle = []; - + var v_last_response; + var v_this = this; - + /** public functions - interface for parent */ this.setSelectionToControl = function(p_selection) { @@ -45,12 +46,20 @@ function CViewModel_Multiplier(p_viewmodel, p_options) { }; this.getViewmodelBundle = function() { + var response = v_viewmodel.getResponseElement(v_dataPaths[0]); var numberOfBundles = 0; if (response != undefined && response.list != undefined) { numberOfBundles = response.list.length; } + var vmbjson = JSON.stringify(response); + if (v_last_response != vmbjson && numberOfBundles != v_currentBundle.length) + { + v_last_response = vmbjson; + v_currentBundle = []; + } + var currentBundles = v_currentBundle.length; if (numberOfBundles < currentBundles) { while (v_currentBundle.length > numberOfBundles) { @@ -61,9 +70,16 @@ function CViewModel_Multiplier(p_viewmodel, p_options) { v_currentBundle.push(createBundle(i)); } } - + return v_currentBundle; }; + + this.getSelectionIndx = function() { + if (v_selections[0]) + return v_selections[0].selection; + else + return 0; + }; /** private functions */ @@ -158,7 +174,7 @@ CViewModel_Multiplier.getHelp = function() { }; CViewModel_Multiplier.providesInterface = function() { - return ["getViewmodelBundle"]; + return ["getViewmodelBundle", "getSelectionIndx"]; }; CViewModel_Multiplier.getCustomDataSchema = function() {