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

Java PortView类代码示例

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

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



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

示例1: handleRelease

import org.jgraph.graph.PortView; //导入依赖的package包/类
@Override
public void handleRelease(MouseEvent e) {
	if (e != null && !e.isConsumed()) {
		PortView end = getInPortViewAt(e.getX(), e.getY());
		if (end != null) {
			mediator.connect(start, current, end, firstPort);
			if ((firstPort != null) && ((VertexView) (firstPort.getParentView()) != null)) {
				if ((JmtCell) ((VertexView) (firstPort.getParentView())).getCell() != null) {
					JmtCell cell = (JmtCell) ((VertexView) (firstPort.getParentView())).getCell();
					mediator.avoidOverlappingCell(new JmtCell[] { cell });
				}
			}
			mediator.getGraph().getGraphLayoutCache().reload();
		}
		e.consume();
		mediator.graphRepaint();
	}
	firstPort = null;
	port = null;
	start = null;
	current = null;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:23,代码来源:ConnectState.java


示例2: getNearestPoint

import org.jgraph.graph.PortView; //导入依赖的package包/类
@Override
protected Point2D getNearestPoint(boolean source) {
    Point2D result = null;
    if (getPointCount() == 2 && !isLoop()) {
        if (!source && this.source instanceof PortView) {
            VertexView sourceCellView = (VertexView) this.source.getParentView();
            result = sourceCellView.getPerimeterPoint(this,
                null,
                getPointLocation(getPointCount() - 1));
        }
    }
    if (result == null) {
        result = super.getNearestPoint(source);
    }
    return result;
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:17,代码来源:JEdgeView.java


示例3: mouseDragged

import org.jgraph.graph.PortView; //导入依赖的package包/类
@Override
public void mouseDragged(MouseEvent e) {
    if (start != null) {
        Graphics g = graph.getGraphics();
        PortView newPort = getTargetPortAt(e.getPoint());
        if (newPort == null || newPort != port) {
            paintConnector(Color.black, graph.getBackground(), g);
            port = newPort;
            if (port != null) {
                current = graph.toScreen(port.getLocation());
            } else {
                current = graph.snap(e.getPoint());
            }
            paintConnector(graph.getBackground(), Color.black, g);
        }
    }
    super.mouseDragged(e);
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:19,代码来源:RelationTool.java


示例4: getSourcePortAt

import org.jgraph.graph.PortView; //导入依赖的package包/类
public PortView getSourcePortAt(Point2D point)
{
	JGraph graph =controller.getMiddlePanel().getGraph();
	// Disable jumping
	graph.setJumpToDefaultPort(false);
	PortView result;
	try
	{
		// Find a Port View in Model Coordinates and Remember
		result = graph.getPortViewAt(point.getX(), point.getY());
	}
	finally
	{
		graph.setJumpToDefaultPort(true);
	}
	return result;
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:18,代码来源:MiddlePanelMarqueeHandler.java


示例5: connect

import org.jgraph.graph.PortView; //导入依赖的package包/类
public void connect(Point2D start, Point2D current, PortView inPort, PortView outPort) {
	Point2D p = fromScreen(start);
	Point2D p2 = fromScreen(current);
	if (inPort != null && outPort != null) {
		ArrayList<Point2D> list = new ArrayList<Point2D>();
		list.add(p);
		list.add(p2);
		Map map = new Hashtable();
		GraphConstants.setPoints(map, list);
		GraphConstants.setRouting(map, JmtGraphConstants.ROUTING_JMT);
		GraphConstants.setLineEnd(map, GraphConstants.ARROW_CLASSIC);
		GraphConstants.setEndFill(map, true);
		GraphConstants.setConnectable(map, false);
		GraphConstants.setDisconnectable(map, false);
		Map<Object, Map> viewMap = new Hashtable<Object, Map>();
		// Adds connection into underlying data structure
		Object sourceKey = ((CellComponent) ((JmtCell) ((OutputPort) (outPort.getCell())).getUserObject()).getUserObject()).getKey();
		Object targetKey = ((CellComponent) ((JmtCell) ((InputPort) (inPort.getCell())).getUserObject()).getUserObject()).getKey();
		JmtEdge connection = new JmtEdge(sourceKey, targetKey, this);
		viewMap.put(connection, map);
		Object[] insert = new Object[] { connection };
		ConnectionSet cs = new ConnectionSet();
		cs.connect(connection, outPort.getCell(), true);
		cs.connect(connection, inPort.getCell(), false);
		// Visualizes connection only if it can be created into data structure
		if (model.setConnected(sourceKey, targetKey, true)) {
			graph.getModel().insert(insert, viewMap, cs, null, null);
		}
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:31,代码来源:Mediator.java


示例6: getPortViewAt

import org.jgraph.graph.PortView; //导入依赖的package包/类
/**
 * This method returns the port of the topmost vertex.
 */
@Override
public PortView getPortViewAt(double x, double y) {
    JVertex<?> vertex = (JVertex<?>) getFirstCellForLocation(x, y, true, false);
    if (vertex != null) {
        return (PortView) getGraphLayoutCache().getMapping(vertex.getPort(), false);
    } else {
        return null;
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:13,代码来源:JGraph.java


示例7: createPortView

import org.jgraph.graph.PortView; //导入依赖的package包/类
@Override
protected PortView createPortView(Object cell) {
    if (cell instanceof DefaultPort) {
        return new DefaultPortView(cell);
    }
    return super.createPortView(cell);
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:8,代码来源:CellViewFactory.java


示例8: getSourcePortAt

import org.jgraph.graph.PortView; //导入依赖的package包/类
public PortView getSourcePortAt(Point2D point) {
    graph.setJumpToDefaultPort(false);
    PortView result;
    try {
        result = graph.getPortViewAt(point.getX(), point.getY());
    } finally {
        graph.setJumpToDefaultPort(true);
    }
    return result;
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:11,代码来源:RelationTool.java


示例9: mouseDragged

import org.jgraph.graph.PortView; //导入依赖的package包/类
public void mouseDragged(MouseEvent e)
{
    // If remembered Start Point is Valid
    if (start != null)
    {
        // Fetch Graphics from Graph
        Graphics g = graph.getGraphics();
        // Reset Remembered Port
        PortView newPort = getTargetPortAt(e.getPoint());
        // Do not flicker (repaint only on real changes)
        if (newPort == null || newPort != port)
        {
            // Xor-Paint the old Connector (Hide old Connector)
            paintConnector(Color.black, graph.getBackground(), g);
            // If Port was found then Point to Port Location
            port = newPort;
            if (port != null)
            {
                current = graph.toScreen(port.getLocation());
            } // Else If no Port was found then Point to Mouse Location
            else
            {
                current = graph.snap(e.getPoint());
            }
            // Xor-Paint the new Connector
            paintConnector(graph.getBackground(), Color.black, g);
        }
    }
    // Call Superclass
    super.mouseDragged(e);
}
 
开发者ID:tchico,项目名称:dgMaster-trunk,代码行数:32,代码来源:DBWizardEREditor.java


示例10: getSourcePortAt

import org.jgraph.graph.PortView; //导入依赖的package包/类
public PortView getSourcePortAt(Point2D point)
{
    // Disable jumping
    graph.setJumpToDefaultPort(false);
    PortView result;
    try
    {
        // Find a Port View in Model Coordinates and Remember
        result = graph.getPortViewAt(point.getX(), point.getY());
    } finally
    {
        graph.setJumpToDefaultPort(true);
    }
    return result;
}
 
开发者ID:tchico,项目名称:dgMaster-trunk,代码行数:16,代码来源:DBWizardEREditor.java


示例11: mouseDragged

import org.jgraph.graph.PortView; //导入依赖的package包/类
public void mouseDragged(MouseEvent e)
{
	//		System.out.println("mouseDragged().:(x="+e.getX()+",y="+e.getY()+")" );
	// If remembered Start Point is Valid
	if (startPoint != null)
	{
		// Fetch Graphics from Graph
		JGraph graph =controller.getMiddlePanel().getGraph();
		Graphics g = graph.getGraphics();
		// Reset Remembered Port
		PortView newPort = getTargetPortAt(e.getPoint());
		// Do not flicker (repaint only on real changes)
		if (isValidPort(port) && isValidPort(newPort))//newPort == null || newPort != port)
		{//paint the port and connector if and only if it is valid one
			// Xor-Paint the old Connector (Hide old Connector)
			FunctionData targetFunctionPort=(FunctionData)((DefaultPort)newPort.getCell()).getUserObject();
			if (!targetFunctionPort.isInput())
			{
				return;
			}
			paintConnector(Color.black, graph.getBackground(), g);
			// If Port was found then Point to Port Location
			port = newPort;
			if (port != null)
				currentPoint = graph.toScreen(port.getLocation(null));
			// Else If no Port was found then Point to Mouse Location
			else
				currentPoint = graph.snap(e.getPoint());
			// Xor-Paint the new Connector
			paintConnector(graph.getBackground(), Color.black, g);
		}
	}
	else
	{//do nothing

	}
	// Call Superclass
	//		super.mouseDragged(e);
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:40,代码来源:MiddlePanelMarqueeHandler.java


示例12: isValidPort

import org.jgraph.graph.PortView; //导入依赖的package包/类
/**
	 * Return true if and only if the port is a child of FunctionBoxCell, future enhancement may be needed.
	 * @param localPort
	 * @return true if and only if the port is a child of FunctionBoxCell, future enhancement may be needed.
	 */
	private boolean isValidPort(PortView localPort)
	{
		if(localPort==null)
		{
			return false;
		}
		Object obj = localPort.getCell();
		if (obj instanceof DefaultPort)
		{
			DefaultPort portCell = (DefaultPort) obj;
			if(!portCell.getEdges().isEmpty())
			{//return false if the port has been linked by edge.
				return false;
			}
			else if (portCell.getParent() instanceof FunctionBoxGraphCell)
			{
//				System.out.println("port " + localPort + "'s parent is FunctionBoxCell. Will return true.");
				return true;
			}
			else
			{
				return false;
			}
		}
		else
		{
			return false;
		}
	}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:35,代码来源:MiddlePanelMarqueeHandler.java


示例13: handleRelease

import org.jgraph.graph.PortView; //导入依赖的package包/类
@Override
public void handleRelease(MouseEvent e) {

	if (e != null && !e.isConsumed()) {
		PortView end = getInPortViewAt(e.getX(), e.getY());

		if (end != null) {
			mediator.connect(start, current, end, firstPort);

			//				bb = (JmtCell)((InputPort)(end.getCell())).getParent();
			//				bb.okin = true;
			//				flag=true;

			if ((firstPort != null) && ((VertexView) (firstPort.getParentView()) != null)) {
				if ((JmtCell) ((VertexView) (firstPort.getParentView())).getCell() != null) {
					JmtCell cell = (JmtCell) ((VertexView) (firstPort.getParentView())).getCell();

					mediator.avoidOverlappingCell(new JmtCell[] { cell });

				}
			}

			mediator.getGraph().getGraphLayoutCache().reload();
		}

		e.consume();
		mediator.graphRepaint();

	}

	//		if(flag){
	//			if((aa!=null) && (bb!=null)){
	//			if(aa.okout && bb.okin && !mediator.no){
	//				aa.AddOut();
	//				bb.AddIn();
	//			}else
	//				mediator.no = true;
	//		
	//
	//		aa.okout = bb.okin = false;
	//		mediator.no = true;
	//			}
	//		}
	//		
	//		flag = false;
	//		aa = null;
	//		bb = null;
	firstPort = null;
	port = null;
	start = null;
	current = null;

}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:54,代码来源:ConnectState.java


示例14: connect

import org.jgraph.graph.PortView; //导入依赖的package包/类
public void connect(Point2D start, Point2D current, PortView inPort, PortView outPort) {
	Point2D p = fromScreen(start);
	Point2D p2 = fromScreen(current);
	if (inPort != null && outPort != null) {
		ArrayList<Point2D> list = new ArrayList<Point2D>();
		list.add(p);
		list.add(p2);
		Map map = new Hashtable();
		GraphConstants.setPoints(map, list);
		GraphConstants.setRouting(map, GraphConstants.ROUTING_SIMPLE);
		GraphConstants.setRouting(map, JmtGraphConstants.ROUTING_JMT);
		GraphConstants.setEndFill(map, true);

		// 24/09/03 - Massimo Cattai
		// //////////////////////////////////////////
		// Add a Line End Attribute
		GraphConstants.setLineEnd(map, GraphConstants.ARROW_CLASSIC);
		// 24/09/03 - end
		// /////////////////////////////////////////////////////
		Map<Object, Map> viewMap = new Hashtable<Object, Map>();
		// ---- Adds connection into underlayng data structure -- BERTOLI
		// MARCO
		Object sourceKey = ((CellComponent) ((JmtCell) ((OutputPort) (outPort.getCell())).getUserObject()).getUserObject()).getKey();
		Object targetKey = ((CellComponent) ((JmtCell) ((InputPort) (inPort.getCell())).getUserObject()).getUserObject()).getKey();
		JmtEdge connection = new JmtEdge(sourceKey, targetKey, this);
		viewMap.put(connection, map);
		Object[] insert = new Object[] { connection };
		ConnectionSet cs = new ConnectionSet();
		cs.connect(connection, outPort.getCell(), true);
		cs.connect(connection, inPort.getCell(), false);
		// Visualize connection only if it can be created into data
		// structure
		if (model.setConnected(sourceKey, targetKey, true)) {
			graph.getModel().insert(insert, viewMap, cs, null, null);
			// FG
			// no = false;
		}
		// ---- End -- BERTOLI MARCO
	}

}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:42,代码来源:Mediator.java


示例15: getTargetPortAt

import org.jgraph.graph.PortView; //导入依赖的package包/类
protected PortView getTargetPortAt(Point2D point) {
    return graph.getPortViewAt(point.getX(), point.getY());
}
 
开发者ID:mirkosertic,项目名称:ERDesignerNG,代码行数:4,代码来源:RelationTool.java


示例16: createPortView

import org.jgraph.graph.PortView; //导入依赖的package包/类
protected PortView createPortView(Object cell)
{
    return new PortView(cell);
}
 
开发者ID:tchico,项目名称:dgMaster-trunk,代码行数:5,代码来源:DBGraphCellViewFactory.java


示例17: getTargetPortAt

import org.jgraph.graph.PortView; //导入依赖的package包/类
protected PortView getTargetPortAt(Point2D point)
{
    // Find a Port View in Model Coordinates and Remember
    return graph.getPortViewAt(point.getX(), point.getY());
}
 
开发者ID:tchico,项目名称:dgMaster-trunk,代码行数:6,代码来源:DBWizardEREditor.java


示例18: getTargetPortAt

import org.jgraph.graph.PortView; //导入依赖的package包/类
protected PortView getTargetPortAt(Point2D point)
{
	// Find a Port View in Model Coordinates and Remember
	JGraph graph =controller.getMiddlePanel().getGraph();
	return graph.getPortViewAt(point.getX(), point.getY());
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:7,代码来源:MiddlePanelMarqueeHandler.java


示例19: getInPortViewAt

import org.jgraph.graph.PortView; //导入依赖的package包/类
/**
 * Gets the first portView of the input port of the cell at position
 * @param x
 * @param y
 * @return portView of the input port
 */
protected PortView getInPortViewAt(int x, int y) {
	return mediator.getInPortViewAt(x, y);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:10,代码来源:ConnectState.java


示例20: getOutPortViewAt

import org.jgraph.graph.PortView; //导入依赖的package包/类
/**
 * Gets the first portView of the output port of the cell at position
 * @param x
 * @param y
 * @return portView of the output port
 */
protected PortView getOutPortViewAt(int x, int y) {
	return mediator.getOutPortViewAt(x, y);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:10,代码来源:ConnectState.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java IPluginExtension类代码示例发布时间:2022-05-23
下一篇:
Java ChannelBinding类代码示例发布时间: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