Skip to content

Commit

Permalink
Updated the existing sawire app to work against the new folder struct…
Browse files Browse the repository at this point in the history
…ure, no grouping or composition yet
  • Loading branch information
ciaranj authored and ericabouaf committed Oct 28, 2010
1 parent 39f884d commit ce8ca6a
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 89 deletions.
4 changes: 2 additions & 2 deletions plugins/grouping/examples/sawire/ExecutionFrame.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,10 +336,10 @@ ExecutionFrame.prototype = {
}
else if(t == "input") {

var inputName = module.value.input.name;
var inputName = module.value.input.inputParams.name;

// "execution"
var value = (!!params && typeof params[inputName] != "undefined") ? params[inputName] : module.value.input.value;
var value = (!!params && typeof params[inputName] != "undefined") ? params[inputName] : module.value.input.inputParams.value;

// store the value
this.execValues[moduleId] = {
Expand Down
120 changes: 63 additions & 57 deletions plugins/grouping/examples/sawire/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,78 +7,84 @@
<link rel="SHORTCUT ICON" href="../favicon.ico" type="image/png" />

<!-- YUI -->
<link rel="stylesheet" type="text/css" href="../../lib/yui/reset-fonts-grids/reset-fonts-grids.css" />
<link rel="stylesheet" type="text/css" href="../../lib/yui/assets/skins/sam/skin.css" />
<link rel="stylesheet" type="text/css" href="../../../../lib/yui/reset-fonts-grids/reset-fonts-grids.css" />
<link rel="stylesheet" type="text/css" href="../../../../lib/yui/assets/skins/sam/skin.css" />

<!-- InputEx CSS -->
<link type='text/css' rel='stylesheet' href='../../lib/inputex/css/inputEx.css' />
<link type='text/css' rel='stylesheet' href='../../../../plugins/inputex/lib/inputex/css/inputEx.css' />

<!-- YUI-accordion CSS -->
<link rel="stylesheet" type="text/css" href="../../lib/accordionview/assets/skins/sam/accordionview.css" />
<link rel="stylesheet" type="text/css" href="../../../../plugins/editor/lib/accordionview/assets/skins/sam/accordionview.css" />

<!-- WireIt CSS -->
<link rel="stylesheet" type="text/css" href="../../assets/WireIt.css" />
<link rel="stylesheet" type="text/css" href="../../css/WireItEditor.css" />
<link rel="stylesheet" type="text/css" href="sawire.css">
<link rel="stylesheet" type="text/css" href="../../../../assets/WireIt.css" />
<link rel="stylesheet" type="text/css" href="../../../../plugins/editor/assets/WireItEditor.css" />
<link rel="stylesheet" type="text/css" href="sawire.css">

<script type="text/javascript" src="util.js"></script>
<script type="text/javascript" src="xmltoken.js"></script>
<script type="text/javascript" src="xpath.js"></script>
<script type="text/javascript" src="dom.js"></script>
<script type="text/javascript" src="xslt.js"></script>
<!-- YUI -->
<script type="text/javascript" src="../../lib/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="../../lib/yui/resize/resize-min.js"></script>
<script type="text/javascript" src="../../lib/yui/layout/layout-min.js"></script>
<script type="text/javascript" src="../../lib/yui/container/container-min.js"></script>
<script type="text/javascript" src="../../lib/yui/json/json-min.js"></script>
<script type="text/javascript" src="../../lib/yui/button/button-min.js"></script>
<script type="text/javascript" src="../../lib/yui/tabview/tabview-min.js"></script>

<!-- InputEx with wirable options (WirableField-beta) -->
<script src="../../lib/inputex/js/inputex.js" type='text/javascript'></script>
<script src="../../lib/inputex/js/Field.js" type='text/javascript'></script>
<script type="text/javascript" src="../../js/inputex/WirableField-beta.js"></script>
<script src="../../lib/inputex/js/Group.js" type='text/javascript'></script>
<script src="../../lib/inputex/js/Visus.js" type='text/javascript'></script>
<script src="../../lib/inputex/js/fields/StringField.js" type='text/javascript'></script>
<script src="../../lib/inputex/js/fields/Textarea.js" type='text/javascript'></script>
<script src="../../lib/inputex/js/fields/SelectField.js" type='text/javascript'></script>
<script src="../../lib/inputex/js/fields/EmailField.js" type='text/javascript'></script>
<script src="../../lib/inputex/js/fields/UrlField.js" type='text/javascript'></script>
<script src="../../lib/inputex/js/fields/ListField.js" type='text/javascript'></script>
<script src="../../lib/inputex/js/fields/CheckBox.js" type='text/javascript'></script>
<script src="../../lib/inputex/js/fields/InPlaceEdit.js" type='text/javascript'></script>
<script type="text/javascript" src="../../../../lib/yui/utilities/utilities.js"></script>
<script type="text/javascript" src="../../../../lib/yui/resize/resize-min.js"></script>
<script type="text/javascript" src="../../../../lib/yui/layout/layout-min.js"></script>
<script type="text/javascript" src="../../../../lib/yui/container/container.js"></script>
<script type="text/javascript" src="../../../../lib/yui/json/json-min.js"></script>
<script type="text/javascript" src="../../../../lib/yui/button/button-min.js"></script>
<script type="text/javascript" src="../../../../lib/yui/tabview/tabview-min.js"></script>

<!-- YUI-Accordion -->
<script src="../../lib/accordionview/accordionview-min.js" type='text/javascript'></script>
<script src="../../../../plugins/editor/lib/accordionview/accordionview-min.js" type='text/javascript'></script>

<!-- InputEx -->
<script src="../../../../plugins/inputex/lib/inputex/js/inputex.js" type='text/javascript'></script>
<script src="../../../../plugins/inputex/lib/inputex/js/Field.js" type='text/javascript'></script>
<script src="../../../../plugins/inputex/js/WirableField.js" type="text/javascript"></script>
<script src="../../../../plugins/inputex/lib/inputex/js/Group.js" type='text/javascript'></script>
<script src="../../../../plugins/inputex/lib/inputex/js/mixins/choice.js" type='text/javascript'></script>
<script src="../../../../plugins/inputex/lib/inputex/js/fields/StringField.js" type='text/javascript'></script>
<script src="../../../../plugins/inputex/lib/inputex/js/fields/SelectField.js" type='text/javascript'></script>
<script src="../../../../plugins/inputex/lib/inputex/js/fields/EmailField.js" type='text/javascript'></script>
<script src="../../../../plugins/inputex/lib/inputex/js/fields/UrlField.js" type='text/javascript'></script>
<script src="../../../../plugins/inputex/lib/inputex/js/fields/ListField.js" type='text/javascript'></script>
<script src="../../../../plugins/inputex/lib/inputex/js/fields/CheckBox.js" type='text/javascript'></script>

<!-- Excanvas -->
<!--[if IE]><script type="text/javascript" src="../../../lib/excanvas.js"></script><![endif]-->

<!-- WireIt -->
<!--[if IE]><script type="text/javascript" src="../../lib/excanvas.js"></script><![endif]-->
<script type="text/javascript" src="../../js/WireIt.js"></script>
<script type="text/javascript" src="../../js/CanvasElement.js"></script>
<script type="text/javascript" src="../../js/Wire.js"></script>
<script type="text/javascript" src="../../js/Terminal.js"></script>
<script type="text/javascript" src="../../js/DD.js"></script>
<script type="text/javascript" src="../../js/DDResize.js"></script>
<script type="text/javascript" src="../../js/Container.js"></script>
<script type="text/javascript" src="../../js/Layer.js"></script>
<script type="text/javascript" src="../../js/inputex/FormContainer-beta.js"></script>
<script type="text/javascript" src="../../js/LayerMap.js"></script>
<script type="text/javascript" src="../../js/WiringEditor.js"></script>
<script type="text/javascript" src="../../js/ImageContainer.js"></script>
<script type="text/javascript" src="../../js/InOutContainer.js"></script>
<script type="text/javascript" src="../../js/adapters/gears.js"></script>

<script type="text/javascript" src="../../js/RubberBand.js"></script>
<script type="text/javascript" src="../../js/GroupUtils.js"></script>
<script type="text/javascript" src="../../js/GroupFormContainer.js"></script>
<script type="text/javascript" src="../../js/Group.js"></script>
<script type="text/javascript" src="../../js/Grouper.js"></script>

<script type="text/javascript" src="../../../../js/WireIt.js"></script>
<script type="text/javascript" src="../../../../js/CanvasElement.js"></script>
<script type="text/javascript" src="../../../../js/LayerMap.js"></script>
<script type="text/javascript" src="../../../../js/Wire.js"></script>
<script type="text/javascript" src="../../../../js/BezierWire.js"></script>
<script type="text/javascript" src="../../../../js/Terminal.js"></script>
<script type="text/javascript" src="../../../../js/TerminalProxy.js"></script>
<script type="text/javascript" src="../../../../js/TerminalInput.js"></script>
<script type="text/javascript" src="../../../../js/TerminalOutput.js"></script>
<script type="text/javascript" src="../../../../js/Scissors.js"></script>
<script type="text/javascript" src="../../../../js/DD.js"></script>
<script type="text/javascript" src="../../../../js/DDResize.js"></script>
<script type="text/javascript" src="../../../../js/Container.js"></script>
<script type="text/javascript" src="../../../../js/Layer.js"></script>

<!-- WireIt inputex-->
<script src="../../../../plugins/inputex/js/FormContainer.js" type="text/javascript" ></script>

<!-- WireIt Editor -->
<script type="text/javascript" src="../../../../plugins/editor/js/BaseEditor.js"></script>
<script type="text/javascript" src="../../../../plugins/editor/js/ModuleProxy.js"></script>
<script type="text/javascript" src="../../../../plugins/editor/js/WiringEditor.js"></script>

<!-- Storage Engine -->
<script type="text/javascript" src="../../../../plugins/editor/js/adapters/web-storage.js"></script>

<!-- Our Code -->
<script type="text/javascript" src="ExecutionFrame.js"></script>
<script type="text/javascript" src="modules.js"></script>
<script type="text/javascript" src="util.js"></script>
<script type="text/javascript" src="sawire.js"></script>
<script type="text/javascript" src="xmltoken.js"></script>
<script type="text/javascript" src="xpath.js"></script>
<script type="text/javascript" src="xslt.js"></script>
<script type="text/javascript" src="dom.js"></script>


<style>
Expand Down
29 changes: 24 additions & 5 deletions plugins/grouping/examples/sawire/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ modules[modules.length++] = {
"xtype": "WireIt.FormContainer",
"title": "Apply xPath to input",
"fields": [
{ "type": "string", "label": "Expression", "name": "expr", "wirable": true }
{
"type": "string",
"inputParams": {
"label": "Expression",
"name": "expr",
"wirable": true
}
}
],
"terminals": [
{
Expand Down Expand Up @@ -73,12 +80,15 @@ modules[modules.length++] ={
"fields": [
{
"type": "text",
"inputParams": {
"label": "WorkItem XML",
"name": "workitemXML",
"wirable": true
}
},
{
"type": "text",
"inputParams": {
"label": "XSL",
"value":'<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">\n'+
'<xsl:template match="node()">\n'+
Expand All @@ -92,6 +102,7 @@ modules[modules.length++] ={
'</xsl:stylesheet>',
"name": "xsl",
"wirable": false
}
}
],
"terminals": [
Expand Down Expand Up @@ -119,18 +130,22 @@ modules[modules.length++] ={
"fields": [
{
"type": "text",
"inputParams": {
"label": "WorkItem XML",
"name": "workitemXML",
"wirable": true
}
},
{
"type": "select",
"inputParams": {
"label": "RuleBase",
"name": "rulebase",
"selectValues": [1,2,3,4],
"selectOptions": ["StripEntitiesRuleBase","SetTransitionConditionA","MyFirstRuleBase","MySecondRuleBase"],
"required":true,
"wirable": false
}
}
],
"executionType":"jsBox",
Expand Down Expand Up @@ -160,9 +175,11 @@ modules[modules.length++] ={
"fields": [
{
"type": "text",
"inputParams": {
"label": "WorkItem XML",
"name": "workitemXML",
"wirable": true
}
}
],
"executionType":"jsBox",
Expand Down Expand Up @@ -212,10 +229,11 @@ var samodules={};
samodules.GetByIdContainer = function(options, layer) {
options.fields = [{
"type": "integer",
"inputParams": {
"label": "Id",
"name": "input",
"wirable": true
}];
}}];
samodules.GetByIdContainer.superclass.constructor.call(this, options, layer);

this.outputTerminal = this.addTerminal({xtype: "WireIt.util.TerminalOutput", "name": "out"});
Expand All @@ -228,10 +246,11 @@ YAHOO.extend(samodules.GetByIdContainer, WireIt.FormContainer, {});
samodules.DisplayItemContainer= function(options, layer) {
options.fields= [{
"type": "text",
"inputParams": {
"label": "Raw XML",
"name": "xml",
"wirable": true
}];
}}];
samodules.DisplayItemContainer.superclass.constructor.call(this, options, layer);

var width = WireIt.getIntStyle(this.el, "width");
Expand Down Expand Up @@ -377,10 +396,10 @@ jsBox.ComposedContainer = function(options, layer) {
for(var i = 0 ; i < pipe.modules.length ; i++) {
var m = pipe.modules[i];
var moduleDefinition =sawire.editor.modulesByName[m.name];
//console.log(moduleDefinition);
console.log(moduleDefinition);

if( m.name == "input") {
m.value.input.wirable = true;
m.value.input.inputParams.wirable = true;
options.fields.push(m.value.input);
}
else if(m.name == "output") {
Expand Down
53 changes: 28 additions & 25 deletions plugins/grouping/examples/sawire/sawire.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,17 @@ var sawire= {

language: {languageName: "myNewLanguage",
"modules":modules,
adapter: WireIt.WiringEditor.adapters.Gears
adapter: WireIt.WiringEditor.adapters.WebStorage
},
/**
* @method init
* @static
*/
init: function() {
this.editor = new sawire.WiringEditor(this.language);
this.editor.toolbar.add({label : "Run", id: "WiringEditor-runButton", events : [ {name : "click", callback: function() {
this.run();
}, context:this } ] })

// Open the infos panel
this.editor.accordionView.openPanel(2);
this.editor = new sawire.WiringEditor(this.language);
// Open the infos panel
this.editor.accordionView.openPanel(2);
},

/**
* Execute the module in the "ExecutionFrame" virtual machine
* @method run
* @static
*/
run: function() {
var ef = new ExecutionFrame( this.editor.getValue() );
for(var containerId in this.editor.layer.containers) {
ExecutionFrame.clearExecutionStateForContainer(this.editor.layer.containers[containerId]);
}
ef.run();
}
};

/**
Expand All @@ -46,13 +29,33 @@ YAHOO.lang.extend(sawire.WiringEditor, WireIt.WiringEditor, {
* Customize the load success handler for the composed module list
*/
onLoadSuccess: function(wirings) {
// sawire.WiringEditor.superclass.onLoadSuccess.call(this,wirings);
sawire.WiringEditor.superclass.onLoadSuccess.call(this,wirings);

// Customize to display composed module in the left list
// this.updateComposedModuleList();
this.updateComposedModuleList();
},

/**

renderButtons: function() {
sawire.WiringEditor.superclass.renderButtons.call(this);
var toolbar = YAHOO.util.Dom.get('toolbar');
// Buttons :
var newButton = new YAHOO.widget.Button({ label:"Run", id:"WiringEditor-runButton", container: toolbar });
newButton.on("click", this._run, this, true);
},

/**
* Execute the module in the "ExecutionFrame" virtual machine
* @method run
* @static
*/
_run: function() {
var ef = new ExecutionFrame( this.getValue() );
for(var containerId in this.layer.containers) {
ExecutionFrame.clearExecutionStateForContainer(this.layer.containers[containerId]);
}
ef.run();
},
/**
* All the saved wirings are reusable modules :
*/
updateComposedModuleList: function() {
Expand Down

0 comments on commit ce8ca6a

Please sign in to comment.