本文整理了Java中com.mxgraph.view.mxGraph.getDefaultParent()
方法的一些代码示例,展示了mxGraph.getDefaultParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。mxGraph.getDefaultParent()
方法的具体详情如下:
包路径:com.mxgraph.view.mxGraph
类名称:mxGraph
方法名:getDefaultParent
[英]Returns the first child of the root in the model, that is, the first or default layer of the diagram.
[中]返回模型中根的第一个子级,即图表的第一层或默认层。
代码示例来源:origin: Activiti/Activiti
protected void layout(FlowElementsContainer flowElementsContainer) {
graph = new mxGraph();
cellParent = graph.getDefaultParent();
graph.getModel().beginUpdate();
layout.setDisableEdgeStyle(false);
layout.setUseBoundingBox(true);
layout.execute(graph.getDefaultParent());
代码示例来源:origin: Activiti/Activiti
double y0 = x0;
if (!moveTree || parent == graph.getDefaultParent() || parent == graph.getCurrentRoot()) {
mxGeometry g = model.getGeometry(root);
if (g.isRelative()) {
if (model.getParent(node.cell) != graph.getCurrentRoot() && model.getParent(node.cell) != graph.getDefaultParent()) {
moveNode(node, dx, dy);
代码示例来源:origin: stackoverflow.com
public GraphEditor(String appTitle, mxGraphComponent component)
{
super(appTitle, component);
final mxGraph graph = graphComponent.getGraph();
graph.insertVertex(graph.getDefaultParent(), null, "Test", 100, 100, 200, 100);
...
}
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
* Generates a GD text output with the cells in the graph.
* The implementation only uses the cells located in the default parent.
* @param graph Graph with the cells.
* @return The GD document generated.
*/
public static String encode(mxGraph graph)
{
StringBuilder builder = new StringBuilder();
Object parent = graph.getDefaultParent();
Object[] vertices = mxGraphModel.getChildCells(graph.getModel(), parent, true, false);
builder.append("# Number of Nodes (0-" + String.valueOf(vertices.length - 1) + ")");
builder.append(String.valueOf(vertices.length));
// TODO
return builder.toString();
}
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
* Generates a GD text output with the cells in the graph.
* The implementation only uses the cells located in the default parent.
* @param graph Graph with the cells.
* @return The GD document generated.
*/
public static String encode(mxGraph graph)
{
StringBuilder builder = new StringBuilder();
Object parent = graph.getDefaultParent();
Object[] vertices = mxGraphModel.getChildCells(graph.getModel(), parent, true, false);
builder.append("# Number of Nodes (0-" + String.valueOf(vertices.length - 1) + ")");
builder.append(String.valueOf(vertices.length));
// TODO
return builder.toString();
}
}
代码示例来源:origin: org.opensingular/singular-server-commons
private static void addStartTransition(mxGraph graph, STask<?> taskInicial, Map<String, Object> mapaVertice) {
final Object v = graph.insertVertex(graph.getDefaultParent(), null, null, 20, 20, 20, 20);
setStyle(v, "START");
final Object destiny = mapaVertice.get(taskInicial.getAbbreviation());
graph.insertEdge(graph.getDefaultParent(), null, null, v, destiny);
}
代码示例来源:origin: org.opensingular/server-commons
private static void addStartTransition(mxGraph graph, MTask<?> taskInicial, Map<String, Object> mapaVertice) {
final Object v = graph.insertVertex(graph.getDefaultParent(), null, null, 20, 20, 20, 20);
setStyle(v, "START");
final Object destino = mapaVertice.get(taskInicial.getAbbreviation());
graph.insertEdge(graph.getDefaultParent(), null, null, v, destino);
}
代码示例来源:origin: org.opensingular/singular-requirement-commons
private static void addStartTransition(mxGraph graph, STask<?> taskInicial, Map<String, Object> mapaVertice) {
final Object v = graph.insertVertex(graph.getDefaultParent(), null, null, 20, 20, 20, 20);
setStyle(v, "START");
final Object destiny = mapaVertice.get(taskInicial.getAbbreviation());
graph.insertEdge(graph.getDefaultParent(), null, null, v, destiny);
}
代码示例来源:origin: org.opensingular/singular-requirement-module
private static void addStartTransition(mxGraph graph, STask<?> taskInicial, Map<String, Object> mapaVertice) {
final Object v = graph.insertVertex(graph.getDefaultParent(), null, null, 20, 20, 20, 20);
setStyle(v, "START");
final Object destiny = mapaVertice.get(taskInicial.getAbbreviation());
graph.insertEdge(graph.getDefaultParent(), null, null, v, destiny);
}
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
* @param graph
* @param sourceVertex
* @param targetVertex
* @return Returns true if the two vertices are connected directly by an edge. If directed, the result is true if they are connected by an edge that points from source to target, if false direction isn't takein into account, just connectivity.
*/
public static boolean areConnected(mxAnalysisGraph aGraph, Object sourceVertex, Object targetVertex)
{
Object currEdges[] = aGraph.getEdges(sourceVertex, aGraph.getGraph().getDefaultParent(), true, true, false, true);
List<Object> neighborList = Arrays.asList(aGraph.getOpposites(currEdges, sourceVertex, true, true));
return neighborList.contains(targetVertex);
};
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
* @param graph
* @param sourceVertex
* @param targetVertex
* @return Returns true if the two vertices are connected directly by an edge. If directed, the result is true if they are connected by an edge that points from source to target, if false direction isn't takein into account, just connectivity.
*/
public static boolean areConnected(mxAnalysisGraph aGraph, Object sourceVertex, Object targetVertex)
{
Object currEdges[] = aGraph.getEdges(sourceVertex, aGraph.getGraph().getDefaultParent(), true, true, false, true);
List<Object> neighborList = Arrays.asList(aGraph.getOpposites(currEdges, sourceVertex, true, true));
return neighborList.contains(targetVertex);
};
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
* @param aGraph
* @param vertex
* @return outdegree of <b>vertex</b>
*/
public static int outdegree(mxAnalysisGraph aGraph, Object vertex)
{
if (mxGraphProperties.isDirected(aGraph.getProperties(), mxGraphProperties.DEFAULT_DIRECTED))
{
return aGraph.getEdges(vertex, aGraph.getGraph().getDefaultParent(), false, true, true, true).length;
}
else
{
return aGraph.getEdges(vertex, aGraph.getGraph().getDefaultParent(), true, true, true, true).length;
}
};
代码示例来源:origin: com.github.vlsi.mxgraph/jgraphx
/**
* @param aGraph
* @param vertex
* @return outdegree of <b>vertex</b>
*/
public static int outdegree(mxAnalysisGraph aGraph, Object vertex)
{
if (mxGraphProperties.isDirected(aGraph.getProperties(), mxGraphProperties.DEFAULT_DIRECTED))
{
return aGraph.getEdges(vertex, aGraph.getGraph().getDefaultParent(), false, true, true, true).length;
}
else
{
return aGraph.getEdges(vertex, aGraph.getGraph().getDefaultParent(), true, true, true, true).length;
}
};
代码示例来源:origin: org.opensingular/singular-requirement-module
private static void createTransition(mxGraph graph, STransition transition, String transitionName,
Map<String, Object> mapNodes) {
Object origin = mapNodes.get(transition.getOrigin().getAbbreviation());
Object destiny = mapNodes.get(transition.getDestination().getAbbreviation());
String name = transitionName;
if (transition.getDestination().getName().equals(transitionName)) {
name = null;
}
graph.insertEdge(graph.getDefaultParent(), null, formatName(name), origin, destiny);
}
代码示例来源:origin: org.opensingular/singular-requirement-commons
private static void createTransition(mxGraph graph, STransition transition, Map<String, Object> mapNodes) {
final Object origin = mapNodes.get(transition.getOrigin().getAbbreviation());
final Object destiny = mapNodes.get(transition.getDestination().getAbbreviation());
String name = transition.getName();
if (transition.getDestination().getName().equals(name)) {
name = null;
} else {
name = formatName(name);
}
graph.insertEdge(graph.getDefaultParent(), null, name, origin, destiny);
}
代码示例来源:origin: org.opensingular/singular-server-commons
private static void createTransition(mxGraph graph, STransition transition, Map<String, Object> mapNodes) {
final Object origin = mapNodes.get(transition.getOrigin().getAbbreviation());
final Object destiny = mapNodes.get(transition.getDestination().getAbbreviation());
String name = transition.getName();
if (transition.getDestination().getName().equals(name)) {
name = null;
} else {
name = formatName(name);
}
graph.insertEdge(graph.getDefaultParent(), null, name, origin, destiny);
}
代码示例来源:origin: org.opensingular/server-commons
private static void createTransition(mxGraph graph, MTransition transicao, Map<String, Object> mapaVertice) {
final Object origem = mapaVertice.get(transicao.getOrigin().getAbbreviation());
final Object destino = mapaVertice.get(transicao.getDestination().getAbbreviation());
String nome = transicao.getName();
if (transicao.getDestination().getName().equals(nome)) {
nome = null;
} else {
nome = formatarNome(nome);
}
graph.insertEdge(graph.getDefaultParent(), null, nome, origem, destino);
}
代码示例来源:origin: stackoverflow.com
public static mxGraph makeHelloWorldGraph() {
mxGraph graph = new mxGraph();
Object parent = graph.getDefaultParent();
graph.getModel().beginUpdate();
try {
Object v1 = graph.insertVertex(parent, null, "", 20, 20, 80,
30,"opacity=0");
Object v2 = graph.insertVertex(parent, null, "World!", 240, 150,
80, 30);
graph.insertEdge(parent, null, "Edge", v1, v2);
} finally {
graph.getModel().endUpdate();
}
return graph;
}
代码示例来源:origin: org.gdl-lang.gdl-tools/gdl-graph
public static void layout(mxGraphComponent graphComponent) {
final mxGraph graph = graphComponent.getGraph();
final mxHierarchicalLayout layout = new mxHierarchicalLayout(graph);
graph.getModel().beginUpdate();
try {
layout.execute(graph.getDefaultParent());
} finally {
graph.getModel().endUpdate();
}
}
代码示例来源:origin: org.tinyjee.jgraphx/jgraphx
/**
* Creates a new edge value based on graph properties in mxAnalysisGraph. Used mostly when creating new edges during graph generation.
* @param aGraph
* @return
*/
public Double getNewEdgeValue(mxAnalysisGraph aGraph)
{
if (getGeneratorFunction() != null)
{
mxGraph graph = aGraph.getGraph();
return getGeneratorFunction().getCost(graph.getView().getState(graph.getDefaultParent()));
}
else
{
return null;
}
};
内容来源于网络,如有侵权,请联系作者删除!