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


Java Node.changeAttribute方法代码示例

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


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

示例1: setupNode

import org.graphstream.graph.Node; //导入方法依赖的package包/类
@Override
public void setupNode(final Node node, final int batt, final long now,
        final int net, final NodeAddress addr) {
    super.setupNode(node, batt, now, net, addr);
    node.addAttribute("ui.label", node.getId());
    if (net < NetworkPacket.THRES) {
        node.changeAttribute("ui.style", "fill-color: rgb(0," + batt
                + ",0),rgb(0,0,0);");
    } else {
        node.changeAttribute("ui.style", "fill-color: rgb(" + batt
                + ",0,0),rgb(0,0,0);");
    }
}
 
开发者ID:sdnwiselab,项目名称:sdn-wise-java,代码行数:14,代码来源:VisualNetworkGraph.java

示例2: updateNode

import org.graphstream.graph.Node; //导入方法依赖的package包/类
@Override
public void updateNode(final Node node, final int batt, final long now) {
    super.updateNode(node, batt, now);
    if (node.getAttribute("net") != null) {
        int net = node.getAttribute("net");

        if (net < NetworkPacket.THRES) {
            node.changeAttribute("ui.style", "fill-color: rgb(0,"
                    + batt + ",0),rgb(0,0,0);");
        } else {
            node.changeAttribute("ui.style", "fill-color: rgb("
                    + batt + ",0,0),rgb(0,0,0);");
        }
    }
}
 
开发者ID:sdnwiselab,项目名称:sdn-wise-java,代码行数:16,代码来源:VisualNetworkGraph.java

示例3: buttonReleased

import org.graphstream.graph.Node; //导入方法依赖的package包/类
@Override
/* (non-Javadoc)
 * @see org.graphstream.ui.view.ViewerListener#buttonReleased(java.lang.String)
 */
public void buttonReleased(String id) {
	
	Node node = graphDisplay.getNode(id);
	
	// If node color is black or node color is red, change the color to purple and display 
	// Closeness Centrality.
	if (!node.hasAttribute("ui.style") || node.getAttribute("ui.style")
			.toString().equals("fill-color: black;") || node.getAttribute("ui.style")
			.toString().equals("fill-color: red;")) {
		
		// Round the Closeness Centrality to two decimals.
		String closeness = df.format(graph.closeness(new Vertex(Integer.parseInt(id))));
		
		node.addAttribute("ui.style", "fill-color: purple;");
		node.addAttribute("ui.label", closeness);
	
	// else if the node color is purple (already clicked node) and its original color is
	// black and change its color to black.
	}else if (node.getAttribute("ui.style").toString().equals("fill-color: purple;") 
			&& !node.hasAttribute("ui.class")){
		node.changeAttribute("ui.style", "fill-color: black;");
		node.changeAttribute("ui.label", id);
		
	// else (if the node is purple and its original color is red) then change node
	// color to red and label it with its ID.
	}else{
		node.changeAttribute("ui.style", "fill-color: red;");
		node.changeAttribute("ui.label", id);
	}
}
 
开发者ID:SudharakaP,项目名称:MaximalCliques,代码行数:35,代码来源:EventHandler.java


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