com.mxgraph.view.mxGraph.getStylesheet()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.4k)|赞(0)|评价(0)|浏览(103)

本文整理了Java中com.mxgraph.view.mxGraph.getStylesheet()方法的一些代码示例,展示了mxGraph.getStylesheet()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。mxGraph.getStylesheet()方法的具体详情如下:
包路径:com.mxgraph.view.mxGraph
类名称:mxGraph
方法名:getStylesheet

mxGraph.getStylesheet介绍

[英]Returns the stylesheet that provides the style.
[中]返回提供样式的样式表。

代码示例

代码示例来源:origin: Activiti/Activiti

  1. protected void createEventVertex(FlowElement flowElement) {
  2. // Add styling for events if needed
  3. if (!graph.getStylesheet().getStyles().containsKey(STYLE_EVENT)) {
  4. Hashtable<String, Object> eventStyle = new Hashtable<String, Object>();
  5. eventStyle.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_ELLIPSE);
  6. graph.getStylesheet().putCellStyle(STYLE_EVENT, eventStyle);
  7. }
  8. // Add vertex representing event to graph
  9. Object eventVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, eventSize, eventSize, STYLE_EVENT);
  10. generatedVertices.put(flowElement.getId(), eventVertex);
  11. }

代码示例来源:origin: Activiti/Activiti

  1. protected void createGatewayVertex(FlowElement flowElement) {
  2. // Add styling for gateways if needed
  3. if (graph.getStylesheet().getStyles().containsKey(STYLE_GATEWAY)) {
  4. Hashtable<String, Object> style = new Hashtable<String, Object>();
  5. style.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_RHOMBUS);
  6. graph.getStylesheet().putCellStyle(STYLE_GATEWAY, style);
  7. }
  8. // Create gateway node
  9. Object gatewayVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, gatewaySize, gatewaySize, STYLE_GATEWAY);
  10. generatedVertices.put(flowElement.getId(), gatewayVertex);
  11. }

代码示例来源:origin: Activiti/Activiti

  1. protected void handleAssociations() {
  2. Hashtable<String, Object> edgeStyle = new Hashtable<String, Object>();
  3. edgeStyle.put(mxConstants.STYLE_ORTHOGONAL, true);
  4. edgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.ElbowConnector);
  5. edgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.0);
  6. edgeStyle.put(mxConstants.STYLE_ENTRY_Y, 0.5);
  7. graph.getStylesheet().putCellStyle(STYLE_SEQUENCEFLOW, edgeStyle);
  8. Hashtable<String, Object> boundaryEdgeStyle = new Hashtable<String, Object>();
  9. boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_X, 0.5);
  10. boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_Y, 1.0);
  11. boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.5);
  12. boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_Y, 1.0);
  13. boundaryEdgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.OrthConnector);
  14. graph.getStylesheet().putCellStyle(STYLE_BOUNDARY_SEQUENCEFLOW, boundaryEdgeStyle);
  15. for (Association association : associations.values()) {
  16. Object sourceVertex = generatedVertices.get(association.getSourceRef());
  17. Object targetVertex = generatedVertices.get(association.getTargetRef());
  18. String style = null;
  19. if (handledFlowElements.get(association.getSourceRef()) instanceof BoundaryEvent) {
  20. // Sequence flow out of boundary events are handled in a different way,
  21. // to make them visually appealing for the eye of the dear end user.
  22. style = STYLE_BOUNDARY_SEQUENCEFLOW;
  23. } else {
  24. style = STYLE_SEQUENCEFLOW;
  25. }
  26. Object associationEdge = graph.insertEdge(cellParent, association.getId(), "", sourceVertex, targetVertex, style);
  27. generatedAssociationEdges.put(association.getId(), associationEdge);
  28. }
  29. }

代码示例来源:origin: Activiti/Activiti

  1. edgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.0);
  2. edgeStyle.put(mxConstants.STYLE_ENTRY_Y, 0.5);
  3. graph.getStylesheet().putCellStyle(STYLE_SEQUENCEFLOW, edgeStyle);
  4. boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_Y, 1.0);
  5. boundaryEdgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.OrthConnector);
  6. graph.getStylesheet().putCellStyle(STYLE_BOUNDARY_SEQUENCEFLOW, boundaryEdgeStyle);

代码示例来源:origin: stackoverflow.com

  1. mxGraph graph = new mxGraph();
  2. Map<String, Object> style = graph.getStylesheet().getDefaultEdgeStyle();
  3. style.put(mxConstants.STYLE_ROUNDED, true);
  4. style.put(mxConstants.STYLE_EDGE, mxConstants.EDGESTYLE_ENTITY_RELATION);

代码示例来源:origin: org.flowable/flowable-bpmn-layout

  1. protected void createEventVertex(FlowElement flowElement) {
  2. // Add styling for events if needed
  3. if (!graph.getStylesheet().getStyles().containsKey(STYLE_EVENT)) {
  4. Hashtable<String, Object> eventStyle = new Hashtable<>();
  5. eventStyle.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_ELLIPSE);
  6. graph.getStylesheet().putCellStyle(STYLE_EVENT, eventStyle);
  7. }
  8. // Add vertex representing event to graph
  9. Object eventVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, eventSize, eventSize, STYLE_EVENT);
  10. generatedVertices.put(flowElement.getId(), eventVertex);
  11. }

