mxGraph 设置默认Edge样式
2014-04-20 17:22
253 查看
在mxgraph Swing 操作中,单击某个cell连接其他cell的节点线是,默认样式是直线连接,没有节点弯曲的设置。可以修改mxgraph的jar包中的mxStylesheet.java 对应的createDefaultEdgeStyle方法,在其中添加:style.put("edgeStyle", mxEdgeStyle.ElbowConnector); 即可。
/**
* Creates and returns the default edge style.
*
* @return Returns the default edge style.
*/
protected Map<String, Object> createDefaultEdgeStyle()
{
Map<String, Object> style = new Hashtable<String, Object>();
style.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_CONNECTOR);
style.put(mxConstants.STYLE_ENDARROW, mxConstants.ARROW_CLASSIC);
style.put(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE);
style.put(mxConstants.STYLE_ALIGN, mxConstants.ALIGN_CENTER);
style.put(mxConstants.STYLE_STROKECOLOR, "#6482B9");
style.put(mxConstants.STYLE_FONTCOLOR, "#446299");
style.put("edgeStyle", mxEdgeStyle.ElbowConnector); //新添加的样式
return style;
}
这个文件里面也可以修改 Cell样式,方法是:
/**
* Creates and returns the default vertex style.
*
* @return Returns the default vertex style.
*/
protected Map<String, Object> createDefaultVertexStyle()
{
Map<String, Object> style = new Hashtable<String, Object>();
style.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_RECTANGLE);
style.put(mxConstants.STYLE_PERIMETER, mxPerimeter.RectanglePerimeter);
style.put(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE);
style.put(mxConstants.STYLE_ALIGN, mxConstants.ALIGN_CENTER);
style.put(mxConstants.STYLE_FILLCOLOR, "#C3D9FF");
style.put(mxConstants.STYLE_STROKECOLOR, "#6482B9");
style.put(mxConstants.STYLE_FONTCOLOR, "#774400");
return style;
}
===================华丽丽的分割线==================
2014-04-20
/**
* Creates and returns the default edge style.
*
* @return Returns the default edge style.
*/
protected Map<String, Object> createDefaultEdgeStyle()
{
Map<String, Object> style = new Hashtable<String, Object>();
style.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_CONNECTOR);
style.put(mxConstants.STYLE_ENDARROW, mxConstants.ARROW_CLASSIC);
style.put(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE);
style.put(mxConstants.STYLE_ALIGN, mxConstants.ALIGN_CENTER);
style.put(mxConstants.STYLE_STROKECOLOR, "#6482B9");
style.put(mxConstants.STYLE_FONTCOLOR, "#446299");
style.put("edgeStyle", mxEdgeStyle.ElbowConnector); //新添加的样式
return style;
}
这个文件里面也可以修改 Cell样式,方法是:
/**
* Creates and returns the default vertex style.
*
* @return Returns the default vertex style.
*/
protected Map<String, Object> createDefaultVertexStyle()
{
Map<String, Object> style = new Hashtable<String, Object>();
style.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_RECTANGLE);
style.put(mxConstants.STYLE_PERIMETER, mxPerimeter.RectanglePerimeter);
style.put(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE);
style.put(mxConstants.STYLE_ALIGN, mxConstants.ALIGN_CENTER);
style.put(mxConstants.STYLE_FILLCOLOR, "#C3D9FF");
style.put(mxConstants.STYLE_STROKECOLOR, "#6482B9");
style.put(mxConstants.STYLE_FONTCOLOR, "#774400");
return style;
}
===================华丽丽的分割线==================
2014-04-20
相关文章推荐
- 详解CSS设置默认字体样式
- 设置渲染默认样式时,UseDefaultSymbol 为只读的解决办法!
- pl/sql developer 设置oracle的date类型默认显示样式
- EditText默认不获取焦点,隐藏软键盘,焦点监听,输入监听,样式设置
- Word2010中如何设置多级编号 把默认标题的样式设置为带有多级编号
- wpf datagrid 样式怎么设置默认选中行的颜色
- 设置浏览器默认样式
- 关于android 动态设置view 样式 问题(默认style)
- jquery滚动条美化Scrollbar设置浏览器默认滚动条CSS美化样式特效
- Android 自定义字体样式 及系统默认字体样式 的设置
- axure中默认字体样式的设置
- normalize.css用这个来设置默认样式,不要用reset.css
- RadioGroup和CheckBox设置背景以及4.4系统上隐藏默认样式的坑
- [转]解析CSS设置默认字体样式
- css清除默认样式和设置公共样式
- js在设置角标的时候因为浏览器默认样式(User Agent Stylesheet)不起作用
- ng-repeat设置第一个元素为默认样式,点击其余元素切换样式
- 详解CSS设置默认字体样式
- 设置<input type="file">的默认样式
- Android menu默认样式的设置