diff --git a/src/main/webapp/script/haflow.admin.js b/src/main/webapp/script/haflow.admin.js
index f0826fc..c0dd1fb 100644
--- a/src/main/webapp/script/haflow.admin.js
+++ b/src/main/webapp/script/haflow.admin.js
@@ -9,6 +9,10 @@ dojo.require("dijit.MenuBar");
dojo.require("dijit.MenuBarItem");
dojo.require("dijit.PopupMenuBarItem");
+dojo.require("dijit.form.Button");
+dojo.require("dijit.form.TextBox");
+dojo.require("dijit.form.SimpleTextarea");
+
dojo.require("dojo.dom");
dojo.require("dojo.json");
dojo.require("dojo.store.Memory");
@@ -39,27 +43,49 @@ HAFlow.Admin.prototype.createAddModuleUserInterface = function() {
text += "
";
text += "
";
text += "
Name:";
- text += "
";
+ text += "
";
text += "
";
text += "
";
text += "
Configurations: (displayName,key)
";
- text += "
";
+ text += "
";
text += "
";
- text += "
";
+ text += "
";
text += "
";
$("#" + this.addModuleContainerId).html(text);
var _currentInstance = this;
- $("#" + "add_module_button").bind(
- "click",
- function() {
- var module = {
- name : $("#add_module_name").val(),
- configurations : _currentInstance.extractConfiguration($(
- "#add_module_configuration").val())
- };
- _currentInstance.addModule(_currentInstance, module);
- });
+ if (dijit.byId("add_module_name") != null) {
+ dijit.registry.remove("add_module_name");
+ }
+ var moduleNameTextBox = new dijit.form.TextBox({
+ id : "add_module_name",
+ });
+ moduleNameTextBox.placeAt(dojo.byId("add_module_name_container"));
+ moduleNameTextBox.startup();
+ if (dijit.byId("add_module_configuration") != null) {
+ dijit.registry.remove("add_module_configuration");
+ }
+ var textarea = new dijit.form.SimpleTextarea({
+ id : "add_module_configuration",
+ rows : 5,
+ cols : 50
+ });
+ textarea.placeAt(dojo.byId("add_module_configuration_container"));
+ textarea.startup();
+
+ var button = new dijit.form.Button({
+ label : "Add Module",
+ onClick : function() {
+ var module = {
+ name : $("#add_module_name").val(),
+ configurations : _currentInstance.extractConfiguration($(
+ "#add_module_configuration").val())
+ };
+ _currentInstance.addModule(_currentInstance, module);
+ }
+ });
+ button.placeAt(dojo.byId("add_module_button"));
+ button.startup();
};
HAFlow.Admin.prototype.extractConfiguration = function(source) {
@@ -120,22 +146,26 @@ HAFlow.Admin.prototype.generateModuleList = function(instance) {
text += "";
text += "";
}
- text += "";
+ text += "";
text += "";
text += "";
}
text += "";
$("#" + this.moduleListContainerId).html(text);
- var _currentInstance = this;
for (i = 0; i < this.moduleList.modules.length; i++) {
- $("#" + "remove_module_" + this.moduleList.modules[i].id).bind(
- "click",
- function() {
- var moduleId = $(this).attr("id").replace("remove_module_",
- "");
- _currentInstance.removeModule(_currentInstance, moduleId);
- });
+ var _currentInstance = this;
+ var button = new dijit.form.Button({
+ label : "Remove Module",
+ moduleId : this.moduleList.modules[i].id,
+ onClick : function() {
+ var moduleId = $(this).attr("moduleId");
+ _currentInstance.removeModule(_currentInstance, moduleId);
+ }
+ });
+ button.placeAt(dojo.byId("remove_module_"
+ + this.moduleList.modules[i].id));
+ button.startup();
}
};
diff --git a/src/main/webapp/script/haflow.main.js b/src/main/webapp/script/haflow.main.js
index 0c31371..ce54f98 100644
--- a/src/main/webapp/script/haflow.main.js
+++ b/src/main/webapp/script/haflow.main.js
@@ -9,6 +9,9 @@ dojo.require("dijit.MenuBar");
dojo.require("dijit.MenuBarItem");
dojo.require("dijit.PopupMenuBarItem");
+dojo.require("dijit.form.Button");
+dojo.require("dijit.form.TextBox");
+
dojo.require("dojo.dom");
dojo.require("dojo.json");
dojo.require("dojo.store.Memory");
@@ -315,16 +318,28 @@ HAFlow.Main.prototype.onFlowClicked = function(instance, flowId) {
var text = "";
text += "";
text += "
Id: " + flowBrief.id + "
";
- text += "
Name: ";
- text += "
";
- text += "
";
+ text += "
Name:
";
+ text += "
";
+ text += "
";
text += "
";
$("#" + instance.informationContainerId).html(text);
- $("#save_flow_name_" + flowBrief.id).bind("click", function() {
- instance.saveFlowName(instance, flowBrief.id);
+ if (dijit.byId("flow_" + flowBrief.id + "_name") != null) {
+ dijit.registry.remove("flow_" + flowBrief.id + "_name");
+ }
+ var flowNameTextBox = new dijit.form.TextBox({
+ id : "flow_" + flowBrief.id + "_name",
+ value : flowBrief.name
});
+ flowNameTextBox.placeAt(dojo.byId("flow_name_text_box"));
+ flowNameTextBox.startup();
+ var button = new dijit.form.Button({
+ label : "Save",
+ onClick : function() {
+ instance.saveFlowName(instance, flowBrief.id);
+ }
+ });
+ button.placeAt(dojo.byId("save_flow_name_button"));
+ button.startup();
};
HAFlow.Main.prototype.saveFlowName = function(instance, flowId) {
@@ -536,17 +551,23 @@ HAFlow.Main.prototype.onConnectionCreated = function(instance, flowId, info) {
HAFlow.Main.prototype.onConnectionClicked = function(instance, flowId, info) {
var source = info.sourceId.replace("node_", "");
var target = info.targetId.replace("node_", "");
+ var sourceNode = instance.getNodeById(instance, flowId, source);
+ var targetNode = instance.getNodeById(instance, flowId, target);
var text = "";
- text += "From: " + info.sourceId + ".To: "
- + info.targetId + ".
";
+ text += "From: " + sourceNode.name + ".To: "
+ + targetNode.name + ".
";
text += "Delete?
";
- text += "";
+ text += "";
$("#" + instance.informationContainerId).html(text);
- $("#delete_connection_" + source + "_" + target).bind("click", function() {
- instance.deleteConnection(instance, flowId, info);
+ var button = new dijit.form.Button({
+ label : "Delete Connection",
+ onClick : function() {
+ instance.deleteConnection(instance, flowId, info);
+ }
});
+ button.placeAt(dojo.byId("delete_connection_button"));
+ button.startup();
};
HAFlow.Main.prototype.deleteConnection = function(instance, flowId, info) {
@@ -593,45 +614,83 @@ HAFlow.Main.prototype.onNodeClicked = function(instance, flowId, nodeId) {
text += "Module: " + module.name + "
";
text += "";
text += "
Name: ";
- text += "
";
- text += "
";
+ text += "
";
+ text += "
";
text += "
";
text += "Delete?
";
- text += "";
+ text += "";
text += "";
$("#" + instance.informationContainerId).html(text);
- $("#save_node_name_" + nodeId).bind("click", function() {
- instance.saveNodeName(instance, flowId, nodeId);
+
+ if (dijit.byId("node_" + nodeId + "_name") != null) {
+ dijit.registry.remove("node_" + nodeId + "_name");
+ }
+ var nodeNameTextBox = new dijit.form.TextBox({
+ id : "node_" + nodeId + "_name",
+ value : node.name
});
- $("#delete_node_" + nodeId).bind("click", function() {
- instance.deleteNode(instance, flowId, nodeId);
+ nodeNameTextBox.placeAt(dojo.byId("node_name_text_box"));
+ nodeNameTextBox.startup();
+
+ var saveNodeNameButton = new dijit.form.Button({
+ label : "Save Node Name",
+ onClick : function() {
+ instance.saveNodeName(instance, flowId, nodeId);
+ }
});
+ saveNodeNameButton.placeAt(dojo.byId("save_node_name_button"));
+ saveNodeNameButton.startup();
+
+ var deleteNodeButton = new dijit.form.Button({
+ label : "DeleteNode",
+ onClick : function() {
+ instance.deleteNode(instance, flowId, nodeId);
+ }
+ });
+ deleteNodeButton.placeAt(dojo.byId("delete_node_button"));
+ deleteNodeButton.startup();
var form = "";
form += "";
form += "
Configuration:
";
var i;
for (i = 0; i < module.configurations.length; i++) {
+ var textBoxId = "flow_" + flowId + "_node_" + nodeId + "_"
+ + module.configurations[i].key;
+ var divId = textBoxId + "_container";
form += "
";
form += ("
" + module.configurations[i].displayName + "");
- form += ("
");
+ form += "
";
form += "
";
}
- form += "
";
+ form += "
";
form += "
";
$("#" + instance.configurationContainerId).html(form);
- $("#save_configuration_" + "flow_" + flowId + "_node_" + nodeId).bind(
- "click", function() {
- instance.saveConfiguration(instance, flowId, nodeId);
- });
+
+ for (i = 0; i < module.configurations.length; i++) {
+ var textBoxId = "flow_" + flowId + "_node_" + nodeId + "_"
+ + module.configurations[i].key;
+ var divId = textBoxId + "_container";
+ if (dijit.byId(textBoxId) != null) {
+ dijit.registry.remove(textBoxId);
+ }
+ var configurationTextBox = new dijit.form.TextBox({
+ id : textBoxId,
+ value : instance.getConfigurationValue(instance, flowId, nodeId,
+ module.configurations[i].key)
+ });
+ configurationTextBox.placeAt(dojo.byId(divId));
+ configurationTextBox.startup();
+ }
+
+ var saveConfigurationButton = new dijit.form.Button({
+ label : "Save Configuration",
+ onClick : function() {
+ instance.saveConfiguration(instance, flowId, nodeId);
+ }
+ });
+ saveConfigurationButton.placeAt(dojo.byId("save_configuration_button"));
+ saveConfigurationButton.startup();
};
HAFlow.Main.prototype.saveNodeName = function(instance, flowId, nodeId) {