默认是全英文的,可以改为我们习惯的中文。找到resources文件夹下面的grapheditor.txt文件,找到对应的变量名和变量值就行了。比如:
# Resources from graph.properties
alreadyConnected=Nodes already connected
cancel=Cancel
close=Close
collapse-expand=Collapse/Expand
containsValidationErrors=Contains validation errors
done=Done
doubleClickOrientation=Doubleclick to Change Orientation
error=Error
errorSavingFile=Error saving file
ok=OK
updatingDocument=Updating Document. Please wait...
updatingSelection=Updating Selection. Please wait...
# Custom resources
clearDefaultStyle=清除默认样式
copy=复制
cut=剪切
delete=删除
duplicate=重复
duplicateIt=Duplicate {1}
east=East
edit=Edit
editData=编辑数据
editDiagram=Edit Diagram
editImage=Edit Image
editLink=编辑链接
editStyle=Edit Styl
但是如果说你不光想改成中午还想添加一些功能或者删除一些默认的功能:
你需要找到Menus.js文件,并在下面的代码中修改就行了:
Menus.prototype.createPopupMenu = function(menu, cell, evt)
{
var graph = this.editorUi.editor.graph;
menu.smartSeparators = true;
if (graph.isSelectionEmpty())
{
this.addMenuItems(menu, ['undo', 'redo', 'pasteHere'], null, evt);
}
else
{
this.addMenuItems(menu, ['delete', '-', 'cut', 'copy', '-', 'duplicate'], null, evt);
}
if (!graph.isSelectionEmpty())
{
if (graph.getSelectionCount() == 1)
{
this.addMenuItems(menu, ['setAsDefaultStyle'], null, evt);
}
menu.addSeparator();
cell = graph.getSelectionCell();
var state = graph.view.getState(cell);
if (state != null)
{
var hasWaypoints = false;
this.addMenuItems(menu, ['toFront', 'toBack', '-'], null, evt);
if (graph.getModel().isEdge(cell) && mxUtils.getValue(state.style, mxConstants.STYLE_EDGE, null) != 'entityRelationEdgeStyle' &&
mxUtils.getValue(state.style, mxConstants.STYLE_SHAPE, null) != 'arrow')
{
var handler = graph.selectionCellsHandler.getHandler(cell);
var isWaypoint = false;
if (handler instanceof mxEdgeHandler && handler.bends != null && handler.bends.length > 2)
{
var index = handler.getHandleForEvent(graph.updateMouseEvent(new mxMouseEvent(evt)));
// Configures removeWaypoint action before execution
// Using trigger parameter is cleaner but have to find waypoint here anyway.
var rmWaypointAction = this.editorUi.actions.get('removeWaypoint');
rmWaypointAction.handler = handler;
rmWaypointAction.index = index;
isWaypoint = index > 0 && index < handler.bends.length - 1;
}
menu.addSeparator();
this.addMenuItem(menu, 'turn', null, evt, null, mxResources.get('reverse'));
this.addMenuItems(menu, [(isWaypoint) ? 'removeWaypoint' : 'addWaypoint'], null, evt);
// Adds reset waypoints option if waypoints exist
var geo = graph.getModel().getGeometry(cell);
hasWaypoints = geo != null && geo.points != null && geo.points.length > 0;
}
if (graph.getSelectionCount() == 1 && (hasWaypoints || (graph.getModel().isVertex(cell) &&
graph.getModel().getEdgeCount(cell) > 0)))
{
this.addMenuItems(menu, ['clearWaypoints'], null, evt);
}
if (graph.getSelectionCount() > 1)
{
menu.addSeparator();
this.addMenuItems(menu, ['group'], null, evt);
}
else if (graph.getSelectionCount() == 1 && !graph.getModel().isEdge(cell) && !graph.isSwimlane(cell) &&
graph.getModel().getChildCount(cell) > 0)
{
menu.addSeparator();
this.addMenuItems(menu, ['ungroup'], null, evt);
}
if (graph.getSelectionCount() == 1)
{
menu.addSeparator();
this.addMenuItems(menu, ['editData', 'editLink'], null, evt);
// Shows edit image action if there is an image in the style
if (graph.getModel().isVertex(cell) && mxUtils.getValue(state.style, mxConstants.STYLE_IMAGE, null) != null)
{
menu.addSeparator();
this.addMenuItem(menu, 'image', null, evt).firstChild.nextSibling.innerHTML = mxResources.get('editImage') + '...';
}
}
}
}
else
{
this.addMenuItems(menu, ['-', 'selectVertices', 'selectEdges',
'selectAll', '-', 'clearDefaultStyle'], null, evt);
}
};