Commit fa916790 authored by Amina Taoui's avatar Amina Taoui

Reload abstraction panel ( sort by absraction group) + correction of...

Reload abstraction panel ( sort by absraction group) + correction of interaction + add button to delete an abstraction from the panel + label framed
parent 5c3df931
......@@ -42,21 +42,6 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionForm', {
width: '10%',
sortable: false
},
// {
// xtype: 'actioncolumn',
// header: '',
// menuText: 'revealAbstraction',
// dataIndex: 'revealAbstraction',
// width: '10%',
// sortable: false,
// items: [
// {
// icon: './resources/icons/eye.png',
// region: 'center',
// tooltip: 'Reveal this element'
// }],
// handler: 'revealElement',
// }
{
text: 'Name',
......@@ -82,7 +67,7 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionForm', {
Ext.getStore("abstractionStore").removeAll();
store.getData().items.forEach(function (elt) {
if(elt.data.idAbstraction === group){
if(elt.data.labelAbstraction === group){
var store = Ext.getStore("abstractionStore");
var dataAbs = [];
dataAbs.push({
......@@ -91,7 +76,7 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionForm', {
id: elt.data.id,
pathway: elt.data.pathway,
biologicalType: elt.data.biologicalType,
idAbstraction:group,
labelAbstraction:group,
});
store.loadData(dataAbs,true);
}
......@@ -118,12 +103,45 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionForm', {
});
}else if (e.getTarget().id === 'delete'){
var store = Ext.getStore("abstractionFormStore");
metExploreD3.displayMessageYesNo("Abstraction", 'Do you want to remove selected abstraction?', function (btn) {
if (btn == 'yes'){
var store = Ext.getStore("abstractionFormStore");
store.getData().items.forEach(function (elt) {
if(elt.data.labelAbstraction===group){
var session = _metExploreViz.getSessionById("viz");
var networkData = session.getD3Data();
var nodes= networkData.getNodes()
.filter(function (n) {
return n.id===elt.data.id;
});
metExploreD3.GraphAbstraction.revealAbstraction('viz',nodes,elt.data.links);
store.remove(elt);
}
});
store.reload();
}
});
}
},
},
features: [{
groupHeaderTpl: new Ext.XTemplate('<tpl for=".">', '<label for="."> Abstraction : {name}</label><input type="image" id="help" src="./resources/icons/help.svg" width="20" align="right"><input type="image" id="reveal" src="./resources/icons/refreshBlack.svg" width="20" align="right"></div>', '</tpl>'),
groupHeaderTpl: new Ext.XTemplate('<tpl for=".">', '<label for="."> Abstraction : {name}</label><input type="image" id="delete" src="./resources/icons/delete.svg" width="20" align="right"><input type="image" id="help" src="./resources/icons/help.svg" width="20" align="right"><input type="image" id="reveal" src="./resources/icons/refreshBlack.svg" width="20" align="right"></div>', '</tpl>'),
ftype: 'grouping'
}],
......
......@@ -41,26 +41,31 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
var networkData = session.getD3Data();
store.data.items.forEach(function (c) {
idAbs.push(c.data.idAbstraction);
});
nodeToAbstract.forEach(function(list){
list.forEach(function(node) {
node.setLabelAbstraction(text);
});
});
store.data.items.forEach(function (c) {
idAbs.push(c.data.labelAbstraction);
});
if(text!="" && store!=undefined) {
if(store.getCount()===0){
metExploreD3.GraphAbstraction.abstractNodesSelected("viz",nodeToAbstract, function(links) {
links.forEach(function (link) {
var l = networkData.getLinks().filter(function (link) {
return link.abstraction ==='abstraction';
});
l.forEach(function (link) {
link.setLabel(text);
});
metExploreD3.GraphLink.changeName(links, text);
......@@ -74,7 +79,6 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
id: node.getId(),
pathway: node.getPathways(),
biologicalType: node.getBiologicalType(),
idAbstraction: text,
labelAbstraction: node.getLabelAbstraction(),
links: links,
});
......@@ -84,13 +88,8 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
store.loadData(dataAbs, true);
store.getData().items.forEach(function (elt) {
if(elt.data.labelAbstraction===text){
var session = _metExploreViz.getSessionById("viz");
var networkData = session.getD3Data();
networkData.getNodes()
.filter(function (n) {
//console.log(n);
return n.id===elt.data.id;
}).forEach(function (node){
node.setLabelAbstraction(text);
......@@ -122,7 +121,11 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
if (btn == 'yes') {
metExploreD3.GraphAbstraction.abstractNodesSelected("viz",nodeToAbstract, function(links) {
links.forEach(function (link) {
var l = networkData.getLinks().filter(function (link) {
return link.abstraction ==='abstraction';
});
l.forEach(function (link) {
link.setLabel(text);
});
metExploreD3.GraphLink.changeName(links, text);
......@@ -138,7 +141,6 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
id: node.getId(),
pathway: node.getPathways(),
biologicalType: node.getBiologicalType(),
idAbstraction: text,
labelAbstraction: node.getLabelAbstraction(),
links: links,
});
......@@ -148,8 +150,6 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
store.loadData(dataAbs, true);
store.getData().items.forEach(function (elt) {
if(elt.data.labelAbstraction===text){
var session = _metExploreViz.getSessionById("viz");
var networkData = session.getD3Data();
networkData.getNodes()
.filter(function (n) {
......@@ -185,7 +185,11 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
} else{
metExploreD3.GraphAbstraction.abstractNodesSelected("viz",nodeToAbstract, function(links) {
links.forEach(function (link) {
var l = networkData.getLinks().filter(function (link) {
return link.abstraction ==='abstraction';
});
l.forEach(function (link) {
link.setLabel(text);
});
metExploreD3.GraphLink.changeName(links, text);
......@@ -201,7 +205,6 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
id: node.getId(),
pathway: node.getPathways(),
biologicalType: node.getBiologicalType(),
idAbstraction: text,
labelAbstraction: node.getLabelAbstraction(),
links: links,
......@@ -212,9 +215,6 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormController',
store.loadData(dataAbs, true);
store.getData().items.forEach(function (elt) {
if(elt.data.labelAbstraction===text){
var session = _metExploreViz.getSessionById("viz");
var networkData = session.getD3Data();
networkData.getNodes()
.filter(function (n) {
return n.id===elt.data.id;
......
......@@ -10,7 +10,7 @@ Ext.define('metExploreViz.view.form.abstractionForm.AbstractionFormStore', {
model: 'metExploreViz.view.form.abstractionForm.AbstractionFormModel',
storeId: 'abstractionFormStore',
data: [],
groupField: 'idAbstraction',
groupField: 'labelAbstraction',
listeners: {
add: function(store, records) {
// if(store.count()==1)
......
This diff is collapsed.
......@@ -22,8 +22,7 @@ metExploreD3.GraphLink = {
*/
addText: function (d, panelLinked) {
var linkStyle = metExploreD3.getLinkStyle ;
if (d.getAbstraction() === 'abstraction') {
// var minDim = Math.min(metaboliteStyle.getWidth(), metaboliteStyle.getHeight());
......@@ -94,20 +93,43 @@ metExploreD3.GraphLink = {
changeName: function (links,text) {
// links.forEach(function(d){
// var t=d3.select("#" + "viz").select("#D3viz")
// .selectAll("g.linkGroup")
// .filter(function (link) {
// return d.id === link.id;
// }).append('svg:text')
// .attr('class', 'abstraction')
// .attr("x",((d.target.x+d.source.x)/2))
// .attr("y", ((d.target.y+d.source.y)/2))
// .attr('text-anchor', 'middle')
// .text(text);
// });
links.forEach(function(d){
d3.select("#" + "viz").select("#D3viz")
var t=d3.select("#" + "viz").select("#D3viz")
.selectAll("g.linkGroup")
.filter(function (link) {
return d.id === link.id;
}).append('svg:text')
.attr('class', 'abstraction')
.attr("x",((d.target.x+d.source.x)/2))
.attr("y", ((d.target.y+d.source.y)/2))
.attr('text-anchor', 'middle')
}).append('svg');
t.append('rect')
.attr('width', 100)
.attr('height', 40)
.attr('x', ((d.target.x+d.source.x)/2)-40)
.attr('y', ((d.target.y+d.source.y)/2)-10)
.attr('stroke', 'black')
.attr('fill', 'white');
t.append('text')
.attr('x', ((d.target.x+d.source.x)/2))
.attr('y', ((d.target.y+d.source.y)/2))
.text(text);
});
},
......@@ -437,6 +459,31 @@ metExploreD3.GraphLink = {
// var a = metExploreD3.GraphLink.link.enter()
// .insert("svg:g", ":first-child")
// .attr("class", "linkGroup")
// .append("svg:path")
// .attr("class", String)
// .attr("d", function (link) {
// return metExploreD3.GraphLink.funcPath3(link, parent, this.id, 3);
// })
// .attr("class", "link")
// .filter(function(link){
// return link.abstraction === 'abstraction';
// }).classed("reaction", false)
// .classed("abstraction",true)
// .attr("fill-rule", "evenodd")
// .attr("fill", function (d) {
// if (d.interaction == "out")
// return linkStyle.getMarkerOutColor();
// else
// return linkStyle.getMarkerInColor();
// })
// .style("stroke", '#808080')
// .style("stroke-width", linkStyle.getLineWidth())
// .style("opacity", linkStyle.getOpacity())
// .style("stroke-dasharray", '4');
var a = metExploreD3.GraphLink.link.enter()
.insert("svg:g", ":first-child")
.attr("class", "linkGroup")
......@@ -448,21 +495,30 @@ metExploreD3.GraphLink = {
.attr("class", "link")
.filter(function(link){
return link.abstraction === 'abstraction';
}).classed("reaction", false)
.classed("abstraction",true)
.attr("fill-rule", "evenodd")
.attr("fill", function (d) {
if (d.interaction == "out")
return linkStyle.getMarkerOutColor();
else
return linkStyle.getMarkerInColor();
})
.style("stroke", '#808080')
.style("stroke-width", linkStyle.getLineWidth())
.style("opacity", linkStyle.getOpacity())
.style("stroke-dasharray", '4');
});
// a.append('svg:text')
// .attr('class', 'abstraction')
// .attr("x",((d.target.x+d.source.x)/2))
// .attr("y", ((d.target.y+d.source.y)/2))
// .attr('text-anchor', 'middle')
// .text(d.label);
a.classed("reaction", false)
.classed("abstraction",true)
.attr("fill-rule", "evenodd")
.attr("fill", function (d) {
if (d.interaction == "out")
return linkStyle.getMarkerOutColor();
else
return linkStyle.getMarkerInColor();
})
.style("stroke", '#808080')
.style("stroke-width", linkStyle.getLineWidth())
.style("opacity", linkStyle.getOpacity())
.style("stroke-dasharray", '4');
if(metExploreD3.getGeneralStyle().isDisplayedPathwaysOnLinks())
metExploreD3.GraphCaption.majCaptionPathwayOnLink();
......
......@@ -1653,11 +1653,11 @@ metExploreD3.GraphNetwork = {
* @param {} reversible : Reversibility of link
* @param {} panel : The panel where is the new link
*/
addLinkInDrawing:function(identifier,source,target,interaction,reversible,panel, hide,abstraction){
addLinkInDrawing:function(identifier,source,target,interaction,reversible,panel, hide,abstraction, label){
var session = _metExploreViz.getSessionById(panel);
var networkData = session.getD3Data();
var newLink = networkData.addLink(identifier,source,target,interaction,reversible,abstraction);
var newLink = networkData.addLink(identifier,source,target,interaction,reversible,abstraction,hide,label);
return newLink;
},
......
......@@ -1405,6 +1405,8 @@ clone.setAttribute("version", "1.1");
if(node.getLabel()!=undefined){
networkJSON+=","+"\"label\":"+JSON.stringify(node.getLabel());
}
console.log(node.getLabelAbstraction());
if(node.getLabelAbstraction()!=undefined){
networkJSON+=","+"\"labelAbstraction\":"+JSON.stringify(node.getLabelAbstraction());
}
......
......@@ -335,11 +335,11 @@ NetworkData.prototype = {
return this.links[indice];
},
addLink:function(id,source,target,interaction,reversible,abstraction,hidden){
addLink:function(id,source,target,interaction,reversible,abstraction,hidden,label){
if(this.links == undefined)
this.links = [];
var object = new LinkData(id, source, target, interaction, reversible,abstraction,hidden);
var object = new LinkData(id, source, target, interaction, reversible,abstraction,hidden,label);
this.links.push(object);
return object;
},
......@@ -379,7 +379,8 @@ NetworkData.prototype = {
alias,
label,
labelFont,
hidden
hidden,
labelAbstraction
){
if(this.nodes == undefined)
this.nodes = [];
......@@ -406,7 +407,8 @@ NetworkData.prototype = {
alias,
label,
labelFont,
hidden);
hidden,
labelAbstraction);
//console.log('ec '+ec);
//console.log('ec '+object.getEC());
this.nodes.push(object);
......@@ -503,7 +505,8 @@ NetworkData.prototype = {
node.alias,
node.label,
node.labelFont,
node.hidden
node.hidden,
node.labelAbstraction
);
}
......@@ -531,7 +534,8 @@ NetworkData.prototype = {
node.alias,
node.label,
node.labelFont,
node.hidden
node.hidden,
node.labelAbstraction
);
}
else
......@@ -558,7 +562,8 @@ NetworkData.prototype = {
node.alias,
node.label,
node.labelFont,
node.hidden);
node.hidden,
node.labelAbstraction);
}
}
if(node.mappingDatas!=undefined){
......@@ -595,7 +600,9 @@ NetworkData.prototype = {
target,
link.interaction,
link.reversible,
link.abstraction);
link.abstraction,
link.hidden,
link.label);
});
if(obj.pathways){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment