当前位置: 首页>>代码示例>>Java>>正文


Java DefaultPort.getUserObject方法代码示例

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


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

示例1: 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

示例2: isPortTypeMatch

import org.jgraph.graph.DefaultPort; //导入方法依赖的package包/类
/**
 * Return true if port matches the type of input (isInputPort is true) or output (isInputPort is false);
 * @param port
 * @param isInputPort
 * @return true if port matches the type of input (isInputPort is true) or output (isInputPort is false);
 */
public static final boolean isPortTypeMatch(DefaultPort port, boolean isInputPort)
{
	boolean result = false;
	Object obj = port.getUserObject();
	if(obj instanceof ParameterMeta)
	{
		ParameterMeta paramMeta = (ParameterMeta) obj;
		result = (isInputPort ==paramMeta.isInput());
	}
	return result;
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:18,代码来源:UIHelper.java

示例3: valueChanged

import org.jgraph.graph.DefaultPort; //导入方法依赖的package包/类
/**
 * Called whenever the value of the selection changes.
 *
 * @param e the event that characterizes the change.
 */
public void valueChanged(GraphSelectionEvent e)
{
	MappingMainPanel mappingPanel= graphController.getMappingPanel();
       mappingPanel.getGraphController().setGraphSelected(true);
	//the graph is in selection mode, do not set property pan for Element or Attribute
       if(!isAClearSelectionEvent(e))
	{//ignore if it is a clear selection event
		Object obj = e.getCell();
		if (obj instanceof DefaultEdge)
		{//only handles edge, when graph is NOT in CLEAR selection mode.
			DefaultEdge edge = (DefaultEdge) obj;
			DefaultPort srcPort=(DefaultPort)edge.getSource();
			DefaultPort trgtPort=(DefaultPort)edge.getTarget();
			//manually highlight if and only if it is orignated from graph selection.
			Object sourceUserObject =srcPort.getUserObject();
			highlightTreeNodeInTree(sourceUserObject);
			//manually highlight if and only if it is orignated from graph selection.
			Object targetUserObject =trgtPort.getUserObject();// getUserObject(target);
			highlightTreeNodeInTree(targetUserObject);
		}
	}
	
	if(e.getCell() instanceof DefaultGraphCell)
	{
		DefaultGraphCell newSelection = (DefaultGraphCell)e.getCell();
		DefaultPropertiesSwitchController propertySwitchConroller =(DefaultPropertiesSwitchController)mappingPanel.getMiddlePanel().getGraphController().getPropertiesSwitchController();
		propertySwitchConroller.setSelectedItem(newSelection);
	}
	mappingPanel.getMiddlePanel().getGraphController().getPropertiesSwitchController().getPropertiesPage().updateProptiesDisplay(null);
	mappingPanel.getMiddlePanel().getGraphController().setGraphSelected(false);
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:37,代码来源:LinkSelectionHighlighter.java

示例4: renderInJGraph

import org.jgraph.graph.DefaultPort; //导入方法依赖的package包/类
public void renderInJGraph()
{
	/** the real renderer */
	ConnectionSet cs = new ConnectionSet();
	Map<Object, AttributeMap> attributes = new Hashtable<Object, AttributeMap>();
	for(DefaultEdge linkEdge:retrieveLinks())
	{
		DefaultPort srcPort=(DefaultPort)linkEdge.getSource();
		DefaultPort trgtPort=(DefaultPort)linkEdge.getTarget();
		DefaultGraphCell sourceCell =(DefaultGraphCell)srcPort.getParent();
		DefaultGraphCell targetCell =(DefaultGraphCell)trgtPort.getParent();

		AttributeMap lineStyle = linkEdge.getAttributes();
		AttributeMap sourceNodeCellAttribute =null;
		if (sourceCell!=null)
			sourceNodeCellAttribute=sourceCell.getAttributes();
		AttributeMap targetNodeCellAttribute =null;
		if (targetCell!=null)
			targetNodeCellAttribute=targetCell.getAttributes();

		Object sourceNode = srcPort.getUserObject();
		Object targetNode = trgtPort.getUserObject();
		try {
			if ( sourceNode instanceof DefaultMappableTreeNode ) 
			{
				if ( (targetNode instanceof DefaultMappableTreeNode) ) {
					// change target node
					DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode) targetNode;
					adjustToNewPosition(treeNode, targetNodeCellAttribute);
				}
				// change source node
				DefaultMutableTreeNode srcNode = (DefaultMutableTreeNode) sourceNode;
				adjustToNewPosition(srcNode, sourceNodeCellAttribute);
			}
			if ( sourceNodeCellAttribute != null
					&&targetNodeCellAttribute!=null) {// put in attribute if and only if it is constructed.
				attributes.put(sourceCell, sourceNodeCellAttribute);
				attributes.put(targetCell, targetNodeCellAttribute);
				attributes.put(linkEdge, lineStyle);
				// cs.connect(linkEdge, sourceCell.getChildAt(0), targetCell.getChildAt(0));
				// Log.logInfo(this, "Drew line for : " + mappingComponent.toString());
			}
		} catch (Throwable e) {
			e.printStackTrace();
			//Log.logInfo(this, "Did not draw line for : " + mappingComponent.toString(true));
		}
	}// end of for
	getGraph().getGraphLayoutCache().edit(attributes, cs, null, null);
	getGraph().getGraphLayoutCache().setSelectsAllInsertedCells(false);
}
 
开发者ID:NCIP,项目名称:caadapter,代码行数:51,代码来源:MappingMiddlePanel.java


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