menu updated.

This commit is contained in:
Zhen Tang 2013-07-05 15:02:35 +08:00
parent e25593c61c
commit 1c3c7ca427
1 changed files with 159 additions and 37 deletions

View File

@ -622,6 +622,8 @@ HAFlow.Main.prototype.initToolbar = function() {
this.toolbar.toolbar.addChild(this.toolbar.saveFlowButton);
this.toolbar.toolbar.addChild(this.toolbar.removeFlowButton);
this.toolbar.toolbar.addChild(this.toolbar.runFlowButton);
this.toolbar.toolbar.startup();
var _currentInstance = this;
dojo.connect(this.toolbar.newFlowButton, "onClick", function(event) {
_currentInstance.newFlow();
@ -635,7 +637,6 @@ HAFlow.Main.prototype.initToolbar = function() {
dojo.connect(this.toolbar.runFlowButton, "onClick", function(event) {
_currentInstance.runFlow(_currentInstance.currentFlowId);
});
this.ui.mainMenu.addChild(this.toolbar.toolbar);
};
@ -663,48 +664,172 @@ HAFlow.Main.prototype.initFlowMenu = function() {
});
this.menu.flowMenu.newFlowMenuItem = new dijit.MenuItem({
id : "newFlowMenuItem",
label : "New Flow",
label : "New",
});
this.menu.flowMenu.saveFlowMenuItem = new dijit.MenuItem({
id : "saveFlowMenuItem",
label : "Save Flow"
this.menu.flowMenu.openFlowMenuItem = new dijit.MenuItem({
id : "openFlowMenuItem",
label : "Open",
disabled : true
});
this.menu.flowMenu.removeFlowMenuItem = new dijit.MenuItem({
id : "removeFlowMenuItem",
label : "Remove Flow"
this.menu.flowMenu.closeFlowMenuItem = new dijit.MenuItem({
id : "closeFlowMenuItem",
label : "Close",
disabled : true
});
this.menu.flowMenu.runFlowMenuItem = new dijit.MenuItem({
id : "runFlowMenuItem",
label : "Run Flow"
// this.menu.flowMenu.saveFlowMenuItem = new dijit.MenuItem({
// id : "saveFlowMenuItem",
// label : "Save Flow"
// });
this.menu.flowMenu.deleteFlowMenuItem = new dijit.MenuItem({
id : "deleteFlowMenuItem",
label : "Delete"
});
this.menu.flowMenu.exportFlowMenuItem = new dijit.MenuItem({
id : "exportFlowMenuItem",
label : "Export",
disabled : true
});
this.menu.flowMenu.importFlowMenuItem = new dijit.MenuItem({
id : "importFlowMenuItem",
label : "Import",
disabled : true
});
this.menu.flowMenu.addChild(this.menu.flowMenu.newFlowMenuItem);
this.menu.flowMenu.addChild(this.menu.flowMenu.saveFlowMenuItem);
this.menu.flowMenu.addChild(this.menu.flowMenu.removeFlowMenuItem);
this.menu.flowMenu.addChild(this.menu.flowMenu.runFlowMenuItem);
this.menu.flowMenu.addChild(this.menu.flowMenu.openFlowMenuItem);
this.menu.flowMenu.addChild(this.menu.flowMenu.closeFlowMenuItem);
// this.menu.flowMenu.addChild(this.menu.flowMenu.saveFlowMenuItem);
this.menu.flowMenu.addChild(this.menu.flowMenu.deleteFlowMenuItem);
this.menu.flowMenu.addChild(this.menu.flowMenu.exportFlowMenuItem);
this.menu.flowMenu.addChild(this.menu.flowMenu.importFlowMenuItem);
this.menu.flowMenu.startup();
this.menu.runMenu = new dijit.Menu({
id : "runMenu"
});
this.menu.runMenu.runMenuItem = new dijit.MenuItem({
id : "runMenuItem",
label : "Run",
});
this.menu.runMenu.debugMenuItem = new dijit.MenuItem({
id : "debugMenuItem",
label : "Debug",
disabled : true
});
this.menu.runMenu.validateMenuItem = new dijit.MenuItem({
id : "validateMenuItem",
label : "Validate",
disabled : true
});
this.menu.runMenu.runHistoryMenuItem = new dijit.MenuItem({
id : "runHistoryMenuItem",
label : "Run History",
disabled : true
});
this.menu.runMenu.debugHistoryMenuItem = new dijit.MenuItem({
id : "debugHistoryMenuItem",
label : "Debug History",
disabled : true
});
this.menu.runMenu.addChild(this.menu.runMenu.runMenuItem);
this.menu.runMenu.addChild(this.menu.runMenu.debugMenuItem);
this.menu.runMenu.addChild(this.menu.runMenu.validateMenuItem);
this.menu.runMenu.addChild(this.menu.runMenu.runHistoryMenuItem);
this.menu.runMenu.addChild(this.menu.runMenu.debugHistoryMenuItem);
this.menu.runMenu.startup();
this.menu.searchMenu = new dijit.Menu({
id : "searchMenu"
});
this.menu.searchMenu.searchFlowMenuItem = new dijit.MenuItem({
id : "searchFlowMenuItem",
label : "Search Flow",
disabled : true
});
this.menu.searchMenu.searchModuleMenuItem = new dijit.MenuItem({
id : "searchModuleMenuItem",
label : "Search Module",
disabled : true
});
this.menu.searchMenu.searchLogMenuItem = new dijit.MenuItem({
id : "searchLogMenuItem",
label : "Search Log",
disabled : true
});
this.menu.searchMenu.addChild(this.menu.searchMenu.searchFlowMenuItem);
this.menu.searchMenu.addChild(this.menu.searchMenu.searchModuleMenuItem);
this.menu.searchMenu.addChild(this.menu.searchMenu.searchLogMenuItem);
this.menu.searchMenu.startup();
this.menu.windowMenu = new dijit.Menu({
id : "windowMenu"
});
this.menu.windowMenu.hideToolbarMenuItem = new dijit.MenuItem({
id : "hideToolbarMenuItem",
label : "Hide Toolbar",
disabled : true
});
this.menu.windowMenu.addChild(this.menu.windowMenu.hideToolbarMenuItem);
this.menu.windowMenu.startup();
this.menu.helpMenu = new dijit.Menu({
id : "helpMenu"
});
this.menu.helpMenu.aboutMenuItem = new dijit.MenuItem({
id : "aboutMenuItem",
label : "About",
disabled : true
});
this.menu.helpMenu.manualMenuItem = new dijit.MenuItem({
id : "manualMenuItem",
label : "Manual",
disabled : true
});
this.menu.helpMenu.addChild(this.menu.helpMenu.aboutMenuItem);
this.menu.helpMenu.addChild(this.menu.helpMenu.manualMenuItem);
this.menu.helpMenu.startup();
this.ui.mainMenu.addChild(new dijit.PopupMenuBarItem({
id : "flowPopupMenuBarItem",
label : "Flow",
popup : this.menu.flowMenu
}));
this.ui.mainMenu.addChild(new dijit.PopupMenuBarItem({
id : "runPopupMenuBarItem",
label : "Run",
popup : this.menu.runMenu
}));
this.ui.mainMenu.addChild(new dijit.PopupMenuBarItem({
id : "searchPopupMenuBarItem",
label : "Search",
popup : this.menu.searchMenu
}));
this.ui.mainMenu.addChild(new dijit.PopupMenuBarItem({
id : "windowPopupMenuBarItem",
label : "Window",
popup : this.menu.windowMenu
}));
this.ui.mainMenu.addChild(new dijit.PopupMenuBarItem({
id : "helpPopupMenuBarItem",
label : "Help",
popup : this.menu.helpMenu
}));
var _currentInstance = this;
dojo.connect(this.menu.flowMenu.newFlowMenuItem, "onClick",
function(event) {
_currentInstance.newFlow();
});
dojo.connect(this.menu.flowMenu.saveFlowMenuItem, "onClick",
function(event) {
_currentInstance.saveFlow(_currentInstance.currentFlowId);
});
dojo.connect(this.menu.flowMenu.removeFlowMenuItem, "onClick", function(
// dojo.connect(this.menu.flowMenu.saveFlowMenuItem, "onClick",
// function(event) {
// _currentInstance.saveFlow(_currentInstance.currentFlowId);
// });
dojo.connect(this.menu.flowMenu.deleteFlowMenuItem, "onClick", function(
event) {
_currentInstance.removeFlow(_currentInstance.currentFlowId);
});
dojo.connect(this.menu.flowMenu.runFlowMenuItem, "onClick",
function(event) {
_currentInstance.runFlow(_currentInstance.currentFlowId);
});
dojo.connect(this.menu.runMenu.runMenuItem, "onClick", function(event) {
_currentInstance.runFlow(_currentInstance.currentFlowId);
});
};
HAFlow.Main.prototype.initBottomTabs = function() {
@ -990,20 +1115,17 @@ HAFlow.Main.prototype.paintFlow = function(flowId) {
HAFlow.Main.prototype.paintNodes = function(flowId) {
var text = "";
for ( var i = 0; i < this.flows[flowId].nodes.length; i++) {
text += "<div class=\"node\" style=\"left:"
+ this.flows[flowId].nodes[i].position.left
+ "px; top:"
+ this.flows[flowId].nodes[i].position.top
+ "px;\" id=\"node_"
+ this.flows[flowId].nodes[i].id
+ "\"><div>"
+ this.flows[flowId].nodes[i].name
+ "</div><div>"
+ "("
+ this
.getModuleById(this,
this.flows[flowId].nodes[i].moduleId).name
+ ")</div>" + "</div>";
var moduleName = this.getModuleById(this,
this.flows[flowId].nodes[i].moduleId).name;
text += "<div class=\"node" + "\" style=\"left:"
+ this.flows[flowId].nodes[i].position.left + "px; top:"
+ this.flows[flowId].nodes[i].position.top + "px;";
if (moduleName == "Start") {
text += "background:#00c0c0";
}
text += "\" id=\"node_" + this.flows[flowId].nodes[i].id + "\">"
+ "<div>" + this.flows[flowId].nodes[i].name + "</div><div>"
+ "(" + moduleName + ")</div>" + "</div>";
}
$("#" + "flowContainer_" + flowId).html(text);
};