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


Java HierarchyManager类代码示例

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


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

示例1: changedVisibility

import y.view.hierarchy.HierarchyManager; //导入依赖的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);
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:25,代码来源:ZyGraphEdge.java

示例2: isAnyParentNodeSelected

import y.view.hierarchy.HierarchyManager; //导入依赖的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;
}
 
开发者ID:google,项目名称:binnavi,代码行数:23,代码来源:ZyGraphLayeredRenderer.java

示例3: removeNode

import y.view.hierarchy.HierarchyManager; //导入依赖的package包/类
protected void removeNode(final NodeType node) {
  if (node.getNode().getGraph() == null) {
    m_graph.reInsertNode(node.getNode());
  }

  final HierarchyManager manager = m_graph.getHierarchyManager();
  final Node n = node.getNode();

  if (manager.isNormalNode(n)) {
    m_graph.removeNode(node.getNode());
  } else if (getGraph().getHierarchyManager().isFolderNode(node.getNode())) {
    GroupHelpers.extractFolder(m_graph, node.getNode());

    m_graph.removeNode(node.getNode());
  } else if (getGraph().getHierarchyManager().isGroupNode(node.getNode())) {
    GroupHelpers.extractGroup(m_graph, node.getNode());

    m_graph.removeNode(node.getNode());
  }

  m_mappings.removeNode(node);
}
 
开发者ID:google,项目名称:binnavi,代码行数:23,代码来源:AbstractZyGraph.java

示例4: convert

import y.view.hierarchy.HierarchyManager; //导入依赖的package包/类
/**
 * Converts a view to a Graph2D object.
 *
 * @param nodes Nodes to convert.
 * @param edges Edges to convert.
 * @param graphSettings Graph settings used to build the graph.
 * @param adjustColors True, to initialize the colors of the nodes. False, otherwise.
 *
 * @return The created Graph2D object.
 * @throws LoadCancelledException Thrown if loading the graph was cancelled.
 */
public Graph2D convert(final Collection<INaviViewNode> nodes, final Collection<INaviEdge> edges,
    final ZyGraphViewSettings graphSettings, final boolean adjustColors)
    throws LoadCancelledException {
  Preconditions.checkNotNull(nodes, "IE00905: View can not be null");
  Preconditions.checkNotNull(edges, "IE00906: Edges argument can not be null");

  if (!m_loadReporter.report(GraphBuilderEvents.Started)) {
    throw new LoadCancelledException();
  }

  m_loadReporter.start();

  final Graph2D graph2D = new Graph2D();
  final HierarchyManager hierarchyManager = new HierarchyManager(graph2D);
  graph2D.setHierarchyManager(hierarchyManager);
  hierarchyManager.addHierarchyListener(new GroupNodeRealizer.StateChangeListener());

  checkCancellation(GraphBuilderEvents.InitializedGraph);

  // Keep track of all connections between view nodes and yfiles nodes
  final HashMap<INaviViewNode, Node> rawNodeToNodeMap = new HashMap<INaviViewNode, Node>();

  // To convert the view into a Graph2D object, it is necessary to convert every node
  // and every edge from the view into the corresponding yfiles objects.
  convertNodes(nodes, graph2D, rawNodeToNodeMap, graphSettings);
  checkCancellation(GraphBuilderEvents.ConvertedNodes);

  convertEdges(edges, graph2D, rawNodeToNodeMap, adjustColors);
  checkCancellation(GraphBuilderEvents.ConvertedEdges);

  setupGroupNodes(nodes, graph2D, rawNodeToNodeMap);
  checkCancellation(GraphBuilderEvents.CreatedGroupNodes);
  checkCancellation(GraphBuilderEvents.Finished);

  return graph2D;
}
 
开发者ID:google,项目名称:binnavi,代码行数:48,代码来源:ZyGraphBuilder.java

示例5: closeGroup

import y.view.hierarchy.HierarchyManager; //导入依赖的package包/类
/**
 * Closes a group node.
 * 
 * @param graph The graph the group node belongs to.
 * @param groupNode The group node to be closed.
 */
public static void closeGroup(final Graph2D graph, final Node groupNode) {
  Preconditions.checkNotNull(graph, "Error: Graph argument can not be null");
  Preconditions.checkNotNull(groupNode, "Error: Group node argument can not be null");

  final HierarchyManager hierarchy = graph.getHierarchyManager();

  final double w = graph.getWidth(groupNode);
  final double h = graph.getHeight(groupNode);

  final NodeList groupNodes = new NodeList();
  groupNodes.add(groupNode);

  graph.firePreEvent();
  for (final NodeCursor nc = groupNodes.nodes(); nc.ok(); nc.next()) {
    hierarchy.closeGroup(nc.node());
  }
  graph.firePostEvent();

  // if the node size has changed, delete source ports of out-edges
  // and target ports of in-edges to ensure that all edges still connect
  // to the node
  if ((w != graph.getWidth(groupNode)) || (h != graph.getHeight(groupNode))) {
    for (final EdgeCursor ec = groupNode.outEdges(); ec.ok(); ec.next()) {
      graph.setSourcePointRel(ec.edge(), YPoint.ORIGIN);
    }
    for (final EdgeCursor ec = groupNode.inEdges(); ec.ok(); ec.next()) {
      graph.setTargetPointRel(ec.edge(), YPoint.ORIGIN);
    }
  }

  graph.updateViews();

}
 
开发者ID:google,项目名称:binnavi,代码行数:40,代码来源:YHelpers.java

示例6: addChildren

