...
 
Commits (5)
......@@ -7,7 +7,7 @@
/**
* 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.).
......
......@@ -22,7 +22,7 @@ Ext.define('metExploreViz.view.button.buttonImportMapping.ButtonImportMappingCon
view.on({
reloadMapping:function(){
view.reset();
me.resetCondition();
},
jsonmapping : function(mappingJSON){
me.addConditions(mappingJSON);
......@@ -110,11 +110,23 @@ Ext.define('metExploreViz.view.button.buttonImportMapping.ButtonImportMappingCon
}
else
newConditions.push(mapping.getName());
newConditions
.filter(function(cond){
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', {
val = parseFloat(text);
metExploreD3.GraphStyleEdition.setCollectionStyle(view.target, view.attrType, view.attrName, view.biologicalType, val);
styleToUse[view.access]=val;
view.default = parseInt(val);
styleToUse[view.access] = val;
view.default = val;
});
},
scope : me
......
......@@ -15,6 +15,11 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
viewModel = me.getViewModel(),
view = me.getView();
view.on({
refreshAllStyles : this.reloadAllScales,
scope:me
});
view.query("allStylesByTypeForm").forEach(function (allStylesByTypeForm) {
allStylesByTypeForm.lookupReference('saveAllScales')
.on({
......@@ -167,7 +172,6 @@ Ext.define('metExploreViz.view.form.allStylesForm.AllStylesFormController', {
}
}
console.log('--------------------------------------------------');
});
view.query("allStylesByTypeForm")
......@@ -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', {
}
var anim = session.isAnimated("viz");
if (anim == 'true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
catch (e) {
......@@ -493,13 +491,11 @@ Ext.define('metExploreViz.view.form.captionForm.CaptionFormController', {
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim=== true) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
throw e;
}
......
......@@ -51,10 +51,6 @@ Ext.define('metExploreViz.view.form.continuousNumberMappingEditor.ContinuousNumb
view.lookupReference('textfieldValue').on({
focusleave : function(that){
console.log(me);
console.log(view);
var value =parseFloat(that.getRawValue());
if(value==="< min" || value==="> max")
......
......@@ -43,56 +43,58 @@ Ext.define('metExploreViz.view.form.linkStyleForm.LinkStyleForm', {
"default": 1,
"min": 0,
"max": 1
},
}
// ,
// {
// "type": "text",
// "attr": "text",
// "title": "Label"
// },
{
"type": "color",
"biologicalType":"link",
"target": ["text.link"],
"attrType": "style",
"access":"fontColor",
"attr": "fill",
"title": "Label color",
"min": "#ff0000",
"max": "#00ffff",
"default": "#000000"
}, {
"type": "int",
"target": ["text.link"],
"attrType": "style",
"attr": "font-size",
"access":"fontSize",
"biologicalType":"link",
"title": "Label font size",
"min": 1,
"max": 200,
"default": 20
}, {
"type": "int",
"target": ["text.link"],
"attrType": "style",
"attr": "font-weight",
"access": "fontWeight",
"biologicalType":"link",
"title": "Label font weight",
"min": 100,
"max": 1000,
"default": 500
}, {
"type": "float",
"target": ["text.link"],
"attrType": "style",
"access":"labelOpacity",
"attr": "opacity",
"title": "Label transparency",
"min": 0.0,
"biologicalType":"link",
"max": 1.0,
"default": 1.0
}]
// {
// "type": "color",
// "biologicalType":"link",
// "target": ["text.link"],
// "attrType": "style",
// "access":"fontColor",
// "attr": "fill",
// "title": "Label color",
// "min": "#ff0000",
// "max": "#00ffff",
// "default": "#000000"
// }, {
// "type": "int",
// "target": ["text.link"],
// "attrType": "style",
// "attr": "font-size",
// "access":"fontSize",
// "biologicalType":"link",
// "title": "Label font size",
// "min": 1,
// "max": 200,
// "default": 20
// }, {
// "type": "int",
// "target": ["text.link"],
// "attrType": "style",
// "attr": "font-weight",
// "access": "fontWeight",
// "biologicalType":"link",
// "title": "Label font weight",
// "min": 100,
// "max": 1000,
// "default": 500
// }, {
// "type": "float",
// "target": ["text.link"],
// "attrType": "style",
// "access":"labelOpacity",
// "attr": "opacity",
// "title": "Label transparency",
// "min": 0.0,
// "biologicalType":"link",
// "max": 1.0,
// "default": 1.0
// }
]
}
});
......@@ -544,7 +544,8 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr
* @param fluxType : string, one or two arrows for fluxes
*/
graphMapping : function(dataType, conditionName, parentAStyleForm) {
var session = _metExploreViz.getSessionById('viz');
var session = _metExploreViz.getSessionById('viz');
if(dataType==="Continuous"){
metExploreD3.GraphMapping.graphMappingContinuousData(conditionName, parentAStyleForm);
......@@ -566,6 +567,8 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr
metExploreD3.GraphMapping.graphMappingDiscreteData(conditionName, parentAStyleForm);
}
if(dataType==="As selection"){
session.setMappingDataType(dataType);
metExploreD3.GraphMapping.graphMappingAsSelectionData(conditionName, parentAStyleForm);
......@@ -597,7 +600,8 @@ Ext.define('metExploreViz.view.form.selectConditionForm.SelectConditionFormContr
var aStyleFormParent = me.getAStyleFormParent();
if(type!=="suggestion"){
networkVizSession.setMapped(selectedCondition);
colorStore = aStyleFormParent.getController().getValueMappingsSet(networkVizSession.getMappingDataType());
colorStore = aStyleFormParent.getController().getValueMappingsSet(dataType);
}
else {
......
......@@ -16,6 +16,9 @@ Ext.define('metExploreViz.view.form.selectMapping.SelectMappingController', {
view = me.getView();
view.on({
reloadMapping:function(){
me.resetMapping();
},
jsonmapping : function(mappingJSON){
me.initMapping(mappingJSON);
},
......@@ -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){
var me = this,
view = me.getView();
......@@ -36,7 +48,8 @@ Ext.define('metExploreViz.view.form.selectMapping.SelectMappingController', {
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
// var records = [];
......
......@@ -19,7 +19,6 @@ Ext.define('metExploreViz.view.form.selectMappingForExtraction.SelectMappingForE
show : function(that){
var store = Ext.getStore("mappingStore");
store.filter(function (mapping) {
console.log(mapping.get("name"));
return mapping.get("name")!=="None";
})
},
......
......@@ -34,7 +34,8 @@ d3.selection.prototype.attrEditor = function(attr, val) {
* @param stroke
* @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")
.attr("class", function(d) { return d.getBiologicalType(); })
.attr("id", function(d) { return d.getId(); })
......@@ -47,7 +48,9 @@ d3.selection.prototype.addNodeForm = function(width, height, rx, ry, stroke, str
+ height/2
+ ")")
.style("stroke", stroke)
.style("stroke-width", strokewidth);
.style("stroke-width", strokewidth)
.style("fill", backgroundColor)
.style("opacity", transparency);
this.append("rect").attr("class","fontSelected")
.attr("width", function(d) { return d.getSvgWidth(); })
......@@ -56,7 +59,8 @@ d3.selection.prototype.addNodeForm = function(width, height, rx, ry, stroke, str
.attr("ry", ry)
.attr( "transform", "translate(-" + width/2 + ",-" + height/2 + ")")
.style("fill-opacity", '0')
.style("fill", '#000');
.style("fill", "#000")
.style("opacity", transparency);
};
/****************************************
......@@ -101,14 +105,21 @@ d3.selection.prototype.addNodeText = function(style) {
// Listening font-size attribute tu update tspan dy attr similarly
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
if (mutation.type == "attributes" && mutation.oldValue) {
if(mutation.target.style["font-size"]!==mutation.oldValue.split("font-size: ")[1].split(";")[0]){
d3.select(mutation.target).selectAll("tspan")
.each(function (ts, i) {
if (i > 0){
d3.select(this).attr('dy', mutation.target.style["font-size"]);
}
});
if (mutation.type == "attributes") {
if(mutation.oldValue){
if(mutation.oldValue.split("font-size: ")[1]){
if(mutation.target.style["font-size"]!==mutation.oldValue.split("font-size: ")[1].split(";")[0]){
d3.select(mutation.target).selectAll("tspan")
.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) {
this
.append("svg:text")
.attr("fill", "#000000")
.attr("fill", style.getFontColor())
.attr("class", function(d) { return d.getBiologicalType(); })
.each(function(d) {
......@@ -150,11 +161,10 @@ d3.selection.prototype.addNodeText = function(style) {
if (i > 0){
tspan.attr('dy', '10');
tspan.attr('dy', style.getFontSize());
}
}
})
.style("font-size",style.getFontSize())
.style("paint-order","stroke")
.style("stroke-width", 1)
.style("stroke", "white")
......@@ -164,11 +174,11 @@ d3.selection.prototype.addNodeText = function(style) {
.style("pointer-events", 'none')
.style("text-anchor", 'middle')
.style("font-family",function(node) { if (node.labelFont) if (node.labelFont.font) return node.labelFont.font; })
.style("font-size",function(node) { if (node.labelFont) if (node.labelFont.fontSize) return node.labelFont.fontSize; })
.style("font-weight",function(node) { if (node.labelFont) if (node.labelFont.fontBold) return node.labelFont.fontBold; })
.style("font-size", style.getFontSize())
.style("font-weight", style.getFontWeight())
.style("font-style",function(node) { if (node.labelFont) if (node.labelFont.fontItalic) return node.labelFont.fontItalic; })
.style("text-decoration-line",function(node) { if (node.labelFont) if (node.labelFont.fontUnderline) return node.labelFont.fontUnderline; })
.style("opacity",function(node) { if (node.labelFont) if (node.labelFont.fontOpacity) return node.labelFont.fontOpacity; })
.style("opacity", style.getLabelOpacity())
.style("x",function(node) {
if (node.labelFont) {
if (node.labelFont.fontX){
......
......@@ -1390,7 +1390,7 @@ metExploreD3.GraphFunction = {
{
if(force!=undefined)
{
if(session.isAnimated("viz")== true)
if(session.isAnimated("viz"))
force.alpha(1).restart();
}
}
......
......@@ -331,7 +331,7 @@ metExploreD3.GraphLink = {
})
.style("stroke", linkStyle.getStrokeColor())
.style("stroke-width", linkStyle.getLineWidth())
.style("opacity", 1)
.style("opacity", linkStyle.getOpacity())
.style("stroke-dasharray", null);
......
......@@ -174,12 +174,10 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim = session.isAnimated("viz");
if (anim == 'true') {
if (anim) {
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
catch (e) {
......@@ -187,13 +185,11 @@ metExploreD3.GraphMapping = {
e.functionUsed="mapNodeDataFile";
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
throw e;
}
......@@ -222,7 +218,7 @@ metExploreD3.GraphMapping = {
});
var nodes = d3.select("#viz").select("#D3viz").select("#graphComponent").selectAll("g.node");
var node = undefined;
var links = undefined;
switch (mapping.getTargetLabel()) {
case "reactionDBIdentifier":
for (var i = conditions.length - 1; i >= 0; i--) {
......@@ -253,7 +249,6 @@ metExploreD3.GraphMapping = {
var mapNode = new MappingData(node, mapping.getName(), conditions[i], line[i + 1]);
node.addMappingData(mapNode);
links = networkData.getLinkByDBIdReaction(node.getDbIdentifier());
links.forEach(function (link) {
link.addMappingData(mapNode);
......@@ -302,12 +297,10 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim = session.isAnimated("viz");
if (anim == 'true') {
if (anim) {
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
catch (e) {
......@@ -316,13 +309,11 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
throw e;
}
......@@ -672,13 +663,11 @@ metExploreD3.GraphMapping = {
var anim = session.isAnimated("viz");
if (anim == 'true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
catch (e) {
......@@ -687,13 +676,11 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
throw e;
}
......@@ -810,17 +797,23 @@ metExploreD3.GraphMapping = {
return c !== "PathwayCoverage" && c !== "PathwayEnrichment"
});
var node = undefined;
var links = undefined;
switch (mapping.getTargetLabel()) {
case "reactionDBIdentifier":
mapping.getData().forEach(function (map) {
if (typeof map.getNode() == "object")
var node = networkData.getNodeByDbIdentifier(map.getNode().getDbIdentifier());
node = networkData.getNodeByDbIdentifier(map.getNode().getDbIdentifier());
else
var node = networkData.getNodeByDbIdentifier(map.getNode());
node = networkData.getNodeByDbIdentifier(map.getNode());
if (node != undefined) {
var mapNode = new MappingData(node, mapping.getName(), map.getConditionName(), map.getMapValue());
node.addMappingData(mapNode);
links = networkData.getLinkByDBIdReaction(node.getDbIdentifier());
links.forEach(function (link) {
link.addMappingData(mapNode);
})
}
});
break;
......@@ -835,6 +828,11 @@ metExploreD3.GraphMapping = {
if (node != undefined) {
var mapNode = new MappingData(node, mapping.getName(), map.getConditionName(), map.getMapValue());
node.addMappingData(mapNode);
links = networkData.getLinkByDBIdReaction(node.getDbIdentifier());
links.forEach(function (link) {
link.addMappingData(mapNode);
})
}
});
break;
......@@ -876,12 +874,10 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim = session.isAnimated("viz");
if (anim == 'true') {
if (anim) {
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
catch (e) {
......@@ -889,13 +885,11 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
throw e;
}
......@@ -995,7 +989,7 @@ metExploreD3.GraphMapping = {
aStyleFormParent.getController().addValueMapping("Discrete", values[i], aStyleFormParent.default);
}
var valueMapping = aStyleFormParent.getController().getValueMappingsSet(session.getMappingDataType());
var valueMapping = aStyleFormParent.getController().getValueMappingsSet("Discrete");
valueMapping.forEach(function(valMapping){
metExploreD3.GraphStyleEdition.setCollectionStyleDiscreteMapping(aStyleFormParent.target, aStyleFormParent.attrType, aStyleFormParent.attrName, aStyleFormParent.biologicalType, conditionName, mappingName, valMapping.getName(), valMapping.getValue())
});
......@@ -1016,7 +1010,7 @@ metExploreD3.GraphMapping = {
aStyleFormParent.getController().addValueMapping("Discrete", values[i], color);
// metExploreD3.GraphMapping.fixMappingColorOnNodeData(color, values[i], conditionName, mappingName);
}
var colorStore = aStyleFormParent.getController().getValueMappingsSet(session.getMappingDataType());
var colorStore = aStyleFormParent.getController().getValueMappingsSet("Discrete");
colorStore.forEach(function(color){
metExploreD3.GraphStyleEdition.setCollectionStyleDiscreteMapping(aStyleFormParent.target, aStyleFormParent.attrType, aStyleFormParent.attrName, aStyleFormParent.biologicalType, conditionName, mappingName, color.getName(), color.getValue())
});
......@@ -1037,13 +1031,13 @@ metExploreD3.GraphMapping = {
metExploreD3.displayMessage("Warning", 'No mapped node on network.');
var anim = session.isAnimated("viz");
if (anim == 'true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
catch (e) {
......@@ -1051,13 +1045,11 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
throw e;
}
......@@ -1102,16 +1094,29 @@ metExploreD3.GraphMapping = {
if(aStyleFormParent.styleType==="float" || aStyleFormParent.styleType==="int" ) {
var medium = (aStyleFormParent.min + aStyleFormParent.max)/2;
aStyleFormParent.getController().addValueMapping("As selection", "Identified", medium);
if(aStyleFormParent.getController().getValueMappingsSet("As selection").length===0) {
var medium = (aStyleFormParent.min + aStyleFormParent.max) / 2;
aStyleFormParent.getController().addValueMapping("As selection", "Identified", medium);
}
else
{
var medium = aStyleFormParent.getController().getValueMappingsSet("As selection")[0].getValue();
}
metExploreD3.GraphStyleEdition.setCollectionStyleAsSelectionMapping(aStyleFormParent.target, aStyleFormParent.attrType, aStyleFormParent.attrName, aStyleFormParent.biologicalType, conditionName, mappingName, "Identified", medium)
}
if(aStyleFormParent.styleType==="color" ) {
if(aStyleFormParent.getController().getValueMappingsSet("As selection").length===0){
var color = aStyleFormParent.max;
var color = aStyleFormParent.max;
aStyleFormParent.getController().addValueMapping("As selection", "Identified", color);
}
else
{
var color = aStyleFormParent.getController().getValueMappingsSet("As selection")[0].getValue();
}
aStyleFormParent.getController().addValueMapping("As selection", "Identified", color);
metExploreD3.GraphStyleEdition.setCollectionStyleAsSelectionMapping(aStyleFormParent.target, aStyleFormParent.attrType, aStyleFormParent.attrName, aStyleFormParent.biologicalType, conditionName, mappingName, "Identified", color)
}
......@@ -1130,13 +1135,12 @@ metExploreD3.GraphMapping = {
metExploreD3.displayMessage("Warning", 'No mapped node on network.');
var anim = session.isAnimated("viz");
if (anim == 'true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
catch (e) {
......@@ -1144,13 +1148,11 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
throw e;
}
......@@ -1338,10 +1340,12 @@ metExploreD3.GraphMapping = {
function() {
try {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
force.stop();
var generalStyle = _metExploreViz.getGeneralStyle();
var vis = d3.select("#viz").select("#D3viz");
var session = _metExploreViz.getSessionById('viz');
var nodes = _metExploreViz.getSessionById('viz').getD3Data().getNodes();
var conditions = mapping.getConditions().filter(function (c) { return c!=="PathwayCoverage" && c!=="PathwayEnrichment" });
......@@ -1458,13 +1462,12 @@ metExploreD3.GraphMapping = {
}
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
catch (e) {
......@@ -1472,13 +1475,11 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
throw e;
}
......@@ -1518,14 +1519,12 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var networkVizSessionStore = metExploreD3.getSessionsSet();
var session = metExploreD3.getSessionById(networkVizSessionStore, 'viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
catch (e) {
......@@ -1533,13 +1532,11 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
throw e;
}
......@@ -1643,13 +1640,11 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim = session.isAnimated("viz");
if (anim == 'true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
catch (e) {
......@@ -1657,13 +1652,11 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var session = _metExploreViz.getSessionById('viz');
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
throw e;
}
......@@ -1904,13 +1897,11 @@ metExploreD3.GraphMapping = {
}
var anim=session.isAnimated("viz");
if (anim==='true') {
if (anim) {
session = _metExploreViz.getSessionById('viz');
force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}, 1
);
......@@ -2174,12 +2165,10 @@ metExploreD3.GraphMapping = {
metExploreD3.fireEventArg('selectMapping', "jsonmapping", mapping);
var anim = session.isAnimated("viz");
if (anim == 'true') {
if (anim) {
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
catch (e) {
......@@ -2187,12 +2176,10 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
}
}, 1);
......@@ -2236,12 +2223,10 @@ metExploreD3.GraphMapping = {
metExploreD3.hideMask(myMask);
if (func!=undefined) {func()};
var anim=session.isAnimated("viz");
if (anim=='true') {
if (anim) {
var force = session.getForce();
if (metExploreD3.GraphNetwork.animation) {
force.alpha(1).restart();
}
force.alpha(force.alpha()).restart();
}
});
}
......@@ -2265,6 +2250,7 @@ metExploreD3.GraphMapping = {
var mapData = new MappingData(map.node, mapping.getName(), condition.name, map.value);
mapping.addMap(mapData);
var node = networkData.getNodeByDbIdentifier(map.node);
var links = undefined;
if(node!=undefined){
var mapNode = new MappingData(node, mapping.getName(), condition.name, map.value);
node.addMappingData(mapNode);
......
......@@ -752,7 +752,7 @@ metExploreD3.GraphNetwork = {
session.setLinked(true);
mainSession.setLinked(true);
if (anim == "true")
if (anim)
metExploreD3.GraphNetwork.animationButtonOn(panel);
else
metExploreD3.GraphNetwork.animationButtonOff(panel);
......@@ -1417,6 +1417,7 @@ metExploreD3.GraphNetwork = {
var session = _metExploreViz.getSessionById(panel);
var force = session.getForce();
console.log("refreshSvg");
if(session.isAnimated())
force.alpha(1).restart();
else
......@@ -1465,6 +1466,8 @@ metExploreD3.GraphNetwork = {
metExploreD3.GraphNetwork.tick(panel);
metExploreD3.hideMask(mask);
metExploreD3.fireEvent('allStylesForm', "refreshAllStyles");
}
catch (e) {
e.functionUsed="refreshViz";
......@@ -1686,7 +1689,7 @@ metExploreD3.GraphNetwork = {
metExploreD3.GraphNetwork.addLinkInDrawing(link.getSource().getDbIdentifier()+"-"+link.getTarget().getId(), link.getSource(), link.getTarget(), "out", false, "viz", false)
});
if (session.isAnimated("viz")==true || session.isAnimated("viz")=="true") {
if (session.isAnimated("viz")) {
force.alpha(1).restart();
}
else
......@@ -2048,7 +2051,9 @@ metExploreD3.GraphNetwork = {
pathwaySize*3,
pathwaySize*3,
networkData.getPathwayByName(pathwayName).getColor(),
pathwaySize*3/5
pathwaySize*3/5,
"#FFFFFF",
0
);
thePathwayElement
......@@ -2805,7 +2810,7 @@ metExploreD3.GraphNetwork = {
var force = session.getForce();
if(force!=undefined)
{
if(session.isAnimated("viz") || session.isAnimated("viz")==true)
if(session.isAnimated("viz"))
force.alpha(1).restart();
}
}
......@@ -2862,7 +2867,7 @@ metExploreD3.GraphNetwork = {
var force = session.getForce();
if(force!=undefined)
{
if(session.isAnimated("viz")=="true")
if(session.isAnimated("viz")===true)
force.alpha(1).restart();
}
}
......@@ -2949,7 +2954,7 @@ metExploreD3.GraphNetwork = {
var force = session.getForce();
if(force!=undefined)
{
if(session.isAnimated("viz")=="true")
if(session.isAnimated("viz"))
force.alpha(1).restart();
}
}
......
......@@ -1060,7 +1060,9 @@ metExploreD3.GraphNode = {
metaboliteStyle.getRX(),
metaboliteStyle.getRY(),
metaboliteStyle.getStrokeColor(),
metaboliteStyle.getStrokeWidth()
metaboliteStyle.getStrokeWidth(),
metaboliteStyle.getBackgroundColor(),
metaboliteStyle.getOpacity()
);
// Duplicated metabolites
......@@ -1101,7 +1103,9 @@ metExploreD3.GraphNode = {
metaboliteStyle.getRX() / 2,
metaboliteStyle.getRY() / 2,
metaboliteStyle.getStrokeColor(),
metaboliteStyle.getStrokeWidth() / 2
metaboliteStyle.getStrokeWidth() / 2,
metaboliteStyle.getBackgroundColor(),
metaboliteStyle.getOpacity()
);
......@@ -1117,7 +1121,9 @@ metExploreD3.GraphNode = {
reactionStyle.getRX(),
reactionStyle.getRY(),
reactionStyle.getStrokeColor(),
reactionStyle.getStrokeWidth()
reactionStyle.getStrokeWidth(),
reactionStyle.getBackgroundColor(),
reactionStyle.getOpacity()
);
......
......@@ -195,12 +195,11 @@ metExploreD3.GraphPanel = {
var vizComp = Ext.getCmp("viz");
if(vizComp!=undefined){
var panel;
console.log(Ext.getCmp("maskInit"));
if(Ext.getCmp("maskInit").isHidden())
panel = 'graphPanel';
else
panel = "maskInit";
console.log(panel);
var myMask = metExploreD3.createLoadMask("Refresh in process...", panel);
if(myMask!= undefined){
......@@ -648,7 +647,6 @@ console.log(panel);
if(jsonParsed.generalStyle)
{
console.log(jsonParsed.generalStyle);
var oldGeneralStyle = metExploreD3.getGeneralStyle();
var style = new GeneralStyle(
oldGeneralStyle.getWebsiteName(),
......@@ -790,7 +788,6 @@ console.log(panel);
if(sessions[key].duplicatedNodes)
{
console.log(sessions[key]);
sessions[key].duplicatedNodes.filter(metExploreD3.GraphUtils.onlyUnique).forEach(function(nodeId){
var nodeSC = networkVizSession.getD3Data().getNodeById(nodeId);
metExploreD3.fireEventParentWebSite("sideCompound", nodeSC);
......@@ -804,6 +801,7 @@ console.log(panel);
if(btn=="yes")
{
_metExploreViz.getMappingsSet().forEach(function(mapping){
metExploreD3.GraphMapping.reloadMapping(mapping);
metExploreD3.fireEventArg('buttonMap', "jsonmapping", mapping);
metExploreD3.fireEventArg('selectMapping', "jsonmapping", mapping);
......@@ -895,8 +893,7 @@ console.log(panel);
networkData.cloneObject(jsonParsed);
var metaboliteStyle = metExploreD3.getMetaboliteStyle();
var reactionStyle = metExploreD3.getReactionStyle();
console.log(metaboliteStyle);
console.log(reactionStyle);
var nodes = networkData.getNodes();
nodes.forEach(function(node){
if(node.getBiologicalType()=="metabolite")
......@@ -978,6 +975,7 @@ console.log(panel);
metExploreD3.GraphNetwork.tick("viz");
}
});
}
}
......@@ -985,12 +983,15 @@ console.log(panel);
if(_metExploreViz.getMappingsLength()>0)
{
// metExploreD3.fireEventArg('buttonMap', "reloadMapping", false);
// metExploreD3.fireEventArg('selectMapping', "reloadMapping", false);
_metExploreViz.getMappingsSet().forEach(function(mapping){
metExploreD3.GraphMapping.reloadMapping(mapping);
metExploreD3.fireEventArg('buttonMap', "jsonmapping", mapping);
metExploreD3.fireEventArg('selectMapping', "jsonmapping", mapping);
});
metExploreD3.fireEventArg('buttonRefresh', "reloadMapping", true);
});
metExploreD3.GraphNetwork.tick("viz");
}
}
func();
......
......@@ -90,6 +90,11 @@ LinkStyle.prototype = {
return this.strokeColor;
},
getOpacity:function()
{
return this.opacity;
},
setMarkerInColor:function(newData)
{
this.markerInColor = newData;
......
......@@ -127,12 +127,12 @@ MetaboliteStyle.prototype = {
getFontWeight:function()
{
return this.fontSize;
return this.fontWeight;
},
setFontWeight:function(newData)
{
this.fontSize = newData;
this.fontWeight = newData;
},
......@@ -196,6 +196,15 @@ MetaboliteStyle.prototype = {
return displayedLabel;
},
getOpacity:function()
{
return this.opacity;
},
setOpacity:function(newData)
{
this.opacity = newData;
},
getLabelOpacity:function()
{
return this.labelOpacity;
......
......@@ -195,6 +195,15 @@ ReactionStyle.prototype = {
return displayedLabel;
},
getOpacity:function()
{
return this.opacity;
},
setOpacity:function(newData)
{
this.opacity = newData;
},
getLabelOpacity:function()
{
return this.labelOpacity;
......