WireItLibrary

WireIt  0.6.0

WireItLibrary > WireIt > WireIt.Layer
Search:
 
Filters

Class WireIt.Layer

A layer encapsulate a bunch of containers and wires

Constructor

WireIt.Layer ( options )
Parameters:
options <Object> Configuration object (see the properties)

Properties

className - String

CSS class name for the layer element
Default Value: "WireIt-Layer"

containers - {Array}

List of all the WireIt.Container (or subclass) instances in this layer

el - {HTMLElement}

Layer DOM element

enableMouseEvents - Boolean

Enable the mouse events
Default Value: true

grouper - object

TODO

groups - object

TODO

layerMap - Boolean

Display the layer map
Default Value: false

layerMapOptions - Object

Options for the layer map
Default Value: null

parentEl - DOMElement

DOM element that schould contain the layer
Default Value: null

wires - {Array}

List of all the WireIt.Wire (or subclass) instances in this layer

Methods

_getMouseEvtPos

Array _getMouseEvtPos ( e )
Returns a position relative to the layer from a mouse event
Parameters:
e <Event> Mouse event
Returns: Array
position

addContainer

WireIt.Container addContainer ( containerConfig )
Instanciate a container given its "xtype": WireIt.Container (default) or a subclass of it.
Parameters:
containerConfig <Object> Container configuration object (see WireIt.Container class for details)
Returns: WireIt.Container
Container instance build from the xtype

addWire

WireIt.Wire addWire ( wireConfig )
Instanciate a wire given its "xtype" (default to WireIt.Wire)
Parameters:
wireConfig <Object> Wire configuration object (see WireIt.Wire class for details)
Returns: WireIt.Wire
Wire instance build from the xtype

clear

void clear ( )
Remove all the containers in this layer (and the associated terminals and wires)

getWiring

Obj getWiring ( )
Return an object that represent the state of the layer including the containers and the wires
Returns: Obj
layer configuration

initContainers

void initContainers ( )
Create all the containers passed as options

initWires

void initWires ( )
Create all the wires passed in the config

onAddWire

void onAddWire ( event , args )
Update the wire list when any of the containers fired the eventAddWire
Parameters:
event <Event> The eventAddWire event fired by the container
args <Array> This array contains a single element args[0] which is the added Wire instance

onRemoveWire

void onRemoveWire ( event , args )
Update the wire list when a wire is removed
Parameters:
event <Event> The eventRemoveWire event fired by the container
args <Array> This array contains a single element args[0] which is the removed Wire instance

onWireClick

void onWireClick ( e )
Handles click on any wire canvas Note: we treat mouse events globally so that wires behind others can still receive the events
Parameters:
e <Event> Mouse click event

onWireMouseMove

void onWireMouseMove ( e )
Handles mousemove events on any wire canvas Note: we treat mouse events globally so that wires behind others can still receive the events
Parameters:
e <Event> Mouse click event

removeAllContainers

void removeAllContainers ( )
Deprecated Alias for clear

removeContainer

void removeContainer ( container )
Remove a container
Parameters:
container <WireIt.Container> Container instance to remove

removeGroup

void removeGroup ( )
TODO

render

void render ( )
Create the dom of the layer and insert it into the parent element

setOptions

void setOptions ( )
Set the options by putting them in this (so it overrides the prototype default)

setSuperHighlighted

void setSuperHighlighted ( )
TODO

setWiring

void setWiring ( wiring )
Load a layer configuration object
Parameters:
wiring <Object> layer configuration

unsetSuperHighlighted

void unsetSuperHighlighted ( )
TODO

Events

eventAddContainer

eventAddContainer ( )
Event that is fired when a container is added You can register this event with myTerminal.eventAddContainer.subscribe(function(e,params) { var container=params[0];}, scope);

eventAddWire

eventAddWire ( )
Event that is fired when a wire is added You can register this event with myTerminal.eventAddWire.subscribe(function(e,params) { var wire=params[0];}, scope);

eventChanged

eventChanged ( )
Event that is fired when the layer has been changed You can register this event with myTerminal.eventChanged.subscribe(function(e,params) { }, scope);

eventContainerDragged

eventContainerDragged ( )
Event that is fired when a container has been moved You can register this event with myTerminal.eventContainerDragged.subscribe(function(e,params) { var container=params[0];}, scope);

eventContainerResized

eventContainerResized ( )
Event that is fired when a container has been resized You can register this event with myTerminal.eventContainerResized.subscribe(function(e,params) { var container=params[0];}, scope);

eventRemoveContainer

eventRemoveContainer ( )
Event that is fired when a container is removed You can register this event with myTerminal.eventRemoveContainer.subscribe(function(e,params) { var container=params[0];}, scope);

eventRemoveWire

eventRemoveWire ( )
Event that is fired when a wire is removed You can register this event with myTerminal.eventRemoveWire.subscribe(function(e,params) { var wire=params[0];}, scope);


Copyright © 2010 Eric Abouaf All rights reserved.