- 浏览: 24681 次
文章分类
- 全部博客 (32)
- Java (8)
- Javascript (8)
- Bpmn&Workflow (6)
- Android (1)
- Eclipse (0)
- RDBMS (1)
- Persistency (1)
- Struts (0)
- Spring (0)
- Hibernate (0)
- Mybatis (0)
- Quartz (3)
- MongoDb (1)
- Neo4j (0)
- Redis (0)
- Gradle (0)
- Git (0)
- Maven (0)
- Ant (0)
- SVN (0)
- UML (0)
- DDD (0)
- UseCase (0)
- QI4J (0)
- 方法论 (0)
- TDD&BDD (1)
- TODO (0)
最新评论
-
niwtsew:
请问这篇文章和标题中的misfire instruction有 ...
Quartz scheduler misfire instructions explained
mxgraph swimlane
- 博客分类:
- Javascript
<!-- $Id: swimlanes.html,v 1.49 2011-10-17 14:37:19 gaudenz Exp $ Copyright (c) 2006-2010, JGraph Ltd Swimlanes example for mxGraph. This example demonstrates using swimlanes for pools and lanes and adding cells and edges between them. This also demonstrates using the stack layout as an automatic layout. --> <html> <head> <title>Swimlanes example for mxGraph</title> <!-- Sets the basepath for the library if not in same directory --> <script type="text/javascript"> mxBasePath = 'src'; </script> <!-- Loads and initializes the library --> <script type="text/javascript" src="http://www.diagram.ly/client?version=1.10.0.2"></script> <!-- Example code --> <script type="text/javascript"> // Defines an icon for creating new connections in the connection handler. // This will automatically disable the highlighting of the source vertex. mxConnectionHandler.prototype.connectImage = new mxImage('images/connector.gif', 16, 16); // Program starts here. Creates a sample graph in the // DOM node with the specified ID. This function is invoked // from the onLoad event handler of the document (see below). function main(container) { // Checks if browser is supported if (!mxClient.isBrowserSupported()) { // Displays an error message if the browser is // not supported. mxUtils.error('Browser is not supported!', 200, false); } else { // Enables crisp rendering of swimlanes in SVG mxSwimlane.prototype.crisp = true; // Creates a wrapper editor around a new graph inside // the given container using an XML config for the // keyboard bindings var config = mxUtils.load( 'editors/config/keyhandler-commons.xml'). getDocumentElement(); var editor = new mxEditor(config); editor.setGraphContainer(container); var graph = editor.graph; var model = graph.getModel(); // Auto-resizes the container graph.border = 80; graph.getView().translate = new mxPoint(graph.border/2, graph.border/2); graph.setResizeContainer(true); graph.graphHandler.setRemoveCellsFromParent(false); // Changes the default vertex style in-place var style = graph.getStylesheet().getDefaultVertexStyle(); style[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_SWIMLANE; style[mxConstants.STYLE_VERTICAL_ALIGN] = 'top'; style[mxConstants.STYLE_FONTSIZE] = 11; style[mxConstants.STYLE_STARTSIZE] = 22; style[mxConstants.STYLE_HORIZONTAL] = false; style[mxConstants.STYLE_FONTCOLOR] = 'black'; style[mxConstants.STYLE_STROKECOLOR] = 'black'; delete style[mxConstants.STYLE_FILLCOLOR]; style = mxUtils.clone(style); style[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_RECTANGLE; style[mxConstants.STYLE_FONTSIZE] = 10; style[mxConstants.STYLE_ROUNDED] = true; style[mxConstants.STYLE_HORIZONTAL] = true; style[mxConstants.STYLE_VERTICAL_ALIGN] = 'middle'; delete style[mxConstants.STYLE_STARTSIZE]; graph.getStylesheet().putCellStyle('process', style); style = mxUtils.clone(style); style[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_ELLIPSE; style[mxConstants.STYLE_PERIMETER] = mxPerimeter.EllipsePerimeter; delete style[mxConstants.STYLE_ROUNDED]; graph.getStylesheet().putCellStyle('state', style); style = mxUtils.clone(style); style[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_RHOMBUS; style[mxConstants.STYLE_PERIMETER] = mxPerimeter.RhombusPerimeter; style[mxConstants.STYLE_VERTICAL_ALIGN] = 'top'; style[mxConstants.STYLE_SPACING_TOP] = 40; style[mxConstants.STYLE_SPACING_RIGHT] = 64; graph.getStylesheet().putCellStyle('condition', style); style = mxUtils.clone(style); style[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_DOUBLE_ELLIPSE; style[mxConstants.STYLE_PERIMETER] = mxPerimeter.EllipsePerimeter; style[mxConstants.STYLE_SPACING_TOP] = 28; style[mxConstants.STYLE_FONTSIZE] = 14; style[mxConstants.STYLE_FONTSTYLE] = 1; delete style[mxConstants.STYLE_SPACING_RIGHT]; graph.getStylesheet().putCellStyle('end', style); style = graph.getStylesheet().getDefaultEdgeStyle(); style[mxConstants.STYLE_EDGE] = mxEdgeStyle.ElbowConnector; style[mxConstants.STYLE_ENDARROW] = mxConstants.ARROW_BLOCK; style[mxConstants.STYLE_ROUNDED] = true; style[mxConstants.STYLE_FONTCOLOR] = 'black'; style[mxConstants.STYLE_STROKECOLOR] = 'black'; style = mxUtils.clone(style); style[mxConstants.STYLE_DASHED] = true; style[mxConstants.STYLE_ENDARROW] = mxConstants.ARROW_OPEN; style[mxConstants.STYLE_STARTARROW] = mxConstants.ARROW_OVAL; graph.getStylesheet().putCellStyle('crossover', style); // Installs double click on middle control point and // changes style of edges between empty and this value graph.alternateEdgeStyle = 'elbow=vertical'; // Adds automatic layout and various switches if the // graph is enabled if (graph.isEnabled()) { // Allows new connections but no dangling edges graph.setConnectable(true); graph.setAllowDanglingEdges(false); // End-states are no valid sources var previousIsValidSource = graph.isValidSource; graph.isValidSource = function(cell) { if (previousIsValidSource.apply(this, arguments)) { var style = this.getModel().getStyle(cell); return style == null || !(style == 'end' || style.indexOf('end') == 0); } return false; }; // Start-states are no valid targets, we do not // perform a call to the superclass function because // this would call isValidSource // Note: All states are start states in // the example below, so we use the state // style below graph.isValidTarget = function(cell) { var style = this.getModel().getStyle(cell); return !this.getModel().isEdge(cell) && !this.isSwimlane(cell) && (style == null || !(style == 'state' || style.indexOf('state') == 0)); }; // Allows dropping cells into new lanes and // lanes into new pools, but disallows dropping // cells on edges to split edges graph.setDropEnabled(true); graph.setSplitEnabled(false); // Returns true for valid drop operations graph.isValidDropTarget = function(target, cells, evt) { if (this.isSplitEnabled() && this.isSplitTarget(target, cells, evt)) { return true; } var model = this.getModel(); var lane = false; var pool = false; var cell = false; // Checks if any lanes or pools are selected for (var i = 0; i < cells.length; i++) { var tmp = model.getParent(cells[i]); lane = lane || this.isPool(tmp); pool = pool || this.isPool(cells[i]); cell = cell || !(lane || pool); } return !pool && cell != lane && ((lane && this.isPool(target)) || (cell && this.isPool(model.getParent(target)))); }; // Adds new method for identifying a pool graph.isPool = function(cell) { var model = this.getModel(); var parent = model.getParent(cell); return parent != null && model.getParent(parent) == model.getRoot(); }; // Changes swimlane orientation while collapsed graph.model.getStyle = function(cell) { var style = mxGraphModel.prototype.getStyle.apply(this, arguments); if (graph.isCellCollapsed(cell)) { if (style != null) { style += ';'; } else { style = ''; } style += 'horizontal=1;align=left;spacingLeft=14;'; } return style; }; // Keeps widths on collapse/expand var foldingHandler = function(sender, evt) { var cells = evt.getProperty('cells'); for (var i = 0; i < cells.length; i++) { var geo = graph.model.getGeometry(cells[i]); if (geo.alternateBounds != null) { geo.width = geo.alternateBounds.width; } } }; graph.addListener(mxEvent.FOLD_CELLS, foldingHandler); } // Applies size changes to siblings and parents new mxSwimlaneManager(graph); // Creates a stack depending on the orientation of the swimlane var layout = new mxStackLayout(graph, false); // Makes sure all children fit into the parent swimlane layout.resizeParent = true; // Applies the size to children if parent size changes layout.fill = true; // Only update the size of swimlanes layout.isVertexIgnored = function(vertex) { return !graph.isSwimlane(vertex); } // Keeps the lanes and pools stacked var layoutMgr = new mxLayoutManager(graph); layoutMgr.getLayout = function(cell) { if (!model.isEdge(cell) && graph.getModel().getChildCount(cell) > 0 && (model.getParent(cell) == model.getRoot() || graph.isPool(cell))) { layout.fill = graph.isPool(cell); return layout; } return null; }; // Gets the default parent for inserting new cells. This // is normally the first child of the root (ie. layer 0). var parent = graph.getDefaultParent(); // Adds cells to the model in a single step model.beginUpdate(); try { var pool1 = graph.insertVertex(parent, null, 'Pool 1', 0, 0, 640, 0); pool1.setConnectable(false); var lane1a = graph.insertVertex(pool1, null, 'Lane A', 0, 0, 640, 110); lane1a.setConnectable(false); var lane1b = graph.insertVertex(pool1, null, 'Lane B', 0, 0, 640, 110); lane1b.setConnectable(false); var pool2 = graph.insertVertex(parent, null, 'Pool 2', 0, 0, 640, 0); pool2.setConnectable(false); var lane2a = graph.insertVertex(pool2, null, 'Lane A', 0, 0, 640, 140); lane2a.setConnectable(false); var lane2b = graph.insertVertex(pool2, null, 'Lane B', 0, 0, 640, 110); lane2b.setConnectable(false); var start1 = graph.insertVertex(lane1a, null, null, 40, 40, 30, 30, 'state'); var end1 = graph.insertVertex(lane1a, null, 'A', 560, 40, 30, 30, 'end'); var step1 = graph.insertVertex(lane1a, null, 'Contact\nProvider', 90, 30, 80, 50, 'process'); var step11 = graph.insertVertex(lane1a, null, 'Complete\nAppropriate\nRequest', 190, 30, 80, 50, 'process'); var step111 = graph.insertVertex(lane1a, null, 'Receive and\nAcknowledge', 385, 30, 80, 50, 'process'); var start2 = graph.insertVertex(lane2b, null, null, 40, 40, 30, 30, 'state'); var step2 = graph.insertVertex(lane2b, null, 'Receive\nRequest', 90, 30, 80, 50, 'process'); var step22 = graph.insertVertex(lane2b, null, 'Refer to Tap\nSystems\nCoordinator', 190, 30, 80, 50, 'process'); var step3 = graph.insertVertex(lane1b, null, 'Request 1st-\nGate\nInformation', 190, 30, 80, 50, 'process'); var step33 = graph.insertVertex(lane1b, null, 'Receive 1st-\nGate\nInformation', 290, 30, 80, 50, 'process'); var step4 = graph.insertVertex(lane2a, null, 'Receive and\nAcknowledge', 290, 20, 80, 50, 'process'); var step44 = graph.insertVertex(lane2a, null, 'Contract\nConstraints?', 400, 20, 50, 50, 'condition'); var step444 = graph.insertVertex(lane2a, null, 'Tap for gas\ndelivery?', 480, 20, 50, 50, 'condition'); var end2 = graph.insertVertex(lane2a, null, 'B', 560, 30, 30, 30, 'end'); var end3 = graph.insertVertex(lane2a, null, 'C', 560, 84, 30, 30, 'end'); var e = null; graph.insertEdge(lane1a, null, null, start1, step1); graph.insertEdge(lane1a, null, null, step1, step11); graph.insertEdge(lane1a, null, null, step11, step111); graph.insertEdge(lane2b, null, null, start2, step2); graph.insertEdge(lane2b, null, null, step2, step22); graph.insertEdge(parent, null, null, step22, step3); graph.insertEdge(lane1b, null, null, step3, step33); graph.insertEdge(lane2a, null, null, step4, step44); graph.insertEdge(lane2a, null, 'No', step44, step444, 'verticalAlign=bottom'); graph.insertEdge(parent, null, 'Yes', step44, step111, 'verticalAlign=bottom;horizontal=0'); graph.insertEdge(lane2a, null, 'Yes', step444, end2, 'verticalAlign=bottom'); e = graph.insertEdge(lane2a, null, 'No', step444, end3, 'verticalAlign=top'); e.geometry.points = [new mxPoint(step444.geometry.x + step444.geometry.width / 2, end3.geometry.y + end3.geometry.height / 2)]; graph.insertEdge(parent, null, null, step1, step2, 'crossover'); graph.insertEdge(parent, null, null, step3, step11, 'crossover'); e = graph.insertEdge(lane1a, null, null, step11, step33, 'crossover'); e.geometry.points = [new mxPoint(step33.geometry.x + step33.geometry.width / 2 + 20, step11.geometry.y + step11.geometry.height * 4 / 5)]; graph.insertEdge(parent, null, null, step33, step4); graph.insertEdge(lane1a, null, null, step111, end1); } finally { // Updates the display model.endUpdate(); } } }; </script> </head> <body onload="main(document.getElementById('graphContainer'))"> <div id="graphContainer" style="position:absolute;overflow:hidden;top:40px;left:40px;width:600px;height:400px;border: gray dotted 1px;cursor:default;"> </div> </body> </html>
发表评论
-
model,form and validation
2012-06-12 07:51 727http://blog.csdn.net/nailwl/art ... -
ajax security
2012-06-03 07:26 1286https://bitbucket.org/mrxx/mrxx ... -
交互设计模式
2012-05-30 13:38 579http://designinginterfaces.com/ ... -
js,模板等
2012-05-27 18:08 599http://yoho88.cn/html/js_templa ... -
mxgraph q&a
2012-05-02 07:22 1120Eventually I need to be able to ... -
百度开放相关
2012-04-29 18:00 623http://dev.baidu.com/connect/ ... -
Javascript相关工具
2012-04-06 15:13 614http://www.spket.com/ JS IDE h ...
相关推荐
MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..MXGRAPH..
最新mxgraph版本 mxgraph js API和demo
mxgraph.js中文文档是一个官方的api,翻译来源于sunflower(github: https://github.com/SunInfoFE),提供给更多的开发者参考和共享源码资源!
mxgraph 右键 toolbar工具条
mxgraph开发包
资源:mxGraph;包含ie,Firefox两个版本;版本号都是1.4.0.0;只带了一个Hello World的示例,其他的例子请自己去官网找吧
本资源是由本人结合mxgraph Demo开发的中文菜单简易版Demo,适合想了解或学习mxgraph的小伙伴。为初学者打开第一扇门。(附件为java项目直接导入即可使用)
mxGraph是一个JS绘图组件适用于需要在网页中设计/编辑Workflow/BPM流程图、图表、网络图和普通图形的Web应用程序。mxgraph下载包中包括用javescript写的前端程序,也包括多个和后端程序(java/C#等等)集成的例子。以下...
mxgraph的学习笔记,基于开源技术,非常不错哦
这是mxGraphModel的逻辑图。mxGraph中的一种存储图的模型,或者数据结构。
mxGraph是一个JS绘图组件适用于需要在网页中设计/编辑Workflow/BPM流程图、图表、网络图和普通图形的Web应用程序。mxgraph下载包中包括用javascript写的前端程序,也包括多个和后端程序(java/C#等)集成的例子。以下是...
mxgraph如何实现拓扑图中节点闪烁或节点边框闪烁的功能,模拟某些节点出现故障时候图元闪烁。
mxGraph破解包含ie和firefoxmxGraph破解包含ie和firefox
经典的mxGraph 1.4.0.0版,破解版本
前段实现mxgraph插件绘制流程图,后台实现保存的xml导出成图片格式,遇到图标没有引用,文字label位置不正确,label换行不识别 标签,linux服务器部署中文字体等问题
extJs 跟mxgraph一样都是一种前台框架,可以混着用,这个例子将结合extjs + mxgraph 做网络拓扑图。mxgraph是将html的页面元素当做一个容器(container),并在此容器中画图的,而extJs也是将此容器包装成一个window...
mxgraph 3.1.2.1 eval
mxGraph开发入门指南
mxGraph压缩包,包含mxGraph2.4和mxGraph1.10的文档。虽然文档是1.10的,但是对mxGraph2.4依旧可用。
mxGraph个人技术实现介绍、源码及其效果图