protected void createEventVertex(FlowElement flowElement) { // Add styling for events if needed if (!graph.getStylesheet().getStyles().containsKey(STYLE_EVENT)) { Hashtable<String, Object> eventStyle = new Hashtable<String, Object>(); eventStyle.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_ELLIPSE); graph.getStylesheet().putCellStyle(STYLE_EVENT, eventStyle); } // Add vertex representing event to graph Object eventVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, eventSize, eventSize, STYLE_EVENT); generatedVertices.put(flowElement.getId(), eventVertex); }
protected void handleAssociations() { Hashtable<String, Object> edgeStyle = new Hashtable<String, Object>(); edgeStyle.put(mxConstants.STYLE_ORTHOGONAL, true); edgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.ElbowConnector); edgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.0); edgeStyle.put(mxConstants.STYLE_ENTRY_Y, 0.5); graph.getStylesheet().putCellStyle(STYLE_SEQUENCEFLOW, edgeStyle); Hashtable<String, Object> boundaryEdgeStyle = new Hashtable<String, Object>(); boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_X, 0.5); boundaryEdgeStyle.put(mxConstants.STYLE_EXIT_Y, 1.0); boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.5); boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_Y, 1.0); boundaryEdgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.OrthConnector); graph.getStylesheet().putCellStyle(STYLE_BOUNDARY_SEQUENCEFLOW, boundaryEdgeStyle); for (Association association : associations.values()) { Object sourceVertex = generatedVertices.get(association.getSourceRef()); Object targetVertex = generatedVertices.get(association.getTargetRef()); String style = null; if (handledFlowElements.get(association.getSourceRef()) instanceof BoundaryEvent) { // Sequence flow out of boundary events are handled in a different way, // to make them visually appealing for the eye of the dear end user. style = STYLE_BOUNDARY_SEQUENCEFLOW; } else { style = STYLE_SEQUENCEFLOW; } Object associationEdge = graph.insertEdge(cellParent, association.getId(), "", sourceVertex, targetVertex, style); generatedAssociationEdges.put(association.getId(), associationEdge); } }
private static void style(mxGraph graph) { final mxStylesheet foo = new mxStylesheet(); final Map<String, Object> stil = new HashMap<>(); stil.put(mxConstants.STYLE_ROUNDED, true); stil.put(mxConstants.STYLE_EDGE, mxConstants.EDGESTYLE_ENTITY_RELATION); stil.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_CONNECTOR); stil.put(mxConstants.STYLE_ENDARROW, mxConstants.ARROW_CLASSIC); stil.put(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE); stil.put(mxConstants.STYLE_ALIGN, mxConstants.ALIGN_CENTER); stil.put(mxConstants.STYLE_STROKECOLOR, "#6482B9"); stil.put(mxConstants.STYLE_FONTCOLOR, "#446299"); foo.setDefaultEdgeStyle(stil); addStyleIcone(foo, "TIMER", "timer.png"); addStyleIcone(foo, "END", "terminate.png"); addStyleIcone(foo, "MESSAGE", "message_intermediate.png"); addStyleIcone(foo, "START", "event.png"); addStyleIcone(foo, "JAVA", "gear.png"); graph.setStylesheet(foo); }
public TrackSchemeStylist(final JGraphXAdapter graphx, final TrackColorGenerator colorGenerator) { this.graphx = graphx; this.colorGenerator = colorGenerator; // Prepare styles final mxStylesheet styleSheet = graphx.getStylesheet(); styleSheet.setDefaultEdgeStyle(BASIC_EDGE_STYLE); styleSheet.setDefaultVertexStyle(SIMPLE_VERTEX_STYLE); styleSheet.putCellStyle(FULL_STYLE_NAME, FULL_VERTEX_STYLE); styleSheet.putCellStyle(SIMPLE_STYLE_NAME, SIMPLE_VERTEX_STYLE); }
nodeStyle.put(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_MIDDLE); mxStylesheet stylesheet = new mxStylesheet(); stylesheet.setDefaultEdgeStyle(edgeStyle); stylesheet.setDefaultVertexStyle(nodeStyle);
/** * Constructs a new stylesheet and assigns default styles. */ public mxStylesheet() { setDefaultVertexStyle(createDefaultVertexStyle()); setDefaultEdgeStyle(createDefaultEdgeStyle()); }
/** * Constructs a new stylesheet to be used in this graph. */ protected mxStylesheet createStylesheet() { return new mxStylesheet(); }
public void setStyle(final String styleName) { if (!graphx.getStylesheet().getStyles().containsKey(styleName)) { throw new IllegalArgumentException("Unknwon TrackScheme style: " + styleName); } this.globalStyle = styleName; }
/** * Returns an array of key, value pairs representing the cell style for the * given cell. If no string is defined in the model that specifies the * style, then the default style for the cell is returned or <EMPTY_ARRAY>, * if not style can be found. * * @param cell Cell whose style should be returned. * @return Returns the style of the cell. */ public Map<String, Object> getCellStyle(Object cell) { Map<String, Object> style = (model.isEdge(cell)) ? stylesheet .getDefaultEdgeStyle() : stylesheet.getDefaultVertexStyle(); String name = model.getStyle(cell); if (name != null) { style = postProcessCellStyle(stylesheet.getCellStyle(name, style)); } if (style == null) { style = mxStylesheet.EMPTY_STYLE; } return style; }
vpool.getGeometry().setY(Math.min(vpool.getPreviousGeometry().getY(), vpool.getGeometry().getY())); Integer startsize = (Integer) getStylesheet().getCellStyle(vpool.getStyle(), null).get(mxConstants.STYLE_STARTSIZE); startsize = startsize != null? startsize : mxConstants.DEFAULT_STARTSIZE; double minx = Double.MAX_VALUE;
edgeStyle.put(mxConstants.STYLE_ENTRY_X, 0.0); edgeStyle.put(mxConstants.STYLE_ENTRY_Y, 0.5); graph.getStylesheet().putCellStyle(STYLE_SEQUENCEFLOW, edgeStyle); boundaryEdgeStyle.put(mxConstants.STYLE_ENTRY_Y, 1.0); boundaryEdgeStyle.put(mxConstants.STYLE_EDGE, mxEdgeStyle.OrthConnector); graph.getStylesheet().putCellStyle(STYLE_BOUNDARY_SEQUENCEFLOW, boundaryEdgeStyle);
private static void style(mxGraph graph) { final mxStylesheet foo = new mxStylesheet(); final Map<String, Object> stil = new HashMap<>(); stil.put(mxConstants.STYLE_ROUNDED, Boolean.TRUE); stil.put(mxConstants.STYLE_EDGE, mxConstants.EDGESTYLE_ORTHOGONAL); stil.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_CONNECTOR); stil.put(mxConstants.STYLE_ENDARROW, mxConstants.ARROW_CLASSIC); stil.put(mxConstants.STYLE_ALIGN, mxConstants.ALIGN_CENTER); stil.put(mxConstants.STYLE_VERTICAL_LABEL_POSITION, mxConstants.ALIGN_BOTTOM); stil.put(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_BOTTOM); stil.put(mxConstants.STYLE_STROKECOLOR, "#6482B9"); stil.put(mxConstants.STYLE_FONTCOLOR, "#446299"); foo.setDefaultEdgeStyle(stil); addStyleIcon(foo, "TIMER", "timer.png"); addStyleIcon(foo, "END", "terminate.png"); addStyleIcon(foo, "MESSAGE", "message_intermediate.png"); addStyleIcon(foo, "START", "start.png"); addStyleIcon(foo, "JAVA", "gear.png"); addStyleIcon(foo, "HUMAN", "pessoinha.png"); graph.setStylesheet(foo); }
public TrackSchemeStylist(final JGraphXAdapter graphx, final TrackColorGenerator colorGenerator) { this.graphx = graphx; this.colorGenerator = colorGenerator; // Prepare styles final mxStylesheet styleSheet = graphx.getStylesheet(); styleSheet.setDefaultEdgeStyle(BASIC_EDGE_STYLE); styleSheet.setDefaultVertexStyle(SIMPLE_VERTEX_STYLE); styleSheet.putCellStyle(FULL_STYLE_NAME, FULL_VERTEX_STYLE); styleSheet.putCellStyle(SIMPLE_STYLE_NAME, SIMPLE_VERTEX_STYLE); }
nodeStyle.put(mxConstants.STYLE_VERTICAL_ALIGN, mxConstants.ALIGN_BOTTOM); mxStylesheet stylesheet = new mxStylesheet(); stylesheet.setDefaultEdgeStyle(edgeStyle); stylesheet.setDefaultVertexStyle(nodeStyle);
/** * Constructs a new stylesheet and assigns default styles. */ public mxStylesheet() { setDefaultVertexStyle(createDefaultVertexStyle()); setDefaultEdgeStyle(createDefaultEdgeStyle()); }
/** * Constructs a new model codec. */ public mxStylesheetCodec() { this(new mxStylesheet()); }
public void setStyle(final String styleName) { if (!graphx.getStylesheet().getStyles().containsKey(styleName)) { throw new IllegalArgumentException("Unknwon TrackScheme style: " + styleName); } this.globalStyle = styleName; }
/** * Returns an array of key, value pairs representing the cell style for the * given cell. If no string is defined in the model that specifies the * style, then the default style for the cell is returned or <EMPTY_ARRAY>, * if not style can be found. * * @param cell Cell whose style should be returned. * @return Returns the style of the cell. */ public Map<String, Object> getCellStyle(Object cell) { Map<String, Object> style = (model.isEdge(cell)) ? stylesheet .getDefaultEdgeStyle() : stylesheet.getDefaultVertexStyle(); String name = model.getStyle(cell); if (name != null) { style = postProcessCellStyle(stylesheet.getCellStyle(name, style)); } if (style == null) { style = mxStylesheet.EMPTY_STYLE; } return style; }
protected void createGatewayVertex(FlowElement flowElement) { // Add styling for gateways if needed if (graph.getStylesheet().getStyles().containsKey(STYLE_GATEWAY)) { Hashtable<String, Object> style = new Hashtable<String, Object>(); style.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_RHOMBUS); graph.getStylesheet().putCellStyle(STYLE_GATEWAY, style); } // Create gateway node Object gatewayVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, gatewaySize, gatewaySize, STYLE_GATEWAY); generatedVertices.put(flowElement.getId(), gatewayVertex); }
/** * Sets the default style for vertices. * * @param value Style to be used for vertices. */ public void setDefaultVertexStyle(Map<String, Object> value) { putCellStyle("defaultVertex", value); }