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

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

?? jgraphgraphfactory.java

?? 工作流應用源碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
		// Create array big enough for all cells		Object[] cells = new DefaultGraphCell[numNodes + numEdges];		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[numEdges + i] = cell;		}		int cellCount = 0;		// Connect every cell to each other		for (int i = 0; i < numNodes; i++) {			// Port of child i			Port sourcePort;			if (cells[numEdges + i] instanceof Port) {				sourcePort = (Port)cells[numEdges + i];			} else {				sourcePort = (Port)model.getChild(cells[numEdges + i], 0);			}			for (int j = i + 1; j < numNodes; j++) {				Port targetPort;				if (cells[numEdges + j] instanceof Port) {					targetPort = (Port)cells[numEdges + j];				} else {					targetPort = (Port)model.getChild(cells[numEdges + j], 0);				}				Edge edge = createEdge(defaultEdgeAttributes, sourcePort,						targetPort);				cells[cellCount++] = edge;			}		}		insertIntoGraph(graph, cells);	}	/**	 * 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 insertSampleFlowGraph(JGraph graph,			Map defaultVertexAttributes, Map defaultEdgeAttributes) {	}	/**	 * Returns a point on a square grid given the index into the total number of	 * cells and the width of one line of the grid	 *	 * @param i	 *            index of cell	 * @param gridWidth	 *            width of each grid line	 * @return the position of the cell	 */	private Point2D calcCellPosition(int i, int gridWidth) {		if (i != 0) {			return new Point2D.Double(20 + (60 * (i % gridWidth)),					20 + (40 * (i / gridWidth)));		} else {			return new Point2D.Double(20, 20);		}	}	/**	 * Method hook to create custom vertices	 *	 * @param userObject	 *            the user object to pass to the cell	 * @return the new vertex instance	 */	protected DefaultGraphCell createVertex(Object userObject,			Point2D position, Map defaultVertexAttributes) {		AttributeMap attributes = new AttributeMap(defaultVertexAttributes);		GraphConstants.setBounds(attributes, new Rectangle2D.Double(position				.getX(), position.getY(), 40, 20));		DefaultGraphCell cell = new DefaultGraphCell(userObject, attributes);		// Add a Port		cell.addPort();		return cell;	}	/**	 * Method hook to create custom edges	 *	 * @return the new vertex instance	 */	protected Edge createEdge(Map defaultEdgeAttributes,			Port sourcePort, Port targetPort) {		AttributeMap edgeAttrib = null;		if (defaultEdgeAttributes != null) {			edgeAttrib = new AttributeMap(defaultEdgeAttributes);		} else {			edgeAttrib = new AttributeMap(6);		}		Edge edge = new DefaultEdge(null, edgeAttrib);		edge.setSource(sourcePort);		edge.setTarget(targetPort);		return edge;	}	/**	 * Common initialization functionality	 *	 */	protected void initialise(JGraph graph) {		// Remove all previous cells		graph.getModel().remove(graph.getDescendants(graph.getRoots()));	}	/**	 * Common insert functionality	 */	protected void insertIntoGraph(JGraph graph, Object[] cells) {		// For performance, don't select inserted cells		boolean selectsAll = graph.getGraphLayoutCache()				.isSelectsAllInsertedCells();		boolean selectsLocal = graph.getGraphLayoutCache()				.isSelectsLocalInsertedCells();		graph.getGraphLayoutCache().setSelectsAllInsertedCells(false);		graph.getGraphLayoutCache().setSelectsLocalInsertedCells(false);		if (insertIntoModel) {			graph.getModel().insert(cells, null, null, null, null);		} else {			graph.getGraphLayoutCache().insert(cells);		}		graph.getGraphLayoutCache().setSelectsAllInsertedCells(selectsAll);		graph.getGraphLayoutCache().setSelectsLocalInsertedCells(selectsLocal);	}	/**	 * Inserts the specified cells into the graph model. This method is a	 * general implementation of cell insertion. If the source and target port	 * are null, then no connection set is created. The method uses the	 * attributes from the specified edge and the egdge's children to construct	 * the insert call. This example shows how to insert an edge with a special	 * arrow between two known vertices:	 *	 * <pre>	 * Object source = graph.getDefaultPortForCell(sourceVertex).getCell();	 * Object target = graph.getDefaultPortForCell(targetVertex).getCell();	 * DefaultEdge edge = new DefaultEdge(&quot;Hello, world!&quot;);	 * edge.setSource(source);	 * edge.setTarget(target);	 * Map attrs = edge.getAttributes();	 * GraphConstants.setLineEnd(attrs, GraphConstants.ARROW_TECHNICAL);	 * graph.getGraphLayoutCache().insert(edge);	 * </pre>	 */	public static void insert(GraphModel model, Object[] cells) {		insert(model, cells, new Hashtable(), new ConnectionSet(), new ParentMap());	}	/**	 * Variant of the insert method that allows to pass a default connection set	 * and parent map and nested map.	 */	public static void insert(GraphModel model, Object[] cells, Map nested, ConnectionSet cs,			ParentMap pm) {		if (cells != null) {			if (nested == null)				nested = new Hashtable();			if (cs == null)				cs = new ConnectionSet();			if (pm == null)				pm = new ParentMap();			for (int i = 0; i < cells.length; i++) {				// Using the children of the vertex we construct the parent map.				int childCount = model.getChildCount(cells[i]);				for (int j = 0; j < childCount; j++) {					Object child = model.getChild(cells[i], j);					pm.addEntry(child, cells[i]);					// And add their attributes to the nested map					AttributeMap attrs = model.getAttributes(child);					if (attrs != null)						nested.put(child, attrs);				}				// A nested map with the vertex as key				// and its attributes as the value				// is required for the model.				Map attrsTmp = (Map) nested.get(cells[i]);				Map attrs = model.getAttributes(cells[i]);				if (attrsTmp != null)					attrs.putAll(attrsTmp);				nested.put(cells[i], attrs);				// Check if we have parameters for a connection set.				Object sourcePort = model.getSource(cells[i]);				if (sourcePort != null)					cs.connect(cells[i], sourcePort, true);				Object targetPort = model.getTarget(cells[i]);				if (targetPort != null)					cs.connect(cells[i], targetPort, false);			}			// Create an array with the parent and its children.			cells = DefaultGraphModel.getDescendants(model, cells)					.toArray();			// Finally call the insert method on the parent class.			model.insert(cells, nested, cs, pm, null);		}	}	/**	 * @return Returns the insertIntoModel.	 */	public boolean isInsertIntoModel() {		return insertIntoModel;	}	/**	 * @param insertIntoModel	 *            The insertIntoModel to set.	 */	public void setInsertIntoModel(boolean insertIntoModel) {		this.insertIntoModel = insertIntoModel;	}	/**	 * @return Returns the numEdges.	 */	public int getNumEdges() {		return numEdges;	}	/**	 * @param numEdges	 *            The numEdges to set.	 */	public void setNumEdges(int numEdges) {		if (numEdges < 1) {			numEdges = 1;		} else if (numEdges > 2000000) {			numEdges = 2000000;		}		this.numEdges = numEdges;	}	/**	 * @return Returns the numNodes.	 */	public int getNumNodes() {		return numNodes;	}	/**	 * @param numNodes	 *            The numNodes to set.	 */	public void setNumNodes(int numNodes) {		if (numNodes < 1) {			numNodes = 1;		} else if (numNodes > 2000000) {			numNodes = 2000000;		}		this.numNodes = numNodes;	}	/**	 * @return Returns the maxNodesPerTreeLevel.	 */	public int getMaxNodesPerTreeLevel() {		return maxNodesPerTreeLevel;	}	/**	 * @param maxNodesPerTreeLevel	 *            The maxNodesPerTreeLevel to set.	 */	public void setMaxNodesPerTreeLevel(int maxNodesPerTreeLevel) {		this.maxNodesPerTreeLevel = maxNodesPerTreeLevel;	}	public static void center(Window wnd) {		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();		Dimension frameSize = wnd.getSize();		wnd.setLocation(screenSize.width / 2 - (frameSize.width / 2),				screenSize.height / 2 - (frameSize.height / 2));	}	/**	 * Simple Dialog that configures how many nodes and edges the graph factory	 * is to create	 */	public class FactoryConfigDialog extends JDialog {		protected boolean insertGraph = false;		protected JGraph graph;		protected int graphType;		protected Map defaultVertexAttributes;		protected Map defaultEdgeAttributes;		protected JTextField maxTreeNodeChildren = new JTextField();		protected JTextField numNodes = new JTextField();		protected JTextField numEdges = new JTextField();		protected JCheckBox insertIntoModel = new JCheckBox();		public FactoryConfigDialog() {			super((Frame) null, "Configure Sample Graph", true);			JPanel panel = new JPanel(new GridLayout(4, 2, 4, 4));			panel.add(new JLabel("Max Child Nodes in Tree"));			panel.add(maxTreeNodeChildren);			panel.add(new JLabel("Number of nodes"));			panel.add(numNodes);			panel.add(new JLabel("Number of edges"));			panel.add(numEdges);			panel.add(new JLabel("Insert into model"));			panel.add(insertIntoModel);			JPanel panelBorder = new JPanel();			panelBorder.setBorder(new EmptyBorder(10, 10, 10, 10));			panelBorder.add(panel);			JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));			panel.setBorder(BorderFactory.createCompoundBorder(BorderFactory					.createMatteBorder(1, 0, 0, 0, Color.GRAY), BorderFactory					.createEmptyBorder(16, 8, 8, 8)));			JButton applyButton = new JButton("Insert");			JButton closeButton = new JButton("Cancel");			buttonPanel.add(closeButton);			buttonPanel.add(applyButton);			getRootPane().setDefaultButton(applyButton);			applyButton.addActionListener(new ActionListener() {				public void actionPerformed(ActionEvent e) {					applyValues();					if (graphType == TREE) {						insertTreeSampleData(graph, defaultVertexAttributes,								defaultEdgeAttributes);					} else if (graphType == RANDOM_CONNECTED) {						insertConnectedGraphSampleData(graph,								defaultVertexAttributes, defaultEdgeAttributes);					} else if (graphType == FULLY_CONNECTED) {						insertFullyConnectedGraphSampleData(graph,								defaultVertexAttributes, defaultEdgeAttributes);					} else if (graphType == FLOW) {						insertSampleFlowGraph(graph, defaultVertexAttributes,								defaultEdgeAttributes);					}					setVisible(false);				}			});			closeButton.addActionListener(new ActionListener() {				public void actionPerformed(ActionEvent e) {					insertGraph = false;					setVisible(false);				}			});			getContentPane().add(panelBorder, BorderLayout.CENTER);			getContentPane().add(buttonPanel, BorderLayout.SOUTH);			pack();			setResizable(false);			// setLocationRelativeTo(parent);		}		public void configureLayout(JGraph graph, int graphType,				Map defaultVertexAttributes, Map defaultEdgeAttributes) {			this.graph = graph;			this.graphType = graphType;			this.defaultVertexAttributes = defaultVertexAttributes;			this.defaultEdgeAttributes = defaultEdgeAttributes;			maxTreeNodeChildren.setText(String					.valueOf(getMaxNodesPerTreeLevel()));			this.numNodes.setText(String.valueOf(getNumNodes()));			this.numEdges.setText(String.valueOf(getNumEdges()));			this.insertIntoModel.setSelected(isInsertIntoModel());		}		protected void applyValues() {			setMaxNodesPerTreeLevel(Integer.parseInt(maxTreeNodeChildren					.getText()));			setNumNodes(Integer.parseInt(this.numNodes.getText()));			setNumEdges(Integer.parseInt(this.numEdges.getText()));			setInsertIntoModel(this.insertIntoModel.isSelected());		}	}}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲视频综合在线| 亚洲国产精品欧美一二99| 日韩久久久精品| 久久久精品免费观看| 国产精品乱码人人做人人爱| 中文字幕一区av| 日产国产欧美视频一区精品| 老汉av免费一区二区三区| 懂色av一区二区三区免费看| 色视频一区二区| 久久尤物电影视频在线观看| 中文字幕的久久| 国产精品福利一区二区三区| 亚洲曰韩产成在线| 精品中文字幕一区二区| 91精品福利视频| 成人欧美一区二区三区在线播放| 久久成人免费电影| 91丨porny丨在线| 国产欧美综合在线观看第十页| 亚洲第一二三四区| 欧美图片一区二区三区| 天天影视涩香欲综合网| 宅男在线国产精品| 中文字幕一区不卡| 欧美久久一二三四区| 久久综合久久综合久久综合| 国产精品免费网站在线观看| 亚洲综合精品久久| 国产在线日韩欧美| 欧美中文字幕一区| 亚洲精品日日夜夜| 激情都市一区二区| 欧美三级中文字| 亚洲成人免费观看| 成人动漫一区二区在线| 久久久久久久久蜜桃| 国产一区二区在线电影| 91精品国产综合久久久久久久| 一区二区三区精品视频在线| 欧美午夜不卡在线观看免费| 蜜桃视频第一区免费观看| 欧美老年两性高潮| 日本va欧美va精品发布| 精品国产1区二区| 丁香婷婷深情五月亚洲| 亚洲成av人片在线观看无码| 美国欧美日韩国产在线播放| 欧美国产97人人爽人人喊| 91精品国产综合久久久久久久久久| 亚洲第一成年网| 欧美国产日韩在线观看| 91福利社在线观看| 麻豆传媒一区二区三区| 久久中文字幕电影| 91在线视频在线| 韩日欧美一区二区三区| 亚洲高清久久久| 欧美日本国产一区| 福利电影一区二区| 精品一区二区三区日韩| 久久综合九色综合欧美亚洲| 色欧美日韩亚洲| 国产一区视频在线看| 亚洲第一福利视频在线| 久久婷婷一区二区三区| 欧美日韩小视频| 波多野结衣91| 精品无人区卡一卡二卡三乱码免费卡| 自拍偷自拍亚洲精品播放| 日韩一级片网址| 欧美无砖砖区免费| 欧美视频在线一区二区三区| 成人精品gif动图一区| 国产经典欧美精品| 国产乱色国产精品免费视频| 国产成人aaa| www.欧美日韩国产在线| 色琪琪一区二区三区亚洲区| 懂色av一区二区在线播放| 国产不卡一区视频| 国产一二精品视频| 国产精品一二三四区| 高潮精品一区videoshd| 国产成人av网站| 972aa.com艺术欧美| 91麻豆.com| 欧美日本精品一区二区三区| 69久久夜色精品国产69蝌蚪网| 欧美日韩的一区二区| 91精品中文字幕一区二区三区| 欧美影片第一页| 欧美tickle裸体挠脚心vk| 久久久久久久免费视频了| 国产精品女同一区二区三区| 亚洲男人天堂av网| 亚洲成av人片一区二区三区| 轻轻草成人在线| 成人激情综合网站| 欧美在线不卡视频| 精品三级在线观看| 日韩久久一区二区| 久久精品国产第一区二区三区| 国产白丝网站精品污在线入口| 色婷婷狠狠综合| 欧美一卡二卡在线| 亚洲国产中文字幕| 国产精品性做久久久久久| 色8久久人人97超碰香蕉987| 精品国产91亚洲一区二区三区婷婷| 国产精品你懂的| 奇米影视在线99精品| av不卡一区二区三区| 久久久久综合网| 久久不见久久见免费视频7| 欧美在线观看禁18| 精品国产乱码久久久久久老虎 | 成人午夜av在线| 这里是久久伊人| 亚洲午夜精品17c| 在线观看日韩一区| 亚洲与欧洲av电影| 99热在这里有精品免费| 久久综合色之久久综合| 奇米影视在线99精品| 欧美一区中文字幕| 日日摸夜夜添夜夜添国产精品| 成人一区二区视频| √…a在线天堂一区| 日本韩国一区二区| 亚洲欧美国产77777| www.综合网.com| 亚洲免费av高清| 欧美日韩国产高清一区二区| 亚洲高清中文字幕| 欧美一区二区免费视频| 国产乱子轮精品视频| 亚洲区小说区图片区qvod| 欧洲激情一区二区| 精品一区二区免费| 久久久久久久av麻豆果冻| jvid福利写真一区二区三区| 日韩一区中文字幕| 日韩一卡二卡三卡四卡| 麻豆精品久久精品色综合| 久久亚洲春色中文字幕久久久| 一本一道综合狠狠老| 捆绑调教一区二区三区| 亚洲一区二区三区视频在线播放| 欧美伦理电影网| aaa欧美色吧激情视频| 五月天国产精品| 中文字幕一区二区在线观看| 欧美一区二区三区小说| 99re视频精品| 成人一区二区三区视频在线观看| 五月综合激情婷婷六月色窝| 国产精品沙发午睡系列990531| 91精品国产一区二区三区蜜臀| 91香蕉视频mp4| 99久久国产综合精品女不卡| 国产福利一区二区三区| 在线影视一区二区三区| 不卡视频一二三四| av日韩在线网站| 成人免费观看视频| 成人伦理片在线| 成人一级片在线观看| 国产麻豆视频一区| 成人免费精品视频| 色综合天天综合网天天看片| 91免费版在线看| 欧美日韩国产综合久久| 欧美福利视频导航| 26uuu欧美日本| 中文字幕久久午夜不卡| 亚洲欧洲成人自拍| 亚洲视频精选在线| 亚洲成av人片一区二区| 蜜臀精品一区二区三区在线观看| 日韩国产欧美在线播放| 精品亚洲国内自在自线福利| 国产一区二区三区电影在线观看| 国产精品影视在线观看| 99久久久国产精品免费蜜臀| 在线免费观看日本一区| 精品日韩在线观看| 国产精品久久毛片a| 亚洲国产wwwccc36天堂| 国产精品99久久久久久有的能看| 国产精选一区二区三区| 99国产精品一区| 亚洲精品在线一区二区| 一区二区三区在线免费视频| 国产麻豆成人精品| 欧美顶级少妇做爰| 国产精品少妇自拍| 国产在线日韩欧美| 欧美另类一区二区三区| 亚洲精品一卡二卡|