pipeline.js 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400
  1. // Licensed Materials - Property of IBM
  2. //
  3. // IBM Cognos Products: cpscrn
  4. //
  5. // (C) Copyright IBM Corp. 2005, 2011
  6. //
  7. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. //
  9. //
  10. var _F_pipeline ={
  11. constants :{
  12. CSS_BOX : ";padding:3px;",
  13. CSS_THUMBNAIL : ";vertical-align:middle; text-align:center; color:white;padding:2px",
  14. CSS_THUMBNAIL_BOX : ";border:1px solid black;",
  15. DOCK_ANIMATION_STEPS : 5
  16. },
  17. utils : {
  18. getTime: function(){
  19. var date = new Date();
  20. return ("0" + date.getHours()).substring((""+date.getHours()).length -1) +
  21. ":"+
  22. ("0" + date.getMinutes()).substring((""+date.getMinutes()).length -1) +
  23. ":" +
  24. ("0" + date.getSeconds()).substring((""+date.getSeconds()).length -1) ;
  25. },
  26. loadXml: function(text){
  27. var doc;
  28. if (window.ActiveXObject){
  29. doc=new ActiveXObject("Microsoft.XMLDOM");
  30. doc.async="false";
  31. doc.loadXML(text);
  32. }else{
  33. var parser=new DOMParser();
  34. doc=parser.parseFromString(text,"text/xml");
  35. }
  36. return doc.documentElement;
  37. },
  38. xmlToHtml: function(xml){
  39. var root = _F_pipeline.utils.loadXml(xml);
  40. if (root == null || root.tagName == "parsererror")
  41. return "<b>"+xml+"</b>";
  42. function startTag(name, padding, id){
  43. var collpase = id != null ? "<span id=\"toggle_xml_tag_content"+id+"\" style=\"cursor:pointer\" onclick=\"_F_pipeline.utils.xml_node_toggle('xml_tag_content"+id+"')\">-</span>":"";
  44. return "<div style=\"padding-left:"+ padding +"px\">"+
  45. collpase+"<font color=\"blue\">&lt;</font>"+"<font color=\"brown\">"+name+"</font>";
  46. }
  47. function flushStartTag(id){
  48. return "<font color=\"blue\">></font>" + (id != null ? "<div id=\"xml_tag_content"+id+"\">" : "");
  49. }
  50. function endTag(name, id){
  51. return (id != null ? "</div>":"")+"<font color=\"blue\">&lt;/</font>"+
  52. "<font color=\"brown\">"+name+"</font>" +
  53. "<font color=\"blue\">></font></div>";
  54. }
  55. function attributeName(name){
  56. return " <font color=\"red\">"+name+"</font>";
  57. }
  58. function attributeValue(value){
  59. return "<font color=\"blue\">=\"</font>" +
  60. "<b>"+value+"</b>" +
  61. "<font color=\"blue\">\"</font>";
  62. }
  63. function textValue(value){
  64. return "<b>"+_F_Strings.xmlEncode(value)+"</b>";
  65. }
  66. function hasElement(node){
  67. var nodes = node.childNodes;
  68. for (var i=0;i<nodes.length;i++){
  69. var child = nodes.item(i);
  70. if (child.nodeType == 1)
  71. return true;
  72. }
  73. return false;
  74. }
  75. function deepScanText(node, html, padding,id, id_prefix){
  76. var collapseId = hasElement(node)? id_prefix + "_"+ id : null;
  77. html += startTag (node.tagName, padding, collapseId);
  78. var attrs = node.attributes;
  79. for (var i=0;i<attrs.length;i++){
  80. var attribute = attrs.item(i);
  81. html += attributeName(attribute.name);
  82. html += attributeValue(attribute.value);
  83. }
  84. html += flushStartTag(collapseId);
  85. // check if we have children elements
  86. var n = node.firstChild;
  87. var counter = 0;
  88. while (n != null){
  89. if (n.nodeType == 3)
  90. html += textValue(n.data);
  91. else if (n.nodeType == 1)
  92. html = deepScanText(n, html, padding + 5, id++, id_prefix +"_" + counter);
  93. n = n.nextSibling;
  94. counter++;
  95. }
  96. html += endTag(node.tagName, collapseId);
  97. return html;
  98. }
  99. return deepScanText(root , "", 0, 0, new Date().getTime());
  100. },
  101. xml_node_toggle: function(id){
  102. var object = $(id);
  103. if (object != null){
  104. if (object.style.display=="none"){
  105. object.style.display="block";
  106. $("toggle_"+id).innerHTML="-";
  107. }else {
  108. object.style.display="none";
  109. $("toggle_"+id).innerHTML="+";
  110. }
  111. }
  112. }
  113. },
  114. ui : {
  115. table: function (border, cellpadding, cellspacing,width, className){
  116. var table = document.createElement("table");
  117. if (className){
  118. table.className= className;
  119. }
  120. table.border= border;
  121. table.cellPadding = cellpadding;
  122. table.cellSpacing = cellspacing;
  123. if (width) {
  124. table.width = width;
  125. }
  126. var tbody = document.createElement("tbody");
  127. table.appendChild (tbody);
  128. return table;
  129. },
  130. tr:function(parent, id, className){
  131. return this.createHtmlObj(parent.firstChild, "tr", id, className);
  132. },
  133. td:function(parent, id, className){
  134. return this.createHtmlObj(parent, "td", id, className);
  135. },
  136. div:function(parent, id, className){
  137. return this.createHtmlObj(parent, "div", id, className);
  138. },
  139. span:function(parent, id, className){
  140. return this.createHtmlObj(parent, "span", id, className);
  141. },
  142. text:function(parent, content){
  143. var text = document.createTextNode(content);
  144. parent.appendChild(text);
  145. return text;
  146. },
  147. img:function(parent, id, image, onclick){
  148. var img = this.createHtmlObj(parent, "img", id, null);
  149. this.setImgSrc(img, image);
  150. if (onclick != null){
  151. img.style.cursor = "pointer";
  152. img.onclick = onclick;
  153. }
  154. return img;
  155. },
  156. setImgSrc:function(img, src){
  157. img.src=_F_config.webContent + "/fragments/debug/images/" + src;
  158. },
  159. textWithOnclick:function(parent, content, onclick){
  160. var span = this.span(parent);
  161. span.innerHTML = "<a href=\"#\" onclick=\"return false;\">"+content+"</a>";
  162. xAddEventListener(span, "click", onclick);
  163. span.style.cursor = "pointer";
  164. return span;
  165. },
  166. createHtmlObj:function(parent, tag, id, className){
  167. var obj = document.createElement(tag);
  168. if (id){
  169. obj.setAttribute("id", id);
  170. }
  171. if (className){
  172. obj.setAttribute("class", className);
  173. obj.setAttribute("className", className);
  174. }
  175. if (parent != null){
  176. parent.appendChild(obj);
  177. }
  178. return obj;
  179. },
  180. htmlStringToObject:function(s){
  181. var static_object_converter= document.createElement("DIV");
  182. static_object_converter.innerHTML = s;
  183. return static_object_converter.firstChild;
  184. },
  185. createBox :function(id, text, backgroundColor, height, width, contentStyle, boxStyle){
  186. var html = "<div id=\""+id+"\" type=\"box\" style=\"height:"+height+";width:"+width+";background-color:"+backgroundColor+";"+ _F_pipeline.constants.CSS_BOX + boxStyle ;
  187. html += "\">";
  188. html += "<div style=\"width:100%;height:"+height+";" + contentStyle + "\" id=\""+id +"_content\">";
  189. if (text != null){
  190. html += text;
  191. }
  192. html += "</div></div>";
  193. return this.htmlStringToObject(html);
  194. },
  195. createBoxWithShadow :function(id, text, backgroundColor, height, width, contentStyle, boxStyle){
  196. var html = "<div id=\""+id+"\" type=\"shadowbox\" style=\"height:"+height+";width:"+width+"; padding:5px; filter:shadow(color:gray, direction=135);\"" ;
  197. if (id != null)
  198. html +=" id=\""+id+"\"";
  199. html += ">";
  200. html += "<div style=\"height:"+height+"; background-color:"+backgroundColor+";"+ _F_pipeline.constants.CSS_BOX + boxStyle ;
  201. html += "\">";
  202. html += "<div style=\"width:100%;height:"+height+";" + contentStyle + "\" id=\""+id +"_content\">";
  203. if (text != null){
  204. html += text;
  205. }
  206. html += "</div></div>";
  207. return this.htmlStringToObject(html);
  208. },
  209. changeBoxColor: function (id, newColor){
  210. var box = $(id);
  211. if (box != null){
  212. var type =box.getAttribute("type");
  213. if ("shadowbox" == type)
  214. box = box.firstChild;
  215. box.style.backgroundColor= newColor;
  216. if ("shadowbox" == type)
  217. $(id).style.filter = "shadow(color:gray, direction=135)";
  218. }
  219. },
  220. getBoxCanvas: function(box){
  221. var type =box.getAttribute("type");
  222. if ("box" == type)
  223. return box.firstChild;
  224. else if ("shadowbox" == type)
  225. return box.firstChild.firstChild;
  226. else
  227. return box;
  228. },
  229. g_dialogs:{},
  230. createDialog: function(id, dataGetter){
  231. var dialog = this.g_dialogs[id];
  232. if (dialog == null){
  233. dialog = new _F_pipeline.ui.dockableDialog(id, dataGetter);
  234. this.g_dialogs[id] = dialog;
  235. }else {
  236. dialog.dataGetter = dataGetter;
  237. }
  238. return dialog;
  239. },
  240. showDialog: function(id){
  241. var dialog = this.g_dialogs[id];
  242. if (dialog != null){
  243. dialog.show();
  244. }
  245. },
  246. hideDialog: function(id){
  247. var dialog = this.g_dialogs[id];
  248. if (dialog != null){
  249. dialog.hide();
  250. }
  251. },
  252. updateDialogs: function(){
  253. for (var id in this.g_dialogs){
  254. var dialog = this.g_dialogs[id];
  255. if (dialog.isShowing())
  256. dialog.show();
  257. }
  258. }
  259. }
  260. }
  261. _F_pipeline.ui.dockingManager = function(){
  262. this.widthOffest = 0;
  263. this.heightOffest = 0;
  264. this.dockingOrder = [];
  265. }
  266. _F_pipeline.ui.dockingManager.constants = {LEFT_DOCK_WIDTH:550,RIGHT_DOCK_WIDTH:450, BOTTOM_DOCK_HEIGHT:300};
  267. _F_pipeline.ui.dockingManager.areas = {
  268. bottom:{x:0,
  269. y:-1 * _F_pipeline.ui.dockingManager.constants.BOTTOM_DOCK_HEIGHT,
  270. dx:-1,
  271. dy:-1},
  272. left:{ x:0,
  273. y:0,
  274. dx:_F_pipeline.ui.dockingManager.constants.LEFT_DOCK_WIDTH,
  275. dy:-1},
  276. right:{
  277. x:-1 * _F_pipeline.ui.dockingManager.constants.RIGHT_DOCK_WIDTH,
  278. y:0,
  279. dx:-1,
  280. dy:-1},
  281. content:{
  282. x:0,
  283. y:0,
  284. dx:-1,
  285. dy:-1}
  286. };
  287. _F_pipeline.ui.dockingManager.prototype = {
  288. getCoordinates:function(dock){
  289. var cod= _F_pipeline.ui.dockingManager.areas[dock];
  290. if (cod != null){
  291. var calculatedCod = new Object();
  292. calculatedCod.x = cod.x < 0 ? xClientWidth() + cod.x: cod.x;
  293. calculatedCod.y = cod.y < 0 ? xClientHeight() + cod.y: cod.y;
  294. calculatedCod.dx = cod.dx < 0 ? xClientWidth() + cod.dx: cod.dx;
  295. calculatedCod.dy = cod.dy < 0 ? xClientHeight() + cod.dy: cod.dy;
  296. var index = _F_Array.indexOf(this.dockingOrder, dock);
  297. if (index == -1 )
  298. index = this.dockingOrder.length;
  299. for (var i = 0 ; i< index; i++){
  300. var c = this.getCoordinates(this.dockingOrder[i]);
  301. if ( this.dockingOrder[i] != "bottom"){
  302. calculatedCod.x = calculatedCod.x >= c.x && calculatedCod.x <= c.dx ? c.dx +1 : calculatedCod.x;
  303. calculatedCod.dx = calculatedCod.dx >= c.x && calculatedCod.dx <= c.dx ? c.x -1 : calculatedCod.dx;
  304. }else{
  305. calculatedCod.y = calculatedCod.y >= c.y && calculatedCod.y <= c.dy ? c.dy +1 : calculatedCod.y;
  306. calculatedCod.dy = calculatedCod.dy >= c.y && calculatedCod.dy <= c.dy ? c.y -1 : calculatedCod.dy;
  307. }
  308. }
  309. return calculatedCod;
  310. }
  311. return null;
  312. },
  313. dock: function(where, viewId, animation){
  314. if (animation == null)
  315. var animation = true;
  316. var dialogObject = _F_pipeline.ui.g_dialogs[viewId];
  317. var previousDock = dialogObject.docked;
  318. var found = false;
  319. for (var id in _F_pipeline.ui.g_dialogs){
  320. var d = _F_pipeline.ui.g_dialogs[id].dialog;
  321. if (dialogObject == d)
  322. continue;
  323. if (previousDock == d.docked){
  324. found = true;
  325. break
  326. }
  327. }
  328. if (!found && _F_Array.indexOf(this.dockingOrder, previousDock) != -1){
  329. this.dockingOrder.splice(_F_Array.indexOf(this.dockingOrder, previousDock), 1);
  330. }
  331. if (!this.isDocked(where) && where != "restore")
  332. this.dockingOrder[this.dockingOrder.length] = where;
  333. var content = $("dock_view_content");
  334. if (content == null){
  335. var node = document.body;
  336. content = _F_pipeline.ui.div(null, "dock_view_content");
  337. content.style.overflow="auto";
  338. content.style.position ="absolute";
  339. var nodes = node.childNodes;
  340. var children=[];
  341. var count = 0;
  342. for (var i=0;i<nodes.length;i++){
  343. var child = nodes[i];
  344. if (child.nodeType == 1){
  345. var id = child.getAttribute("id");
  346. if (id == null || id.indexOf("dock_") != 0){
  347. children[count] = child;
  348. count++;
  349. }
  350. }else{
  351. children[count] = child;
  352. count++;
  353. }
  354. }
  355. for (var i=0;i<children.length;i++) {
  356. node.removeChild(children[i]);
  357. content.appendChild(children[i]);
  358. }
  359. node.appendChild(content);
  360. }
  361. dialogObject.dock(where, animation ? null: 1);
  362. this.redraw();
  363. },
  364. redraw: function(){
  365. for (var id in _F_pipeline.ui.g_dialogs){
  366. var d = _F_pipeline.ui.g_dialogs[id];
  367. d.dock(d.docked, 1);
  368. }
  369. },
  370. updateContent: function(){
  371. var cod = this.getCoordinates("content");
  372. var content = $("dock_view_content");
  373. xMoveTo(content,cod.x, cod.y);
  374. xResizeTo(content, cod.dx-cod.x, cod.dy - cod.y);
  375. },
  376. isDocked:function(docked){
  377. for (var i = 0; i < this.dockingOrder.length; i++){
  378. if (docked == this.dockingOrder[i])
  379. return true;
  380. }
  381. return false;
  382. }
  383. }
  384. var DOCKING_MANAGER = new _F_pipeline.ui.dockingManager();
  385. xAddEventListener(window, "resize", function(){DOCKING_MANAGER.redraw()});
  386. _F_pipeline.ui.dockableDialog = function(id, dataGetter){
  387. this.id = id;
  388. this.dataGetter= dataGetter;
  389. this.docked ="restore";
  390. this.dockingManager = DOCKING_MANAGER;
  391. var dlg_id = "dock_"+id;
  392. this.restoreHeight = 400;
  393. this.restoreWidth = 600;
  394. this.restoreX = (xClientWidth() - this.restoreWidth ) / 2;
  395. if (this.restoreX < 0) this.restoreX = 0;
  396. this.restoreY = (xClientHeight() - this.restoreHeight) / 2;
  397. if (this.restoreY < 0) this.restoreY = 0;
  398. this.dialog = new ui_dialog(dlg_id,"",
  399. ui_dialog.style.BTN_NOBUTTONS | ui_dialog.style.RESIZABLE | ui_dialog.style.MODELESS, this.restoreX, this.restoreY,this.restoreWidth,this.restoreHeight);
  400. this.dialog.show();
  401. this.dialog.hide();
  402. var captionRow = $(dlg_id+"caption").firstChild.rows[0];
  403. var dock;
  404. var _self = this;
  405. dock = _F_pipeline.ui.td();
  406. dock.width="15";
  407. dock.style.padding="2px";
  408. dock.onclick=function(){DOCKING_MANAGER.dock('left',_self.id)};
  409. dock.innerHTML="<table cellspacing='0' cellpadding='0' style ='cursor:pointer;border: 1px solid navy;height:17px;width:15px;padding:0px' ><tr><td style='width:5px;background-color:silver'></td><td style='width:10px'></td></tr></table>";
  410. captionRow.insertBefore(dock, captionRow.lastChild);
  411. dock = _F_pipeline.ui.td();
  412. dock.width="15";
  413. dock.style.padding="2px";
  414. dock.onclick=function(){DOCKING_MANAGER.dock('bottom',_self.id)};
  415. dock.innerHTML="<table cellspacing='0' cellpadding='0' style ='cursor:pointer;border: 1px solid navy;height:15px;width:15px;padding:0px' ><tr style='height:10px'><td></td></tr><tr style='height:5px;background-color:silver'><td></td></tr></table>";
  416. captionRow.insertBefore(dock, captionRow.lastChild);
  417. dock = _F_pipeline.ui.td();
  418. dock.width="15";
  419. dock.style.padding="2px";
  420. dock.innerHTML="<table cellspacing='0' cellpadding='0' style ='cursor:pointer;border: 1px solid navy;height:17px;width:15px;padding:0px' ><tr><td style='width:10px'></td><td style='width:5px;background-color:silver'></td></tr></table>";
  421. dock.onclick=function(){DOCKING_MANAGER.dock('right',_self.id)};
  422. captionRow.insertBefore(dock, captionRow.lastChild);
  423. dock = _F_pipeline.ui.td();
  424. dock.width="15";
  425. dock.style.padding="2px";
  426. dock.onclick=function(){DOCKING_MANAGER.dock('restore',_self.id)};
  427. dock.innerHTML="<table cellspacing='0' cellpadding='0' style ='cursor:pointer;border: 1px solid navy;height:17px;width:15px;padding:0px' ><tr><td></td></tr></table>";
  428. captionRow.insertBefore(dock, captionRow.lastChild);
  429. this.dialog.setContent("<div id='"+id+"dock_content'></div>");
  430. this.dialog.minDialogWidth=100;
  431. var btn = $(dlg_id + "btn" + ui_dialog.button["CLOSEBOX"]);
  432. if (btn != null){
  433. xAddEventListener(btn, "click", function(){_self.hide()});
  434. }
  435. }
  436. _F_pipeline.ui.dockableDialog.prototype={
  437. hide: function(){this.dialog.hide();this.dockingManager.dock("restore", this.id, false)},
  438. show: function(){
  439. var data = null;
  440. if (this.dataGetter != null){
  441. try {data = this.dataGetter()} catch(e){};
  442. }
  443. if (data != null)
  444. data.update(this);
  445. this.dialog.show();
  446. },
  447. isShowing:function(){
  448. return this.dialog.dlg.style.display!="none";
  449. },
  450. setContent: function(content){
  451. if (content != null){
  452. if (typeof content == 'string')
  453. $(this.id + "dock_content").innerHTML=content;
  454. else{
  455. $(this.id + "dock_content").innerHTML="";
  456. $(this.id + "dock_content").appendChild(content);
  457. }
  458. }
  459. },
  460. setTitle: function(title){
  461. if (title != null){
  462. this.dialog.setCaption(title +" - " + _F_pipeline.utils.getTime());
  463. }
  464. },
  465. dock: function(where, step){
  466. var dlg_id = "dock_"+this.id;
  467. var obj = this.dialog;
  468. if (step == null){
  469. step = _F_pipeline.constants.DOCK_ANIMATION_STEPS;
  470. }
  471. if (where != "restore" && this.docked=="restore"){
  472. this.restoreHeight = xHeight(this.dialog.dlg);
  473. this.restoreWidth = xWidth(this.dialog.dlg);
  474. this.restoreX = this.dialog.x;
  475. this.restoreY = this.dialog.y;
  476. }
  477. var cod = this.dockingManager.getCoordinates(where);
  478. var newHeight = cod != null ? cod.dy - cod.y : this.restoreHeight;
  479. var newWidth = cod != null ? cod.dx - cod.x : this.restoreWidth;
  480. var newTop = cod != null ? cod.y : this.restoreY;
  481. var newLeft = cod != null ? cod.x : this.restoreX;
  482. var ox = obj.x;
  483. var oy = obj.y;
  484. var oheight = xHeight(obj.dlg);
  485. var owidth = xWidth(obj.dlg);
  486. obj.lastX = ox;
  487. obj.lastY=oy;
  488. obj.startX = ox;
  489. obj.startY=oy;
  490. if (step > 1){
  491. obj.onresize({ xdlg:obj},
  492. Math.floor((newWidth - owidth )/ step),
  493. Math.floor((newHeight - oheight )/ step));
  494. obj.onmove({ xdlg:obj,
  495. xDPX:ox + Math.floor((newLeft - ox )/ step),
  496. xDPY:oy + Math.floor((newTop - oy )/ step)
  497. });
  498. setTimeout("_F_pipeline.ui.g_dialogs['" + this.id+ "'].dock('"+where+"',"+ (step-1) +")",1);
  499. }else{
  500. obj.onresize({ xdlg:obj},
  501. newWidth - owidth,
  502. newHeight - oheight);
  503. obj.onmove({ xdlg:obj,
  504. xDPX:newLeft,
  505. xDPY:newTop
  506. });
  507. this.docked = where;
  508. this.dockingManager.updateContent();
  509. if ("restore" == where)
  510. xEnableDrag($(dlg_id+"caption"),obj.onstartmove, obj.onmove, null);
  511. else
  512. xDisableDrag($(dlg_id+"caption"));
  513. }
  514. }
  515. }
  516. _F_pipeline.execution = function(obj){
  517. this.id = obj.id;
  518. this.name = obj.name;
  519. this.outputs = [];
  520. this.params = [];
  521. this.paramsBefore = [];
  522. this.processes = [];
  523. }
  524. _F_pipeline.execution.prototype = {
  525. getId: function(){
  526. return this.id;
  527. },
  528. getName: function(){
  529. return this.name;
  530. },
  531. getOutputs: function(){
  532. return this.outputs;
  533. },
  534. getOutput: function(label){
  535. var length = this.outputs.length;
  536. for (var i = 0; i< length; i++){
  537. var output = this.outputs[i];
  538. if (label == output.getLabel()){
  539. return output;
  540. }
  541. }
  542. return null;
  543. },
  544. getParams: function(){
  545. return this.params;
  546. },
  547. getParamInitialValues: function(){
  548. return this.paramsBefore;
  549. },
  550. getParam: function(name){
  551. var length = this.params.length;
  552. for (var i = 0; i< length; i++){
  553. var param = this.params[i];
  554. if (name == param.getName()){
  555. return param;
  556. }
  557. }
  558. return null;
  559. },
  560. getParamInitialValue: function(name){
  561. var length = this.paramsBefore.length;
  562. for (var i = 0; i< length; i++){
  563. var param = this.paramsBefore[i];
  564. if (name == param.getName()){
  565. return param;
  566. }
  567. }
  568. return null;
  569. },
  570. getProcess: function(name){
  571. var length = this.processes.length;
  572. for (var i = 0; i< length; i++){
  573. var process = this.processes[i];
  574. if (name == process.getName()){
  575. return process;
  576. }
  577. }
  578. return null;
  579. },
  580. getProcesses: function(){
  581. return this.processes;
  582. },
  583. addParam: function(obj){
  584. obj.process = this;
  585. this.params.push(obj);
  586. },
  587. addParamInitialValue: function(obj){
  588. obj.process = this;
  589. this.paramsBefore.push(obj);
  590. },
  591. addProcess: function(obj){
  592. obj.execution = this;
  593. this.processes.push(obj);
  594. },
  595. addOutput: function(obj){
  596. this.outputs.push(obj);
  597. },
  598. getDisplayName:function(){
  599. return this.getName();
  600. },
  601. getResolver: function(){
  602. var id = this.id;
  603. return function(){
  604. return _F_pipeline.getExecution(id);
  605. }
  606. }
  607. }
  608. _F_pipeline.process = function(obj){
  609. this.execution = obj.execution;
  610. this.name = obj.name;
  611. this.className = obj.className;
  612. this.params = [];
  613. this.paramsBefore = []
  614. this.outputs= [];
  615. this.inputs=[];
  616. this.traces=[];
  617. }
  618. _F_pipeline.process.prototype = {
  619. getId: function(){
  620. return this.execution.getId() +"_process_"+ this.name;
  621. },
  622. getName: function(){
  623. return this.name;
  624. },
  625. getExecution: function(){
  626. return this.execution;
  627. },
  628. getParams: function(){
  629. return this.params;
  630. },
  631. getParamInitialValues: function(){
  632. return this.paramsBefore;
  633. },
  634. getOutputs: function(){
  635. return this.outputs;
  636. },
  637. getInputs: function(){
  638. return this.inputs;
  639. },
  640. getTraces: function(){
  641. return this.traces;
  642. },
  643. addParam: function(param){
  644. param.process = this;
  645. this.params.push(param);
  646. },
  647. addOutput: function(output){
  648. output.process = this;
  649. this.execution.addOutput(output);
  650. this.outputs.push(output);
  651. },
  652. addTrace: function(trace){
  653. trace.process = this;
  654. trace.name = trace.name + " (trace"+(this.traces.length+1)+")";
  655. this.traces.push(trace);
  656. },
  657. addInput: function(input){
  658. input.process = this;
  659. var output = input.getOutput();
  660. if (output != null)
  661. output.addConsumer(this);
  662. this.inputs.push(input);
  663. },
  664. getOutput: function(label){
  665. var length = this.outputs.length;
  666. for (var i = 0; i< length; i++){
  667. var output = this.outputs[i];
  668. if (label == output.getLabel()){
  669. return output;
  670. }
  671. }
  672. return null;
  673. },
  674. getParam: function(name){
  675. var length = this.params.length;
  676. for (var i = 0; i< length; i++){
  677. var param = this.params[i];
  678. if (name == param.getName()){
  679. return param;
  680. }
  681. }
  682. return null;
  683. },
  684. getTrace: function(name){
  685. var length = this.traces.length;
  686. for (var i = 0; i< length; i++){
  687. var trace = this.traces[i];
  688. if (name == trace.getName()){
  689. return trace;
  690. }
  691. }
  692. return null;
  693. },
  694. getParamInitialValue: function(name){
  695. var length = this.paramsBefore.length;
  696. for (var i = 0; i< length; i++){
  697. var param = this.paramsBefore[i];
  698. if (name == param.getName()){
  699. return param;
  700. }
  701. }
  702. return null;
  703. },
  704. addParamInitialValue: function(obj){
  705. obj.process = this;
  706. this.paramsBefore.push(obj);
  707. },
  708. getInput: function(label){
  709. var length = this.inputs.length;
  710. for (var i = 0; i< length; i++){
  711. var input = this.inputs[i];
  712. if (label == input.getLabel()){
  713. return input;
  714. }
  715. }
  716. return null;
  717. },
  718. getDisplayName:function(){
  719. return this.getName();
  720. },
  721. getResolver: function(){
  722. var parentResolver = this.execution.getResolver();
  723. var name = this.name;
  724. return function(){
  725. return parentResolver().getProcess(name);
  726. }
  727. }
  728. }
  729. _F_pipeline.param = function(obj)
  730. {
  731. this.process = obj.process;
  732. this.name = obj.name;
  733. this.content = obj.content;
  734. this.initialValue = obj.initialValue;
  735. }
  736. _F_pipeline.param.prototype = {
  737. getId: function(){
  738. return this.process.getId() +"_param_"+ this.name + (this.initialValue ? "_before" : "_after");
  739. },
  740. getName:function(){
  741. return this.name;
  742. },
  743. getContent:function(){
  744. return this.content;
  745. },
  746. getProcess: function(){
  747. return this.process;
  748. },
  749. update: function(dialog){
  750. dialog.setContent(_F_pipeline.utils.xmlToHtml(this.getContent()));
  751. dialog.setTitle(this.process.getDisplayName() + " - " + this.getDisplayName() +" parameter "+ (this.initialValue ? "(before execution)" : "(after execution)"));
  752. },
  753. getDisplayName:function(){
  754. return this.getName();
  755. },
  756. getResolver: function(){
  757. var parentResolver = this.process.getResolver();
  758. var name = this.name;
  759. var initialValue = this.initialValue;
  760. return function(){
  761. if (initialValue)
  762. return parentResolver().getParamInitialValue(name);
  763. else
  764. return parentResolver().getParam(name);
  765. }
  766. }
  767. }
  768. _F_pipeline.trace = function(obj)
  769. {
  770. this.process = obj.process;
  771. this.name = obj.name;
  772. this.content = obj.content;
  773. }
  774. _F_pipeline.trace.prototype = {
  775. getId: function(){
  776. return this.process.getId() +"_trace_"+ this.name;
  777. },
  778. getName:function(){
  779. return this.name;
  780. },
  781. getContent:function(){
  782. return this.content;
  783. },
  784. getProcess: function(){
  785. return this.process;
  786. },
  787. update: function(dialog){
  788. dialog.setContent(_F_pipeline.utils.xmlToHtml(this.getContent()));
  789. dialog.setTitle(this.process.getDisplayName() + " - " + this.getDisplayName());
  790. },
  791. getDisplayName:function(){
  792. return this.getName().replace("_"," ").replace("_"," ") ;
  793. },
  794. getResolver: function(){
  795. var parentResolver = this.process.getResolver();
  796. var name = this.name;
  797. return function(){
  798. return parentResolver().getTrace(name);
  799. }
  800. }
  801. }
  802. _F_pipeline.output = function(obj){
  803. this.label = obj.label;
  804. this.name = obj.name;
  805. this.process = obj.process;
  806. this.content = obj.content;
  807. this.consumers=[];
  808. }
  809. _F_pipeline.output.prototype = {
  810. getId: function(){
  811. return this.process.getId() + "_param_"+ this.getLabel();
  812. },
  813. getLabel: function(){
  814. return this.label;
  815. },
  816. getName: function(){
  817. return this.name;
  818. },
  819. getContent: function(){
  820. return this.content;
  821. },
  822. getProcess: function(){
  823. return this.process;
  824. },
  825. addConsumer: function(obj){
  826. this.consumers.push(obj);
  827. },
  828. getConsumers:function(){
  829. return this.consumers;
  830. },
  831. update: function(dialog){
  832. dialog.setContent(_F_pipeline.utils.xmlToHtml(this.getContent()));
  833. dialog.setTitle(this.process.getDisplayName() + " - " + this.getDisplayName() +" Output");
  834. },
  835. getDisplayName:function(){
  836. return this.getName() + (this.getContent() == "NULL" ? " (NULL)" : "");
  837. },
  838. getResolver: function(){
  839. var parentResolver = this.process.getResolver();
  840. var label = this.getLabel();
  841. return function(){
  842. return parentResolver().getOutput(label);
  843. }
  844. }
  845. }
  846. _F_pipeline.input = function(obj){
  847. this.name = obj.name;
  848. this.label = obj.label;
  849. this.process = obj.process;
  850. this.content = obj.content;
  851. }
  852. _F_pipeline.input.prototype = {
  853. getId: function(){
  854. return this.process.getId()+ "_input_" + this.getLabel();
  855. },
  856. getContent: function(){
  857. if (this.label != null && this.label != ""){
  858. return this.process.getExecution().getOutput(this.label).getContent();
  859. }
  860. return this.content;
  861. },
  862. getProcess: function(){
  863. return this.process;
  864. },
  865. getName: function(){
  866. return this.name;
  867. },
  868. getLabel: function(){
  869. return (this.label != null && this.label != "") ? this.label : this.getName();
  870. },
  871. getOutput: function(){
  872. if (this.label != null && this.label != ""){
  873. return this.process.execution.getOutput(this.label);
  874. }
  875. return null;
  876. },
  877. getProducer: function(){
  878. var output = this.getOutput();
  879. return output != null ? output.getProcess(): null;
  880. }
  881. ,
  882. update: function(dialog){
  883. dialog.setContent(_F_pipeline.utils.xmlToHtml(this.getContent()));
  884. dialog.setTitle(this.process.getDisplayName() + " - " +this.getName() +" Input");
  885. },
  886. getDisplayName:function(){
  887. return this.getName() + (this.getContent() == "NULL" ? "( NULL)" : "");;
  888. },
  889. getResolver: function(){
  890. var parentResolver = this.process.getResolver();
  891. var label = this.getLabel();
  892. return function(){
  893. return parentResolver().getInput(label);
  894. }
  895. }
  896. }
  897. _F_pipeline.view = {
  898. constants :{
  899. UI_PARAM_INPUT_COLOR : "#666699",
  900. UI_PARAM_OUTPUT_COLOR : "#666699",
  901. UI_OUTPUT_COLOR : "#778899",
  902. UI_TRACE_COLOR : "gray",
  903. UI_INPUT_COLOR : "#99aacc",
  904. UI_PROCESS_COLOR : "#336699",
  905. UI_PIPELINE_COLOR : "silver",
  906. UI_SELECTED_COLOR : "336600",
  907. UI_RELATED_COLOR : "660033",
  908. UI_RELATED_EQUAL_COLOR : "669900"
  909. }
  910. };
  911. _F_pipeline.view.pipelineView = function(executionId){
  912. this.executionId = executionId;
  913. }
  914. _F_pipeline.view.pipelineView.prototype = {
  915. getId: function(){
  916. return this.executionId +"_view";
  917. },
  918. getUI:function(){
  919. return this.getPipelineUI();
  920. },
  921. getPipelineUI:function(){
  922. var UI_HEIGHT = "";
  923. var UI_WIDTH = "";
  924. var execution = _F_pipeline.getExecution(this.executionId);
  925. var UI_ID = execution.getId() +"pipeline_box";
  926. var box = _F_pipeline.ui.createBox(UI_ID, execution.getDisplayName(),_F_pipeline.view.constants.UI_PIPELINE_COLOR,UI_HEIGHT, UI_WIDTH, _F_pipeline.constants.CSS_THUMBNAIL, _F_pipeline.constants.CSS_THUMBNAIL_BOX);
  927. var canvas = _F_pipeline.ui.getBoxCanvas(box);
  928. var table = _F_pipeline.ui.table(0,5,0,"");
  929. canvas.appendChild(table);
  930. table.id=UI_ID +"processtable";
  931. table.align="center";
  932. var processes = execution.getProcesses();
  933. var length = processes.length;
  934. for (var i = 0 ; i < length; i++){
  935. this.getProcessUI(processes[i], table);
  936. if (i < length - 1){
  937. var tr = _F_pipeline.ui.tr(table)
  938. var td = _F_pipeline.ui.td(tr)
  939. td.colSpan="10";
  940. td.align = "center";
  941. td.style.padding="30px";
  942. _F_pipeline.ui.img(td,null, "move_down.gif");
  943. }
  944. }
  945. return box;
  946. },
  947. getProcessUI: function(process, table){
  948. var params = process.getParams();
  949. var paramInitialValue = process.getParamInitialValues();
  950. var outputs = process.getOutputs();
  951. var inputs = process.getInputs();
  952. var paramsSize = params.length;
  953. var outputSize = outputs.length;
  954. var inputSize = inputs.length;
  955. var isPipelineRendered = false;
  956. for (var i = 0 ; i < paramsSize; i++){
  957. var tr = _F_pipeline.ui.tr(table)
  958. var td = _F_pipeline.ui.td(tr)
  959. td.appendChild(this.getParamInputUI(paramInitialValue[i], process));
  960. if (!isPipelineRendered){
  961. isPipelineRendered = true;
  962. td = _F_pipeline.ui.td(tr);
  963. td.rowSpan = paramsSize + outputSize;
  964. td.valign="middle";
  965. _F_pipeline.ui.img(td,null, "move_right.gif");
  966. td = _F_pipeline.ui.td(tr);
  967. td.rowSpan = paramsSize + outputSize;
  968. td.width="50";
  969. td.height="100%";
  970. td.appendChild(this.getProcessBoxUI(process));
  971. td = _F_pipeline.ui.td(tr);
  972. td.rowSpan = paramsSize + outputSize;
  973. td.valign="middle";
  974. _F_pipeline.ui.img(td,null, "move_right.gif");
  975. }
  976. td = _F_pipeline.ui.td(tr);
  977. td.appendChild(this.getParamOutputUI(params[i], process));
  978. }
  979. var size = inputSize > outputSize ? inputSize : outputSize;
  980. for (var i = 0 ; i < size; i++){
  981. var tr = _F_pipeline.ui.tr(table)
  982. // before
  983. var td = _F_pipeline.ui.td(tr)
  984. if (i < inputSize){
  985. td.appendChild(this.getInputUI(inputs[i], process));
  986. }
  987. if (!isPipelineRendered){
  988. isPipelineRendered = true;
  989. td = _F_pipeline.ui.td(tr);
  990. td.rowSpan = paramsSize + outputSize;
  991. td.valign="middle";
  992. _F_pipeline.ui.img(td,null, "move_right.gif");
  993. td = _F_pipeline.ui.td(tr);
  994. td.rowSpan = paramsSize + outputSize;
  995. td.width="50";
  996. td.height="100%";
  997. td.appendChild(this.getProcessBoxUI(process));
  998. td = _F_pipeline.ui.td(tr);
  999. td.rowSpan = paramsSize + outputSize;
  1000. td.valign="middle";
  1001. _F_pipeline.ui.img(td,null, "move_right.gif");
  1002. }
  1003. td = _F_pipeline.ui.td(tr);
  1004. if (i < outputSize){
  1005. td.appendChild(this.getOutputUI(outputs[i],process));
  1006. }
  1007. }
  1008. },
  1009. getProcessBoxUI: function(process){
  1010. var UI_ID = process.getId();
  1011. var UI_HEIGHT = "";
  1012. var UI_WIDTH = "";
  1013. var processBox = _F_pipeline.ui.createBoxWithShadow(UI_ID,process.getDisplayName(), _F_pipeline.view.constants.UI_PROCESS_COLOR, UI_HEIGHT, UI_WIDTH, _F_pipeline.constants.CSS_THUMBNAIL, _F_pipeline.constants.CSS_THUMBNAIL_BOX );
  1014. var traces = process.getTraces();
  1015. var canvas = _F_pipeline.ui.getBoxCanvas(processBox);
  1016. for (var j = 0 ; j < traces.length; j++){
  1017. var trace = traces[j];
  1018. canvas.appendChild(this.getTraceUI(traces[j], process));
  1019. if (j < traces.length -1)
  1020. _F_pipeline.ui.div(canvas).style.height="5px";
  1021. }
  1022. return processBox;
  1023. },
  1024. getTraceUI:function(trace, process){
  1025. var traceBox = _F_pipeline.ui.createBox(trace.getId(),trace.getDisplayName(), _F_pipeline.view.constants.UI_TRACE_COLOR, "", "", _F_pipeline.constants.CSS_THUMBNAIL, _F_pipeline.constants.CSS_THUMBNAIL_BOX );
  1026. traceBox.style.cursor = "pointer";
  1027. var _self = this;
  1028. var DLG_ID =this.getId()+ "_dlg";
  1029. xAddEventListener(traceBox, "mouseOver", function(){_self.traceClick(trace)});
  1030. xAddEventListener(traceBox, "mouseOut", function(){_self.resetHighlight(); _self.updateHighlight()});
  1031. xAddEventListener(traceBox, "click", function(){
  1032. _self.traceClick(trace);
  1033. var resolver = trace.getResolver();
  1034. _self.restoreHighlight = function(){_self.traceClick(resolver());};
  1035. _F_pipeline.ui.createDialog(DLG_ID,resolver);
  1036. _F_pipeline.ui.showDialog(DLG_ID);
  1037. });
  1038. return traceBox;
  1039. },
  1040. getParamInputUI:function(param, process){
  1041. var UI_HEIGHT = 20;
  1042. var UI_WIDTH = "";
  1043. var UI_ID = param.getId();
  1044. var DLG_ID =this.getId()+ "_dlg";
  1045. var obj = _F_pipeline.ui.createBoxWithShadow(UI_ID, param.getDisplayName(), _F_pipeline.view.constants.UI_PARAM_INPUT_COLOR, UI_HEIGHT, UI_WIDTH, _F_pipeline.constants.CSS_THUMBNAIL, _F_pipeline.constants.CSS_THUMBNAIL_BOX);
  1046. obj.style.cursor = "pointer";
  1047. var _self = this;
  1048. xAddEventListener(obj, "mouseOver", function(){_self.paramClick(param)});
  1049. xAddEventListener(obj, "mouseOut", function(){_self.resetHighlight(); _self.updateHighlight()});
  1050. xAddEventListener(obj, "click", function(){
  1051. var resolver = param.getResolver();
  1052. _self.paramClick(param);
  1053. _self.restoreHighlight = function(){_self.paramClick(resolver());};
  1054. _F_pipeline.ui.createDialog(DLG_ID,resolver);
  1055. _F_pipeline.ui.showDialog(DLG_ID);
  1056. });
  1057. return obj;
  1058. },
  1059. getParamOutputUI:function(param, process){
  1060. var UI_HEIGHT = 20;
  1061. var UI_WIDTH = "";
  1062. var UI_ID = param.getId();
  1063. var DLG_ID =this.getId()+ "_dlg";
  1064. var obj = _F_pipeline.ui.createBoxWithShadow(UI_ID, param.getDisplayName(),_F_pipeline.view.constants.UI_PARAM_OUTPUT_COLOR, UI_HEIGHT, UI_WIDTH, _F_pipeline.constants.CSS_THUMBNAIL, _F_pipeline.constants.CSS_THUMBNAIL_BOX);
  1065. obj.style.cursor = "pointer";
  1066. var _self = this;
  1067. xAddEventListener(obj, "mouseOver", function(){_self.paramClick(param)});
  1068. xAddEventListener(obj, "mouseOut", function(){_self.resetHighlight(); _self.updateHighlight()});
  1069. xAddEventListener(obj, "click", function(){
  1070. var resolver = param.getResolver();
  1071. _self.paramClick(param);
  1072. _self.restoreHighlight = function(){_self.paramClick(resolver());};
  1073. _F_pipeline.ui.createDialog(DLG_ID,resolver);
  1074. _F_pipeline.ui.showDialog(DLG_ID);
  1075. });
  1076. return obj;
  1077. },
  1078. getOutputUI:function(output, process){
  1079. var UI_HEIGHT = 30;
  1080. var UI_WIDTH = "";
  1081. var UI_ID = output.getId();
  1082. var DLG_ID =this.getId()+ "_dlg";
  1083. var box = _F_pipeline.ui.createBoxWithShadow(UI_ID, output.getDisplayName(), _F_pipeline.view.constants.UI_OUTPUT_COLOR, UI_HEIGHT,UI_WIDTH, _F_pipeline.constants.CSS_THUMBNAIL, _F_pipeline.constants.CSS_THUMBNAIL_BOX);
  1084. box.style.cursor = "pointer";
  1085. var _self = this;
  1086. xAddEventListener(box, "mouseOver", function(){_self.outputClick(output)});
  1087. xAddEventListener(box, "mouseOut", function(){_self.resetHighlight(); _self.updateHighlight()});
  1088. xAddEventListener(box, "click", function(){
  1089. var resolver = output.getResolver();
  1090. _self.outputClick(output);
  1091. _self.restoreHighlight = function(){_self.outputClick(resolver());}
  1092. _F_pipeline.ui.createDialog(DLG_ID,resolver);
  1093. _F_pipeline.ui.showDialog(DLG_ID);
  1094. });
  1095. return box;
  1096. },
  1097. getInputUI:function(input, process){
  1098. var UI_HEIGHT = 30;
  1099. var UI_WIDTH = "";
  1100. var UI_ID = input.getId();
  1101. var DLG_ID =this.getId()+ "_dlg";
  1102. var box = _F_pipeline.ui.createBoxWithShadow(UI_ID, input.getDisplayName(), _F_pipeline.view.constants.UI_INPUT_COLOR, UI_HEIGHT,UI_WIDTH, _F_pipeline.constants.CSS_THUMBNAIL, _F_pipeline.constants.CSS_THUMBNAIL_BOX);
  1103. box.style.cursor = "pointer";
  1104. var _self = this;
  1105. xAddEventListener(box, "mouseOver", function(){_self.inputClick(input)});
  1106. xAddEventListener(box, "mouseOut", function(){_self.resetHighlight(); _self.updateHighlight()});
  1107. xAddEventListener(box, "click", function(){
  1108. var resolver = input.getResolver();
  1109. _self.inputClick(input);
  1110. _self.restoreHighlight = function(){_self.inputClick(resolver());}
  1111. _F_pipeline.ui.createDialog(DLG_ID,resolver);
  1112. _F_pipeline.ui.showDialog(DLG_ID);
  1113. });
  1114. return box;
  1115. },
  1116. resetHighlight:function(){
  1117. var execution = _F_pipeline.getExecution(this.executionId);
  1118. var plength = execution.processes.length;
  1119. for (var h = 0 ; h < plength; h++){
  1120. var length = execution.processes[h].outputs.length;
  1121. for (var i = 0; i< length; i++){
  1122. var output = execution.processes[h].outputs[i];
  1123. _F_pipeline.ui.changeBoxColor(output.getId(), _F_pipeline.view.constants.UI_OUTPUT_COLOR);
  1124. }
  1125. length = execution.processes[h].inputs.length;
  1126. for (var i = 0; i< length; i++){
  1127. var input = execution.processes[h].inputs[i];
  1128. _F_pipeline.ui.changeBoxColor(input.getId(), _F_pipeline.view.constants.UI_INPUT_COLOR);
  1129. }
  1130. length = execution.processes[h].params.length;
  1131. for (var i = 0; i< length; i++){
  1132. var param = execution.processes[h].params[i];
  1133. _F_pipeline.ui.changeBoxColor(param.getId(), (param.initialValue ? _F_pipeline.view.constants.UI_PARAM_INPUT_COLOR : _F_pipeline.view.constants.UI_PARAM_OUTPUT_COLOR));
  1134. }
  1135. length = execution.processes[h].paramsBefore.length;
  1136. for (var i = 0; i< length; i++){
  1137. var param = execution.processes[h].paramsBefore[i];
  1138. _F_pipeline.ui.changeBoxColor(param.getId(), (param.initialValue ? _F_pipeline.view.constants.UI_PARAM_INPUT_COLOR : _F_pipeline.view.constants.UI_PARAM_OUTPUT_COLOR));
  1139. }
  1140. length = execution.processes[h].traces.length;
  1141. for (var i = 0; i< length; i++){
  1142. var trace = execution.processes[h].traces[i];
  1143. _F_pipeline.ui.changeBoxColor(trace.getId(), _F_pipeline.view.constants.UI_TRACE_COLOR);
  1144. }
  1145. }
  1146. },
  1147. paramClick:function(param){
  1148. this.resetHighlight();
  1149. _F_pipeline.ui.changeBoxColor(param.getId(), _F_pipeline.view.constants.UI_SELECTED_COLOR);
  1150. if (param.getProcess().getExecution){
  1151. var execution = param.getProcess().getExecution();
  1152. var processes= execution.getProcesses();
  1153. var length = processes.length;
  1154. for (var i = 0; i< length; i++){
  1155. var process = processes[i];
  1156. var paramsIn = process.getParamInitialValues();
  1157. var plength = paramsIn.length;
  1158. for (var j = 0; j< plength; j++){
  1159. if (paramsIn[j] == param)
  1160. continue;
  1161. if (paramsIn[j].getName() == param.getName())
  1162. _F_pipeline.ui.changeBoxColor(paramsIn[j].getId(),paramsIn[j].getContent() == param.getContent()? _F_pipeline.view.constants.UI_RELATED_EQUAL_COLOR : _F_pipeline.view.constants.UI_RELATED_COLOR);
  1163. }
  1164. var paramsOut = process.getParams();
  1165. plength = paramsOut.length;
  1166. for (var j = 0; j< plength; j++){
  1167. if (paramsOut[j] == param)
  1168. continue;
  1169. if (paramsOut[j].getName() == param.getName())
  1170. _F_pipeline.ui.changeBoxColor(paramsOut[j].getId(), paramsOut[j].getContent() == param.getContent()? _F_pipeline.view.constants.UI_RELATED_EQUAL_COLOR : _F_pipeline.view.constants.UI_RELATED_COLOR);
  1171. }
  1172. }
  1173. }
  1174. },
  1175. outputClick:function(output){
  1176. this.resetHighlight();
  1177. _F_pipeline.ui.changeBoxColor(output.getId(), _F_pipeline.view.constants.UI_SELECTED_COLOR);
  1178. if (output.getProcess().getExecution){
  1179. var execution = output.getProcess().getExecution();
  1180. var processes= execution.getProcesses();
  1181. var length = processes.length;
  1182. for (var i = 0; i< length; i++){
  1183. var process = processes[i];
  1184. var inputs = process.getInputs();
  1185. var plength = inputs.length;
  1186. for (var j = 0; j< plength; j++){
  1187. if (inputs[j].getLabel() == output.getLabel())
  1188. _F_pipeline.ui.changeBoxColor(inputs[j].getId(), _F_pipeline.view.constants.UI_RELATED_EQUAL_COLOR);
  1189. }
  1190. }
  1191. }
  1192. },
  1193. traceClick:function(trace){
  1194. this.resetHighlight();
  1195. _F_pipeline.ui.changeBoxColor(trace.getId(), _F_pipeline.view.constants.UI_SELECTED_COLOR);
  1196. },
  1197. inputClick:function(input){
  1198. this.resetHighlight();
  1199. _F_pipeline.ui.changeBoxColor(input.getId(), _F_pipeline.view.constants.UI_SELECTED_COLOR);
  1200. if (input.getProcess().getExecution){
  1201. var execution = input.getProcess().getExecution();
  1202. var processes= execution.getProcesses();
  1203. var length = processes.length;
  1204. for (var i = 0; i< length; i++){
  1205. var process = processes[i];
  1206. var outputs = process.getOutputs();
  1207. var plength = outputs.length;
  1208. for (var j = 0; j< plength; j++){
  1209. if (outputs[j].getLabel() == input.getLabel())
  1210. _F_pipeline.ui.changeBoxColor(outputs[j].getId(), _F_pipeline.view.constants.UI_RELATED_EQUAL_COLOR);
  1211. }
  1212. var inputs = process.getInputs();
  1213. plength = inputs.length;
  1214. for (var j = 0; j< plength; j++){
  1215. if (inputs[j] == input)
  1216. continue;
  1217. if (inputs[j].getLabel() == input.getLabel())
  1218. _F_pipeline.ui.changeBoxColor(inputs[j].getId(), _F_pipeline.view.constants.UI_RELATED_EQUAL_COLOR);
  1219. }
  1220. }
  1221. }
  1222. },
  1223. update: function(dialog){
  1224. dialog.setContent(this.getUI());
  1225. dialog.setTitle(_F_pipeline.getExecution(this.executionId).getName());
  1226. this.updateHighlight();
  1227. },
  1228. updateHighlight: function(dialog){
  1229. if (this.restoreHighlight)
  1230. this.restoreHighlight();
  1231. }
  1232. }
  1233. _F_pipeline.view.toolbar = function(executionId, name, loader){
  1234. this.executionId = executionId;
  1235. this.name = name;
  1236. this.loader = loader;
  1237. this.loaded = false;
  1238. if (_F_pipeline.getExecution(executionId) != null)
  1239. this.load();
  1240. }
  1241. _F_pipeline.view.toolbar.prototype = {
  1242. getUI: function(){
  1243. var viewId = this.getId();
  1244. var div = _F_pipeline.ui.div(null, this.getId());
  1245. _F_pipeline.ui.text(div, "DEBUG MODE (" + this.name+"): ");
  1246. var _self = this;
  1247. _F_pipeline.ui.textWithOnclick(div, "Pipeline View", function(){
  1248. if (!_self.loaded){
  1249. _self.load();
  1250. }
  1251. DOCKING_MANAGER.dock('left',viewId);
  1252. _F_pipeline.ui.showDialog(viewId);
  1253. });
  1254. return div ;
  1255. },
  1256. getId: function(){
  1257. return this.executionId;
  1258. },
  1259. load: function(){
  1260. if (!this.loaded){
  1261. if (this.loader != null)
  1262. this.loader();
  1263. var viewId = this.getId();
  1264. var pipelineView = _F_pipeline.view.views[viewId];
  1265. if (pipelineView == null){
  1266. pipelineView = new _F_pipeline.view.pipelineView(this.executionId);
  1267. _F_pipeline.view.views[viewId] = pipelineView;
  1268. }
  1269. _F_pipeline.ui.createDialog(viewId, function(){ return pipelineView;});
  1270. this.loaded = true;
  1271. }
  1272. }
  1273. }
  1274. _F_pipeline.executions = {};
  1275. _F_pipeline.view.views = {};
  1276. _F_pipeline.getExecution = function(id){
  1277. return _F_pipeline.executions[id];
  1278. }
  1279. _F_pipeline.attach = function(fragment, executionId, loader){
  1280. var toolbar = new _F_pipeline.view.toolbar(executionId, fragment.title, loader);
  1281. fragment.addEventListener("fragment.load", function(){
  1282. $(fragment.id + "debugViewContainer").innerHTML="";
  1283. $(fragment.id +"debugViewContainer").appendChild(toolbar.getUI());
  1284. _F_pipeline.ui.updateDialogs();
  1285. });
  1286. }
  1287. fragment.prototype.oldRenderURI= fragment.prototype.renderURI;
  1288. fragment.prototype.renderURI = function(params){
  1289. var p = this.oldRenderURI(params);
  1290. if (p.indexOf("?") != -1)
  1291. p = p + "&";
  1292. else
  1293. p = p + "?";
  1294. p = p + "frag-debug=fragment";
  1295. return p;
  1296. }