代码示例来源:origin: com.bbossgroups.activiti/activiti-bpmn-layout

  1. protected void createEventVertex(FlowElement flowElement) {
  2. // Add styling for events if needed
  3. if (!graph.getStylesheet().getStyles().containsKey(STYLE_EVENT)) {
  4. Hashtable<String, Object> eventStyle = new Hashtable<String, Object>();
  5. eventStyle.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_ELLIPSE);
  6. graph.getStylesheet().putCellStyle(STYLE_EVENT, eventStyle);
  7. }
  8. // Add vertex representing event to graph
  9. Object eventVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, eventSize, eventSize, STYLE_EVENT);
  10. generatedVertices.put(flowElement.getId(), eventVertex);
  11. }

代码示例来源:origin: com.bbossgroups.activiti/activiti-bpmn-layout

  1. protected void createGatewayVertex(FlowElement flowElement) {
  2. // Add styling for gateways if needed
  3. if (graph.getStylesheet().getStyles().containsKey(STYLE_GATEWAY)) {
  4. Hashtable<String, Object> style = new Hashtable<String, Object>();
  5. style.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_RHOMBUS);
  6. graph.getStylesheet().putCellStyle(STYLE_GATEWAY, style);
  7. }
  8. // Create gateway node
  9. Object gatewayVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, gatewaySize, gatewaySize, STYLE_GATEWAY);
  10. generatedVertices.put(flowElement.getId(), gatewayVertex);
  11. }

代码示例来源:origin: org.flowable/flowable-bpmn-layout

  1. protected void createGatewayVertex(FlowElement flowElement) {
  2. // Add styling for gateways if needed
  3. if (graph.getStylesheet().getStyles().containsKey(STYLE_GATEWAY)) {
  4. Hashtable<String, Object> style = new Hashtable<>();
  5. style.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_RHOMBUS);
  6. graph.getStylesheet().putCellStyle(STYLE_GATEWAY, style);
  7. }
  8. // Create gateway node
  9. Object gatewayVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, gatewaySize, gatewaySize, STYLE_GATEWAY);
  10. generatedVertices.put(flowElement.getId(), gatewayVertex);
  11. }

代码示例来源:origin: org.flowable/flowable-bpmn-layout

  1. protected void handleAssociations() {
  2. Hashtable<String, Object> edgeStyle = new Hashtable<>();
  3. edgeStyle.put(mxConstants.STYLE_ORTHOGONAL, true);
  4. edgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.ElbowConnector);
  5. edgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.0);
  6. edgeStyle.put(mxConstants.STYLE_ENTRY_Y, 0.5);
  7. graph.getStylesheet().putCellStyle(STYLE_SEQUENCEFLOW, edgeStyle);
  8. Hashtable<String, Object> boundaryEdgeStyle = new Hashtable<>();
  9. boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_X, 0.5);
  10. boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_Y, 1.0);
  11. boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.5);
  12. boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_Y, 1.0);
  13. boundaryEdgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.orthConnector);
  14. graph.getStylesheet().putCellStyle(STYLE_BOUNDARY_SEQUENCEFLOW, boundaryEdgeStyle);
  15. for (Association association : associations.values()) {
  16. Object sourceVertex = generatedVertices.get(association.getSourceRef());
  17. Object targetVertex = generatedVertices.get(association.getTargetRef());
  18. String style = null;
  19. if (handledFlowElements.get(association.getSourceRef()) instanceof BoundaryEvent) {
  20. // Sequence flow out of boundary events are handled in a different way,
  21. // to make them visually appealing for the eye of the dear end user.
  22. style = STYLE_BOUNDARY_SEQUENCEFLOW;
  23. } else {
  24. style = STYLE_SEQUENCEFLOW;
  25. }
  26. Object associationEdge = graph.insertEdge(cellParent, association.getId(), "", sourceVertex, targetVertex, style);
  27. generatedAssociationEdges.put(association.getId(), associationEdge);
  28. }
  29. }

代码示例来源:origin: org.flowable/flowable-bpmn-layout

  1. edgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.0);
  2. edgeStyle.put(mxConstants.STYLE_ENTRY_Y, 0.5);
  3. graph.getStylesheet().putCellStyle(STYLE_SEQUENCEFLOW, edgeStyle);
  4. boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_Y, 1.0);
  5. boundaryEdgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.orthConnector);
  6. graph.getStylesheet().putCellStyle(STYLE_BOUNDARY_SEQUENCEFLOW, boundaryEdgeStyle);

代码示例来源:origin: com.bbossgroups.activiti/activiti-bpmn-layout

  1. edgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.0);
  2. edgeStyle.put(mxConstants.STYLE_ENTRY_Y, 0.5);
  3. graph.getStylesheet().putCellStyle(STYLE_SEQUENCEFLOW, edgeStyle);
  4. boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_Y, 1.0);
  5. boundaryEdgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.orthConnector);
  6. graph.getStylesheet().putCellStyle(STYLE_BOUNDARY_SEQUENCEFLOW, boundaryEdgeStyle);

相关文章

mxGraph类方法