Commit 5e9f7a17 authored by maxchaza's avatar maxchaza
Browse files

Merge branch 'hotfix/initNetwork'

parents 2e2c6914 2c2be1f0
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
/** /**
* The version of the application. * The version of the application.
*/ */
"version": "3.0.8", "version": "3.0.9",
/** /**
* The relative path to the application's markup file (html, jsp, asp, etc.). * The relative path to the application's markup file (html, jsp, asp, etc.).
......
...@@ -22,7 +22,7 @@ Ext.define('metExploreViz.view.button.buttonImportMapping.ButtonImportMappingCon ...@@ -22,7 +22,7 @@ Ext.define('metExploreViz.view.button.buttonImportMapping.ButtonImportMappingCon
view.on({ view.on({
reloadMapping:function(){ reloadMapping:function(){
view.reset(); me.resetCondition();
}, },
jsonmapping : function(mappingJSON){ jsonmapping : function(mappingJSON){
me.addConditions(mappingJSON); me.addConditions(mappingJSON);
...@@ -110,11 +110,23 @@ Ext.define('metExploreViz.view.button.buttonImportMapping.ButtonImportMappingCon ...@@ -110,11 +110,23 @@ Ext.define('metExploreViz.view.button.buttonImportMapping.ButtonImportMappingCon
} }
else else
newConditions.push(mapping.getName()); newConditions.push(mapping.getName());
newConditions newConditions
.filter(function(cond){ .filter(function(cond){
return !(cond.includes("PathwayEnrichment") || cond.includes("PathwayCoverage")) return !(cond.includes("PathwayEnrichment") || cond.includes("PathwayCoverage"))
}) })
.forEach(function (value) { conditionStore.add({name: value, type: 'int', biologicalType: biologicalType}); }); .forEach(function (value) {
if(conditionStore.find("name", value)===-1)
conditionStore.add({name: value, type: 'int', biologicalType: biologicalType});
});
},
/*****************************************************
* Fill condition store store
* @param mapping : Mapping object
*/
resetCondition : function() {
var conditionStore = Ext.getStore("conditionStore");
conditionStore.loadData([], false);
} }
}); });
...@@ -461,8 +461,8 @@ Ext.define('metExploreViz.view.form.aStyleForm.AStyleFormController', { ...@@ -461,8 +461,8 @@ Ext.define('metExploreViz.view.form.aStyleForm.AStyleFormController', {
val = parseFloat(text); val = parseFloat(text);
metExploreD3.GraphStyleEdition.setCollectionStyle(view.target, view.attrType, view.attrName, view.biologicalType, val); metExploreD3.GraphStyleEdition.setCollectionStyle(view.target, view.attrType, view.attrName, view.biologicalType, val);
styleToUse[view.access]=val; styleToUse[view.access] = val;
view.default = parseInt(val); view.default = val;
}); });
}, },
scope : me scope : me
......
...@@ -15,6 +15,11 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', { ...@@ -15,6 +15,11 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
viewModel = me.getViewModel(), viewModel = me.getViewModel(),
view = me.getView(); view = me.getView();
view.on({
refreshAllStyles : this.reloadAllScales,
scope:me
});
view.query("allStylesByTypeForm").forEach(function (allStylesByTypeForm) { view.query("allStylesByTypeForm").forEach(function (allStylesByTypeForm) {
allStylesByTypeForm.lookupReference('saveAllScales') allStylesByTypeForm.lookupReference('saveAllScales')
.on({ .on({
...@@ -167,7 +172,6 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', { ...@@ -167,7 +172,6 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
} }
} }
console.log('--------------------------------------------------');
}); });
view.query("allStylesByTypeForm") view.query("allStylesByTypeForm")
...@@ -182,5 +186,65 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', { ...@@ -182,5 +186,65 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
}); });
},
reloadAllScales:function () {
var me = this,
viewModel = me.getViewModel(),
view = me.getView();
var allScales = [];
view.query("allStylesByTypeForm").forEach(function (allStylesByTypeForm) {
var partOfAllScales = allStylesByTypeForm.query("aStyleForm")
.forEach(function (scale) {
var form = Ext.getCmp(scale.biologicalType+"StyleForm");
if(form){
var theStyleForm = form.query("aStyleForm").find(function (aStyleForm) { return aStyleForm.title===scale.title;});
if(theStyleForm){
var selectConditionForm = theStyleForm.lookupReference('selectConditionForm');
var selectCondition = selectConditionForm.lookupReference('selectCondition');
var selectConditionType = selectConditionForm.lookupReference('selectConditionType');
var dataType = selectConditionType.getValue();
var selectedCondition = selectCondition.getValue();
if (scale.scaleRange){
if(dataType==="Continuous" && selectedCondition!==null){
selectConditionForm.getController().map(true, true, theStyleForm);
}
}
if (scale.valueDiscreteMappings){
if(dataType==="Discrete" && selectedCondition!==null){
selectConditionForm.getController().map(true, true, theStyleForm);
}
}
if (scale.valueAsSelectionMappings){
if(dataType==="As selection" && selectedCondition!==null){
selectConditionForm.getController().map(true, true, theStyleForm);
}
}
if (scale.valueAliasMappings){
if(dataType==="Alias" && selectedCondition!==null){
selectConditionForm.getController().map(true, true, theStyleForm);
}
}
}
}
});
});
/*
view.query("allStylesByTypeForm")
.forEach(function (allStylesByTypeForm) {
allStylesByTypeForm.query("aStyleForm")
.forEach(function (aStyleForm) {
if (aStyleForm.scaleRange)
aStyleForm.getController().updateContinuousCaption();
})
});
*/
} }
}); });
\ No newline at end of file
...@@ -478,13 +478,11 @@ Ext.define('metExploreViz.view.form.captionForm.CaptionFormController', { ...@@ -478,13 +478,11 @@ Ext.define('metExploreViz.view.form.captionForm.CaptionFormController', {
} }
var anim = session.isAnimated("viz"); var anim = session.isAnimated("viz");
if (anim == 'true') { if (anim) {
var session = _metExploreViz.getSessionById('viz'); var session = _metExploreViz.getSessionById('viz');
var force = session.getForce(); var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) { force.alpha(force.alpha()).restart();
force.alpha(1).restart();
}
} }
} }
catch (e) { catch (e) {
...@@ -493,13 +491,11 @@ Ext.define('metExploreViz.view.form.captionForm.CaptionFormController', { ...@@ -493,13 +491,11 @@ Ext.define('metExploreViz.view.form.captionForm.CaptionFormController', {
metExploreD3.hideMask(myMask); metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz"); var anim=session.isAnimated("viz");
if (anim=='true') { if (anim=== true) {
var session = _metExploreViz.getSessionById('viz'); var session = _metExploreViz.getSessionById('viz');
var force = session.getForce(); var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) { force.alpha(force.alpha()).restart();
force.alpha(1).restart();
}
} }
throw e; throw e;
} }
......
...@@ -51,10 +51,6 @@ Ext.define('metExploreViz.view.form.continuousNumberMappingEditor.ContinuousNumb ...@@ -51,10 +51,6 @@ Ext.define('metExploreViz.view.form.continuousNumberMappingEditor.ContinuousNumb
view.lookupReference('textfieldValue').on({ view.lookupReference('textfieldValue').on({
focusleave : function(that){ focusleave : function(that){
console.log(me);
console.log(view);
var value =parseFloat(that.getRawValue()); var value =parseFloat(that.getRawValue());
if(value==="< min" || value==="> max") if(value==="< min" || value==="> max")
......
...@@ -43,56 +43,58 @@ Ext.define('metExploreViz.view.form.linkStyleForm.LinkStyleForm', { ...@@ -43,56 +43,58 @@ Ext.define('metExploreViz.view.form.linkStyleForm.LinkStyleForm', {
"default": 1, "default": 1,
"min": 0, "min": 0,
"max": 1 "max": 1
}, }
// ,
// { // {
// "type": "text", // "type": "text",
// "attr": "text", // "attr": "text",
// "title": "Label" // "title": "Label"
// }, // },
{ // {
"type": "color", // "type": "color",
"biologicalType":"link", // "biologicalType":"link",
"target": ["text.link"], // "target": ["text.link"],
"attrType": "style", // "attrType": "style",
"access":"fontColor", // "access":"fontColor",
"attr": "fill", // "attr": "fill",
"title": "Label color", // "title": "Label color",
"min": "#ff0000", // "min": "#ff0000",
"max": "#00ffff", // "max": "#00ffff",
"default": "#000000" // "default": "#000000"
}, { // }, {
"type": "int", // "type": "int",
"target": ["text.link"], // "target": ["text.link"],
"attrType": "style", // "attrType": "style",
"attr": "font-size", // "attr": "font-size",
"access":"fontSize", // "access":"fontSize",
"biologicalType":"link", // "biologicalType":"link",
"title": "Label font size", // "title": "Label font size",
"min": 1, // "min": 1,
"max": 200, // "max": 200,
"default": 20 // "default": 20
}, { // }, {
"type": "int", // "type": "int",
"target": ["text.link"], // "target": ["text.link"],
"attrType": "style", // "attrType": "style",
"attr": "font-weight", // "attr": "font-weight",
"access": "fontWeight", // "access": "fontWeight",
"biologicalType":"link", // "biologicalType":"link",
"title": "Label font weight", // "title": "Label font weight",
"min": 100, // "min": 100,
"max": 1000, // "max": 1000,
"default": 500 // "default": 500
}, { // }, {
"type": "float", // "type": "float",
"target": ["text.link"], // "target": ["text.link"],
"attrType": "style", // "attrType": "style",
"access":"labelOpacity", // "access":"labelOpacity",
"attr": "opacity", // "attr": "opacity",
"title": "Label transparency", // "title": "Label transparency",
"min": 0.0, // "min": 0.0,
"biologicalType":"link", // "biologicalType":"link",
"max": 1.0, // "max": 1.0,
"default": 1.0 // "default": 1.0
}] // }
]
} }
}); });
...@@ -544,7 +544,8 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr ...@@ -544,7 +544,8 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr
* @param fluxType : string, one or two arrows for fluxes * @param fluxType : string, one or two arrows for fluxes
*/ */
graphMapping : function(dataType, conditionName, parentAStyleForm) { graphMapping : function(dataType, conditionName, parentAStyleForm) {
var session = _metExploreViz.getSessionById('viz');
var session = _metExploreViz.getSessionById('viz');
if(dataType==="Continuous"){ if(dataType==="Continuous"){
metExploreD3.GraphMapping.graphMappingContinuousData(conditionName, parentAStyleForm); metExploreD3.GraphMapping.graphMappingContinuousData(conditionName, parentAStyleForm);
...@@ -566,6 +567,8 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr ...@@ -566,6 +567,8 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr
metExploreD3.GraphMapping.graphMappingDiscreteData(conditionName, parentAStyleForm); metExploreD3.GraphMapping.graphMappingDiscreteData(conditionName, parentAStyleForm);
} }
if(dataType==="As selection"){ if(dataType==="As selection"){
session.setMappingDataType(dataType); session.setMappingDataType(dataType);
metExploreD3.GraphMapping.graphMappingAsSelectionData(conditionName, parentAStyleForm); metExploreD3.GraphMapping.graphMappingAsSelectionData(conditionName, parentAStyleForm);
...@@ -597,7 +600,8 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr ...@@ -597,7 +600,8 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr
var aStyleFormParent = me.getAStyleFormParent(); var aStyleFormParent = me.getAStyleFormParent();
if(type!=="suggestion"){ if(type!=="suggestion"){
networkVizSession.setMapped(selectedCondition); networkVizSession.setMapped(selectedCondition);
colorStore = aStyleFormParent.getController().getValueMappingsSet(networkVizSession.getMappingDataType());
colorStore = aStyleFormParent.getController().getValueMappingsSet(dataType);
} }
else { else {
......
...@@ -16,6 +16,9 @@ Ext.define('metExploreViz.view.form.selectMapping.SelectMappingController', { ...@@ -16,6 +16,9 @@ Ext.define('metExploreViz.view.form.selectMapping.SelectMappingController', {
view = me.getView(); view = me.getView();
view.on({ view.on({
reloadMapping:function(){
me.resetMapping();
},
jsonmapping : function(mappingJSON){ jsonmapping : function(mappingJSON){
me.initMapping(mappingJSON); me.initMapping(mappingJSON);
}, },
...@@ -23,6 +26,15 @@ Ext.define('metExploreViz.view.form.selectMapping.SelectMappingController', { ...@@ -23,6 +26,15 @@ Ext.define('metExploreViz.view.form.selectMapping.SelectMappingController', {
}); });
}, },
/*****************************************************
* Fill condition store store
* @param mapping : Mapping object
*/
resetMapping : function() {
var store = Ext.getStore("mappingStore");
store.loadData([], false);
},
initMapping:function(mappingJSON){ initMapping:function(mappingJSON){
var me = this, var me = this,
view = me.getView(); view = me.getView();
...@@ -36,7 +48,8 @@ Ext.define('metExploreViz.view.form.selectMapping.SelectMappingController', { ...@@ -36,7 +48,8 @@ Ext.define('metExploreViz.view.form.selectMapping.SelectMappingController', {
var store = Ext.getStore("mappingStore"); var store = Ext.getStore("mappingStore");
store.add({name: mappingJSON.getName()}); if(store.find("name", mappingJSON.getName())===-1)
store.add({name: mappingJSON.getName()});
// //
// //take an array to store the object that we will get from the ajax response // //take an array to store the object that we will get from the ajax response
// var records = []; // var records = [];
......
...@@ -19,7 +19,6 @@ Ext.define('metExploreViz.view.form.selectMappingForExtraction.SelectMappingForE ...@@ -19,7 +19,6 @@ Ext.define('metExploreViz.view.form.selectMappingForExtraction.SelectMappingForE
show : function(that){ show : function(that){
var store = Ext.getStore("mappingStore"); var store = Ext.getStore("mappingStore");
store.filter(function (mapping) { store.filter(function (mapping) {
console.log(mapping.get("name"));
return mapping.get("name")!=="None"; return mapping.get("name")!=="None";
}) })
}, },
......
...@@ -34,7 +34,8 @@ d3.selection.prototype.attrEditor = function(attr, val) { ...@@ -34,7 +34,8 @@ d3.selection.prototype.attrEditor = function(attr, val) {
* @param stroke * @param stroke
* @param strokewidth * @param strokewidth
*/ */
d3.selection.prototype.addNodeForm = function(width, height, rx, ry, stroke, strokewidth) { d3.selection.prototype.addNodeForm = function(width, height, rx, ry, stroke, strokewidth, backgroundColor, transparency) {
this.append("rect") this.append("rect")
.attr("class", function(d) { return d.getBiologicalType(); }) .attr("class", function(d) { return d.getBiologicalType(); })
.attr("id", function(d) { return d.getId(); }) .attr("id", function(d) { return d.getId(); })
...@@ -47,7 +48,9 @@ d3.selection.prototype.addNodeForm = function(width, height, rx, ry, stroke, str ...@@ -47,7 +48,9 @@ d3.selection.prototype.addNodeForm = function(width, height, rx, ry, stroke, str
+ height/2 + height/2
+ ")") + ")")
.style("stroke", stroke) .style("stroke", stroke)
.style("stroke-width", strokewidth); .style("stroke-width", strokewidth)
.style("fill", backgroundColor)
.style("opacity", transparency);
this.append("rect").attr("class","fontSelected") this.append("rect").attr("class","fontSelected")
.attr("width", function(d) { return d.getSvgWidth(); }) .attr("width", function(d) { return d.getSvgWidth(); })
...@@ -56,7 +59,8 @@ d3.selection.prototype.addNodeForm = function(width, height, rx, ry, stroke, str ...@@ -56,7 +59,8 @@ d3.selection.prototype.addNodeForm = function(width, height, rx, ry, stroke, str
.attr("ry", ry) .attr("ry", ry)
.attr( "transform", "translate(-" + width/2 + ",-" + height/2 + ")") .attr( "transform", "translate(-" + width/2 + ",-" + height/2 + ")")
.style("fill-opacity", '0') .style("fill-opacity", '0')
.style("fill", '#000'); .style("fill", "#000")
.style("opacity", transparency);
}; };
/**************************************** /****************************************
...@@ -101,14 +105,21 @@ d3.selection.prototype.addNodeText = function(style) { ...@@ -101,14 +105,21 @@ d3.selection.prototype.addNodeText = function(style) {
// Listening font-size attribute tu update tspan dy attr similarly // Listening font-size attribute tu update tspan dy attr similarly
var observer = new MutationObserver(function(mutations) { var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) { mutations.forEach(function(mutation) {
if (mutation.type == "attributes" && mutation.oldValue) { if (mutation.type == "attributes") {
if(mutation.target.style["font-size"]!==mutation.oldValue.split("font-size: ")[1].split(";")[0]){ if(mutation.oldValue){
d3.select(mutation.target).selectAll("tspan") if(mutation.oldValue.split("font-size: ")[1]){
.each(function (ts, i) { if(mutation.target.style["font-size"]!==mutation.oldValue.split("font-size: ")[1].split(";")[0]){
if (i > 0){ d3.select(mutation.target).selectAll("tspan")
d3.select(this).attr('dy', mutation.target.style["font-size"]); .each(function (ts, i) {
} if (i > 0){
}); if(mutation.target.style["font-size"])
d3.select(this).attr('dy', mutation.target.style["font-size"]);
else d3.select(this).attr('dy', style.getFontSize());
}
});
}
}
} }
} }
}); });
...@@ -116,7 +127,7 @@ d3.selection.prototype.addNodeText = function(style) { ...@@ -116,7 +127,7 @@ d3.selection.prototype.addNodeText = function(style) {
this this
.append("svg:text") .append("svg:text")
.attr("fill", "#000000") .attr("fill", style.getFontColor())
.attr("class", function(d) { return d.getBiologicalType(); }) .attr("class", function(d) { return d.getBiologicalType(); })
.each(function(d) { .each(function(d) {
...@@ -150,11 +161,10 @@ d3.selection.prototype.addNodeText = function(style) { ...@@ -150,11 +161,10 @@ d3.selection.prototype.addNodeText = function(style) {
if (i > 0){ if (i > 0){
tspan.attr('dy', '10'); tspan.attr('dy', style.getFontSize());
} }
} }
}) })
.style("font-size",style.getFontSize())
.style("paint-order","stroke") .style("paint-order","stroke")
.style("stroke-width", 1) .style("stroke-width", 1)
.style("stroke", "white") .style("stroke", "white")
...@@ -164,11 +174,11 @@ d3.selection.prototype.addNodeText = function(style) { ...@@ -164,11 +174,11 @@ d3.selection.prototype.addNodeText = function(style) {
.style("pointer-events", 'none') .style("pointer-events", 'none')
.style("text-anchor", 'middle') .style("text-anchor", 'middle')