CommandDelete.js
Summary
No overview generated for 'CommandDelete.js'
draw2d.CommandDelete=function( figure)
{
draw2d.Command.call(this,"delete figure");
this.parent = figure.parent;
this.figure = figure;
this.workflow = figure.workflow;
this.connections = null;
}
draw2d.CommandDelete.prototype = new draw2d.Command;
draw2d.CommandDelete.prototype.type="CommandDelete";
draw2d.CommandDelete.prototype.execute=function()
{
this.redo();
}
draw2d.CommandDelete.prototype.undo=function()
{
this.workflow.addFigure(this.figure);
if(this.figure instanceof draw2d.Connection)
this.figure.reconnect();
this.workflow.setCurrentSelection(this.figure);
if(this.parent!=null)
this.parent.addChild(this.figure);
for (var i = 0; i < this.connections.getSize(); ++i)
{
this.workflow.addFigure(this.connections.get(i));
this.connections.get(i).reconnect();
}
}
draw2d.CommandDelete.prototype.redo=function()
{
this.workflow.removeFigure(this.figure);
this.workflow.setCurrentSelection(null);
if(this.figure.getPorts && this.connections==null)
{
this.connections = new draw2d.ArrayList();
var ports = this.figure.getPorts();
for(var i=0; i<ports.getSize(); i++)
{
if(ports.get(i).getConnections)
this.connections.addAll(ports.get(i).getConnections());
}
}
if(this.connections == null)
this.connections = new draw2d.ArrayList();
if(this.parent!=null)
this.parent.removeChild(this.figure);
for (var i = 0; i < this.connections.getSize(); ++i)
{
this.workflow.removeFigure(this.connections.get(i));
}
}
Documentation generated by
JSDoc on Thu Feb 7 23:45:47 2008