Class GraphComponent

  • All Implemented Interfaces:
    com.googlecode.blaisemath.geom.TransformedCoordinateSpace, ImageObserver, MenuContainer, Serializable

    public class GraphComponent
    extends com.googlecode.blaisemath.graphics.swing.JGraphicComponent
    Provides a view of a graph, using a GraphLayoutManager for positions/layout and a VisualGraph for appearance. The layout manager supports executing long-running layout algorithms in a background thread, and the visual graph shares a CoordinateManager that is used for updating locations from the layout manager. The coordinate manager is thread-safe.
    Author:
    Elisha Peterson
    See Also:
    Serialized Form
    • Constructor Detail

      • GraphComponent

        public GraphComponent()
        Construct with an empty graph.
      • GraphComponent

        public GraphComponent​(com.google.common.graph.Graph graph)
        Construct with specified graph.
        Parameters:
        graph - the graph to initialize with
      • GraphComponent

        public GraphComponent​(com.googlecode.blaisemath.graph.layout.GraphLayoutManager gm)
        Construct with specified graph manager (contains graph and positions).
        Parameters:
        gm - graph manager to initialize with
    • Method Detail

      • getAdapter

        public VisualGraph getAdapter()
        Return the adapter that contains the graph manager and the graph, responsible for handling the visual appearance.
        Returns:
        the adapter
      • getEdgeStyler

        public com.googlecode.blaisemath.style.ObjectStyler<com.google.common.graph.EndpointPair<Object>> getEdgeStyler()
      • setEdgeStyler

        public void setEdgeStyler​(com.googlecode.blaisemath.style.ObjectStyler<com.google.common.graph.EndpointPair<Object>> edgeStyler)
      • getNodeStyler

        public com.googlecode.blaisemath.style.ObjectStyler<Object> getNodeStyler()
      • setNodeStyler

        public void setNodeStyler​(com.googlecode.blaisemath.style.ObjectStyler<Object> nodeStyler)
      • getLayoutManager

        public com.googlecode.blaisemath.graph.layout.GraphLayoutManager getLayoutManager()
        Return the graph manager underlying the component, responsible for handling the graph and node locations.
        Returns:
        the manager
      • setLayoutManager

        public void setLayoutManager​(com.googlecode.blaisemath.graph.layout.GraphLayoutManager gm)
      • getGraph

        public com.google.common.graph.Graph getGraph()
      • setGraph

        public void setGraph​(com.google.common.graph.Graph graph)
      • isLayoutTaskActive

        public boolean isLayoutTaskActive()
      • setLayoutTaskActive

        public void setLayoutTaskActive​(boolean val)
      • setNodeLabelFilter

        public void setNodeLabelFilter​(Predicate<Object> nodeLabelFilter)
      • getNodeLabelDelegate

        public Function<?,​String> getNodeLabelDelegate()
      • getSelectedNodes

        public Set getSelectedNodes()
      • setSelectedNodes

        public void setSelectedNodes​(Collection nodes)
      • addContextMenuInitializer

        public void addContextMenuInitializer​(String key,
                                              com.googlecode.blaisemath.util.swing.ContextMenuInitializer init)
        Adds context menu element to specified object.
        Parameters:
        key - either "graph", "node", or "edge"
        init - used to initialize the context menu
      • removeContextMenuInitializer

        public void removeContextMenuInitializer​(String key,
                                                 com.googlecode.blaisemath.util.swing.ContextMenuInitializer init)
        Removes context menu element from specified object
        Parameters:
        key - either "graph", "node", or "edge"
        init - used to initialize the context menu