• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DefaultPort类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jgraph.graph.DefaultPort的典型用法代码示例。如果您正苦于以下问题:Java DefaultPort类的具体用法?Java DefaultPort怎么用?Java DefaultPort使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DefaultPort类属于org.jgraph.graph包,在下文中一共展示了DefaultPort类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getOffset

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
public int getOffset() {
	JmtCell sourceOfEdge = (JmtCell) ((DefaultPort) this.getSource()).getParent();
	Rectangle boundsSource = GraphConstants.getBounds(sourceOfEdge.getAttributes()).getBounds();
	JmtCell targetOfEdge = (JmtCell) ((DefaultPort) this.getTarget()).getParent();
	Rectangle boundsTarget = GraphConstants.getBounds(targetOfEdge.getAttributes()).getBounds();
	GraphModel graphmodel = mediator.getGraph().getModel();
	Object[] fathers = (DefaultGraphModel.getIncomingEdges(graphmodel, targetOfEdge));
	int max = (int) boundsSource.getMaxX();
	for (Object father : fathers) {
		if (father instanceof JmtEdge) {
			JmtCell sourceOfEdge2 = (JmtCell) ((DefaultPort) ((JmtEdge) father).getSource()).getParent();
			Rectangle boundsSource2 = GraphConstants.getBounds(sourceOfEdge2.getAttributes()).getBounds();
			if (sourceOfEdge != sourceOfEdge2 && boundsSource.getMaxX() < boundsTarget.getMinX() - 5
					&& boundsSource2.getMaxX() < boundsTarget.getMinX() - 5) {
				if (max < boundsSource2.getMaxX() && (int) boundsSource.getMaxX() > (int) boundsSource2.getMinX()) {
					max = (int) boundsSource2.getMaxX();
				}
			}
		}
	}
	return (int) (max - boundsSource.getMaxX());
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:23,代码来源:JmtEdge.java


示例2: setAttributes

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
/**
 * Sets all the attributes like background colour, dimensions, port number
 * & position
 *
 * @param pt
 * @return created map
 */
public Hashtable<Object, Map> setAttributes(Point2D pt, JGraph graph) {
	//contains attributes of the cell & ports
	Hashtable<Object, Map> nest = new Hashtable<Object, Map>();

	Dimension cellDimension = getSize(graph);
	//contains attributes of the cell
	Map attr = getAttributes();
	GraphConstants.setBounds(attr, new Rectangle2D.Double(pt.getX(), pt.getY(), cellDimension.getWidth(), cellDimension.getHeight()));
	GraphConstants.setEditable(attr, false);
	GraphConstants.setBackground(attr, graph.getBackground());
	nest.put(this, attr);

	//create ports
	ports = createPorts();
	Icon icon = GraphConstants.getIcon(attr);
	updatePortPositions(nest, icon, cellDimension);
	for (Port port : ports) {
		add((DefaultPort) port);
	}
	return nest;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:29,代码来源:JmtCell.java


示例3: getOffset

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
public int getOffset() {
	JmtCell sourceOfEdge = (JmtCell) ((DefaultPort) this.getSource()).getParent();
	Rectangle boundsSource = GraphConstants.getBounds(sourceOfEdge.getAttributes()).getBounds();
	JmtCell targetOfEdge = (JmtCell) ((DefaultPort) this.getTarget()).getParent();
	Rectangle boundsTarget = GraphConstants.getBounds(targetOfEdge.getAttributes()).getBounds();
	Object[] listEdges = null;
	GraphModel graphmodel = mediator.getGraph().getModel();
	//		System.out.println("Padre: "+targetOfEdge);
	Object[] fathers = (DefaultGraphModel.getIncomingEdges(graphmodel, targetOfEdge));
	int max = (int) boundsSource.getMaxX();
	for (Object father : fathers) {
		//			System.out.println("Dentro il for");
		if (father instanceof JmtEdge) {
			JmtCell sourceOfEdge2 = (JmtCell) ((DefaultPort) ((JmtEdge) father).getSource()).getParent();
			Rectangle boundsSource2 = GraphConstants.getBounds(sourceOfEdge2.getAttributes()).getBounds();
			if (sourceOfEdge != sourceOfEdge2 && boundsSource.getMaxX() < boundsTarget.getMinX() - 5
					&& boundsSource2.getMaxX() < boundsTarget.getMinX() - 5) {
				if (max < boundsSource2.getMaxX() && (int) boundsSource.getMaxX() > (int) boundsSource2.getMinX()) {
					max = (int) boundsSource2.getMaxX();
				}
			}
		}
	}
	return (int) (max - boundsSource.getMaxX());
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:26,代码来源:JmtEdge.java


示例4: setAttributes

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
/**
 * Sets all the attribults like background colour, dimensions, port number
 * & position
 * @param pt
 * @return created map
 */
public Hashtable<Object, Map> setAttributes(Point2D pt, JGraph graph) {
	//contains attribute of the cell & ports
	Hashtable<Object, Map> nest = new Hashtable<Object, Map>();

	Dimension cellDimension = getSize(graph);
	//contains attrib of cell
	Map attr = getAttributes();
	GraphConstants.setBounds(attr, new Rectangle2D.Double(pt.getX(), pt.getY(), cellDimension.getWidth(), cellDimension.getHeight()));
	GraphConstants.setEditable(attr, false);
	GraphConstants.setBackground(attr, graph.getBackground());
	nest.put(this, attr);

	//create ports
	ports = createPorts();
	Icon icon = GraphConstants.getIcon(attr);
	updatePortPositions(nest, icon, cellDimension);
	for (Port port : ports) {
		add((DefaultPort) port);
	}
	return nest;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:28,代码来源:JmtCell.java


示例5: mouseReleased

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
@Override
public void mouseReleased(MouseEvent e) {
    if (e != null && port != null && firstPort != null) {
        connect((Port) firstPort.getCell(), (Port) port.getCell());
        e.consume();
    } else {
        if (firstPort != null) {
            DefaultPort thePort = (DefaultPort) firstPort.getCell();
            GraphCell theCell = (GraphCell) thePort.getParent();
            if (theCell instanceof TableCell) {
                DefaultPopupMenu menu = createPopupMenu(graph.fromScreen(new Point2D.Double(e.getX(), e.getY())),
                        (TableCell) theCell);
                menu.show(graph, e.getX(), e.getY());
            }
        }
    }
    firstPort = null;
    port = null;
    start = null;
    current = null;
    super.mouseReleased(e);

    graph.repaint();
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:25,代码来源:RelationTool.java


示例6: connect

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
public void connect(Port aSource, Port aTarget) {
    // Construct Edge with no label
    GraphCell theSourceCell = (GraphCell) ((DefaultPort) aSource).getParent();
    GraphCell theTargetCell = (GraphCell) ((DefaultPort) aTarget).getParent();
    if ((theSourceCell instanceof TableCell) && (theTargetCell instanceof TableCell)) {

        Table theTargetTable = (Table) ((TableCell) theTargetCell).getUserObject();
        if (theTargetTable.hasPrimaryKey()) {
            graph.commandNewRelation((TableCell) theSourceCell, (TableCell) theTargetCell);
            graph.repaint();
        } else {
            MessagesHelper.displayErrorMessage(graph, getResourceHelper().getText(
                    ERDesignerBundle.EXPORTINGTABLENEEDSPRIMARYKEY));
        }
    }
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:17,代码来源:RelationTool.java


示例7: removeLink

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
public void removeLink(DataBean source, DataBean target, Link type) {
	GraphVertex sourceVertex = vertexMap.get(source);
	GraphVertex targetVertex = vertexMap.get(target);

	if (type.equals(Link.GROUPING)) {
		sourceVertex.getGroup().removeChildVertex(sourceVertex);

	} else {
		for (DefaultEdge edge : getAllEdgesOfVertex(sourceVertex, this)) {

			// Get link type, source vertex and target vertex
			Link edgeType = (Link) edge.getUserObject();
			GraphVertex edgeSource = (GraphVertex) ((DefaultPort) edge.getSource()).getParent();
			GraphVertex edgeTarget = (GraphVertex) ((DefaultPort) edge.getTarget()).getParent();

			logger.debug("Edge type: " + edgeType + ", edgeSource: " + edgeSource + ", edgeTarget: " + edgeTarget);

			if (edgeSource.equals(sourceVertex) && edgeTarget.equals(targetVertex) && edgeType.equals(type)) {
				// Remove the edge if target, source and link type matched
				graphLayoutCache.remove(new Object[] { edge });
			}
		}
	}
}
 
开发者ID:chipster,项目名称:chipster,代码行数:25,代码来源:MicroarrayGraph.java


示例8: getUserObject

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
private Object getUserObject(Object graphOrTreeNode)
{
	if(graphOrTreeNode instanceof DefaultPort)
	{
		DefaultMutableTreeNode parentCell = (DefaultMutableTreeNode)((DefaultPort) graphOrTreeNode).getParent();
		return getUserObject(parentCell);
	}
	else if(graphOrTreeNode instanceof DefaultMutableTreeNode)
	{
		return ((DefaultMutableTreeNode)graphOrTreeNode).getUserObject();
	}
	else
	{
		return null;
	}
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:17,代码来源:LinkSelectionHighlighter.java


示例9: acceptsSource

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
/**
 * Override Superclass Method to provide additional checking.
 */
public boolean acceptsSource(Object edge, Object port)
{
	reasonList = new ArrayList();
	Object target = ((Edge) edge).getTarget();
	boolean result = true;
	// Source only Valid if not Equal Target
	boolean lineResult = (target != port);
	if(!lineResult)
	{
		reasonList.add("The source cannot be same with the target.");
		result = lineResult;
	}
	if(target instanceof DefaultPort && port instanceof DefaultPort)
	{
		lineResult = !GeneralUtilities.areEqual(((DefaultPort)target).getParent(), ((DefaultPort) port).getParent());
		if(!lineResult)
		{
			reasonList.add("The source and target ports are originated from the same vertex.");
			result = lineResult;
		}
	}
	return result;
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:27,代码来源:MiddlePanelGraphModel.java


示例10: acceptsTarget

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
/**
 * Override Superclass Method to provide additional checking.
 */
public boolean acceptsTarget(Object edge, Object port)
{
	reasonList = new ArrayList();
	Object source = ((Edge) edge).getSource();
	boolean result = true;
	// Target only Valid if not Equal Source
	boolean lineResult = (source != port);
	if (!lineResult)
	{
		reasonList.add("The source cannot be same with the target.");
		result = lineResult;
	}
	if (source instanceof DefaultPort && port instanceof DefaultPort)
	{
		lineResult = !GeneralUtilities.areEqual(((DefaultPort) source).getParent(), ((DefaultPort) port).getParent());
		if (!lineResult)
		{
			reasonList.add("The source and target ports are originated from the same vertex.");
			result = lineResult;
		}
	}
	return result;
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:27,代码来源:MiddlePanelGraphModel.java


示例11: isCellRemovable

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
/**
	 * test if the given cell may cause sourceCell or targetCell removable
	 * @param cell
	 * @return if the given cell may cause sourceCell or targetCell removable
	 */
	private boolean isCellRemovable(DefaultGraphCell cell)
	{
		boolean result = sourceCell.equals(cell) || targetCell.equals(cell);
//		if(result)
//		{
		if(!(cell instanceof DefaultPort))
		{
			Set edgeSet = ((DefaultPort) cell.getChildAt(0)).getEdges();
			result = result && !(cell instanceof FunctionBoxDefaultPort) && (edgeSet.isEmpty() || edgeSet.size()==1);
		}
		else
		{//if cell is an instance of DefaultPort, port is not removable.
			result = false;
		}
//		}
		return result;
	}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:23,代码来源:MappingViewCommonComponent.java


示例12: unmapCells

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
private void unmapCells(Object[] cells) {
	// System.out.println("middlePanel kind: " + middlePanel.getKind() );
	for (int i = 0; i < cells.length; i++) {
		if (cells[i] == null || !(cells[i] instanceof DefaultEdge))
			continue;
		DefaultEdge linkEdge = (DefaultEdge) cells[i];
		DefaultPort srcPort = (DefaultPort) linkEdge.getSource();
		if (srcPort instanceof FunctionBoxGraphPort)
			((FunctionBoxGraphPort) srcPort).setMapStatus(false);
		else {
			MappableNode sourceNode = (MappableNode) srcPort
					.getUserObject();
			sourceNode.setMapStatus(false);
		}
		DefaultPort trgtPort = (DefaultPort) linkEdge.getTarget();
		if (trgtPort instanceof FunctionBoxGraphPort)
			((FunctionBoxGraphPort) trgtPort).setMapStatus(false);
		else {
			MappableNode targetNode = (MappableNode) trgtPort
					.getUserObject();
			targetNode.setMapStatus(false);
		}
	}
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:25,代码来源:MiddlePanelJGraphController.java


示例13: mouseReleased

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
public void mouseReleased(MouseEvent e)
{
	//		System.out.println("mouseReleased(). :(x="+e.getX()+",y="+e.getY()+")" );
	// If Valid Event, Current and First Port
	JGraph graph =controller.getMiddlePanel().getGraph();
	if (e != null && port != null && firstPort != null
			&& firstPort != port)
	{
		if(isValidPort(port) && isValidPort(firstPort))
		{
			// Then Establish Connection
			controller.linkFunctionPortToFunctionPort((DefaultPort) firstPort.getCell(), (DefaultPort) port.getCell());
			e.consume();
		}
	}
	else
	{
		graph.repaint();
	}
	// Reset Global Vars
	firstPort = port = null;
	startPoint = currentPoint = null;
	// Call Superclass
	super.mouseReleased(e);
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:26,代码来源:MiddlePanelMarqueeHandler.java


示例14: acceptsSource

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
/**
 * Override Superclass Method to provide additional checking.
 */
public boolean acceptsSource(Object edge, Object port)
{
	reasonList = new ArrayList<String>();
	Object target = ((Edge) edge).getTarget();
	boolean result = true;
	// Source only Valid if not Equal Target
	boolean lineResult = (target != port);
	if(!lineResult)
	{
		reasonList.add("The source cannot be same with the target.");
		result = lineResult;
	}
	if(target instanceof DefaultPort && port instanceof DefaultPort)
	{
		lineResult = !GeneralUtilities.areEqual(((DefaultPort)target).getParent(), ((DefaultPort) port).getParent());
		if(!lineResult)
		{
			reasonList.add("The source and target ports are originated from the same vertex.");
			result = lineResult;
		}
	}
	return result;
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:27,代码来源:MiddlePanelGraphModel.java


示例15: acceptsTarget

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
/**
 * Override Superclass Method to provide additional checking.
 */
public boolean acceptsTarget(Object edge, Object port)
{
	reasonList = new ArrayList<String>();
	Object source = ((Edge) edge).getSource();
	boolean result = true;
	// Target only Valid if not Equal Source
	boolean lineResult = (source != port);
	if (!lineResult)
	{
		reasonList.add("The source cannot be same with the target.");
		result = lineResult;
	}
	if (source instanceof DefaultPort && port instanceof DefaultPort)
	{
		lineResult = !GeneralUtilities.areEqual(((DefaultPort) source).getParent(), ((DefaultPort) port).getParent());
		if (!lineResult)
		{
			reasonList.add("The source and target ports are originated from the same vertex.");
			result = lineResult;
		}
	}
	return result;
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:27,代码来源:MiddlePanelGraphModel.java


示例16: getSourcParentProperty

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
public String getSourcParentProperty()
{
	DefaultPort srcPort=(DefaultPort)this.getSource();
	if (srcPort==null)
		return null;
	if (srcPort instanceof FunctionBoxGraphPort)
	{
		FunctionBoxGraphPort fPort=(FunctionBoxGraphPort)srcPort;
		FunctionBoxGraphCell functionBox=(FunctionBoxGraphCell)fPort.getParent();
		return functionBox.getFunctionDef().getGroup()+":"+functionBox.getFunctionDef().getName();
	}
	else
	{
		DefaultMutableTreeNode treeNode=(DefaultMutableTreeNode)srcPort;
		DefaultMutableTreeNode userObjct=(DefaultMutableTreeNode )treeNode.getUserObject();
		DefaultMutableTreeNode parentNode=(DefaultMutableTreeNode )userObjct.getParent();
		return parentNode.getUserObject().toString();
	}
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:20,代码来源:MappingGraphLink.java


示例17: getSourceNameProperty

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
public String getSourceNameProperty()
{
	DefaultPort srcPort=(DefaultPort)this.getSource();
	if (srcPort==null)
		return null;
	if (srcPort instanceof FunctionBoxGraphPort)
	{
		FunctionBoxGraphPort fPort=(FunctionBoxGraphPort)srcPort;
		FunctionData fData=(FunctionData)fPort.getUserObject();

		return fData.getName()+":"+fData.getValue();
	}
	else
	{
		DefaultMutableTreeNode treeNode=(DefaultMutableTreeNode)srcPort;
		return treeNode.getUserObject().toString();
	}
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:19,代码来源:MappingGraphLink.java


示例18: getTargetParentProperty

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
public String getTargetParentProperty()
{
	DefaultPort trgtPort=(DefaultPort)this.getTarget();
	if (trgtPort==null)
		return null;
	if (trgtPort instanceof FunctionBoxGraphPort)
	{
		FunctionBoxGraphPort fPort=(FunctionBoxGraphPort)trgtPort;
		FunctionBoxGraphCell functionBox=(FunctionBoxGraphCell)fPort.getParent();
		return functionBox.getFunctionDef().getGroup()+":"+functionBox.getFunctionDef().getName();
	}
	else
	{
		DefaultMutableTreeNode treeNode=(DefaultMutableTreeNode)trgtPort;
		DefaultMutableTreeNode userObjct=(DefaultMutableTreeNode )treeNode.getUserObject();
		DefaultMutableTreeNode parentNode=(DefaultMutableTreeNode )userObjct.getParent();
		return parentNode.getUserObject().toString();
	}

}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:21,代码来源:MappingGraphLink.java


示例19: getTargetNameProperty

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
public String getTargetNameProperty()
{
	DefaultPort trgtPort=(DefaultPort)this.getTarget();
	if (trgtPort==null)
		return null;
	if (trgtPort instanceof FunctionBoxGraphPort)
	{
		FunctionBoxGraphPort fPort=(FunctionBoxGraphPort)trgtPort;
		FunctionData fData=(FunctionData)fPort.getUserObject();

		return fData.getName()+":"+fData.getValue();
	}
	else
	{
		DefaultMutableTreeNode treeNode=(DefaultMutableTreeNode)trgtPort;
		return treeNode.getUserObject().toString();
	}
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:19,代码来源:MappingGraphLink.java


示例20: isCellRemovable

import org.jgraph.graph.DefaultPort; //导入依赖的package包/类
/**
	 * test if the given cell may cause sourceCell or targetCell removable
	 * @param cell
	 * @return if the given cell may cause sourceCell or targetCell removable
	 */
	private boolean isCellRemovable(DefaultGraphCell cell)
	{
		boolean result = sourceCell.equals(cell) || targetCell.equals(cell);
//		if(result)
//		{
		if(!(cell instanceof DefaultPort))
		{
			Set edgeSet = ((DefaultPort) cell.getChildAt(0)).getEdges();
//			result = result && !(cell instanceof FunctionBoxDefaultPort) && (edgeSet.isEmpty() || edgeSet.size()==1);
		}
		else
		{//if cell is an instance of DefaultPort, port is not removable.
			result = false;
		}
//		}
		return result;
	}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:23,代码来源:MappingViewCommonComponent.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SQLName类代码示例发布时间:2022-05-23
下一篇:
Java UpnpService类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap