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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? jgraphgraphfactory.java

?? 工作流應用源碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
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;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区四区蜜桃| 一区二区三区久久| 欧美v亚洲v综合ⅴ国产v| 99久久99久久久精品齐齐| 国产精品一区二区在线观看网站 | 亚洲一线二线三线久久久| 亚洲国产精品ⅴa在线观看| 精品乱人伦一区二区三区| 日韩欧美国产午夜精品| 制服.丝袜.亚洲.中文.综合| 日韩小视频在线观看专区| 免费看日韩a级影片| 亚洲一区视频在线| 欧美成人精品高清在线播放 | 国产精品人人做人人爽人人添| 国产99久久久国产精品免费看 | 国产精品久久久久久妇女6080 | 日韩一区二区免费电影| 亚洲第一福利一区| 中文字幕佐山爱一区二区免费| 久久久无码精品亚洲日韩按摩| 9191久久久久久久久久久| 欧美日韩一区二区三区不卡| 欧美性色黄大片| 欧美性生活久久| 色婷婷av一区二区三区之一色屋| 岛国精品在线播放| 成人免费看片app下载| 成人白浆超碰人人人人| 91在线视频免费观看| 色婷婷综合久色| 欧美综合一区二区| 欧美自拍偷拍一区| 91理论电影在线观看| 91网址在线看| 在线观看成人免费视频| 欧美日韩一区不卡| 日韩三级视频在线观看| 久久老女人爱爱| 国产精品福利av| 亚洲一卡二卡三卡四卡无卡久久| 亚洲精品综合在线| 偷拍一区二区三区四区| 免费一级欧美片在线观看| 久久av资源网| 成人一区二区三区中文字幕| 91在线视频官网| 欧美日韩综合不卡| 日韩精品一区二区三区三区免费| 国产亚洲欧美中文| 亚洲天堂2016| 喷水一区二区三区| 国产成人日日夜夜| 91黄色免费看| 欧美本精品男人aⅴ天堂| 国产亚洲欧美在线| 亚洲精品视频在线观看网站| 日精品一区二区| 国产suv精品一区二区三区| 日本精品裸体写真集在线观看| 欧美videossexotv100| 欧美激情一区二区三区| 午夜视频一区二区| www.亚洲色图.com| 欧美一区二区视频免费观看| 亚洲天堂精品在线观看| 久久精品国产色蜜蜜麻豆| 国产成a人无v码亚洲福利| 91精品黄色片免费大全| 国产精品成人免费在线| 九一久久久久久| 91网站在线播放| 国产欧美日韩精品在线| 日韩主播视频在线| 99久久夜色精品国产网站| 26uuu久久天堂性欧美| 亚洲黄一区二区三区| 丰满少妇久久久久久久| 日韩一级黄色片| 亚洲欧美激情视频在线观看一区二区三区| 日精品一区二区| 91丨九色porny丨蝌蚪| 精品av久久707| 亚洲午夜激情av| av午夜精品一区二区三区| 欧美mv日韩mv国产网站app| 亚洲狼人国产精品| 成人蜜臀av电影| 精品日韩一区二区三区 | 亚洲欧美日韩在线| 精品一区二区在线看| 欧美视频你懂的| 国产精品另类一区| 久久99久久久久| 欧美日韩精品免费| 亚洲精品视频在线观看免费| 成人午夜视频在线观看| 日韩欧美国产一二三区| 亚洲欧美一区二区在线观看| 国产麻豆视频精品| 欧美丰满一区二区免费视频| 亚洲欧美日韩小说| 亚洲蜜臀av乱码久久精品蜜桃| 国产精品亚洲专一区二区三区| 在线不卡中文字幕| 亚洲综合精品自拍| 色综合激情久久| 中文字幕亚洲一区二区av在线| 天天综合日日夜夜精品| 欧美性受xxxx| 亚洲最大色网站| 91丨九色丨黑人外教| 中文字幕制服丝袜成人av| 国产91在线观看| 国产日产欧产精品推荐色| 国产伦精一区二区三区| 精品国产乱码久久久久久图片| 日本中文字幕不卡| 精品国产乱码久久久久久蜜臀 | 亚洲三级在线看| aaa亚洲精品| 自拍偷拍亚洲综合| 青青草国产精品97视觉盛宴| 91精品久久久久久久91蜜桃| 视频一区二区国产| 欧美精品色一区二区三区| 丝袜亚洲另类欧美| 欧美日韩精品一区二区三区四区 | 成a人片亚洲日本久久| 国产三级精品三级在线专区| 日本vs亚洲vs韩国一区三区| 日韩欧美国产综合一区| 奇米精品一区二区三区在线观看一| 在线不卡中文字幕播放| 免费观看91视频大全| 欧美日韩高清一区二区不卡| 日韩国产欧美三级| 精品少妇一区二区三区在线视频 | 777奇米成人网| 美洲天堂一区二卡三卡四卡视频| 欧美另类变人与禽xxxxx| 亚洲国产另类av| 日韩午夜激情免费电影| 久草热8精品视频在线观看| 中文字幕精品—区二区四季| 99久久99久久精品国产片果冻| 久久久高清一区二区三区| 韩国成人福利片在线播放| 国产午夜亚洲精品午夜鲁丝片| 国产精品一区二区久激情瑜伽| 国产精品日产欧美久久久久| 色88888久久久久久影院野外| 国产亚洲精品超碰| 91国偷自产一区二区开放时间 | 亚洲免费观看高清完整版在线观看熊| 日本高清成人免费播放| 男女视频一区二区| 在线不卡a资源高清| 久久91精品国产91久久小草| 国产丝袜欧美中文另类| 91成人网在线| 韩国中文字幕2020精品| 国产精品久久久久影院| 欧美视频中文字幕| 国产一区二区三区四区在线观看| 一区二区三区中文字幕| 欧美一区二区播放| 91成人免费网站| 人人精品人人爱| 国产精品久久久久aaaa| 91精品国模一区二区三区| 国产一区二区在线看| 亚洲精品网站在线观看| 26uuu精品一区二区| 欧美午夜不卡视频| 国产成人在线视频免费播放| 国产亚洲一区二区三区四区| 欧美巨大另类极品videosbest | 国产精品国产三级国产三级人妇| 欧美精品乱人伦久久久久久| 国产成人丝袜美腿| 午夜国产精品一区| 国产精品国模大尺度视频| 欧美一区二区三区小说| 日本韩国视频一区二区| 国产中文字幕一区| 日本人妖一区二区| 国产成人亚洲精品青草天美| 欧美欧美欧美欧美| 久久久国产综合精品女国产盗摄| 精品国产91洋老外米糕| 亚洲精品福利视频网站| 成人精品亚洲人成在线| 亚洲成a人v欧美综合天堂下载| 亚洲在线视频网站| 久久九九影视网| 久久精品日韩一区二区三区| 91小视频免费看| 午夜伦理一区二区| 色综合天天视频在线观看|