private void showNode(final IViewNode<?> node, final boolean visible) {
      if (visible) {
        m_graph.reInsertNode(m_node);

        if ((node.getParentGroup() != null) && !node.getParentGroup().isVisible()) {
          node.getParentGroup().setVisible(true);
        }

        if (node instanceof IGroupNode<?, ?>) {
          final IGroupNode<?, ?> gnode = (IGroupNode<?, ?>) node;

          if (gnode.isCollapsed()) {
            m_graph.getHierarchyManager().convertToFolderNode(m_node);
          } else {
            m_graph.getHierarchyManager().convertToGroupNode(m_node);
          }

          // We need to make all of the nodes inside the group visible
          // because we need to connect their outgoing edges to the other
          // visible edges of the graph. This is only necessary if the
          // group node is collapsed though. If it is expanded, the element
          // nodes of the group node are visible anyway.
          if (gnode.isCollapsed()) {
            for (final IViewNode<?> element : gnode.getElements()) {
              element.setVisible(true);
            }
          }
        }

        if (m_pnode != null) {
          m_graph.getHierarchyManager().setParentNode(m_node, m_pnode);
        }
      } else {
        // Save the parent node of the node for later re-use when the
        // node becomes visible again.
        m_pnode = m_graph.getHierarchyManager().getParentNode(m_node);

        if ((m_pnode == null) && (node.getParentGroup() != null)) {
          throw new IllegalStateException("Error");
        }

        if (node instanceof IGroupNode<?, ?>) {
          final IGroupNode<?, ?> gnode = (IGroupNode<?, ?>) node;

          if (gnode.isCollapsed()) {
            for (final IViewNode<?> element : gnode.getElements()) {
              element.setVisible(false);
            }
          }
        }

        if ((node.getParentGroup() == null) || !node.getParentGroup().isCollapsed()) {
          m_graph.removeNode(m_node);
        }
      }

      for (final IViewEdge<? extends IViewNode<?>> edge : node.getIncomingEdges()) {
        if (node.getParentGroup() == null) {
          edge.setVisible(
              edge.getSource().isVisible()
                  && edge.getTarget().isVisible()
                  && NodeHelpers.getVisibleNode(edge.getTarget()).isVisible()
                  && NodeHelpers.getVisibleNode(edge.getSource()).isVisible());
        } else if (node.getParentGroup().isCollapsed()) {
          edge.setVisible(node.getParentGroup().isVisible() && edge.getSource().isVisible());
        } else {
          edge.setVisible(
              edge.getSource().isVisible()
                  && edge.getTarget().isVisible()
                  && NodeHelpers.getVisibleNode(edge.getTarget()).isVisible()
                  && NodeHelpers.getVisibleNode(edge.getSource()).isVisible());
        }
      }

      for (final IViewEdge<? extends IViewNode<?>> edge : node.getOutgoingEdges()) {
        if (node.getParentGroup() == null) {
          edge.setVisible(
              edge.getSource().isVisible()
                  && edge.getTarget().isVisible()
                  && NodeHelpers.getVisibleNode(edge.getTarget()).isVisible()
                  && NodeHelpers.getVisibleNode(edge.getSource()).isVisible());
        } else if (node.getParentGroup().isCollapsed()) {
          edge.setVisible(node.getParentGroup().isVisible() && edge.getTarget().isVisible());
        } else {
          edge.setVisible(
              edge.getSource().isVisible()
                  && edge.getTarget().isVisible()
                  && NodeHelpers.getVisibleNode(edge.getTarget()).isVisible()
                  && NodeHelpers.getVisibleNode(edge.getSource()).isVisible());
        }
      }
    }
Colorizes a part of a line of the node in a given color.

@param line The index of the line.
@param position The index of the first character to colorize.
@param length The number of characters to colorize.
@param color The color used to colorize the characters.
java/zylib/src/main/java/com/google/security/zynamics/zylib/yfileswrap/gui/zygraph/nodes/ZyGraphNode.java