Node.js
Summary
No overview generated for 'Node.js'
draw2d.Node=function()
{
this.bgColor = null;
this.lineColor = new draw2d.Color(128,128,255);
this.lineStroke=1;
this.ports = new draw2d.ArrayList();
draw2d.Figure.call(this);
}
draw2d.Node.prototype = new draw2d.Figure;
draw2d.Node.prototype.type="Node";
draw2d.Node.prototype.dispose=function()
{
for(var i=0;i<this.ports.getSize();i++)
{
this.ports.get(i).dispose();
}
this.ports = null;
draw2d.Figure.prototype.dispose.call(this);
}
draw2d.Node.prototype.createHTMLElement=function()
{
var item =draw2d.Figure.prototype.createHTMLElement.call(this);
item.style.width="auto";
item.style.height="auto";
item.style.margin="0px";
item.style.padding="0px";
if(this.lineColor!=null)
item.style.border= this.lineStroke+"px solid "+this.lineColor.getHTMLStyle();
item.style.fontSize="1px";
if(this.bgColor!=null)
item.style.backgroundColor=this.bgColor.getHTMLStyle();
return item;
}
draw2d.Node.prototype.paint=function()
{
draw2d.Figure.prototype.paint.call(this);
for(var i=0;i<this.ports.getSize();i++)
{
this.ports.get(i).paint();
}
}
draw2d.Node.prototype.getPorts=function()
{
return this.ports;
}
draw2d.Node.prototype.getPort= function( portName)
{
if(this.ports==null)
return null;
for(var i=0;i<this.ports.getSize();i++)
{
var port = this.ports.get(i);
if(port.getName() == portName)
return port;
}
}
draw2d.Node.prototype.addPort=function( port, x, y)
{
this.ports.add(port);
port.setOrigin(x,y);
port.setPosition(x,y);
port.setParent(this);
port.setDeleteable(false);
this.html.appendChild(port.getHTMLElement());
if(this.workflow!=null)
{
this.workflow.registerPort(port);
}
}
draw2d.Node.prototype.removePort=function( port)
{
if(this.ports!=null)
this.ports.removeElementAt(this.ports.indexOf(port));
try
{
this.html.removeChild(port.getHTMLElement());
}
catch(exc)
{
}
if(this.workflow!=null)
this.workflow.unregisterPort(port);
}
draw2d.Node.prototype.setWorkflow= function( workflow)
{
var oldWorkflow = this.workflow;
draw2d.Figure.prototype.setWorkflow.call(this,workflow);
if(oldWorkflow!=null)
{
for(var i=0;i<this.ports.getSize();i++)
{
oldWorkflow.unregisterPort(this.ports.get(i));
}
}
if(this.workflow!=null)
{
for(var i=0;i<this.ports.getSize();i++)
{
this.workflow.registerPort(this.ports.get(i));
}
}
}
draw2d.Node.prototype.setBackgroundColor= function( color)
{
this.bgColor = color;
if(this.bgColor!=null)
this.html.style.backgroundColor=this.bgColor.getHTMLStyle();
else
this.html.style.backgroundColor="transparent";
}
draw2d.Node.prototype.getBackgroundColor= function()
{
return this.bgColor;
}
draw2d.Node.prototype.setColor= function( color)
{
this.lineColor = color;
if(this.lineColor!=null)
this.html.style.border= this.lineStroke+"px solid "+this.lineColor.getHTMLStyle();
else
this.html.style.border= "0px";
}
draw2d.Node.prototype.setLineWidth=function( w)
{
this.lineStroke=w;
if(this.lineColor!=null)
this.html.style.border= this.lineStroke+"px solid "+this.lineColor.getHTMLStyle();
else
this.html.style.border= "0px";
}
Documentation generated by
JSDoc on Thu Feb 7 23:45:47 2008