import y.view.hierarchy.HierarchyManager; //导入依赖的package包/类
private void addChildren(final HierarchyManager hm, final Node groupNode,
    final NodeList childNodes) {
  for (final NodeCursor nc = hm.getChildren(groupNode); nc.ok(); nc.next()) {
    final Node n = nc.node();

    if (hm.isGroupNode(n)) {
      addChildren(hm, n, childNodes);
    } else {
      childNodes.add(n);
    }
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:13,代码来源:ZyGroupNodeRealizer.java

示例7: moveContent

import y.view.hierarchy.HierarchyManager; //导入依赖的package包/类
private void moveContent(final double dx, final double dy) {
  final Graph2D graph = (Graph2D) m_userData.getNode().getNode().getGraph();

  final HierarchyManager hm = graph.getHierarchyManager();
  // Find the children contained in the given group node.
  final NodeList childNodes = new NodeList();
  addChildren(hm, getNode(), childNodes);
  // Move the children.
  moveNodes(graph, childNodes.nodes(), dx, dy);
}
 
开发者ID:google,项目名称:binnavi,代码行数:11,代码来源:ZyGroupNodeRealizer.java

示例8: setupHierarchyManager

import y.view.hierarchy.HierarchyManager; //导入依赖的package包/类
private void setupHierarchyManager() {
  if (m_graph.getHierarchyManager() == null) {
    final HierarchyManager hierarchyManager = new HierarchyManager(m_graph);
    m_graph.setHierarchyManager(hierarchyManager);
    hierarchyManager.addHierarchyListener(new GroupNodeRealizer.StateChangeListener());
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:8,代码来源:AbstractZyGraph.java

示例9: copyTemplate

import y.view.hierarchy.HierarchyManager; //导入依赖的package包/类
/**
 * Copy the newly created node to the graph. if the new node is a Nucleic
 * acid group node, it will add it to current graph and also connect the
 * possible edges. For other single node, it just add the new node to the
 * graph
 * 
 * @param newNode1
 * @return NodeCursor
 */
public static NodeCursor copyTemplate(MacromoleculeEditor editor,
		Graph2D tgt, final Node newNode1, Node overlapNode) // , double
															// worldCoordX,
															// double
															// worldCoordY)
		throws MonomerException, JDOMException, IOException {
	// final Graph2D tgt = view.getGraph2D();
	final Graph2D src = (Graph2D) newNode1.getGraph();

	final HierarchyManager nhm = HierarchyManager.getInstance(src);

	GraphCopier copier = SequenceGraphTools.getGraphCopier(src);

	// droping a new folder node. Only nucleotide acids are implemented as
	// folder nodes
	// TODO commented code is workaround
	if (nhm != null) { // && ((nhm.isGroupNode(newNode1) ||
						// nhm.isFolderNode(newNode1)))) {
		return dropFolderNode(editor, tgt, newNode1, src, copier,
				overlapNode);

	} else {// drop single new node, either replace an existing nucleic acid
			// monomerInfo or create a new peptide/chemical structure node

		return dropSingleNode(editor, tgt, newNode1, overlapNode, copier);
	}
}
 
开发者ID:PistoiaHELM,项目名称:HELMEditor,代码行数:37,代码来源:DragAndDropSupport.java

示例10: openFolder

import y.view.hierarchy.HierarchyManager; //导入依赖的package包/类
/**
 * Opens a folder node.
 * 
 * @param graph The graph the folder node belongs to.
 * @param folderNode The folder node to be opened.
 */
public static void openFolder(final Graph2D graph, final Node folderNode) {
  Preconditions.checkNotNull(graph, "Error: Graph argument can not be null");
  Preconditions.checkNotNull(folderNode, "Error: Folder node argument can not be null");

  final HierarchyManager hierarchy = graph.getHierarchyManager();

  final double w = graph.getWidth(folderNode);
  final double h = graph.getHeight(folderNode);

  final NodeList folderNodes = new NodeList();
  folderNodes.add(folderNode);

  graph.firePreEvent();

  for (final NodeCursor nc = folderNodes.nodes(); nc.ok(); nc.next()) {
    // get original location of folder node
    final Graph2D innerGraph = (Graph2D) hierarchy.getInnerGraph(nc.node());
    final YPoint folderP = graph.getLocation(nc.node());
    final NodeList innerNodes = new NodeList(innerGraph.nodes());

    hierarchy.openFolder(nc.node());

    // get new location of group node
    final Rectangle2D.Double gBox = graph.getRealizer(nc.node()).getBoundingBox();
    // move grouped nodes to former location of folder node
    LayoutTool.moveSubgraph(graph, innerNodes.nodes(), folderP.x - gBox.x, folderP.y - gBox.y);
  }
  graph.firePostEvent();

  graph.unselectAll();
  for (final NodeCursor nc = folderNodes.nodes(); nc.ok(); nc.next()) {
    graph.setSelected(nc.node(), true);
  }

  // if the node size has changed, delete source ports of out-edges
  // and target ports of in-edges to ensure that all edges still connect
  // to the node
  if ((w != graph.getWidth(folderNode)) || (h != graph.getHeight(folderNode))) {
    for (final EdgeCursor ec = folderNode.outEdges(); ec.ok(); ec.next()) {
      graph.setSourcePointRel(ec.edge(), YPoint.ORIGIN);
    }
    for (final EdgeCursor ec = folderNode.inEdges(); ec.ok(); ec.next()) {
      graph.setTargetPointRel(ec.edge(), YPoint.ORIGIN);
    }
  }

  graph.updateViews();
}
 
开发者ID:google,项目名称:binnavi,代码行数:55,代码来源:YHelpers.java


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