Activity.js 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244
  1. MWF.xDesktop.requireApp("process.ProcessDesigner", "Property", null, false);
  2. MWF.xApplication.process.ProcessDesigner.Activity = new Class({
  3. initialize: function(data, process){
  4. this.data = data;
  5. this.process = process;
  6. this.paper = this.process.paper;
  7. if (!this.data.edition) this.data.edition = (new o2.widget.UUID()).toString();
  8. this.routes = [];
  9. this.fromRoutes = [];
  10. // this.decisions = [];
  11. // this.fromDecisions = [];
  12. // this.fromRoutes = [];
  13. this.setType();
  14. this.setStyle();
  15. this.setSize();
  16. this.getPoint();
  17. this.selectedMultiStatus = false;
  18. this.positionLoaded = false;
  19. },
  20. setType: function(){
  21. this.type = "activity";
  22. this.data.type = "activity";
  23. },
  24. setStyle: function(){
  25. this.style = this.process.css.activity["default"];
  26. },
  27. setSize: function(){
  28. var size = MWF.getTextSize(this.data.name, this.style.text);
  29. this.width = size.x+38;
  30. this.width = this.width<100 ? 100: this.width;
  31. this.height = 40;
  32. },
  33. getPoint: function(){
  34. var parentNode = $(this.paper.canvas).getParent() || this.process.designer.paperInNode;
  35. this.paperSize = parentNode.getSize();
  36. this.paperOriginalSize = {x: this.paperSize.x*0.99, y: this.paperSize.y*0.99};
  37. var height = this.paperSize.y;
  38. var width = this.paperSize.x;
  39. this.top = height/2;
  40. this.left = width/2;
  41. this.center = {x: this.left, y: this.top};
  42. this.point = {x: this.left-(this.width/2), y: this.top-(this.height/2)};
  43. },
  44. resetPoint: function(){
  45. this.center = {x: this.point.x + this.width/2, y: this.point.y + this.height/2};
  46. },
  47. checkUUID: function(){
  48. for (var i=0; i<this.routes.length; i++){
  49. delete this.process.routes[this.routes[i].data.id];
  50. delete this.process.routeDatas[this.routes[i].data.id];
  51. this.routes[i].data.id = this.process.checkUUIDs.pop().id;
  52. this.routes[i].data.process = this.process.process.id;
  53. this.setRouteData(this.routes[i].data.id, i);
  54. //this.data.routeList[i] = this.routes[i].data.id;
  55. this.routes[i].data.activity = this.routes[i].toActivity.data.id;
  56. this.process.routes[this.routes[i].data.id] = this.routes[i];
  57. this.process.routeDatas[this.routes[i].data.id] = this.routes[i].data;
  58. }
  59. },
  60. loaded: function(callback){
  61. if (this.positionLoaded){
  62. if (callback) callback();
  63. }
  64. },
  65. load : function(callback){
  66. if (this.process.isNewProcess){
  67. this.data.createTime = new Date().format('db');
  68. this.data.updateTime = new Date().format('db');
  69. }
  70. this.draw();
  71. this.setActivityPosition(function(){
  72. this.positionLoaded = true;
  73. this.loaded(callback);
  74. }.bind(this));
  75. this.setEvent();
  76. if (this.process.activityListNode) this.addToActivityList();
  77. // this.setPosition(100,100);
  78. },
  79. addToActivityList: function(){
  80. this.listItem = new MWF.APPPD.Activity.List(this);
  81. this.listItem.load();
  82. },
  83. create: function(point){
  84. this.point = point || {x: 100, y: 100};
  85. this.center = {"x": this.point.x+(this.width/2), "y": this.point.y+(this.height/2)};
  86. //this.center = center || {x: 100, y: 100};
  87. //this.point = {x: this.center.x-(this.width/2), y: this.center.y-(this.height/2)};
  88. this.draw();
  89. this.setEvent();
  90. if (this.process.activityListNode) this.addToActivityList();
  91. },
  92. setEvent: function(){
  93. if (!this.process.options.isView){
  94. this.set.drag(
  95. function(dx, dy, x, y, e){
  96. if (!e.rightClick){
  97. if (this.process.selectedActivitys.length){
  98. this.noselected = true;
  99. this.process.selectedActivitys.each(function(activity){
  100. activity.activityMove(dx, dy, x, y);
  101. });
  102. }else{
  103. this.activityMove(dx, dy, x, y);
  104. }
  105. }
  106. }.bind(this),
  107. function(x, y, e){
  108. if (!e.rightClick){
  109. if (this.process.selectedActivitys.length){
  110. this.process.selectedActivitys.each(function(activity){
  111. activity.activityMoveStart();
  112. });
  113. }else{
  114. this.activityMoveStart();
  115. }
  116. }
  117. }.bind(this),
  118. function(e){
  119. if (!e.rightClick){
  120. if (this.process.selectedActivitys.length){
  121. this.process.selectedActivitys.each(function(activity){
  122. activity.activityMoveEnd();
  123. });
  124. }else{
  125. this.activityMoveEnd();
  126. }
  127. }
  128. }.bind(this)
  129. );
  130. //this.set.drag(
  131. // function(dx, dy, x, y, e){}.bind(this),
  132. // function(x, y, e){}.bind(this),
  133. // function(e){}.bind(this)
  134. //);
  135. this.set.click(function(e){
  136. if (this.process.isCreateRoute){
  137. // this.checkCreateRoute();
  138. }else{
  139. if (this.process.selectedActivitys.length){
  140. if (!this.noselected){
  141. if (this.process.currentSelected != this){
  142. this.selected();
  143. }
  144. }
  145. this.noselected = false;
  146. }
  147. }
  148. e.stopPropagation();
  149. }.bind(this));
  150. this.set.dblclick(function(){
  151. this.quickCreateRoute();
  152. }.bind(this));
  153. // this.set.mouseup(function(e){
  154. // }.bind(this));
  155. this.set.mousedown(function(e){
  156. if (this.process.isCreateRoute){
  157. this.checkCreateRoute();
  158. }else{
  159. if (!this.process.selectedActivitys.length){
  160. if (this.process.currentSelected != this){
  161. this.selected();
  162. }
  163. }
  164. }
  165. //this.checkCreateRoute();
  166. e.stopPropagation();
  167. }.bind(this));
  168. // this.shap.node.mousedown(function(e){
  169. // e.stop();
  170. // });
  171. // this.text.node.mousedown(function(e){
  172. // e.stop();
  173. // });
  174. // this.icon.node.mousedown(function(e){
  175. // e.stop();
  176. // });
  177. this.set.hover(this.mouseHover.bind(this), function(){
  178. if (this.process.isCreateRoute || this.process.isCopyRoute || this.process.isChangeRouteTo || this.process.isChangeRouteFrom){
  179. this.shap.attr(this.style.shap);
  180. }
  181. }.bind(this));
  182. this.set.mouseup(function(){
  183. this.mouseUp();
  184. }.bind(this));
  185. }
  186. },
  187. mouseHover: function(){
  188. if (this.process.isCreateRoute || this.process.isCopyRoute || this.process.isChangeRouteTo || this.process.isChangeRouteFrom){
  189. this.shap.attr({"stroke-width": "2"});
  190. }
  191. },
  192. mouseUp: function(){
  193. if (this.process.isChangeRouteTo){
  194. this.process.currentChangeRoute.setActivity(this, null);
  195. this.process.currentChangeRoute.isBack = false;
  196. this.process.currentChangeRoute.positionPoints = this.process.currentChangeRoute.getRoutePoint();
  197. this.process.currentChangeRoute.reload();
  198. this.process.isChangeRouteTo = false;
  199. this.process.currentChangeRoute = null;
  200. }
  201. if (this.process.isChangeRouteFrom){
  202. this.process.currentChangeRoute.setActivity(null, this);
  203. this.process.currentChangeRoute.isBack = false;
  204. this.process.currentChangeRoute.positionPoints = this.process.currentChangeRoute.getRoutePoint();
  205. this.process.currentChangeRoute.reload();
  206. this.process.isChangeRouteFrom = false;
  207. this.process.currentChangeRoute = null;
  208. }
  209. this.shap.attr(this.style.shap);
  210. },
  211. quickCreateRoute: function(){
  212. this.process.createRoute();
  213. this.process.routeCreateFromActivity(this);
  214. },
  215. checkCreateRoute: function(){
  216. if (this.process.isCreateRoute){
  217. var route = this.process.currentCreateRoute;
  218. if (!route.fromActivity){
  219. this.process.routeCreateFromActivity(this);
  220. }else{
  221. debugger;
  222. this.process.routeCreateToActivity(this);
  223. }
  224. }
  225. if (this.process.isCopyRoute){
  226. this.process.routeAddFromActivity(this);
  227. }
  228. },
  229. draw: function(){
  230. this.set = this.paper.set();
  231. this.shap = this.createShap();
  232. // this.shadow = this.careteShadow();
  233. this.text = this.createText();
  234. this.icon = this.createIcon();
  235. this.set.push(this.shadow, this.shap, this.text, this.icon);
  236. },
  237. redraw: function(){
  238. this.setSize();
  239. this.resetPoint();
  240. if (this.shap) this.redrawShap();
  241. if (this.text) this.redrawText();
  242. if (this.icon) this.redrawIcon();
  243. if (this.bBox) this.redrawBox();
  244. if (this.listItem) this.redrawListItem();
  245. this.redrawRoute();
  246. },
  247. careteShadow: function(){
  248. var shadow;
  249. shadow = this.shap.glow({
  250. "width": 10,
  251. "fill": true,
  252. "opacity": 0.2,
  253. "offsetx": 0,
  254. "offsety": 0,
  255. "color": "#aaa"
  256. });
  257. shadow.data("bind", this);
  258. return shadow;
  259. },
  260. createShap: function(){
  261. var shap;
  262. shap = this.paper.rectPath(this.point.x, this.point.y, this.width, this.height, this.style.shap.radius);
  263. shap.attr(this.style.shap);
  264. shap.data("bind", this);
  265. return shap;
  266. },
  267. createText: function(){
  268. var atts = this.getTextIconPoint();
  269. text = this.paper.text(atts.tatt.x, atts.tatt.y, this.data.name);
  270. text.attr(this.style.text);
  271. if (this.style.text.display=="none"){
  272. text.hide();
  273. }
  274. return text;
  275. },
  276. createIcon: function(){
  277. var atts = this.getTextIconPoint();
  278. var icon = this.paper.image(this.style.icon.src, atts.iatt.x, atts.iatt.y, 16, 16);
  279. icon.attr(this.style.icon.attr);
  280. return icon;
  281. },
  282. redrawShap: function(){
  283. var shapPath = MWFRaphael.getRectPath(this.point.x, this.point.y, this.width, this.height, this.style.shap.radius);
  284. this.shap.attr("path", shapPath);
  285. },
  286. redrawText: function(){
  287. var atts = this.getTextIconPoint();
  288. this.text.attr({
  289. "x": atts.tatt.x,
  290. "y": atts.tatt.y,
  291. "text": this.data.name
  292. });
  293. },
  294. redrawIcon: function(){
  295. var atts = this.getTextIconPoint();
  296. this.icon.attr({
  297. "x": atts.iatt.x,
  298. "y": atts.iatt.y
  299. });
  300. },
  301. redrawBox: function(){
  302. this.set.exclude(this.bBox);
  303. this.bBox.remove();
  304. this.bBox = null;
  305. var bBox = this.set.getBBox();
  306. this.bBox = this.paper.rectPath(bBox.x-3, bBox.y-3, bBox.width+6, bBox.height+6, 0);
  307. this.bBox.attr(this.process.css.activity.box);
  308. this.set.push(this.bBox);
  309. // var bBox = this.set.getBBox();
  310. // var boxPath = MWFRaphael.getRectPath(bBox.x-3, bBox.y-3, bBox.width+6, bBox.height+6, 0);
  311. // this.bBox.attr("path", boxPath);
  312. },
  313. redrawListItem: function(){
  314. var nameTd = this.listItem.row.tds[1];
  315. nameTd.set("text", this.data.name);
  316. },
  317. loadRoutes: function(){
  318. var routeIds = this.getRoutedata();
  319. routeIds.each(function(id){
  320. if (this.process.routes[id]){
  321. this.routes.push(this.process.routes[id]);
  322. this.process.routes[id].setActivity(null, this);
  323. this.process.routes[id].load();
  324. }
  325. }.bind(this));
  326. },
  327. getRoutedata: function(){
  328. if (!this.data.routeList) this.data.routeList = [];
  329. this.data.routeList = this.data.routeList.clean();
  330. return this.data.routeList;
  331. },
  332. setRouteData: function(id, i){
  333. var index = (i || i==0) ? i : null;
  334. if (!this.data.routeList) this.data.routeList = [];
  335. if (index!=null && index<=this.data.routeList.length){
  336. var idx = this.data.routeList.indexOf(id);
  337. if (idx==-1) this.data.routeList[index] = id;
  338. }else{
  339. if (this.data.routeList.indexOf(id)==-1) this.data.routeList.push(id);
  340. }
  341. },
  342. removeRouteData: function(id){
  343. if (!this.data.routeList) this.data.routeList = [];
  344. this.data.routeList.erase(id);
  345. },
  346. // loadDecisions: function(){
  347. // if (this.data.decisionIdList){
  348. // if (typeOf(this.data.decisionIdList).toLowerCase() == "array"){
  349. // this.data.decisionIdList.each(function(id){
  350. // var item = this.process.decisionDatas[id];
  351. // var decision = new MWF.PCDecision(item, this.process, this);
  352. // this.decisions.push(decision);
  353. // decision.load();
  354. // }.bind(this));
  355. // }else{
  356. // var item = this.process.decisionDatas[this.data.decisionIdList];
  357. // var decision = new MWF.PCDecision(item, this.process, this);
  358. // this.decisions.push(decision);
  359. // decision.load();
  360. // }
  361. // };
  362. // },
  363. redrawRoute: function(path){
  364. this.routes.each(function(route){
  365. route.reload(path,null);
  366. });
  367. this.fromRoutes.each(function(route){
  368. route.reload(null,path);
  369. });
  370. },
  371. activityMove: function(dx, dy, tox, toy){
  372. //var moveSet = this.set.clone();
  373. if (!this.set.isFront){
  374. this.set.toFront();
  375. this.set.isFront = true;
  376. }
  377. var paperSize = this.process.getPaperSize();
  378. if ((this.set.ox+dx)<0) dx = 0 - this.set.ox;
  379. if ((this.set.ox+dx+this.width)>paperSize.x){
  380. //this.paperSize.x = this.set.ox+dx+this.width;
  381. this.process.setPaperSizeX( this.set.ox+dx+this.width );
  382. this.paper.setSize(paperSize.x, paperSize.y);
  383. //alert("set width");
  384. $(this.paper.canvas).getParent().setStyle("width", ""+paperSize.x+"px");
  385. }
  386. //if ((this.set.ox+dx+this.width)<this.paperOriginalSize.x){
  387. // if (this.paperSize.x > this.paperOriginalSize.x){
  388. // this.paperSize.x = this.paperOriginalSize.x;
  389. // this.paper.setSize(this.paperOriginalSize.x, this.paperSize.y);
  390. // //alert("set width");
  391. // $(this.paper.canvas).getParent().setStyle("width", ""+this.paperSize.x+"px");
  392. // }
  393. //}
  394. if ((this.set.oy + dy)<0) dy = 0 - this.set.oy;
  395. if ((this.set.oy + dy+this.height)>paperSize.y){
  396. //this.paperSize.y = this.set.oy + dy+this.height;
  397. this.process.setPaperSizeY( this.set.oy + dy+this.height );
  398. this.paper.setSize(paperSize.x, paperSize.y);
  399. //alert("set height");
  400. $(this.paper.canvas).getParent().setStyle("height", ""+paperSize.y+"px");
  401. }
  402. //if ((this.set.oy + dy+this.height)<this.paperOriginalSize.y){
  403. // if (this.paperSize.y > this.paperOriginalSize.y){
  404. // this.paperSize.y = this.paperOriginalSize.y;
  405. // this.paper.setSize(this.paperSize.x, this.paperSize.y);
  406. // $(this.paper.canvas).getParent().setStyle("height", ""+this.paperSize.y+"px");
  407. // }
  408. //}
  409. // if (this.process.isGrid){
  410. var toX = Raphael.snapTo(10, this.set.ox + dx + this.width/2, 10);
  411. var toY = Raphael.snapTo(10, this.set.oy + dy + this.height/2, 10);
  412. dx = toX - this.set.ox - this.width/2;
  413. dy = toY - this.set.oy - this.height/2;
  414. // }
  415. // this.shap.transform("t"+dx+","+dy);
  416. // if (this.bBox) this.bBox.transform("t"+dx+","+dy);
  417. // var path = this.shap.attr("path");
  418. path = Raphael.transformPath(this.set.shapPath, "t"+dx+","+dy);
  419. this.shap.attr("path", path);
  420. //this.cloneMoveShap.attr("path", path);
  421. //
  422. //return ;
  423. // this.shap.transform("t0,0");
  424. if (this.bBox){
  425. // var boxPath = this.bBox.attr("path");
  426. var bBox = this.shap.getBBox();
  427. boxPath = MWFRaphael.getRectPath(bBox.x-3, bBox.y-3, bBox.width+6, bBox.height+6, 0);
  428. //boxPath = Raphael.transformPath(this.set.boxPath, "t"+dx+","+dy);
  429. this.bBox.attr("path", boxPath);
  430. // this.bBox.transform("t0,0");
  431. }
  432. this.point = {x: this.set.ox + dx, y: this.set.oy + dy};
  433. this.center = {x: this.set.ox + dx + this.width/2, y: this.set.oy + dy + this.height/2};
  434. var atts = this.getMoveTextIconPoint();
  435. this.text.attr(atts.tatt);
  436. this.icon.attr(atts.iatt);
  437. this.routes.each(function(route){
  438. if (this.process.selectedActivitys.indexOf(route.toActivity) !== -1){
  439. route.corners.each(function(corner, idx){
  440. // var p = this.positionPoints[idx];
  441. var p = corner.data("point");
  442. var cx = p.x.toFloat()+dx.toFloat();
  443. var cy = p.y.toFloat()+dy.toFloat();
  444. var cornerPath = MWFRaphael.getRectPath(cx-2.5,cy-2.5, 5, 5, 0);
  445. corner.attr("path", cornerPath);
  446. route.positionPoints[idx] = {"x": cx, "y": cy};
  447. route.data.track = route.positionPointsToString();
  448. }.bind(this));
  449. }
  450. if (route.data.position){
  451. var t = route.getTextPoint();
  452. var tx = t.x.toFloat() + dx.toFloat() - this.set.movex;
  453. var ty = t.y.toFloat() + dy.toFloat() - this.set.movey;
  454. route.text.attr({
  455. "x": tx,
  456. "y": ty
  457. });
  458. route.data.position = tx + "," + ty;
  459. }
  460. }.bind(this));
  461. this.set.movex = dx;
  462. this.set.movey = dy;
  463. this.redrawRoute();
  464. this.paper.safari();
  465. },
  466. activityMoveStart: function(){
  467. this.set.isFront = false;
  468. var box = this.shap.getBBox();
  469. this.set.ox = box.x;
  470. this.set.oy = box.y;
  471. this.set.movex = 0;
  472. this.set.movey = 0;
  473. this.set.animate({
  474. "fill-opacity": .5
  475. },
  476. 500
  477. );
  478. this.set.shapPath = this.shap.attr("path");
  479. if (this.bBox) this.set.boxPath = this.bBox.attr("path")
  480. //this.cloneMoveShap = this.shap.clone();
  481. //
  482. //this.cloneMoveShap.animate({
  483. // "fill-opacity": .3
  484. // },
  485. // 200
  486. //);
  487. this.routes.each(function(route){
  488. if (this.process.selectedActivitys.indexOf(route.toActivity) != -1){
  489. route.corners.each(function(corner, idx){
  490. var p = route.positionPoints[idx];
  491. corner.data("point", p);
  492. }.bind(this));
  493. }
  494. }.bind(this));
  495. },
  496. activityMoveEnd: function(){
  497. this.center.x = this.center.x.toInt();
  498. this.center.y = this.center.y.toInt();
  499. this.data.position = this.center.x+","+this.center.y;
  500. this.set.animate({"fill-opacity": 1}, 500);
  501. // this.reSizePaper(this.center.x, this.center.y);
  502. // this.cloneMoveShap.remove();
  503. },
  504. setActivityPosition: function(callback){
  505. var x;
  506. var y;
  507. if (this.data.position){
  508. var tmp = this.data.position.split(/(?:,\s*){1}|(?:;\s*){1}/g);
  509. x = tmp[0];
  510. y = tmp[1];
  511. }else{
  512. // this.paperSize.x;
  513. // this.paperSize.y;
  514. var xi = Math.random();
  515. x = ((this.paperSize.x-300) * xi).toInt();
  516. var yi = Math.random();
  517. y = ((this.paperSize.y-300) * yi).toInt();
  518. this.data.position = x+","+y;
  519. }
  520. this.reSizePaper(x, y);
  521. this.setPosition(x.toFloat(), y.toFloat(), null, callback);
  522. },
  523. reSizePaper: function(x, y){
  524. //this.paperSize = $(this.paper.canvas).getParent().getSize();
  525. // if (x>this.paperSize.x) this.process.designer.paperNode.setStyle("height", x);
  526. // if (y>this.paperSize.y) this.process.designer.paperNode.setStyle("width", y);
  527. y = y.toFloat()+this.height.toFloat();
  528. x = x.toFloat()+this.width.toFloat();
  529. if (x>this.paperSize.x){
  530. this.paper.setSize(x*0.99, this.paperSize.y);
  531. $(this.paper.canvas).getParent().setStyle("width", ""+x+"px");
  532. this.paperSize.x = x;
  533. }
  534. if (y>this.paperSize.y){
  535. this.paper.setSize(this.paperSize.x*0.99, y);
  536. $(this.paper.canvas).getParent().setStyle("height", ""+y+"px");
  537. this.paperSize.y = y;
  538. }
  539. },
  540. setPosition: function(x, y, time, callback){
  541. x = x.toFloat();
  542. y = y.toFloat();
  543. if (!time) time = 300;
  544. var mx = x-(this.center.x.toFloat());
  545. var my = y-(this.center.y.toFloat());
  546. this.center = {x: x, y: y};
  547. this.point = {x: x-(this.width/2), y: y-(this.height/2)};
  548. var path = this.shap.attr("path");
  549. var path = Raphael.transformPath(path, "t"+mx+","+my);
  550. var atts = this.getTextIconPoint();
  551. this.shap.animate({"path": path}, time, "<>", callback);
  552. this.text.animate(atts.tatt, time, "<>");
  553. this.icon.animate(atts.iatt, time, "<>");
  554. // this.animateLine(time);
  555. },
  556. getTextIconPoint: function(){
  557. var t_att = {x: this.center.x+10, y: this.center.y};
  558. var i_att = {x: this.center.x-(this.width/2)+8, y: this.center.y-8};
  559. return {"tatt": t_att, "iatt": i_att};
  560. },
  561. getMoveTextIconPoint: function(){
  562. return this.getTextIconPoint();
  563. },
  564. showProperty: function(){
  565. if (!this.property){
  566. this.property = new MWF.APPPD.Activity.Property(this, {
  567. "onPostLoad": function(){
  568. this.property.show();
  569. }.bind(this)
  570. });
  571. this.property.load();
  572. }else{
  573. this.property.show();
  574. }
  575. },
  576. selectedMulti: function(){
  577. if (!this.bBox){
  578. var bBox = this.shap.getBBox();
  579. this.bBox = this.paper.rectPath(bBox.x-3, bBox.y-3, bBox.width+6, bBox.height+6, 0);
  580. this.bBox.attr(this.process.css.activity.box);
  581. this.set.push(this.bBox);
  582. }
  583. this.process.selectedActivitys.push(this);
  584. this.process.selectedActivityDatas.push(this.data);
  585. if (this.listItem) this.listItem.listUnSelected();
  586. if (this.property) this.property.hide();
  587. this.selectedMultiStatus = true;
  588. },
  589. unSelectedMulti: function(){
  590. if (this.bBox){
  591. this.set.exclude(this.bBox);
  592. this.bBox.remove();
  593. this.bBox = null;
  594. }
  595. this.selectedMultiStatus = false;
  596. },
  597. selected: function(){
  598. // if (this.process.jsonParse) {
  599. // window.setTimeout(function(){this.process.jsonParse.stopParseJson = true;}.bind(this), 1);
  600. // }
  601. try{
  602. this.process.designer.paperInNode.focus();
  603. }catch(e){};
  604. this.activitySelected();
  605. if (this.listItem) this.listItem.listSelected();
  606. // if (this.process.property) this.process.property.hide();
  607. window.setTimeout(function(){this.showProperty()}.bind(this), 10);
  608. // this.showQuickAction();
  609. },
  610. unSelected: function(){
  611. this.activityUnSelected();
  612. if (this.listItem) this.listItem.listUnSelected();
  613. if (this.property) this.property.hide();
  614. },
  615. showQuickAction: function(){
  616. this.getQuickActionJson(function(){
  617. this.quickActionJson.each(function(action, idx){
  618. var y = this.point.y-20;
  619. var x = this.point.x + (20*idx);
  620. var actionNode = this.paper.image(this.process.path+this.process.options.style+"/quickAction/"+action.icon, x, y, 16, 16);
  621. actionNode.toFront();
  622. //var actionNode = new Element("div", {
  623. // "styles": {
  624. // "top":this.center.y,
  625. // "left": this.center.x,
  626. // "height": "24px",
  627. // "width": "24px",
  628. // "position": "absolute",
  629. // "background-color": "red",
  630. // "z-index": "50000"
  631. // }
  632. //}).inject(this.process.designer.paperNode)
  633. }.bind(this));
  634. }.bind(this));
  635. },
  636. getQuickActionJson: function(callback){
  637. if (!this.quickActionJson){
  638. MWF.getJSON(this.process.path+"action.json", {
  639. "onSuccess": function(obj){
  640. var defaultActions = obj["default"];
  641. var myActions = obj[this.type];
  642. this.quickActionJson = defaultActions.concat(myActions);
  643. if (callback) callback();
  644. }.bind(this),
  645. "onerror": function(text){
  646. this.notice(text, "error");
  647. }.bind(this),
  648. "onRequestFailure": function(xhr){
  649. this.notice(xhr.responseText, "error");
  650. }.bind(this)
  651. });
  652. }else{
  653. if (callback) callback();
  654. }
  655. },
  656. activitySelected: function(){
  657. //if (this.process.currentSelected) this.process.currentSelected.unSelected();
  658. this.process.unSelectedAll();
  659. if (!this.bBox){
  660. var bBox = this.shap.getBBox();
  661. this.bBox = this.paper.rectPath(bBox.x-3, bBox.y-3, bBox.width+6, bBox.height+6, 0);
  662. this.bBox.attr(this.process.css.activity.box);
  663. this.set.push(this.bBox);
  664. }
  665. this.process.currentSelected = this;
  666. },
  667. activityUnSelected: function(){
  668. this.process.currentSelected = null;
  669. if (this.bBox){
  670. this.set.exclude(this.bBox);
  671. this.bBox.remove();
  672. this.bBox = null;
  673. }
  674. },
  675. addRouteData: function(id){
  676. if (this.data.routeList.indexOf(id)==-1) this.data.routeList.push(id);
  677. },
  678. destroy: function(){
  679. if (this.type=="begin"){
  680. this.process.begin = null;
  681. this.process.process.begin = null;
  682. }
  683. this.routes.each(function(r){
  684. r.destroy();
  685. });
  686. this.fromRoutes.each(function(r){
  687. r.destroy();
  688. });
  689. if (this.listItem){
  690. this.listItem.row.tr.destroy();
  691. }
  692. var activitys = {};
  693. for (aid in this.process[this.type+"s"]){
  694. if (aid!=this.data.id){
  695. activitys[aid] = this.process[this.type+"s"][aid];
  696. }else{
  697. this.process[this.type+"s"][aid] = null;
  698. }
  699. }
  700. this.process[this.type+"s"] = null;
  701. this.process[this.type+"s"] = activitys;
  702. this.process.activitys.erase(this);
  703. if (this.process.process[this.type+"List"]) this.process.process[this.type+"List"].erase(this.data);
  704. this.set.remove();
  705. }
  706. });
  707. MWF.APPPD.Activity.SingleRouter = new Class({
  708. Extends: MWF.APPPD.Activity,
  709. getRoutedata: function(){
  710. if (!this.data.route) this.data.route = "";
  711. return [this.data.route];
  712. },
  713. setRouteData: function(id){
  714. if (!this.data.route) this.data.route = "";
  715. this.data.route = id;
  716. },
  717. removeRouteData: function(id){
  718. this.data.route = "";
  719. },
  720. quickCreateRoute: function(){
  721. if (!this.routes.length){
  722. this.process.createRoute();
  723. this.process.routeCreateFromActivity(this);
  724. }
  725. },
  726. checkCreateRoute: function(){
  727. if (this.process.isCreateRoute){
  728. var route = this.process.currentCreateRoute;
  729. if (!route.fromActivity){
  730. if (!this.routes.length) this.process.routeCreateFromActivity(this);
  731. }else{
  732. this.process.routeCreateToActivity(this);
  733. }
  734. }
  735. if (this.process.isCopyRoute){
  736. if (!this.routes.length) this.process.routeAddFromActivity(this);
  737. }
  738. },
  739. mouseHover: function(){
  740. if (this.process.isCreateRoute){
  741. var route = this.process.currentCreateRoute;
  742. if (!route.fromActivity){
  743. if (!this.routes.length) this.shap.attr({"stroke-width": "2"});
  744. }else{
  745. this.shap.attr({"stroke-width": "2"});
  746. }
  747. }
  748. if (this.process.isChangeRouteTo){
  749. this.shap.attr({"stroke-width": "2"});
  750. }
  751. if (this.process.isChangeRouteFrom || this.process.isCopyRoute){
  752. if (!this.routes.length) this.shap.attr({"stroke-width": "2"});
  753. }
  754. },
  755. mouseUp: function(){
  756. if (this.process.isChangeRouteTo){
  757. this.process.currentChangeRoute.setActivity(this, null);
  758. this.process.currentChangeRoute.isBack = false;
  759. this.process.currentChangeRoute.positionPoints = this.process.currentChangeRoute.getRoutePoint();
  760. this.process.currentChangeRoute.reload();
  761. this.process.isChangeRouteTo = false;
  762. this.process.currentChangeRoute = null;
  763. }
  764. if (this.process.isChangeRouteFrom){
  765. if (!this.routes.length){
  766. this.process.currentChangeRoute.setActivity(null, this);
  767. this.process.currentChangeRoute.isBack = false;
  768. this.process.currentChangeRoute.positionPoints = this.process.currentChangeRoute.getRoutePoint();
  769. this.process.currentChangeRoute.reload();
  770. this.process.isChangeRouteFrom = false;
  771. this.process.currentChangeRoute = null;
  772. }
  773. }
  774. this.shap.attr(this.style.shap);
  775. },
  776. addRouteData: function(id){
  777. if (!this.data.route) this.data.route = id;
  778. }
  779. });
  780. MWF.APPPD.Activity.Circle = new Class({
  781. Extends: MWF.APPPD.Activity,
  782. setSize: function(){
  783. if (this.style.text.display=="none"){
  784. this.width = this.style.shap.width;
  785. this.height = this.style.shap.height;
  786. this.radius = this.style.shap.radius;
  787. }else{
  788. var size = MWF.getTextSize(this.data.name, this.style.text);
  789. this.radius = size.x/2+10;
  790. this.radius = this.radius<20 ? 20 : this.radius;
  791. this.width = this.height = this.radius*2;
  792. }
  793. },
  794. reSizePaper: function(x, y){
  795. //this.paperSize = $(this.paper.canvas).getParent().getSize();
  796. // if (x>this.paperSize.x) this.process.designer.paperNode.setStyle("height", x);
  797. // if (y>this.paperSize.y) this.process.designer.paperNode.setStyle("width", y);
  798. y = y.toFloat()+this.height.toFloat()/2;
  799. x = x.toFloat()+this.width.toFloat()/2;
  800. if (x>this.paperSize.x){
  801. this.paper.setSize(x*0.99, this.paperSize.y);
  802. $(this.paper.canvas).getParent().setStyle("width", ""+x+"px");
  803. this.paperSize.x = x;
  804. }
  805. if (y>this.paperSize.y){
  806. this.paper.setSize(this.paperSize.x*0.99, y);
  807. $(this.paper.canvas).getParent().setStyle("height", ""+y+"px");
  808. this.paperSize.y = y;
  809. }
  810. },
  811. resetPoint: function(){
  812. this.point = {x: this.center.x-this.width/2, y: this.center.y-this.height/2};
  813. },
  814. createShap: function(){
  815. var shap;
  816. shap = this.paper.circlePath(this.center.x, this.center.y, this.radius);
  817. shap.attr(this.style.shap);
  818. shap.data("bind", this);
  819. return shap;
  820. },
  821. redrawText: function(){
  822. return true;
  823. },
  824. redrawShap: function(){
  825. var shapPath = MWFRaphael.getCirclePath(this.center.x, this.center.y, this.radius);
  826. this.shap.attr("path", shapPath);
  827. },
  828. getOffset: function(){
  829. return {"tx": 6, "ty": 0, "ix": -8, "iy": -8};
  830. },
  831. getTextIconPoint: function(){
  832. var off = this.getOffset();
  833. if (this.style.text.display=="none"){
  834. var t_att = {x: this.center.x+off.tx, y: this.center.y+off.ty};
  835. var i_att = {x: this.center.x+off.ix, y: this.center.y+off.iy};
  836. return {"tatt": t_att, "iatt": i_att};
  837. }else{
  838. var t_att = {x: this.center.x+6, y: this.center.y};
  839. var i_att = {x: this.center.x-(this.width/2), y: this.center.y-8};
  840. return {"tatt": t_att, "iatt": i_att};
  841. }
  842. },
  843. getMoveOffset: function(){
  844. return {"tx": 6, "ty": 0, "ix": -9, "iy": -9};
  845. },
  846. getMoveTextIconPoint: function(){
  847. var off = this.getMoveOffset();
  848. if (this.style.text.display=="none"){
  849. var t_att = {x: this.center.x+off.tx, y: this.center.y+off.ty};
  850. var i_att = {x: this.center.x+off.ix, y: this.center.y+off.iy};
  851. return {"tatt": t_att, "iatt": i_att};
  852. }else{
  853. var t_att = {x: this.center.x+6, y: this.center.y};
  854. var i_att = {x: this.center.x-(this.width/2), y: this.center.y-8};
  855. return {"tatt": t_att, "iatt": i_att};
  856. }
  857. }
  858. });
  859. MWF.APPPD.Activity.Circle.SingleRouter = new Class({
  860. Extends: MWF.APPPD.Activity.Circle,
  861. getRoutedata: function(){
  862. if (!this.data.route) this.data.route = "";
  863. return [this.data.route];
  864. },
  865. setRouteData: function(id){
  866. if (!this.data.route) this.data.route = "";
  867. this.data.route = id;
  868. },
  869. removeRouteData: function(id){
  870. this.data.route = "";
  871. },
  872. quickCreateRoute: function(){
  873. if (!this.routes.length){
  874. this.process.createRoute();
  875. this.process.routeCreateFromActivity(this);
  876. }
  877. },
  878. checkCreateRoute: function(){
  879. if (this.process.isCreateRoute){
  880. var route = this.process.currentCreateRoute;
  881. if (!route.fromActivity){
  882. if (!this.routes.length) this.process.routeCreateFromActivity(this);
  883. }else{
  884. this.process.routeCreateToActivity(this);
  885. }
  886. }
  887. if (this.process.isCopyRoute){
  888. if (!this.routes.length) this.process.routeAddFromActivity(this);
  889. }
  890. },
  891. mouseHover: function(){
  892. if (this.process.isCreateRoute){
  893. var route = this.process.currentCreateRoute;
  894. if (!route.fromActivity){
  895. if (!this.routes.length) this.shap.attr({"stroke-width": "2"});
  896. }else{
  897. this.shap.attr({"stroke-width": "2"});
  898. }
  899. }
  900. if (this.process.isChangeRouteTo){
  901. this.shap.attr({"stroke-width": "2"});
  902. }
  903. if (this.process.isChangeRouteFrom || this.process.isCopyRoute){
  904. if (!this.routes.length) this.shap.attr({"stroke-width": "2"});
  905. }
  906. },
  907. mouseUp: function(){
  908. if (this.process.isChangeRouteTo){
  909. this.process.currentChangeRoute.setActivity(this, null);
  910. this.process.currentChangeRoute.isBack = false;
  911. this.process.currentChangeRoute.positionPoints = this.process.currentChangeRoute.getRoutePoint();
  912. this.process.currentChangeRoute.reload();
  913. this.process.isChangeRouteTo = false;
  914. this.process.currentChangeRoute = null;
  915. }
  916. if (this.process.isChangeRouteFrom){
  917. if (!this.routes.length){
  918. this.process.currentChangeRoute.setActivity(null, this);
  919. this.process.currentChangeRoute.isBack = false;
  920. this.process.currentChangeRoute.positionPoints = this.process.currentChangeRoute.getRoutePoint();
  921. this.process.currentChangeRoute.reload();
  922. this.process.isChangeRouteFrom = false;
  923. this.process.currentChangeRoute = null;
  924. }
  925. }
  926. this.shap.attr(this.style.shap);
  927. },
  928. addRouteData: function(id){
  929. if (!this.data.route) this.data.route = id;
  930. }
  931. });
  932. MWF.APPPD.Activity.Circle.NoRouter = new Class({
  933. Extends: MWF.APPPD.Activity.Circle,
  934. quickCreateRoute: function(){
  935. return false;
  936. },
  937. checkCreateRoute: function(){
  938. if (this.process.isCreateRoute){
  939. var route = this.process.currentCreateRoute;
  940. if (route.fromActivity){
  941. this.process.routeCreateToActivity(this);
  942. }
  943. }
  944. },
  945. mouseHover: function(){
  946. if (this.process.isCreateRoute){
  947. var route = this.process.currentCreateRoute;
  948. if (route.fromActivity){
  949. this.shap.attr({"stroke-width": "2"});
  950. }
  951. }
  952. if (this.process.isChangeRouteTo){
  953. this.shap.attr({"stroke-width": "2"});
  954. }
  955. },
  956. mouseUp: function(){
  957. if (this.process.isChangeRouteTo){
  958. this.process.currentChangeRoute.setActivity(this, null);
  959. this.process.currentChangeRoute.isBack = false;
  960. this.process.currentChangeRoute.positionPoints = this.process.currentChangeRoute.getRoutePoint();
  961. this.process.currentChangeRoute.reload();
  962. this.process.isChangeRouteTo = false;
  963. this.process.currentChangeRoute = null;
  964. }
  965. this.shap.attr(this.style.shap);
  966. },
  967. addRouteData: function(id){}
  968. });
  969. MWF.APPPD.Activity.Diamond = new Class({
  970. Extends: MWF.APPPD.Activity,
  971. setSize: function(){
  972. var size = MWF.getTextSize(this.data.name, this.style.text);
  973. this.width = size.x + 80;
  974. this.width = this.width<120 ? 120: this.width;
  975. this.height = this.width*0.4;
  976. },
  977. createShap: function(){
  978. var shap;
  979. shap = this.paper.diamond(this.point.x, this.point.y, this.width, this.height, this.style.shap.radiusX, this.style.shap.radiusY);
  980. shap.attr(this.style.shap);
  981. shap.data("bind", this);
  982. return shap;
  983. },
  984. redrawShap: function(){
  985. var shapPath = MWFRaphael.getDiamondPath(this.point.x, this.point.y, this.width, this.height, this.style.shap.radiusX, this.style.shap.radiusY);
  986. this.shap.attr("path", shapPath);
  987. },
  988. getTextIconPoint: function(){
  989. var t_att = {x: this.center.x+6, y: this.center.y+1};
  990. var i_att = {x: this.center.x-(this.width/2)+28, y: this.center.y-9};
  991. return {"tatt": t_att, "iatt": i_att};
  992. }
  993. });
  994. (function (){
  995. var Activity = function(extendClass, name){
  996. return new Class({
  997. Extends: extendClass,
  998. setType: function(){
  999. this.type = name;
  1000. this.data.type = name;
  1001. },
  1002. setStyle: function(){
  1003. this.style = this.process.css.activity[name];
  1004. }
  1005. });
  1006. };
  1007. MWF.APPPD.Activity.Begin = new Activity(MWF.APPPD.Activity.Circle.SingleRouter, "begin");
  1008. MWF.APPPD.Activity.End = new Activity(MWF.APPPD.Activity.Circle.NoRouter, "end");
  1009. MWF.APPPD.Activity.Cancel = new Activity(MWF.APPPD.Activity.Circle.NoRouter, "cancel");
  1010. MWF.APPPD.Activity.Manual = new Activity(MWF.APPPD.Activity, "manual");
  1011. MWF.APPPD.Activity.Condition = new Activity(MWF.APPPD.Activity.Diamond, "condition");
  1012. MWF.APPPD.Activity.Choice = new Activity(MWF.APPPD.Activity.Diamond, "choice");
  1013. MWF.APPPD.Activity.Split = new Activity(MWF.APPPD.Activity.Circle.SingleRouter, "split");
  1014. MWF.APPPD.Activity.Parallel = new Activity(MWF.APPPD.Activity.Circle, "parallel");
  1015. MWF.APPPD.Activity.Merge = new Activity(MWF.APPPD.Activity.Circle.SingleRouter, "merge");
  1016. MWF.APPPD.Activity.Embed = new Activity(MWF.APPPD.Activity.SingleRouter, "embed");
  1017. MWF.APPPD.Activity.Publish = new Activity(MWF.APPPD.Activity.SingleRouter, "publish");
  1018. MWF.APPPD.Activity.Delay = new Activity(MWF.APPPD.Activity.Circle.SingleRouter, "delay");
  1019. MWF.APPPD.Activity.Invoke = new Activity(MWF.APPPD.Activity.SingleRouter, "invoke");
  1020. MWF.APPPD.Activity.Service = new Activity(MWF.APPPD.Activity.SingleRouter, "service");
  1021. MWF.APPPD.Activity.Agent = new Activity(MWF.APPPD.Activity.SingleRouter, "agent");
  1022. MWF.APPPD.Activity.Message = new Activity(MWF.APPPD.Activity.SingleRouter, "message");
  1023. })();
  1024. MWF.xApplication.process.ProcessDesigner.Activity.List = new Class({
  1025. initialize: function(activity){
  1026. this.activity = activity;
  1027. this.process = activity.process;
  1028. this.paper = this.activity.process.paper;
  1029. },
  1030. load: function(){
  1031. //this.activity.process.activityListNode
  1032. // this.listActivityNode = new Element("div",{
  1033. // "styles": this.process.css.listActivityNode
  1034. // });
  1035. // this.activityTable = new HtmlTable({
  1036. // "properties": {
  1037. // "width": "100%"
  1038. // }
  1039. // }).inject(this.listActivityNode);
  1040. var actionIcon = (this.activity.type=="begin") ? " " : "<img src=\""+"../x_component_process_ProcessDesigner/$Process/default/icon/copy.png"+"\" />";
  1041. this.row = this.process.activityTable.push([
  1042. {
  1043. "content": " ",
  1044. "properties": {
  1045. "styles": this.activity.style.listIcon
  1046. }
  1047. },
  1048. {
  1049. "content": this.activity.data.name,
  1050. "properties": {
  1051. "styles": this.process.css.list.listText
  1052. }
  1053. },
  1054. {
  1055. "content": actionIcon,
  1056. "properties": {
  1057. "styles": this.process.css.list.listIcon,
  1058. "events": {
  1059. "click": this.copyActivity.bind(this)
  1060. }
  1061. }
  1062. },
  1063. {
  1064. "content": "<img src=\""+"../x_component_process_ProcessDesigner/$Process/default/icon/delete.png"+"\" />",
  1065. "properties": {
  1066. "styles": this.process.css.list.listIcon,
  1067. "events": {
  1068. "click": this.deleteActivity.bind(this)
  1069. }
  1070. }
  1071. }
  1072. ]
  1073. );
  1074. this.row.tr.addEvent("click", function(){
  1075. this.activity.selected();
  1076. }.bind(this));
  1077. //this.listActivityNode.inject(this.activity.process.activityListNode);
  1078. //var activityTable = new Element("table").inject(this.listActivityNode);
  1079. },
  1080. copyActivity: function(){
  1081. this.process.copyActivity(this.activity);
  1082. },
  1083. deleteActivity: function(e){
  1084. this.process.deleteActivity(e, this.activity);
  1085. },
  1086. listSelected: function(){
  1087. if (this.process.currentListSelected) this.process.currentListSelected.listUnSelected();
  1088. this.row.tr.setStyles(this.process.css.list.listRowSelected);
  1089. this.process.currentListSelected = this;
  1090. //alert(this.process.currentSelected!=this.activity)
  1091. //if (this.process.currentSelected!=this.activity) this.activity.selected();
  1092. },
  1093. listUnSelected: function(){
  1094. this.process.currentListSelected = null;
  1095. this.row.tr.setStyles(this.process.css.list.listRow);
  1096. //if (this.process.currentSelected==this.activity) this.activity.unSelected();
  1097. }
  1098. });
  1099. MWF.xApplication.process.ProcessDesigner.Activity.Property = new Class({
  1100. Implements: [Options, Events],
  1101. Extends: MWF.APPPD.Property,
  1102. initialize: function(activity, options){
  1103. this.setOptions(options);
  1104. this.activity = activity;
  1105. this.process = activity.process;
  1106. this.paper = this.activity.process.paper;
  1107. this.data = activity.data;
  1108. this.htmlPath = "../x_component_process_ProcessDesigner/$Process/"+this.activity.type+".html";
  1109. },
  1110. setValue: function(name, value){
  1111. var names = name.split(".");
  1112. var o = this.data;
  1113. while (names.length>1){
  1114. var k = names.shift();
  1115. if (!o.hasOwnProperty(k)){
  1116. o[k] = {};
  1117. }
  1118. o=o[k];
  1119. }
  1120. var key = names.shift();
  1121. o[key] = value;
  1122. // this.data[name] = value;
  1123. if (name=="name"){
  1124. if (!value) this.data[name] = MWF.APPPD.LP.unnamed;
  1125. this.activity.redraw();
  1126. }
  1127. }
  1128. });