WireItLibrary

WireIt  0.6.0

WireItLibrary > WireIt > WireIt.Container
Search:
 
Filters

Class WireIt.Container

Known Subclasses:
WireIt.util.InOutContainer WireIt.util.EllipseLabelContainer WireIt.util.ImageContainer WireIt.FormContainer WireIt.CanvasContainer inputEx.LayerContainer WireIt.RectLabelContainer
Visual module that contains terminals. The wires are updated when the module is dragged around.

Constructor

WireIt.Container ( options , layer )
Parameters:
options <Object> Configuration object (see options property)
layer <WireIt.Layer> The WireIt.Layer (or subclass) instance that contains this container

Properties

bodyEl - {HTMLElement}

Body element

className - String

CSS class name for the container element
Default Value: "WireIt-Container"

close - Boolean

display a button to close the container
Default Value: true

closeButtonClassName - String

CSS class name for the close button
Default Value: "WireIt-Container-closebutton"

ddHandle - Boolean

(only if draggable) boolean indicating we use a handle for drag'n drop
Default Value: true

ddHandleClassName - String

CSS class name for the drag'n drop handle
Default Value: "WireIt-Container-ddhandle"

draggable - Boolean

boolean that enables drag'n drop on this container
Default Value: true

el - {HTMLElement}

Container DOM element

groupable - Boolean

option to add the grouping button
Default Value: true

height - Integer

initial height of the container
Default Value: null

icon - String

image url to be displayed in the module header
Default Value: null

layer - {WireIt.Layer}

the WireIt.Layer object that schould contain this container

position - Array

initial position of the container
Default Value: [100,100]

preventSelfWiring - Boolean

option to prevent connections between terminals of this same container
Default Value: true

resizable - Boolean

boolean that makes the container resizable
Default Value: true

resizeHandleClassName - String

CSS class name for the resize handle
Default Value: "WireIt-Container-resizehandle"

terminals - {Array}

List of the terminals

title - String

text that will appear in the module header
Default Value: null

width - Integer

initial width of the container
Default Value: null

wires - {Array}

List of all the wires connected to this container terminals

xtype - String

String representing this class for exporting as JSON
Default Value: "WireIt.Container"

Methods

addTerminal

WireIt.Terminal addTerminal ( )
Instanciate the terminal from the class pointer "xtype" (default WireIt.Terminal)
Returns: WireIt.Terminal
terminal Created terminal

dehighlight

void dehighlight ( )
TODO

getConfig

void getConfig ( )
Return the config of this container.

getTerminal

void getTerminal ( )

getValue

Object getValue ( )
Subclasses should override this method.
Returns: Object
value

getXY

getXY ( )
Get the position relative to the layer (if any)
Returns:
Array position

highlight

void highlight ( )
TODO

initTerminals

void initTerminals ( )
Call the addTerminal method for each terminal configuration.

makeDraggable

void makeDraggable ( )
Use the DD utility to make container draggable while redrawing the connected wires

makeResizable

void makeResizable ( )
Use the DDResize utility to make container resizable while redrawing the connected wires

onAddWire

void onAddWire ( event , args )
This method is called when a wire is added to one of the terminals
Parameters:
event <Event> The eventAddWire event fired by the terminal
args <Array> This array contains a single element args[0] which is the added Wire instance

onCloseButton

void onCloseButton ( )
Called when the user clicked on the close button

onMouseDown

void onMouseDown ( )
Called when the user made a mouse down on the container and sets the focus to this container (only if within a Layer)

onRemoveWire

void onRemoveWire ( event , args )
This method is called when a wire is removed from one of the terminals
Parameters:
event <Event> The eventRemoveWire event fired by the terminal
args <Array> This array contains a single element args[0] which is the removed Wire instance

onResize

void onResize ( )
Function called when the container is being resized. It sets the size of the body element of the container

redrawAllTerminals

void redrawAllTerminals ( )
Redraw all the wires connected to the terminals of this container

remove

void remove ( )
Remove this container from the dom

removeAllTerminals

void removeAllTerminals ( )
Remove all terminals

removeFocus

void removeFocus ( )
Remove the class that shows the container as "focused"

render

void render ( )
Render the dom of the container

setBody

void setBody ( content )
Sets the content of the body element
Parameters:
content <String or HTMLElement>

setFocus

void setFocus ( )
Adds the class that shows the container as "focused"

setOptions

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

setValue

void setValue ( val )
Subclasses should override this method.
Parameters:
val <Any> Value

superHighlight

void superHighlight ( )
TODO

Events

eventAddWire

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

eventBlur

eventBlur ( )
Event that is fired when the container loses focus You can register this event with myContainer.eventBlur.subscribe(function(e,params) { }, scope);

eventFocus

eventFocus ( )
Event that is fired when the container is focused You can register this event with myContainer.eventFocus.subscribe(function(e,params) { }, scope);

eventRemoveWire

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


Copyright © 2010 Eric Abouaf All rights reserved.