| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- MWF.xApplication.ScriptEditor.statement = MWF.xApplication.ScriptEditor.statement || {};
- MWF.xApplication.ScriptEditor.statement.Link = new Class({
- initialize: function(statement, type, node){
- this.statement = statement;
- this.type = type;
- this.node = node;
- this.area = this.statement.area;
- this.block = this.statement.block;
- this.editor = this.statement.editor;
- this.rePosition();
- this.linkStatement = null;
- this.toLink = null;
- if (this.type==="up"){
- this.linkType = "up";
- this.around = false;
- }
- if (this.type==="middle"){
- this.linkType = "down";
- this.around = true;
- }
- if (this.type==="down"){
- this.linkType = "down";
- this.around = false;
- }
- this.load();
- },
- load :function(){
- },
- rePosition: function(){
- this.position = this.node.getPosition(this.statement.areaNode);
- return this;
- },
- linkDown: function(link){
- var oldLink = this.toLink;
- if (link.toLink){
- link.toLink.toLink = null;
- link.toLink = null;
- }
- this.toLink = link;
- link.toLink = this;
- if (oldLink && oldLink!==link){
- if (link.statement.centerLink && !link.statement.centerLink.toLink){
- link.statement.centerLink.toLink = oldLink;
- var group = this.area.getStatementGroup(oldLink.statement);
- link.statement.centerLink.endStatement = group[group.length-1];
- oldLink.toLink = link.statement.centerLink;
- }else{
- var linkGroup = this.area.getStatementGroup(link.statement);
- var statement = linkGroup[linkGroup.length-1];
- oldLink.toLink = statement.bottomLink;
- statement.bottomLink.toLink = oldLink;
- }
- }
- },
- linkUp: function(link){
- this.toLink = link;
- link.toLink = link;
- },
- linkMiddle: function(link){
- var oldLink = this.toLink;
- if (link.toLink){
- link.toLink.toLink = null;
- link.toLink = null;
- }
- this.toLink = link;
- link.toLink = this;
- if (oldLink && oldLink!==link){
- if (link.statement.centerLink && !link.statement.centerLink.toLink){
- link.statement.centerLink.toLink = oldLink;
- var group = this.area.getStatementGroup(oldLink.statement);
- link.statement.centerLink.endStatement = group[group.length-1];
- oldLink.toLink = link.statement.centerLink;
- }else{
- var linkGroup = this.area.getStatementGroup(link.statement);
- var statement = linkGroup[linkGroup.length-1];
- oldLink.toLink = statement.bottomLink;
- statement.bottomLink.toLink = oldLink;
- }
- }else{
- this.endStatement = link.statement;
- }
- },
- linkUpAround: function(link){
- this.toLink = link;
- link.toLink = link;
- var group = this.area.getStatementGroup(this.statement);
- link.endStatement = group[group.length-1];
- },
- // link: function(link){
- // if (this.type==="up"){
- // this.toLink = link;
- // link.toLink = this;
- // }
- // if (this.type==="down"){
- // var oldLink = this.toLink;
- // this.toLink = link;
- // link.toLink = this;
- //
- // if (link.statement.centerLink){
- // oldLink.toLink = link.statement.centerLink;
- // link.statement.bottomLink.toLink = oldLink;
- //
- // }else{
- // oldLink.toLink = link.statement.bottomLink;
- // link.statement.bottomLink.toLink = oldLink;
- // }
- // }
- // if (this.type==="middle"){
- // var oldLink = this.toLink;
- // this.toLink = link;
- // link.toLink = this;
- //
- // if (link)
- //
- // var group = this.area.getStatementGroup(oldLink.statement);
- //
- // }
- //
- //
- //
- // if (!this.toLink){
- // this.toLink = link;
- // }else {
- // var oldToLink = this.toLink;
- // this.toLink = link;
- // if (this.linkType==="up" && link.linkType==="down"){
- //
- // }
- //
- // if (this.linkType==="down" && link.linkType==="up"){
- //
- // }
- // }
- // },
- getSerialLinkGroup: function(link){
- link.statement.bottomLink
- }
- });
|