亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? jgraphgraphfactory.java

?? 工作流應(yīng)用源碼
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
package com.softwarematch.workflow;import java.awt.BorderLayout;import java.awt.Color;import java.awt.Dimension;import java.awt.FlowLayout;import java.awt.Frame;import java.awt.GridLayout;import java.awt.Toolkit;import java.awt.Window;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.geom.Point2D;import java.awt.geom.Rectangle2D;import java.util.Hashtable;import java.util.Map;import java.util.Random;import javax.swing.BorderFactory;import javax.swing.JButton;import javax.swing.JCheckBox;import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JPanel;import javax.swing.JTextField;import javax.swing.border.EmptyBorder;import org.jgraph.JGraph;import org.jgraph.graph.AttributeMap;import org.jgraph.graph.ConnectionSet;import org.jgraph.graph.DefaultEdge;import org.jgraph.graph.DefaultGraphCell;import org.jgraph.graph.DefaultGraphModel;import org.jgraph.graph.Edge;import org.jgraph.graph.GraphConstants;import org.jgraph.graph.GraphModel;import org.jgraph.graph.ParentMap;import org.jgraph.graph.Port;/** * A helper class that creates graphs. Currently supports tree graphs and a * random graph where all edges are connected at least once */public class JGraphGraphFactory {	public static final int FULLY_CONNECTED = 0;	public static final int RANDOM_CONNECTED = 1;	public static final int TREE = 2;	public static final int FLOW = 3;	/**	 * Shared <code>Random</code>	 */	private Random random = new Random();	/**	 * Number of vertices on current tree level being worked on	 */	private int numVerticesLevel;	/**	 * Stores first unconnected edge available	 */	private int edgeIndex;	/**	 * Stores first unconnected cell available in smaple tree, root cell never	 * is available	 */	private int vertexIndex;	/**	 * Whether or not insert at performed directly on the model	 */	private boolean insertIntoModel = false;	/**	 * Number of nodes for use as bean variable	 */	protected int numNodes = 36;	/**	 * Number of edges for use as bean variable	 */	protected int numEdges = 36;	/**	 * The maximum number of child nodes any parent in the tree graph can have	 */	protected int maxNodesPerTreeLevel = 2;	protected FactoryConfigDialog dialog;	/**	 * Default constructor	 */	public JGraphGraphFactory() {	}	/**	 * Entry method for inserting a sample graph	 *	 * @param graph	 *            the JGraph to perform the insert on	 * @param graphType	 *            which sample graph type is to be inserted	 * @param defaultVertexAttributes	 *            the default attributes to use for vertices	 * @param defaultEdgeAttributes	 *            the default attributes to use for edges	 */	public void insertGraph(JGraph graph, int graphType,			Map defaultVertexAttributes, Map defaultEdgeAttributes) {		if (dialog == null) {			dialog = new FactoryConfigDialog();		}		dialog.configureLayout(graph, graphType, defaultVertexAttributes,				defaultEdgeAttributes);		dialog.setModal(true);		center(dialog);		dialog.setVisible(true);	}	/**	 * clears the graph and inserts a random tree. The nodes are initially	 * placed a grid with the root node selected. The algorithm used is not	 * recursive as the number of nodes per level are not know at the size. A	 * DFS search would not work, since we don't know where the leaves are.	 * Cells are inserted over edges for clarity	 *	 * @param graph	 *            the JGraph to perform the insert on	 * @param defaultVertexAttributes	 *            the default attributes to use for vertices	 * @param defaultEdgeAttributes	 *            the default attributes to use for edges	 * @return the root node of the tree	 */	public Object insertTreeSampleData(JGraph graph, Map defaultVertexAttributes,			Map defaultEdgeAttributes) {		// Create array big enough for all cells		Object[] cells = new Object[numNodes * 2];		initialise(graph);		numVerticesLevel = 1;		edgeIndex = 0;		vertexIndex = 1;		int gridWidth = (int) Math.sqrt(numNodes);		// Ensure arrows are present in edge attributes		int arrow = GraphConstants.ARROW_CLASSIC;		GraphConstants.setLineEnd(defaultEdgeAttributes, arrow);		GraphConstants.setEndFill(defaultEdgeAttributes, true);		// the cell occupy the first half of the cells array, i.e. from		// 0 to numNodes-1, the edge the second half, from numNodes to		// numNode*2-1		for (int i = 0; i < numNodes; i++) {			Point2D cellPosition = calcCellPosition(i, gridWidth);			DefaultGraphCell cell = createVertex(new Integer(i).toString(),					cellPosition, defaultVertexAttributes);			cells[i] = cell;		}		connectNextLevel(graph.getModel(), cells, defaultEdgeAttributes);		Object[] cells2 = new Object[numNodes + numNodes - 1];		System.arraycopy(cells, numNodes, cells2, 0, numNodes - 1);		System.arraycopy(cells, 0, cells2, numNodes - 1, numNodes);		insertIntoGraph(graph, cells2);		// Select the root cell		graph.setSelectionCell(cells[0]);		return cells[0];	}	/**	 * clears the graph and inserts a random tree. The nodes are initially	 * placed a grid with the root node selected. The algorithm used is not	 * recursive as the number of nodes per level are not know at the size. A	 * DFS search would not work, since we don't know where the leaves are.	 * Cells are inserted over edges for clarity	 *	 * @param model	 *            the model to perform the insert on	 * @param defaultVertexAttributes	 *            the default attributes to use for vertices	 * @param defaultEdgeAttributes	 *            the default attributes to use for edges	 * @return the root node of the tree	 */	public Object insertTreeSampleData(GraphModel model, Map defaultVertexAttributes,			Map defaultEdgeAttributes) {		// Create array big enough for all cells		Object[] cells = new Object[numNodes * 2];		// Clear out the model		Object[] roots = DefaultGraphModel.getRoots(model);		Object[] descendants = DefaultGraphModel.getDescendants(model, roots).toArray();		model.remove(descendants);		numVerticesLevel = 1;		edgeIndex = 0;		vertexIndex = 1;		int gridWidth = (int) Math.sqrt(numNodes);		// Ensure arrows are present in edge attributes		int arrow = GraphConstants.ARROW_CLASSIC;		GraphConstants.setLineEnd(defaultEdgeAttributes, arrow);		GraphConstants.setEndFill(defaultEdgeAttributes, true);		// the cell occupy the first half of the cells array, i.e. from		// 0 to numNodes-1, the edge the second half, from numNodes to		// numNode*2-1		for (int i = 0; i < numNodes; i++) {			Point2D cellPosition = calcCellPosition(i, gridWidth);			DefaultGraphCell cell = createVertex(new Integer(i).toString(),					cellPosition, defaultVertexAttributes);			cells[i] = cell;		}		connectNextLevel(model, cells, defaultEdgeAttributes);		Object[] cells2 = new Object[numNodes + numNodes - 1];		System.arraycopy(cells, numNodes, cells2, 0, numNodes - 1);		System.arraycopy(cells, 0, cells2, numNodes - 1, numNodes);		JGraphGraphFactory.insert(model, cells2);		return cells[0];	}	/**	 * Takes all cells to be connected between one level and the next creates	 *	 * @param cells	 * @param defaultEdgeAttributes	 */	protected void connectNextLevel(GraphModel model, Object[] cells, Map defaultEdgeAttributes) {		// If we've connected all vertices stop connecting		if (vertexIndex < numNodes) {			// Store the number of vertices on this level locally as the			// variable is going to be reused			int localNumVerticesLevel = numVerticesLevel;			numVerticesLevel = 0;			int localVertexCount = vertexIndex;			// For each node in this level connect a random number of vertices			for (int i = localVertexCount - localNumVerticesLevel; i < localVertexCount; i++) {				connectChildrenVertices(model, cells, cells[i], defaultEdgeAttributes);			}			// Recurse			connectNextLevel(model, cells, defaultEdgeAttributes);		}	}	/**	 * Connects the next <code>numChildren</code> free vertices as targets	 * from the specified <code>parent</code>	 *	 * @param cells	 * @param parent	 * @param defaultEdgeAttributes	 */	protected void connectChildrenVertices(GraphModel model, Object[] cells, Object parent,			Map defaultEdgeAttributes) {		// If we've connected all vertices stop connecting		if (vertexIndex < numNodes) {			// Make a list of child cells first. We don't recurse straight down			// to leaves since we don't how deep the tree is. Instead, each			// level is connected at a time. Increasing maxNodesPerTreeLevel			// makes the tree wider and shallower, decreasing makes it deeper			// and narrower			int numChildren = random.nextInt(maxNodesPerTreeLevel) + 1;			Port parentPort;			if (parent instanceof Port) {				parentPort = (Port)parent;			} else {				parentPort = (Port)model.getChild(parent, 0);			}			for (int i = 0; i < numChildren; i++) {				// If we've connected all vertices stop connecting				if (vertexIndex < numNodes) {					numVerticesLevel++;					// Port of child i					Port childPort;					if (cells[vertexIndex] instanceof Port) {						childPort = (Port)cells[vertexIndex++];					} else {						childPort = (Port)model.getChild(cells[vertexIndex++], 0);					}					Edge edge = createEdge(defaultEdgeAttributes, parentPort,							childPort);					cells[(edgeIndex++) + numNodes] = edge;				}			}		}	}	/**	 * clears the graph and inserts a random graph. The nodes are initially	 * placed a grid with no node selected. If there are at least as many edges	 * as nodes then all cells have at least one edge connected to them.	 *	 * @param graph	 *            the JGraph instance to act upon	 * @param defaultVertexAttributes	 *            the default attributes to use for vertices	 * @param defaultEdgeAttributes	 *            the default attributes to use for edges	 */	public void insertConnectedGraphSampleData(JGraph graph,			Map defaultVertexAttributes, Map defaultEdgeAttributes) {		// Create array big enough for all cells		Object[] cells = new DefaultGraphCell[numNodes + numEdges];		GraphModel model = graph.getModel();		initialise(graph);		int gridWidth = (int) Math.sqrt(numNodes);		for (int i = 0; i < numNodes; i++) {			Point2D cellPosition = calcCellPosition(i, gridWidth);			DefaultGraphCell cell = createVertex(new Integer(i).toString(),					cellPosition, defaultVertexAttributes);			cells[i] = cell;		}		// Connect every cell in turn to a random other		for (int i = 0; i < Math.min(numNodes, numEdges); i++) {			// Port of child i			Port sourcePort;			if (cells[i] instanceof Port) {				sourcePort = (Port)cells[i];			} else {				sourcePort = (Port)model.getChild(cells[i], 0);			}			// Select random other cell			int node = random.nextInt(numNodes);			if (numNodes > 1) {				while (node == i) {					node = random.nextInt(numNodes);				}			}			Port targetPort;			if (cells[node] instanceof Port) {				targetPort = (Port)cells[node];			} else {				targetPort = (Port)model.getChild(cells[node], 0);			}			Edge edge = createEdge(defaultEdgeAttributes, sourcePort,					targetPort);			cells[i + numNodes] = edge;		}		// Connect remaining edges randomly		for (int i = numNodes; i < numEdges; i++) {			int sourceNode = random.nextInt(numNodes);			Port sourcePort;			if (cells[sourceNode] instanceof Port) {				sourcePort = (Port)cells[sourceNode];			} else {				sourcePort = (Port)model.getChild(cells[sourceNode], 0);			}			// Select random other cell			int targetNode = random.nextInt(numNodes);			if (numNodes > 1) {				while (targetNode == sourceNode) {					targetNode = random.nextInt(numNodes);				}			}			Port targetPort;			if (cells[targetNode] instanceof Port) {				targetPort = (Port)cells[targetNode];			} else {				targetPort = (Port)model.getChild(cells[targetNode], 0);			}			Edge edge = createEdge(defaultEdgeAttributes, sourcePort,					targetPort);			cells[i + numNodes] = edge;		}		Object[] cells2 = new Object[numNodes + numEdges];		System.arraycopy(cells, numNodes, cells2, 0, numEdges);		System.arraycopy(cells, 0, cells2, numEdges, numNodes);		insertIntoGraph(graph, cells2);	}	/**	 * clears the graph and inserts a fully connected graph. The nodes are	 * initially placed a grid. There are the same number of cells and edges in	 * the graph, all cells have at least one edge connected to them.	 *	 * @param graph	 *            the JGraph instance to act upon	 * @param defaultVertexAttributes	 *            the default attributes to use for vertices	 * @param defaultEdgeAttributes	 *            the default attributes to use for edges	 */	public void insertFullyConnectedGraphSampleData(JGraph graph,			Map defaultVertexAttributes, Map defaultEdgeAttributes) {		GraphModel model = graph.getModel();		// Calculate the number of edges		int numEdges = ((numNodes - 1) * (numNodes)) / 2;

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品久久久久久无| 色综合久久天天综合网| 欧美肥妇free| 日韩精品一级中文字幕精品视频免费观看| 欧美最猛黑人xxxxx猛交| 亚洲人成网站在线| 欧美午夜精品久久久久久超碰 | 精品一区二区三区视频| 777a∨成人精品桃花网| 精东粉嫩av免费一区二区三区| 国产日韩欧美在线一区| 99精品视频在线免费观看| 亚洲女人的天堂| 欧美精品自拍偷拍| 国产在线日韩欧美| 亚洲视频你懂的| 51久久夜色精品国产麻豆| 久久se这里有精品| 亚洲天堂精品视频| 欧美日韩精品免费| 久久精品国产亚洲一区二区三区| 久久综合精品国产一区二区三区| 成人精品一区二区三区中文字幕| 一区二区高清视频在线观看| 日韩欧美一级在线播放| 成人国产精品免费网站| 亚洲国产欧美在线| 久久久久九九视频| 欧美在线不卡视频| 国模大尺度一区二区三区| 成人欧美一区二区三区白人 | 精品国产精品一区二区夜夜嗨| 国产制服丝袜一区| 亚洲国产成人va在线观看天堂| 日韩一级片在线观看| 成人动漫一区二区| 久久精品国产免费看久久精品| 久久精品免视看| 欧美精品自拍偷拍动漫精品| 成人app在线| 免费观看在线综合| 亚洲另类在线制服丝袜| 久久精品欧美日韩| 7777精品伊人久久久大香线蕉超级流畅 | 这里是久久伊人| 暴力调教一区二区三区| 久久电影国产免费久久电影| 一区二区三区自拍| 中文字幕av免费专区久久| 日韩欧美一卡二卡| 欧美日本在线观看| 一本到不卡免费一区二区| 国产乱国产乱300精品| 日本亚洲免费观看| 亚洲国产wwwccc36天堂| 亚洲欧美综合色| 国产亚洲欧美日韩在线一区| 91精品国产麻豆| 欧美三电影在线| 91浏览器在线视频| 国产91精品精华液一区二区三区| 麻豆freexxxx性91精品| 丝袜美腿一区二区三区| 一二三区精品视频| 亚洲欧美一区二区三区国产精品| 国产日本欧美一区二区| 337p粉嫩大胆噜噜噜噜噜91av| 日韩午夜在线观看| 欧美一区二区精美| 欧美日高清视频| 51精品秘密在线观看| 欧美精品亚洲二区| 欧美精品777| 欧美猛男男办公室激情| 91精品国产综合久久精品图片 | 欧美草草影院在线视频| 4438x亚洲最大成人网| 欧美一三区三区四区免费在线看| 欧美三级在线看| 欧美日韩国产综合一区二区三区| 欧美在线免费播放| 欧美日本一区二区| 日韩一区二区不卡| 久久久亚洲精华液精华液精华液| 久久久久久久久久久久久久久99 | 91麻豆高清视频| 91激情五月电影| 欧美吞精做爰啪啪高潮| 欧美人妇做爰xxxⅹ性高电影| 欧美日韩一区二区在线观看| 欧美日本在线播放| 欧美成人乱码一区二区三区| 久久综合网色—综合色88| 中文字幕精品一区二区三区精品| 欧美激情综合五月色丁香小说| 国产精品免费视频观看| 亚洲乱码国产乱码精品精98午夜 | 国产成人av电影| 成人动漫av在线| 91黄色激情网站| 欧美精品免费视频| 精品国产污污免费网站入口| 久久免费视频一区| 亚洲欧洲精品天堂一级 | 91猫先生在线| 91精品国产综合久久久蜜臀粉嫩 | 91视频免费播放| 欧美美女网站色| 国产女人18水真多18精品一级做| 亚洲精品综合在线| 日本亚洲电影天堂| caoporm超碰国产精品| 欧美日韩亚洲综合一区二区三区| 精品乱人伦一区二区三区| 欧美激情在线一区二区| 肉丝袜脚交视频一区二区| 国产精品69久久久久水密桃| 91久久精品网| 久久色在线视频| 亚洲一区二区三区四区在线观看| 久久精品国产免费看久久精品| 不卡大黄网站免费看| 欧美一区二区三区四区五区| 中文字幕免费在线观看视频一区| 亚洲大片免费看| 成人性色生活片免费看爆迷你毛片| 欧美日韩一级片在线观看| 久久久精品综合| 五月天中文字幕一区二区| 成人av网站在线观看| 日韩午夜在线观看视频| 亚洲精品视频免费看| 国产盗摄一区二区| 91麻豆精品国产91久久久更新时间 | 不卡一区中文字幕| 日韩精品一区二区三区三区免费| 亚洲美女淫视频| 成人午夜av在线| 欧美一区二区三区在线看| 亚洲免费av高清| 国产一区二区不卡| 欧美精品在欧美一区二区少妇| 亚洲免费毛片网站| 成人免费视频一区| 精品国产免费视频| 日韩有码一区二区三区| 91久久精品日日躁夜夜躁欧美| 久久精品视频在线免费观看| 久久不见久久见中文字幕免费| 欧美精品1区2区3区| 亚洲国产欧美在线| 色av一区二区| 国产精品国产三级国产aⅴ无密码 国产精品国产三级国产aⅴ原创 | 久久99国产精品麻豆| 欧美日本精品一区二区三区| 亚洲激情五月婷婷| 99精品欧美一区二区三区小说| 国产视频一区二区在线| 激情综合色丁香一区二区| 日韩一区二区高清| 日本不卡视频一二三区| 欧美理论电影在线| 三级欧美在线一区| 91精品国产综合久久蜜臀 | 亚洲一线二线三线视频| 91在线小视频| 亚洲女同ⅹxx女同tv| 色婷婷狠狠综合| 国产一区二区三区日韩| 日韩欧美一二区| 久久国产精品色婷婷| 欧美成人性战久久| 国产精品资源在线观看| 国产三级一区二区| 成人免费av资源| 亚洲精品国久久99热| 欧美系列亚洲系列| 亚洲高清免费在线| 日韩欧美国产成人一区二区| 日本视频免费一区| 国产日韩欧美亚洲| 97久久精品人人做人人爽| 亚洲另类在线制服丝袜| 欧美日韩一二区| 玖玖九九国产精品| 国产精品乱码人人做人人爱| av动漫一区二区| 亚洲主播在线观看| 日韩精品专区在线影院观看| 国产乱码精品1区2区3区| ...xxx性欧美| 欧美乱妇15p| 韩国女主播一区| 国产精品国产自产拍高清av| 欧美日韩精品一区视频| 久久99精品国产| 亚洲视频在线一区| 日韩一区二区免费在线观看| 国产成a人亚洲| 亚洲一二三四区不卡|