本文整理汇总了Java中y.base.Node.getGraph方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getGraph方法的具体用法?Java Node.getGraph怎么用?Java Node.getGraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类y.base.Node
的用法示例。
在下文中一共展示了Node.getGraph方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: changedVisibility
import y.base.Node; //导入方法依赖的package包/类
@Override
public void changedVisibility(final IViewEdge<?> edge, final boolean visible) {
if (visible) {
final Node source = m_sourceNode.getNode();
final Node target = m_targetNode.getNode();
// Make sure "all endpoints lie in a graph"
if ((source.getGraph() == null) || (target.getGraph() == null)) {
return;
}
// Note: "m_graph.reInsertEdge(m_edge)" won't work here, as
// edges can lose target nodes when group nodes are
// collapsed
final HierarchyManager hm = m_graph.getHierarchyManager();
final Edge yedge = hm.createEdge(source, target);
m_graph.setRealizer(yedge, m_realizer);
m_edge = yedge;
} else if (m_edge.getGraph() == m_graph) {
m_graph.removeEdge(m_edge);
}
}
示例2: bringNodeToFront
import y.base.Node; //导入方法依赖的package包/类
public void bringNodeToFront(final Node node) {
final Graph2D g = (Graph2D) node.getGraph();
final NodeRealizer r = g.getRealizer(node);
if (r.isSelected()) {
// This does not work properly! Why? NH
for (final NodeCursor nc = g.selectedNodes(); nc.ok(); nc.next()) {
m_nodesInDrawingOrder.remove(nc.node());
m_nodesInDrawingOrder.add(nc.node());
}
} else {
// This seems to work correctly.
m_nodesInDrawingOrder.remove(node);
m_nodesInDrawingOrder.add(node);
}
}
示例3: isAnyParentNodeSelected
import y.base.Node; //导入方法依赖的package包/类
/**
* Determines whether any of the parent nodes of the given node is selected.
*/
private boolean isAnyParentNodeSelected(final Node n) {
final Graph2D graph = (Graph2D) n.getGraph();
final HierarchyManager hierarchy = graph.getHierarchyManager();
if (hierarchy == null) {
return false;
}
boolean result = false;
Node parent = hierarchy.getParentNode(n);
while (parent != null) {
if (graph.isSelected(parent)) {
result = true;
break;
}
parent = hierarchy.getParentNode(parent);
}
return result;
}