change property style to table style

This commit is contained in:
dawncx 2013-12-27 10:04:31 +08:00
parent b21029510e
commit 021d769494
14 changed files with 636 additions and 217 deletions

View File

@ -38,6 +38,7 @@ public class FlowController {
@ResponseBody
public FlowListModel get(HttpServletRequest request,
@RequestParam(value = "path", required = true) String path) {
System.out.println("call /flow!!!!!!!");
return this.getFlowHelper().getFlowList(
(Integer) request.getSession().getAttribute("userid"), path);
}

View File

@ -81,7 +81,8 @@ public class MainLogonController {
public String login(RedirectAttributes redirectAttributes,
HttpServletRequest request,
@RequestParam("username") String username,
@RequestParam("password") String password) {
@RequestParam("password") String password,
@RequestParam("language") String language) {
if (username == "" || password == "") {
redirectAttributes.addFlashAttribute("message", "username or password is empty!");
@ -94,9 +95,10 @@ public class MainLogonController {
request.getSession().setAttribute("userid", userid);
request.getSession().setAttribute("username", username);
request.getSession().setAttribute("scope", 0);
if(language.equals("English")||language.equals("english"))
return "redirect:/main";
else
return "redirect:/zh";
} else {
redirectAttributes.addFlashAttribute("message","invalid username or password!");
return "redirect:/";
@ -105,17 +107,12 @@ public class MainLogonController {
@RequestMapping(value = "/main")
public ModelAndView post(HttpServletRequest request) {
//boolean flag = UserHelper.isUserLogon(request,0);
//if(flag){
ModelAndView main=new ModelAndView("main");
main.addObject("username", request.getSession().getAttribute("username"));
return main;
//}
/*else{
ModelAndView mav=new ModelAndView("logon");
mav.addObject("message","<EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
return mav;
}*/
}
@RequestMapping(value = "/zh")

View File

@ -85,6 +85,8 @@ public class FlowHelper {
if (flow == null) {
return null;
}
System.out.println("tiaoshi!!!!!!!!!!!!!!");
System.out.println(flow.getId());
FlowModel flowModel = new FlowModel();
flowModel.setId(flow.getId());
flowModel.setName(flow.getName());
@ -115,8 +117,13 @@ public class FlowHelper {
model.setKey(profile.getKey());
model.setValue(profile.getValue());
nodeModel.getConfigurations().add(model);
System.out.println("configuration!!!!!!!");
System.out.println(profile.getValue());
}
flowModel.getNodes().add(nodeModel);
System.out.println("node!!!!!!!!!");
System.out.println(node.getId());
System.out.println(node.getName());
}
flowModel.setEdges(new HashSet<EdgeModel>());
for (Edge edge : flow.getEdges()) {
@ -146,6 +153,7 @@ public class FlowHelper {
}
public boolean doSaveFlow(UUID flowId, FlowModel model,int userid) {
Set<Node> nodes = new HashSet<Node>();
Set<Edge> edges = new HashSet<Edge>();
for (NodeModel nodeModel : model.getNodes()) {

View File

@ -51,7 +51,7 @@ public class SessionFilter extends OncePerRequestFilter{
//uri which make request
String uri = request.getRequestURI();
System.out.println(uri);
String userName=(String)request.getSession().getAttribute("username");
Integer scope=(Integer)request.getSession().getAttribute("scope");
@ -61,8 +61,7 @@ public class SessionFilter extends OncePerRequestFilter{
return;
}
//admin user filter
System.out.println(isUserLogon(uri,userName,scope,notFilter,"admin"));
System.out.println(isUserLogon(uri,userName,scope,notFilter,"haflow"));
boolean isLogon=isUserLogon(uri,userName,scope,notFilter,"admin")&&isUserLogon(uri,userName,scope,notFilter,"haflow");
if(isLogon){
filterChain.doFilter(request, response);

View File

@ -163,7 +163,24 @@
</tr>
</table>
</li>
<div class="clear"></div><br />
<li class='mktFormReq mktField' style="width:500px;" >
<table>
<tr>
<td style="width:150px;"><label>Language:</label><span style="color:#F00">*</span></td>
<td><span class='mktInput'>
<select name="language" class='mktFormText mktFormString mktFReq' style="
width: 322px;
height: 30px;">
<option value="english" class='mktFormText mktFormString mktFReq'>English</option>
<option value="chinese" class='mktFormText mktFormString mktFReq'>简体中文</option>
</select>
<span class='mktFormMsg' id="error_password"></span>
</span>
</td>
</tr>
</table>
</li>
<div class="clear"></div><br />
<li class='mktField' style="width:500px;">

View File

@ -16,6 +16,7 @@
<title>Haflow - a big data analysis service platform!</title>
<link rel="stylesheet"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dijit/themes/claro/claro.css">
<link rel="Stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dojox/grid/resources/soriaGrid.css" />
<link rel="stylesheet"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dijit/themes/soria/soria.css">
<link rel="stylesheet"

View File

@ -15,6 +15,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Haflow - a big data analysis service platform!</title>
<link rel="Stylesheet" href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dojox/grid/resources/soriaGrid.css" />
<link rel="stylesheet"
href="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dijit/themes/claro/claro.css">
<link rel="stylesheet"
@ -40,6 +41,7 @@
src="http://ajax.googleapis.com/ajax/libs/dojo/1.9.0/dojo/dojo.js"
djConfig="isDebug:true,parseOnLoad:true,locale:'zh-cn'"></script>
<script type="text/javascript" src="<%=basePath%>/script/locale/nls/zh-cn/myfile.js"></script>
<script type="text/javascript" src="<%=basePath%>/script/ajax.setup.js"></script>
<script type="text/javascript" src="<%=basePath%>/script/haflow.js"></script>
<script type="text/javascript" src="<%=basePath%>/script/haflow.ui.js"></script>
<script type="text/javascript" src="<%=basePath%>/script/haflow.main.js"></script>

View File

@ -160,7 +160,3 @@ dojo.addOnLoad(function(){
}
});

View File

@ -30,6 +30,8 @@ dojo.require("dojox.grid.EnhancedGrid");
dojo.require("dojo.data.ItemFileWriteStore");
dojo.require("dojox.grid.cells.dijit");
dojo.require("dojox.layout.ContentPane");
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileWriteStore");
// public
HAFlow.Main.prototype.initFlowList = function() {
@ -263,65 +265,202 @@ HAFlow.Main.prototype.refreshFlowList = function(instance, parentPath, data) {
HAFlow.Main.prototype.onFlowClicked = function(instance, flowId) {
var flowBrief = instance.getFlowBriefById(instance, flowId);
var text = "";
text += "<table border=\"0\">";
text += "<tr style=\"tr\"><th align=\"left\">"+myfile.flowInfo+"</th><td>"
+ flowBrief.id + "</td></tr>";
text += "<tr style=\"tr\"><th align=\"left\">"+myfile.name+"</th><td><span id=\"flow_name_text_box\" class=\"configuration-content\"></span></td></tr>";
text += "<tr style=\"tr\"><td align=\"left\"><div id=\"save_flow_name_button\" class=\"configuration-content\"></div></td></tr>";
text += "</table>";
text += "<div id='save_flow_table_button'></div>";
text += "<div id='gridDiv' style='width:100%; height:350px'></div>";
$("#" + instance.informationContainerId).html(text);
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,
style : "width:300px;"
});
flowNameTextBox.placeAt(dojo.byId("flow_name_text_box"));
flowNameTextBox.startup();
var button = new dijit.form.Button({
label : myfile.save,
onClick : function() {
instance.saveFlowName(instance, flowBrief.id);
console.log("save Table:");
console.log(instance);
var grid = dijit.byId("flow_" + flowBrief.id + "_InfoTable");
var length = grid.store._arrayOfAllItems.length;
var newFlowName = "NewFlow";
for ( var i = 0; i < length; i++) {
var row = grid.getItem(i);
var key = row["key"];
if (key == myfile.name) {
newFlowName=grid.store.getValue(row,"value");
break;
}
}
instance.saveFlowName(newFlowName, instance, flowBrief.id);
}
});
button.placeAt(dojo.byId("save_flow_name_button"));
button.placeAt("save_flow_table_button");
button.startup();
this.initFlowDataGrid(flowBrief, instance, flowId);
var informationPane = dijit.byId(instance.informationContainerId);
_currentInstance.ui.bottomContainer.selectChild(informationPane);
};
HAFlow.Main.prototype.initFlowDataGrid = function(flowBrief, instance, flowId) {
if (dijit.byId("flow_" + flowBrief.id + "_InfoTable") != null) {
dijit.registry.remove("flow_" + flowBrief.id + "_InfoTable");
}
var items = [];
items.push({
key : myfile.flowInfo,
value : flowBrief.id,
});
items.push({
key : myfile.name,
value : flowBrief.name,
});
var store = new dojo.data.ItemFileWriteStore({
data : {
items : items
}
});
var layout = [ {
name : myfile.description,
field : "key",
width : "50%",
}, {
name : myfile.value,
field : "value",
width : "50%",
editable : true,
}
];
var grid = new dojox.grid.DataGrid({
id : "flow_" + flowBrief.id + "_InfoTable",
store : store,
structure : layout,
});
grid.placeAt("gridDiv");
grid.startup();
grid.canSort = function() {
return false;
};
grid.canEdit = function(inCell, inRowIndex) {
if (inCell.index == 1 && inRowIndex == 0)
return false;
else
return true;
};
};
HAFlow.Main.prototype.onFlowFolderClicked = function(instance, flowId) {
var flowBrief = instance.getFlowBriefById(instance, flowId);
var text="";
text+="<table border=\"0\">";
text+="<tr style=\"tr\"><th align=\"left\">"+myfile.name+"</th><td><span id=\"flow_name_text_box\" class=\"configuration-content\"></span></td></tr>";
text+="<tr style=\"tr\"><td align=\"left\"><div id=\"save_flow_name_button\" class=\"configuration-content\"></div></td></tr>";
text+="</table>";
text+="<div id='gridDiv' style='width:100%; height:350px'></div>";
$("#" + instance.informationContainerId).html(text);
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,
style : "width:300px;"
});
flowNameTextBox.placeAt(dojo.byId("flow_name_text_box"));
flowNameTextBox.startup();
var button = new dijit.form.Button({
label : myfile.save,
onClick : function() {
instance.saveFlowFolderName(instance, flowBrief.id);
}
});
button.placeAt(dojo.byId("save_flow_name_button"));
button.startup();
this.initFloderDataGrid(flowBrief,instance, flowId);
var informationPane = dijit.byId(instance.informationContainerId);
_currentInstance.ui.bottomContainer.selectChild(informationPane);
};
HAFlow.Main.prototype.initFloderDataGrid=function(flowBrief,instance,flowId){
if (dijit.byId("flow_" + flowBrief.id + "_InfoTable") != null) {
dijit.registry.remove("flow_" + flowBrief.id + "_InfoTable");
}
var items=[];
items.push({
key:myfile.flowInfo,
value:flowBrief.id,
});
items.push({
key:myfile.name,
value:flowBrief.name,
});
var store=new dojo.data.ItemFileWriteStore({data:{items:items}});
var layout=[
{ name: "c1", field: "key", width: "50%", },
{ name: "c2", field: "value", width: "50%" ,
editable: true,}
];
var grid=new dojox.grid.DataGrid({
id:"flow_"+flowBrief.id+"_InfoTable",
store:store,
structure:layout,
autoHeight: true
});
grid.placeAt("gridDiv");
grid.startup();
grid.canSort=function(){
return false;
};
grid.canEdit=function(inCell,inRowIndex){
if(inCell.index==1&&inRowIndex==0)
return false;
else
return true;
};
onSet=function(item,attr,oldVal,newVal){
if (item._0 == "1" && attr == "value") {
if (oldVal == null)
oldVal = "";
if (oldVal != newVal) {
instance.saveFlowFolderName(newVal, instance, flowBrief.id);
}
}
};
dojo.connect(grid.store, "onSet", grid,onSet);
};
/*
* HAFlow.Main.prototype.onFlowClicked = function(instance, flowId) { var
* flowBrief = instance.getFlowBriefById(instance, flowId); var text = ""; text += "<table
* border=\"0\">"; text += "<tr style=\"tr\"><th align=\"left\">"+myfile.flowInfo+"</th><td>" +
* flowBrief.id + "</td></tr>"; text += "<tr style=\"tr\"><th align=\"left\">"+myfile.name+"</th><td><span
* id=\"flow_name_text_box\" class=\"configuration-content\"></span></td></tr>";
* text += "<tr style=\"tr\"><td align=\"left\"><div
* id=\"save_flow_name_button\" class=\"configuration-content\"></div></td></tr>";
* text += "</table>"; $("#" + instance.informationContainerId).html(text); 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, style : "width:300px;" });
* flowNameTextBox.placeAt(dojo.byId("flow_name_text_box"));
* flowNameTextBox.startup(); var button = new dijit.form.Button({ label :
* myfile.save, onClick : function() { instance.saveFlowName(instance,
* flowBrief.id); } }); button.placeAt(dojo.byId("save_flow_name_button"));
* button.startup(); var informationPane =
* dijit.byId(instance.informationContainerId);
* _currentInstance.ui.bottomContainer.selectChild(informationPane); };
*
* HAFlow.Main.prototype.onFlowFolderClicked = function(instance, flowId) { var
* flowBrief = instance.getFlowBriefById(instance, flowId); var text = "";
* text+="<table border=\"0\">"; text+="<tr style=\"tr\"><th align=\"left\">"+myfile.name+"</th><td><span
* id=\"flow_name_text_box\" class=\"configuration-content\"></span></td></tr>";
* text+="<tr style=\"tr\"><td align=\"left\"><div
* id=\"save_flow_name_button\" class=\"configuration-content\"></div></td></tr>";
* text+="</table>"; $("#" + instance.informationContainerId).html(text); 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, style : "width:300px;" });
* flowNameTextBox.placeAt(dojo.byId("flow_name_text_box"));
* flowNameTextBox.startup(); var button = new dijit.form.Button({ label :
* myfile.save, onClick : function() { instance.saveFlowFolderName(instance,
* flowBrief.id); } }); button.placeAt(dojo.byId("save_flow_name_button"));
* button.startup(); var informationPane =
* dijit.byId(instance.informationContainerId);
* _currentInstance.ui.bottomContainer.selectChild(informationPane); };
*/
HAFlow.Main.prototype.newFlow = function(parentpath,path) {
var newFlowId = HAFlow.generateUUID();
this.flows[newFlowId] = {};
@ -395,8 +534,10 @@ HAFlow.Main.prototype.saveFlow = function(flowId) {
_currentInstance.addToConsole("Flow have not modified!");
return;
}
$.ajax({
url : _currentInstance.basePath + "flow/" + flowId,
type : "PUT",
dataType : "json",
contentType : "application/json",
@ -411,7 +552,9 @@ HAFlow.Main.prototype.saveFlow = function(flowId) {
error : function(request, status, error) {
_currentInstance.addToConsole("An error occurred while saving flow: "
+ error, true);
console.log(status);
}
});
};
@ -592,9 +735,15 @@ HAFlow.Main.prototype.showRunHistory = function(flowId) {
});
};
HAFlow.Main.prototype.saveFlowName = function(instance, flowId) {
HAFlow.Main.prototype.saveFlowName = function(newFlowName,instance, flowId) {
if (instance.flows[flowId]) {
var value = $("#" + "flow_" + flowId + "_name").val();
/*
* old save Flow Name
*
* var value = $("#" + "flow_" + flowId + "_name").val();
*/
var value=newFlowName;
if (this.checkFlowName(instance, instance.flows[flowId].name, value)) {
instance.flows[flowId].name = value;
instance.getFlowBriefById(instance, flowId).name = value;
@ -620,8 +769,14 @@ HAFlow.Main.prototype.saveFlowName = function(instance, flowId) {
};
//TODO:
HAFlow.Main.prototype.saveFlowFolderName = function(instance, flowId) {
var value = $("#" + "flow_" + flowId + "_name").val();
HAFlow.Main.prototype.saveFlowFolderName = function(newVal,instance, flowId) {
/*
* old value
*
* var value = $("#" + "flow_" + flowId + "_name").val();
*
* */
var value=newVal;
var item=instance.flowListStore.query({id:flowId});
var flowfolder={};
instance.getFlowBriefById(instance, flowId).name = value;
@ -665,9 +820,15 @@ HAFlow.Main.prototype.saveFlowFolderName = function(instance, flowId) {
};
HAFlow.Main.prototype.saveNodeName = function(instance, flowId, nodeId) {
HAFlow.Main.prototype.saveNodeName = function(newVal,instance, flowId, nodeId) {
var node = instance.getNodeById(instance, flowId, nodeId);
var value = $("#" + "node_" + nodeId + "_name").val();
if(node==null) return _currentInstance.addToConsole("Please choose a valid node!",true);
/*
* old value
* var value = $("#" + "node_" + nodeId + "_name").val();
*/
value=newVal;
if (instance.checkNodeName(instance, flowId, node.name, value)) {
node.name = value;
instance.paintFlow(flowId);
@ -676,6 +837,37 @@ HAFlow.Main.prototype.saveNodeName = function(instance, flowId, nodeId) {
_currentInstance.addToConsole("Invalid node name", true);
}
};
HAFlow.Main.prototype.saveNodeConfiguration = function(_baseRowIndex,instance, flowId, nodeId){
var node = instance.getNodeById(instance, flowId, nodeId);
var module = instance.getModuleById(instance, node.moduleId);
node.configurations = [];
var i;
var grid = dijit.registry.byId("flow_" + flowId + "_node_" + nodeId
+ "_Table");
//var length = grid.store._arrayOfAllItems.length;
for (i = 0; i < module.configurations.length; i++) {
var row = grid.getItem(i+_baseRowIndex);
var val = grid.store.getValue(row, "value");
console.log(val);
if (module.configurations[i].type != "BOOLEAN" && val != null
&& val.match(module.configurations[i].pattern) == null) {
_currentInstance.addToConsole("Invalid node configuration: "
+ module.configurations[i].displayName, true);
return;
}
}
for (i = 0; i < module.configurations.length; i++) {
node.configurations.push({
key : module.configurations[i].key,
value : grid.store.getValue(grid.getItem(i+_baseRowIndex),"value")
});
}
};
HAFlow.Main.prototype.saveConfiguration = function(instance, flowId, nodeId) {
var node = instance.getNodeById(instance, flowId, nodeId);

View File

@ -198,12 +198,14 @@ HAFlow.Main.prototype.doAddModule = function(instance, flowId, moduleId, left,
for (i = 0; i < instance.flows[flowId].nodes.length; i++) {
var pattern = /^NewNode(\d+)$/;
var matches = pattern.exec(instance.flows[flowId].nodes[i].name);
if (matches != null) {
for (j = 0; j < matches.length; j++) {
if (parseInt(matches[j]) > currentNewNodeNumber) {
currentNewNodeNumber = parseInt(matches[j]);
}
}
}
}
currentNewNodeNumber++;
var newNode = {};
var id = HAFlow.generateUUID();

View File

@ -204,13 +204,26 @@ HAFlow.Main.prototype.initHdfsFileListTree = function() {
id : "RefreshMenuItem",
label : myfile.refresh
});
if(dijit.byId("CopyHdfsMenuItem")!=null){
dijit.registry.remove("CopyHdfsMenuItem");
}
this.menu.treeMenu.CopyHdfsMenuItem= new dijit.MenuItem({
id:"CopyHdfsMenuItem",
label:myfile.copyHdfsPath
});
this.menu.treeMenu.addChild(this.menu.treeMenu.DownloadMenuItem);
this.menu.treeMenu.addChild(this.menu.treeMenu.CreateMenuItem);
this.menu.treeMenu.addChild(this.menu.treeMenu.DeleteMenuItem);
this.menu.treeMenu.addChild(this.menu.treeMenu.UploadMenuItem);
this.menu.treeMenu.addChild(this.menu.treeMenu.RenameMenuItem);
this.menu.treeMenu.addChild(this.menu.treeMenu.RefreshMenuItem);
this.menu.treeMenu.addChild(this.menu.treeMenu.CopyHdfsMenuItem);
//added by dawn
dojo.connect(this.menu.treeMenu.CopyHdfsMenuItem,"onClick",function(){
var tn = dijit.byNode(this.getParent().currentTarget);
_currentInstance.hdfspath = tn.item.path;
});
dojo.connect(
this.menu.treeMenu.UploadMenuItem, "onClick",
@ -523,7 +536,7 @@ HAFlow.Main.prototype.initHdfsFileListTree = function() {
if (item.directory == "true") {
} else {
hdfspath = item.path;
_currentInstance.hdfspath = item.path;
var information = [];
information.name = item.name;
information.path = item.path;
@ -698,6 +711,7 @@ HAFlow.Main.prototype.getHdfsCsv = function(path, fileName) {
}
table += "</table>";
if (dijit.byId("hdfsContainerPane_" + path + "/" + fileName) != null) {
dijit.byId("hdfsContainerPane_" + path + "/" + fileName).setContent(table);
_currentInstance.ui.centerContainer.selectChild(dijit.byId("hdfsContainerPane_" + path + "/" + fileName));
} else {
var contentPane = new dojox.layout.ContentPane({

View File

@ -1,3 +1,8 @@
dojo.registerModulePath("widget","/haflow/script/widget");
dojo.require("widget.MultipleEditor");
dojo.require("dijit.Menu");
dojo.require("dijit.MenuItem");
//jsplumb helper
//public
@ -240,7 +245,185 @@ HAFlow.Main.prototype.bindFunctions = function(flowId) {
});
};
//changed by dawn
HAFlow.Main.prototype.onNodeClicked = function(instance, flowId, nodeId){
var text="";
text+="<div id='delete_node_button' ></div>";
text+="<div id='gridDiv' style='width:100%; height:100%'></div>";
$("#" + instance.informationContainerId).html(text);
var button = new dijit.form.Button({
label : myfile.deletenode,
onClick:function() {
instance.deleteNode(instance, flowId, nodeId);
}
});
button.placeAt("delete_node_button");
button.startup();
this.initNodeDataGrid(instance,flowId,nodeId);
};
HAFlow.Main.prototype.initNodeDataGrid=function(instance,flowId,nodeId){
var node = instance.getNodeById(instance, flowId, nodeId);
var module = instance.getModuleById(instance, node.moduleId);
if (dijit.byId("flow_" + flowId + "_node_"+nodeId+"_Table") != null) {
dijit.registry.remove("flow_" + flowId + "_node_"+nodeId+"_Table");
}
var items = [];
items.push({
key : myfile.NodeId,
value : node.id,
});
items.push({
key : myfile.flow,
value : instance.flows[node.flowId].name,
});
items.push({
key : myfile.module,
value : module.name,
});
items.push({
key : myfile.name,
value : node.name,
});
var configItems=this.getNodeConfigurationItems(instance, flowId, nodeId);
var allitems=items.concat(configItems);
var store = new dojo.data.ItemFileWriteStore({
data : {
items : allitems
}
});
var layout = [ {
name : myfile.description,
field : "key",
width : "50%",
}, {
name : myfile.value,
field : "value",
width : "50%",
editable : true,
type:widget.MultipleEditor
}
];
var grid = new dojox.grid.DataGrid({
id : "flow_" + flowId + "_node_"+nodeId+"_Table",
store : store,
structure : layout,
onRowContextMenu: function(e){
initCellMenu(e);
},
autoHeight:true
});
grid.placeAt("gridDiv");
grid.startup();
grid.canSort = function() {
return false;
};
grid.canEdit = function(inCell, inRowIndex) {
if (inCell.index == 1 && inRowIndex < 3)
return false;
else
return true;
};
onSet = function(item, attr, oldVal, newVal) {
if (item._0 == "3" && attr == "value") {
if (oldVal == null)
oldVal = "";
if (oldVal != newVal) {
instance.saveNodeName(newVal, instance, flowId, nodeId);
}
}
if (item._0 > "3" && attr == "value") {
var _baseRowIndex = 4;
//console.log("------>>>>>>>>>beforeSaveNodeConfiguration");
//console.log(node.configurations);
instance.saveNodeConfiguration(_baseRowIndex, instance, flowId,
nodeId);
//console.log("------>>>>>>>>>afterSaveNodeConfiguration");
//console.log(node.configurations);
}
};
dojo.connect(grid.store, "onSet", grid, onSet);
initCellMenu=function(e){
//function initCellMenu(e) {
var cellMenu = new dijit.Menu({
});
var cellMenuItem=new dijit.MenuItem({
label : myfile.pasteHdfsPath,
onClick: function(){
var item=e.grid.getItem(e.rowIndex);
var columname=e.grid.getCell(e.cellIndex).field;
if(columname=="value"&&e.rowIndex>3&&instance.hdfspath!=null)
grid.store.setValue(item,columname,instance.hdfspath);
//console.log(e.cellIndex);
}
});
if(instance.hdfspath==null)
cellMenuItem.set("disabled",true);
/*else
cellMenuItem.set("disabled",false);*/
cellMenu.addChild(cellMenuItem);
cellMenu.startup();
cellMenu.bindDomNode(e.grid.domNode);
};
};
HAFlow.Main.prototype.getNodeConfigurationItems = function(instance, flowId,
nodeId) {
var node = instance.getNodeById(instance, flowId, nodeId);
var module = instance.getModuleById(instance, node.moduleId);
var configItems = [];
var i;
for (i = 0; i < module.configurations.length; i++) {
if (module.configurations[i].type == "BOOLEAN") {
//console.log("----->>>>>>>>>configuration is boolean!");
//console.log(instance.getConfigurationValue(instance, flowId,
//nodeId, module.configurations[i].key));
configItems.push({
key : module.configurations[i].displayName,
value : (instance.getConfigurationValue(instance, flowId,
nodeId, module.configurations[i].key) == "true"||instance.getConfigurationValue(instance, flowId,
nodeId, module.configurations[i].key) == true) ? true
: false,
type:"bool"
});
} else {
configItems.push({
key : module.configurations[i].displayName,
value : instance.getConfigurationValue(instance, flowId,
nodeId, module.configurations[i].key),
type:"string"
});
}
}
return configItems;
};
// ended by dawn
/*HAFlow.Main.prototype.onNodeClicked = function(instance, flowId, nodeId) {
var node = instance.getNodeById(instance, flowId, nodeId);
var module = instance.getModuleById(instance, node.moduleId);
var text = "";
@ -301,7 +484,7 @@ HAFlow.Main.prototype.onNodeClicked = function(instance, flowId, nodeId) {
var saveNodeNameButton = new dijit.form.Button({
label : myfile.saveNodeName,
onClick : function() {
instance.saveNodeName(instance, flowId, nodeId);
instance.saveNodeName($("#" + "node_" + nodeId + "_name").val(),instance, flowId, nodeId);
}
});
saveNodeNameButton.placeAt(dojo.byId("save_node_name_button"));
@ -371,7 +554,7 @@ HAFlow.Main.prototype.onNodeClicked = function(instance, flowId, nodeId) {
saveConfigurationButton.placeAt(dojo.byId("save_configuration_button"));
saveConfigurationButton.startup();
};
*/
HAFlow.Main.prototype.onModuleClicked = function(instance, flowId, moduleId) {
var text = "";
var i;

View File

@ -205,7 +205,7 @@ HAFlow.Main.prototype.initFlowMenu = function() {
}));
//change language
if(language=="Chinese"){
/*if(language=="Chinese"){
this.ui.mainMenu
.addChild(new dijit.layout.ContentPane(
{
@ -228,7 +228,7 @@ HAFlow.Main.prototype.initFlowMenu = function() {
"<font size=2px>切换中文</font></a>&nbsp&nbsp</div>",
style : "float:right;"
}));
}
}*/
// userInformation
this.ui.mainMenu

View File

@ -1,4 +1,11 @@
myfile={
"deletenode":"删除结点",
"copyHdfsPath":"复制HDFS路径",
"pasteHdfsPath":"粘贴HDFS路径",
"module":"模块",
"description":"描述",
"value":"值",
"NodeId":"结点编号",
"flow":"流程",
"flows":"流程",
"run":"运行",
@ -65,7 +72,7 @@
"newReport":"新建报表",
"newReportDirectory":"新建报表文件夹",
"console":"控制台",
"information":"基本信息",
"information":"配置信息",
"reports":"报表",
"quit":"退出",
"updateTime":"更新时间",