本文整理了Java中com.mxgraph.view.mxGraph.addCell()
方法的一些代码示例,展示了mxGraph.addCell()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。mxGraph.addCell()
方法的具体详情如下:
包路径:com.mxgraph.view.mxGraph
类名称:mxGraph
方法名:addCell
[英]Adds the cell to the default parent. This is a shortcut method.
[中]将单元格添加到默认父级。这是一种快捷方式。
代码示例来源:origin: Activiti/Activiti
protected void handleBoundaryEvents() {
for (BoundaryEvent boundaryEvent : boundaryEvents) {
mxGeometry geometry = new mxGeometry(0.8, 1.0, eventSize, eventSize);
geometry.setOffset(new mxPoint(-(eventSize / 2), -(eventSize / 2)));
geometry.setRelative(true);
mxCell boundaryPort = new mxCell(null, geometry, "shape=ellipse;perimter=ellipsePerimeter");
boundaryPort.setId("boundary-event-" + boundaryEvent.getId());
boundaryPort.setVertex(true);
Object portParent = null;
if (boundaryEvent.getAttachedToRefId() != null) {
portParent = generatedVertices.get(boundaryEvent.getAttachedToRefId());
} else if (boundaryEvent.getAttachedToRef() != null) {
portParent = generatedVertices.get(boundaryEvent.getAttachedToRef().getId());
} else {
throw new RuntimeException("Could not generate DI: boundaryEvent '" + boundaryEvent.getId() + "' has no attachedToRef");
}
graph.addCell(boundaryPort, portParent);
generatedVertices.put(boundaryEvent.getId(), boundaryPort);
}
}
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
* Adds the cell to the default parent. This is a shortcut method.
*
* @param cell Cell to be inserted.
* @return Returns the cell that was added.
*/
public Object addCell(Object cell)
{
return addCell(cell, null);
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
* Adds the cell to the parent. This is a shortcut method.
*
* @param cell Cell tobe inserted.
* @param parent Object that represents the new parent. If no parent is
* given then the default parent is used.
* @return Returns the cell that was added.
*/
public Object addCell(Object cell, Object parent)
{
return addCell(cell, parent, null, null, null);
}
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
* Adds the cell to the parent. This is a shortcut method.
*
* @param cell Cell tobe inserted.
* @param parent Object that represents the new parent. If no parent is
* given then the default parent is used.
* @return Returns the cell that was added.
*/
public Object addCell(Object cell, Object parent)
{
return addCell(cell, parent, null, null, null);
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
* Adds the cell to the default parent. This is a shortcut method.
*
* @param cell Cell to be inserted.
* @return Returns the cell that was added.
*/
public Object addCell(Object cell)
{
return addCell(cell, null);
}
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
* Adds the edge to the parent and connects it to the given source and
* target terminals. This is a shortcut method.
*
* @param edge Edge to be inserted into the given parent.
* @param parent Object that represents the new parent. If no parent is
* given then the default parent is used.
* @param source Optional cell that represents the source terminal.
* @param target Optional cell that represents the target terminal.
* @param index Optional index to insert the cells at. Default is to append.
* @return Returns the edge that was added.
*/
public Object addEdge(Object edge, Object parent, Object source,
Object target, Integer index)
{
return addCell(edge, parent, index, source, target);
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
* Adds the edge to the parent and connects it to the given source and
* target terminals. This is a shortcut method.
*
* @param edge Edge to be inserted into the given parent.
* @param parent Object that represents the new parent. If no parent is
* given then the default parent is used.
* @param source Optional cell that represents the source terminal.
* @param target Optional cell that represents the target terminal.
* @param index Optional index to insert the cells at. Default is to append.
* @return Returns the edge that was added.
*/
public Object addEdge(Object edge, Object parent, Object source,
Object target, Integer index)
{
return addCell(edge, parent, index, source, target);
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
* Adds a new vertex into the given parent using value as the user object
* and the given coordinates as the geometry of the new vertex. The id and
* style are used for the respective properties of the new cell, which is
* returned.
*
* @param parent Cell that specifies the parent of the new vertex.
* @param id Optional string that defines the Id of the new vertex.
* @param value Object to be used as the user object.
* @param x Integer that defines the x coordinate of the vertex.
* @param y Integer that defines the y coordinate of the vertex.
* @param width Integer that defines the width of the vertex.
* @param height Integer that defines the height of the vertex.
* @param style Optional string that defines the cell style.
* @param relative Specifies if the geometry should be relative.
* @return Returns the new vertex that has been inserted.
*/
public Object insertVertex(Object parent, String id, Object value,
double x, double y, double width, double height, String style,
boolean relative)
{
Object vertex = createVertex(parent, id, value, x, y, width, height,
style, relative);
return addCell(vertex, parent);
}
代码示例来源:origin: net.kieker-monitoring/kieker
private final Map<String, mxCell> createOutputPorts(final MIPlugin plugin, final mxCell vertex, final boolean reader) {
final Map<String, mxCell> port2graph = new HashMap<String, mxCell>(); // NOPMD (no concurrent access)
final String[] portNames = KaxVizFrame.getAllOutputPortNames(plugin);
for (int i = 0; i < portNames.length; i++) {
final mxGeometry portGeometry = new mxGeometry((i + 1d) / (portNames.length + 1), 1.06, 10, 10);
portGeometry.setOffset(new mxPoint(0, -10));
portGeometry.setRelative(true);
final String fillcolor = reader ? STYLE_READER_COLOR : STYLE_FILTER_COLOR; // NOPMD NOCS (?:)
final mxCell port = new mxCell(portNames[i], portGeometry,
STYLE_PORT + "verticalLabelPosition=top;portConstraint=south;" + fillcolor);
port.setVertex(true);
this.graph.addCell(port, vertex);
port2graph.put(portNames[i], port);
}
return port2graph;
}
代码示例来源:origin: net.kieker-monitoring/kieker
private final Map<String, mxCell> createInputPorts(final MIFilter plugin, final mxCell vertex) {
final Map<String, mxCell> port2graph = new HashMap<String, mxCell>(); // NOPMD (no concurrent access)
final String[] portNames = KaxVizFrame.getAllInputPortNames(plugin);
for (int i = 0; i < portNames.length; i++) {
final mxGeometry portGeometry = new mxGeometry((i + 1d) / (portNames.length + 1), -0.06, 10, 10);
portGeometry.setOffset(new mxPoint(0, 0));
portGeometry.setRelative(true);
final mxCell port = new mxCell(
portNames[i],
portGeometry,
STYLE_PORT + "spacingTop=3;verticalLabelPosition=bottom;portConstraint=north;" + STYLE_FILTER_COLOR);
port.setVertex(true);
this.graph.addCell(port, vertex);
port2graph.put(portNames[i], port);
}
return port2graph;
}
代码示例来源:origin: kieker-monitoring/kieker
private final Map<String, mxCell> createOutputPorts(final MIPlugin plugin, final mxCell vertex, final boolean reader) {
final Map<String, mxCell> port2graph = new HashMap<>(); // NOPMD (no concurrent access)
final String[] portNames = KaxVizFrame.getAllOutputPortNames(plugin);
for (int i = 0; i < portNames.length; i++) {
final mxGeometry portGeometry = new mxGeometry((i + 1d) / (portNames.length + 1), 1.06, 10, 10);
portGeometry.setOffset(new mxPoint(0, -10));
portGeometry.setRelative(true);
final String fillcolor = reader ? STYLE_READER_COLOR : STYLE_FILTER_COLOR; // NOPMD NOCS (?:)
final mxCell port = new mxCell(portNames[i], portGeometry,
STYLE_PORT + "verticalLabelPosition=top;portConstraint=south;" + fillcolor);
port.setVertex(true);
this.graph.addCell(port, vertex);
port2graph.put(portNames[i], port);
}
return port2graph;
}
代码示例来源:origin: kieker-monitoring/kieker
private final Map<String, mxCell> createInputPorts(final MIFilter plugin, final mxCell vertex) {
final Map<String, mxCell> port2graph = new HashMap<>(); // NOPMD (no concurrent access)
final String[] portNames = KaxVizFrame.getAllInputPortNames(plugin);
for (int i = 0; i < portNames.length; i++) {
final mxGeometry portGeometry = new mxGeometry((i + 1d) / (portNames.length + 1), -0.06, 10, 10);
portGeometry.setOffset(new mxPoint(0, 0));
portGeometry.setRelative(true);
final mxCell port = new mxCell(
portNames[i],
portGeometry,
STYLE_PORT + "spacingTop=3;verticalLabelPosition=bottom;portConstraint=north;" + STYLE_FILTER_COLOR);
port.setVertex(true);
this.graph.addCell(port, vertex);
port2graph.put(portNames[i], port);
}
return port2graph;
}
代码示例来源:origin: net.kieker-monitoring/kieker
private final mxCell createFilter(final MIFilter plugin, final int c) {
final mxCell vertex = new mxCell("<<Filter>>\n" + plugin.getName() + " : " + KaxVizFrame.getShortClassName(plugin),
new mxGeometry(FILTER_SPACE, FILTER_SPACE + (c * (FILTER_HEIGHT + FILTER_SPACE)),
FILTER_WIDTH, FILTER_HEIGHT), STYLE_FILTER);
vertex.setVertex(true);
this.graph.addCell(vertex);
return vertex;
}
代码示例来源:origin: net.kieker-monitoring/kieker
private final mxCell createRepository(final MIRepository repository, final int c) {
final mxCell vertex = new mxCell("<<Repository>>\n" + repository.getName() + " : " + KaxVizFrame.getShortClassName(repository),
new mxGeometry(FILTER_SPACE, FILTER_SPACE + (c * (FILTER_HEIGHT + FILTER_SPACE)),
FILTER_WIDTH, FILTER_HEIGHT), STYLE_REPOSITORY);
vertex.setVertex(true);
this.graph.addCell(vertex);
return vertex;
}
代码示例来源:origin: kieker-monitoring/kieker
private final mxCell createRepository(final MIRepository repository, final int c) {
final mxCell vertex = new mxCell("<<Repository>>\n" + repository.getName() + " : " + KaxVizFrame.getShortClassName(repository),
new mxGeometry(FILTER_SPACE, FILTER_SPACE + (c * (FILTER_HEIGHT + FILTER_SPACE)),
FILTER_WIDTH, FILTER_HEIGHT),
STYLE_REPOSITORY);
vertex.setVertex(true);
this.graph.addCell(vertex);
return vertex;
}
代码示例来源:origin: net.kieker-monitoring/kieker
private final mxCell createReader(final MIReader reader, final int c) {
final mxCell vertex = new mxCell("<<Reader>>\n" + reader.getName() + " : " + KaxVizFrame.getShortClassName(reader),
new mxGeometry(FILTER_SPACE, FILTER_SPACE + (c * (FILTER_HEIGHT + FILTER_SPACE)),
FILTER_WIDTH, FILTER_HEIGHT), STYLE_READER);
vertex.setVertex(true);
this.graph.addCell(vertex);
return vertex;
}
代码示例来源:origin: kieker-monitoring/kieker
private final mxCell createReader(final MIReader reader, final int c) {
final mxCell vertex = new mxCell("<<Reader>>\n" + reader.getName() + " : " + KaxVizFrame.getShortClassName(reader),
new mxGeometry(FILTER_SPACE, FILTER_SPACE + (c * (FILTER_HEIGHT + FILTER_SPACE)),
FILTER_WIDTH, FILTER_HEIGHT),
STYLE_READER);
vertex.setVertex(true);
this.graph.addCell(vertex);
return vertex;
}
代码示例来源:origin: kieker-monitoring/kieker
private final mxCell createFilter(final MIFilter plugin, final int c) {
final mxCell vertex = new mxCell("<<Filter>>\n" + plugin.getName() + " : " + KaxVizFrame.getShortClassName(plugin),
new mxGeometry(FILTER_SPACE, FILTER_SPACE + (c * (FILTER_HEIGHT + FILTER_SPACE)),
FILTER_WIDTH, FILTER_HEIGHT),
STYLE_FILTER);
vertex.setVertex(true);
this.graph.addCell(vertex);
return vertex;
}
代码示例来源:origin: com.bbossgroups.activiti/activiti-bpmn-layout
protected void handleBoundaryEvents() {
for (BoundaryEvent boundaryEvent : boundaryEvents) {
mxGeometry geometry = new mxGeometry(0.8, 1.0, eventSize, eventSize);
geometry.setOffset(new mxPoint(-(eventSize/2), -(eventSize/2)));
geometry.setRelative(true);
mxCell boundaryPort = new mxCell(null, geometry, "shape=ellipse;perimter=ellipsePerimeter");
boundaryPort.setId("boundary-event-" + boundaryEvent.getId());
boundaryPort.setVertex(true);
Object portParent = null;
if (boundaryEvent.getAttachedToRefId() != null) {
portParent = generatedVertices.get(boundaryEvent.getAttachedToRefId());
} else if (boundaryEvent.getAttachedToRef() != null) {
portParent = generatedVertices.get(boundaryEvent.getAttachedToRef().getId());
} else {
throw new RuntimeException("Could not generate DI: boundaryEvent '" + boundaryEvent.getId() + "' has no attachedToRef");
}
graph.addCell(boundaryPort, portParent);
generatedVertices.put(boundaryEvent.getId(), boundaryPort);
}
}
代码示例来源:origin: org.flowable/flowable-bpmn-layout
protected void handleBoundaryEvents() {
for (BoundaryEvent boundaryEvent : boundaryEvents) {
mxGeometry geometry = new mxGeometry(0.8, 1.0, eventSize, eventSize);
geometry.setOffset(new mxPoint(-(eventSize / 2), -(eventSize / 2)));
geometry.setRelative(true);
mxCell boundaryPort = new mxCell(null, geometry, "shape=ellipse;perimeter=ellipsePerimeter");
boundaryPort.setId("boundary-event-" + boundaryEvent.getId());
boundaryPort.setVertex(true);
Object portParent = null;
if (boundaryEvent.getAttachedToRefId() != null) {
portParent = generatedVertices.get(boundaryEvent.getAttachedToRefId());
} else if (boundaryEvent.getAttachedToRef() != null) {
portParent = generatedVertices.get(boundaryEvent.getAttachedToRef().getId());
} else {
throw new RuntimeException("Could not generate DI: boundaryEvent '" + boundaryEvent.getId() + "' has no attachedToRef");
}
graph.addCell(boundaryPort, portParent);
generatedVertices.put(boundaryEvent.getId(), boundaryPort);
}
}
内容来源于网络,如有侵权,请联系作者删除!