<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>API: animations-plugin ComposableWiringEditor.js (YUI Library)</title>
<link rel="stylesheet" type="text/css" href="assets/reset-fonts-grids-min.css" />
<link rel="stylesheet" type="text/css" href="assets/api.css" />
<script type="text/javascript" src="assets/api-js"></script>
<script type="text/javascript" src="assets/ac-js"></script>
</head>
<body id="yahoo-com">
<div id="doc3" class="yui-t2">
<div id="hd">
<h1><a href="http://neyric.github.com/wireit" title="WireItLibrary">WireItLibrary</a></h1>
<h3>animations-plugin <span class="subtitle">0.6.0</span></h3>
<a href="./index.html" title="WireItLibrary">WireItLibrary</a>
> <a href="./module_animations-plugin.html" title="animations-plugin">animations-plugin</a>
> ComposableWiringEditor.js (source view)
<form onsubmit="return false">
<div id="propertysearch">
Search: <input autocomplete="off" id="searchinput" />
<div id="searchresults">
</div>
</div>
</form>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<form action="#" name="yui-classopts-form" method="get" id="yui-classopts-form">
<fieldset>
<legend>Filters</legend>
<span class="classopts"><input type="checkbox" name="show_private" id="show_private" /> <label for="show_private">Show Private</label></span>
<span class="classopts"><input type="checkbox" name="show_protected" id="show_protected" /> <label for="show_protected">Show Protected</label></span>
<span class="classopts"><input type="checkbox" name="show_deprecated" id="show_deprecated" /> <label for="show_deprecated">Show Deprecated</label></span>
</fieldset>
</form>
<div id="srcout">
<style>
#doc3 .classopts { display:none; }
</style>
<div class="highlight"><pre><span class="c">/**</span>
<span class="c"> * Extend the WiringEditor with composable wirings</span>
<span class="c"> * @module composable-plugin</span>
<span class="c"> */</span>
<span class="c">/**</span>
<span class="c"> * The ComposableWiringEditor </span>
<span class="c"> *</span>
<span class="c"> * @class ComposableWiringEditor</span>
<span class="c"> * @extends WireIt.ComposableWiringEditor</span>
<span class="c"> * @constructor</span>
<span class="c"> */</span>
<span class="nx">WireIt</span><span class="p">.</span><span class="nx">ComposableWiringEditor</span> <span class="o">=</span> <span class="kd">function</span><span class="p">(</span><span class="nx">options</span><span class="p">)</span> <span class="p">{</span>
<span class="c">// Add the "input" and "output" modules</span>
<span class="nx">options</span><span class="p">.</span><span class="nx">modules</span> <span class="o">=</span> <span class="nx">WireIt</span><span class="p">.</span><span class="nx">ComposableWiringEditor</span><span class="p">.</span><span class="nx">modules</span><span class="p">.</span><span class="nx">concat</span><span class="p">(</span><span class="nx">options</span><span class="p">.</span><span class="nx">modules</span><span class="p">);</span>
<span class="nx">WireIt</span><span class="p">.</span><span class="nx">ComposableWiringEditor</span><span class="p">.</span><span class="nx">superclass</span><span class="p">.</span><span class="nx">constructor</span><span class="p">.</span><span class="nx">call</span><span class="p">(</span><span class="k">this</span><span class="o">,</span> <span class="nx">options</span><span class="p">);</span>
<span class="p">};</span>
<span class="c">/**</span>
<span class="c"> * Default "input" and "output" modules</span>
<span class="c"> * @static</span>
<span class="c"> */</span>
<span class="nx">WireIt</span><span class="p">.</span><span class="nx">ComposableWiringEditor</span><span class="p">.</span><span class="nx">modules</span> <span class="o">=</span> <span class="p">[</span>
<span class="p">{</span>
<span class="s2">"name"</span><span class="o">:</span> <span class="s2">"input"</span><span class="o">,</span>
<span class="s2">"container"</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">"xtype"</span><span class="o">:</span> <span class="s2">"WireIt.FormContainer"</span><span class="o">,</span>
<span class="s2">"title"</span><span class="o">:</span> <span class="s2">"input"</span><span class="o">,</span>
<span class="s2">"fields"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span><span class="s2">"type"</span><span class="o">:</span> <span class="s2">"type"</span><span class="o">,</span> <span class="s2">"label"</span><span class="o">:</span> <span class="s2">"Value"</span><span class="o">,</span> <span class="s2">"name"</span><span class="o">:</span> <span class="s2">"input"</span><span class="o">,</span> <span class="s2">"wirable"</span><span class="o">:</span> <span class="kc">false</span><span class="o">,</span> <span class="s2">"value"</span><span class="o">:</span> <span class="p">{</span> <span class="s2">"type"</span><span class="o">:</span><span class="s2">"string"</span><span class="o">,</span> <span class="s2">"typeInvite"</span><span class="o">:</span> <span class="s2">"input name"</span> <span class="p">}</span> <span class="p">}</span>
<span class="p">]</span><span class="o">,</span>
<span class="s2">"terminals"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span><span class="s2">"name"</span><span class="o">:</span> <span class="s2">"out"</span><span class="o">,</span> <span class="s2">"direction"</span><span class="o">:</span> <span class="p">[</span><span class="mi">0</span><span class="o">,</span><span class="mi">1</span><span class="p">]</span><span class="o">,</span> <span class="s2">"offsetPosition"</span><span class="o">:</span> <span class="p">{</span><span class="s2">"left"</span><span class="o">:</span> <span class="mi">86</span><span class="o">,</span> <span class="s2">"bottom"</span><span class="o">:</span> <span class="o">-</span><span class="mi">15</span><span class="p">}</span><span class="o">,</span> <span class="s2">"ddConfig"</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">"type"</span><span class="o">:</span> <span class="s2">"output"</span><span class="o">,</span>
<span class="s2">"allowedTypes"</span><span class="o">:</span> <span class="p">[</span><span class="s2">"input"</span><span class="p">]</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">}</span><span class="o">,</span>
<span class="p">{</span>
<span class="s2">"name"</span><span class="o">:</span> <span class="s2">"output"</span><span class="o">,</span>
<span class="s2">"container"</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">"xtype"</span><span class="o">:</span> <span class="s2">"WireIt.FormContainer"</span><span class="o">,</span>
<span class="s2">"title"</span><span class="o">:</span> <span class="s2">"output"</span><span class="o">,</span>
<span class="s2">"fields"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span><span class="s2">"type"</span><span class="o">:</span> <span class="s2">"string"</span><span class="o">,</span> <span class="s2">"label"</span><span class="o">:</span> <span class="s2">"name"</span><span class="o">,</span> <span class="s2">"name"</span><span class="o">:</span> <span class="s2">"name"</span><span class="o">,</span> <span class="s2">"wirable"</span><span class="o">:</span> <span class="kc">false</span> <span class="p">}</span>
<span class="p">]</span><span class="o">,</span>
<span class="s2">"terminals"</span><span class="o">:</span> <span class="p">[</span>
<span class="p">{</span><span class="s2">"name"</span><span class="o">:</span> <span class="s2">"in"</span><span class="o">,</span> <span class="s2">"direction"</span><span class="o">:</span> <span class="p">[</span><span class="mi">0</span><span class="o">,-</span><span class="mi">1</span><span class="p">]</span><span class="o">,</span> <span class="s2">"offsetPosition"</span><span class="o">:</span> <span class="p">{</span><span class="s2">"left"</span><span class="o">:</span> <span class="mi">82</span><span class="o">,</span> <span class="s2">"top"</span><span class="o">:</span> <span class="o">-</span><span class="mi">15</span> <span class="p">}</span><span class="o">,</span> <span class="s2">"ddConfig"</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">"type"</span><span class="o">:</span> <span class="s2">"input"</span><span class="o">,</span>
<span class="s2">"allowedTypes"</span><span class="o">:</span> <span class="p">[</span><span class="s2">"output"</span><span class="p">]</span>
<span class="p">}</span><span class="o">,</span>
<span class="s2">"nMaxWires"</span><span class="o">:</span> <span class="mi">1</span>
<span class="p">}</span>
<span class="p">]</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">];</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">extend</span><span class="p">(</span><span class="nx">WireIt</span><span class="p">.</span><span class="nx">ComposableWiringEditor</span><span class="o">,</span> <span class="nx">WireIt</span><span class="p">.</span><span class="nx">WiringEditor</span><span class="o">,</span> <span class="p">{</span>
<span class="c">/**</span>
<span class="c"> * @property composedCategory</span>
<span class="c"> */</span>
<span class="nx">composedCategory</span><span class="o">:</span> <span class="s2">"Composed"</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * Customize the load success handler for the composed module list</span>
<span class="c"> */</span>
<span class="nx">onLoadSuccess</span><span class="o">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">wirings</span><span class="p">)</span> <span class="p">{</span>
<span class="c">// Reset the internal structure</span>
<span class="k">this</span><span class="p">.</span><span class="nx">pipes</span> <span class="o">=</span> <span class="nx">wirings</span><span class="o">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">pipesByName</span> <span class="o">=</span> <span class="p">{};</span>
<span class="c">// Build the "pipesByName" index</span>
<span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span> <span class="o">;</span> <span class="nx">i</span> <span class="o"><</span> <span class="k">this</span><span class="p">.</span><span class="nx">pipes</span><span class="p">.</span><span class="nx">length</span> <span class="o">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">pipesByName</span><span class="p">[</span> <span class="k">this</span><span class="p">.</span><span class="nx">pipes</span><span class="p">[</span><span class="nx">i</span><span class="p">].</span><span class="nx">name</span><span class="p">]</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">pipes</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
<span class="p">}</span>
<span class="c">// Customize to display composed module in the left list</span>
<span class="k">this</span><span class="p">.</span><span class="nx">updateComposedModuleList</span><span class="p">();</span>
<span class="k">this</span><span class="p">.</span><span class="nx">updateLoadPanelList</span><span class="p">();</span>
<span class="c">// Check for autoload param and display the loadPanel otherwise</span>
<span class="k">if</span><span class="p">(</span><span class="o">!</span><span class="k">this</span><span class="p">.</span><span class="nx">checkAutoLoad</span><span class="p">())</span> <span class="p">{</span>
<span class="k">this</span><span class="p">.</span><span class="nx">loadPanel</span><span class="p">.</span><span class="nx">show</span><span class="p">();</span>
<span class="p">}</span>
<span class="p">}</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * All the saved wirings are reusable modules :</span>
<span class="c"> */</span>
<span class="nx">updateComposedModuleList</span><span class="o">:</span> <span class="kd">function</span><span class="p">()</span> <span class="p">{</span>
<span class="c">// Remove all previous module with the ComposedModule class</span>
<span class="kd">var</span> <span class="nx">el</span> <span class="o">=</span> <span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Dom</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s2">"module-category-Composed"</span><span class="p">);</span>
<span class="k">if</span><span class="p">(</span> <span class="nx">el</span> <span class="p">)</span> <span class="p">{</span>
<span class="c">// Purge element (remove listeners on el and childNodes recursively)</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">util</span><span class="p">.</span><span class="nx">Event</span><span class="p">.</span><span class="nx">purgeElement</span><span class="p">(</span><span class="nx">el</span><span class="o">,</span> <span class="kc">true</span><span class="p">);</span>
<span class="nx">el</span><span class="p">.</span><span class="nx">innerHTML</span> <span class="o">=</span> <span class="s2">""</span><span class="o">;</span>
<span class="p">}</span>
<span class="k">if</span><span class="p">(</span><span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">isArray</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">pipes</span><span class="p">))</span> <span class="p">{</span>
<span class="k">for</span><span class="p">(</span><span class="kd">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="mi">0</span> <span class="o">;</span> <span class="nx">i</span> <span class="o"><</span> <span class="k">this</span><span class="p">.</span><span class="nx">pipes</span><span class="p">.</span><span class="nx">length</span> <span class="o">;</span> <span class="nx">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
<span class="kd">var</span> <span class="nx">module</span> <span class="o">=</span> <span class="k">this</span><span class="p">.</span><span class="nx">pipes</span><span class="p">[</span><span class="nx">i</span><span class="p">];</span>
<span class="kd">var</span> <span class="nx">m</span> <span class="o">=</span> <span class="p">{</span>
<span class="nx">name</span><span class="o">:</span> <span class="nx">module</span><span class="p">.</span><span class="nx">name</span><span class="o">,</span>
<span class="nx">category</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">composedCategory</span><span class="o">,</span>
<span class="nx">container</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">"xtype"</span><span class="o">:</span> <span class="s2">"WireIt.ComposedContainer"</span><span class="o">,</span>
<span class="s2">"title"</span><span class="o">:</span> <span class="nx">module</span><span class="p">.</span><span class="nx">name</span><span class="o">,</span>
<span class="s2">"wiring"</span><span class="o">:</span> <span class="k">this</span><span class="p">.</span><span class="nx">pipes</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span>
<span class="p">}</span>
<span class="p">};</span>
<span class="nx">YAHOO</span><span class="p">.</span><span class="nx">lang</span><span class="p">.</span><span class="nx">augmentObject</span><span class="p">(</span><span class="nx">m</span><span class="o">,</span> <span class="k">this</span><span class="p">.</span><span class="nx">pipes</span><span class="p">[</span><span class="nx">i</span><span class="p">]);</span>
<span class="k">this</span><span class="p">.</span><span class="nx">modulesByName</span><span class="p">[</span><span class="nx">module</span><span class="p">.</span><span class="nx">name</span><span class="p">]</span> <span class="o">=</span> <span class="nx">m</span><span class="o">;</span>
<span class="k">this</span><span class="p">.</span><span class="nx">addModuleToList</span><span class="p">(</span><span class="nx">m</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">});</span>
</pre></div>
</div>
</div>
</div>
<div class="yui-b">
<div class="nav">
<div id="moduleList" class="module">
<h4>Modules</h4>
<ul class="content">
<li class="selected"><a href="module_animations-plugin.html" title="animations-plugin">animations-plugin</a></li>
<li class=""><a href="module_composable-plugin.html" title="composable-plugin">composable-plugin</a></li>
<li class=""><a href="module_editor-plugin.html" title="editor-plugin">editor-plugin</a></li>
<li class=""><a href="module_inputex-plugin.html" title="inputex-plugin">inputex-plugin</a></li>
<li class=""><a href="module_layout-plugin.html" title="layout-plugin">layout-plugin</a></li>
<li class=""><a href="module_wireit.html" title="WireIt">WireIt</a></li>
</ul>
</div>
<div id="classList" class="module">
<h4>Classes</h4>
<ul class="content">
<li class=""><a href="WireIt.util.Anim.html" title="WireIt.util.Anim">WireIt.util.Anim</a></li>
</ul>
</div>
<div id="fileList" class="module">
<h4>Files</h4>
<ul class="content">
<li class=""><a href="Anim.js.html" title="Anim.js">Anim.js</a></li>
<li class="selected"><a href="ComposableWiringEditor.js.html" title="ComposableWiringEditor.js">ComposableWiringEditor.js</a></li>
<li class=""><a href="Layer.js.html" title="Layer.js">Layer.js</a></li>
</ul>
</div>
</div>
</div>
</div>
<div id="ft">
<hr />
Copyright © 2010 Eric Abouaf All rights reserved.
</div>
</div>
<script type="text/javascript">
var ALL_YUI_PROPS = [{"url": "WireIt.util.Anim.html#method_clearExplode", "access": "", "host": "WireIt.util.Anim", "type": "method", "name": "clearExplode"}, {"url": "WireIt.util.Anim.html#method_moveWireItWires", "access": "", "host": "WireIt.util.Anim", "type": "method", "name": "moveWireItWires"}, {"url": "WireIt.util.Anim.html#method_setTerminals", "access": "", "host": "WireIt.util.Anim", "type": "method", "name": "setTerminals"}, {"url": "WireIt.util.Anim.html#property__WireItTerminals", "access": "", "host": "WireIt.util.Anim", "type": "property", "name": "_WireItTerminals"}];
</script>
</body>
</html>