当前位置: 首页>>代码示例>>Java>>正文


Java DefaultEdge.setSource方法代码示例

本文整理汇总了Java中org.jgraph.graph.DefaultEdge.setSource方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultEdge.setSource方法的具体用法?Java DefaultEdge.setSource怎么用?Java DefaultEdge.setSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jgraph.graph.DefaultEdge的用法示例。


在下文中一共展示了DefaultEdge.setSource方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testJGraph

import org.jgraph.graph.DefaultEdge; //导入方法依赖的package包/类
@Test
public void testJGraph() throws Exception {
	GraphModel model = new DefaultGraphModel();
	GraphLayoutCache view = new GraphLayoutCache(model, new DefaultCellViewFactory());
	JGraph graph = new JGraph(model, view);

	DefaultGraphCell[] cells = new DefaultGraphCell[3];
	cells[0] = createCell("hello", true);
	cells[1] = createCell("world", false);
	DefaultEdge edge = new DefaultEdge();
	GraphConstants.setLineStyle(edge.getAttributes(), GraphConstants.ARROW_LINE);
	edge.setSource(cells[0].getChildAt(0));
	edge.setTarget(cells[1].getChildAt(0));
	cells[2] = edge;
	graph.getGraphLayoutCache().insert(cells);

	JOptionPane.showMessageDialog(null, new JScrollPane(graph));
}
 
开发者ID:e-Contract,项目名称:eid-applet,代码行数:19,代码来源:JGraphTest.java

示例2: addEdge

import org.jgraph.graph.DefaultEdge; //导入方法依赖的package包/类
public void addEdge( int source, int target){
   	//System.out.println("adding edge: "+source+"->"+ target+ "to cell "+cellCount);
   	DefaultEdge edge = new DefaultEdge();
   	edge.setSource(cells[source].getChildAt(0));
	edge.setTarget(cells[target].getChildAt(0));
	int arrow = GraphConstants.ARROW_CLASSIC;
	GraphConstants.setLineEnd(edge.getAttributes(), arrow);
	GraphConstants.setEndFill(edge.getAttributes(), true);
//	Node s = (Node)cells[source].getUserObject();
//	Node t = (Node)cells[target].getUserObject();
/*	_edge.arrow_x=(int)(s.x+t.x)/2;
	_edge.arrow_y=(int)(s.y+t.y)/2;*/
	
   	cells[cellCount] = edge;
   	edgeCount++;
   	cellCount++;
   }
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:18,代码来源:BinomialTradingApplication.java

示例3: createEdge

import org.jgraph.graph.DefaultEdge; //导入方法依赖的package包/类
/**
 * Creates a new edge in JGraph.
 *
 * @param source DefaultGraphCell that is the source for the edge.
 * @param target DefaultGraphCell that is the target for the edge.
 * @return DefaultGraphCell that was generated to connect the source with
 * the target.
 * @throws Exception
 */
public static DefaultGraphCell createEdge(DefaultGraphCell source,
        DefaultGraphCell target) throws Exception {
    DefaultEdge edge = new DefaultEdge();
    source.addPort();
    edge.setSource(source.getChildAt(source.getChildCount() - 1));
    target.addPort();
    edge.setTarget(target.getChildAt(target.getChildCount() - 1));
    return edge;
}
 
开发者ID:datapoet,项目名称:hubminer,代码行数:19,代码来源:JGraphConverter.java

示例4: createConnection

import org.jgraph.graph.DefaultEdge; //导入方法依赖的package包/类
private DefaultEdge createConnection(DefaultGraphCell cell) {
    DefaultEdge edge = new DefaultEdge();
    edge.setSource(stack.peek().getChildAt(0));
    edge.setTarget(cell);

    // Set Arrow Style for edge
    int arrow = GraphConstants.ARROW_TECHNICAL;
    GraphConstants.setLineEnd(edge.getAttributes(), arrow);
    GraphConstants.setEndFill(edge.getAttributes(), true);
    return edge;
}
 
开发者ID:fabioz,项目名称:Pydev,代码行数:12,代码来源:GraphVisitor.java

示例5: insertLink

import org.jgraph.graph.DefaultEdge; //导入方法依赖的package包/类
private void insertLink(GraphVertex sourceVertex, GraphVertex targetVertex, Link type, DataBean sourceDataBean) {
	if (type.equals(DataBean.Link.GROUPING)) {

		if (sourceVertex.getGroup() != null && targetVertex.getGroup() != null) {
			// both are grouped
			if (sourceVertex.getGroup() == targetVertex.getGroup()) {
				// already in the same group, ignore
				return;
			} else {
				throw new IllegalArgumentException("beans already have different groups");
			}
		}

		if (sourceVertex.getGroup() == null && targetVertex.getGroup() == null) {
			createGroup(sourceVertex.getData()); // create group for the source and add target next
		}

		// other is grouped, other not => group the ungrouped one
		if (sourceVertex.getGroup() != null) {
			sourceVertex.getGroup().addChildVertex(targetVertex);
		} else {
			targetVertex.getGroup().addChildVertex(sourceVertex);
		}

	} else if (type.equals(DataBean.Link.ANNOTATION) || type.equals(DataBean.Link.DERIVATION) || type.equals(DataBean.Link.MODIFICATION)) {

		DefaultEdge linkEdge = new NoLabelEdge(type);
		linkEdge.setSource(sourceVertex.getChildAt(0));
		linkEdge.setTarget(targetVertex.getChildAt(0));

		switch (type) {
		case ANNOTATION:
			setAnnotationEdgeStyle(linkEdge);
			break;
		case DERIVATION:
			setDerivationEdgeStyle(linkEdge);
			break;
		case MODIFICATION:
			setModificationEdgeStyle(linkEdge);
			break;
		}

		this.getGraphLayoutCache().insert(linkEdge);

		if (type.equals(DataBean.Link.DERIVATION) || type.equals(DataBean.Link.MODIFICATION)) {
			layoutManager.updateLayout(sourceVertex, sourceDataBean); // update position if this was made child of other bean
			graphPanel.autoZoom();
			scrollCellToVisibleAnimated(sourceVertex);
			repaint();

		} else if (type.equals(DataBean.Link.ANNOTATION)) {
			moveCloseToAnnotated(sourceVertex.getData());
		}

	} else {
		throw new IllegalArgumentException("unsupported link type: " + type);
	}
}
 
开发者ID:chipster,项目名称:chipster,代码行数:59,代码来源:MicroarrayGraph.java

示例6: createWeightedEdge

import org.jgraph.graph.DefaultEdge; //导入方法依赖的package包/类
/**
 * Creates a new weighted edge in JGraph.
 *
 * @param source DefaultGraphCell that is the source for the edge.
 * @param target DefaultGraphCell that is the target for the edge.
 * @param weight Double that is the weight of the edge.
 * @return DefaultGraphCell that was generated to connect the source with
 * the target, with the specified weight.
 * @throws Exception
 */
public static DefaultGraphCell createWeightedEdge(DefaultGraphCell source,
        DefaultGraphCell target, double weight) throws Exception {
    DefaultEdge edge = new DefaultEdge((new Double(weight)).toString());
    source.addPort();
    edge.setSource(source.getChildAt(source.getChildCount() - 1));
    target.addPort();
    edge.setTarget(target.getChildAt(target.getChildCount() - 1));
    return edge;
}
 
开发者ID:datapoet,项目名称:hubminer,代码行数:20,代码来源:JGraphConverter.java


注:本文中的org.jgraph.graph.DefaultEdge.setSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。