View Javadoc

1   package org.glassbox.graphview;
2   
3   import java.util.Collection;
4   
5   import de.fzi.wim.guibase.graphview.graph.*;
6   
7   /***
8    * A layout strategy used to calculate a complete graph layout in the background.
9    */
10  public interface OffScreenLayoutStrategy {
11      /***
12       * Returns the graph of the strategy.
13       *
14       * @return                              the graph of the strategy
15       */
16      Graph getGraph();
17      /***
18       * Notifies the strategy that elements were inserted into the graph.
19       *
20       * @param nodes                         the inserted nodes (may be <code>null</code>)
21       * @param edges                         the inserted edges (may be <code>null</code>)
22       */
23      void elementsAdded(Collection nodes,Collection edges);
24      /***
25       * Notifies the strategy that elements were removed from the graph.
26       *
27       * @param nodes                         the removed nodes (may be <code>null</code>)
28       * @param edges                         the removed edges (may be <code>null</code>)
29       */
30      void elementsRemoved(Collection nodes,Collection edges);
31      /***
32       * Notifies the strategy that the graph has been radically changed.
33       */
34      void graphContentsChanged();
35      /***
36       * Notifies the strategy that the graph has changed due tue an event that is not caused by
37       * the strategy itself.
38       */
39      void notifyGraphLayoutUpdated();
40      /***
41       * Prepare the graph layout calculation.
42       * The strategy should build an internal representation of the graph here to
43       * be used for the actual calculation.
44       */
45      void prepareGraphLayout();
46      /***
47       * Execute the layout.
48       * This should calculate the layout without reading from or writing to the original
49       * graph instance.
50       */
51      void executeGraphLayout();
52      /***
53       * Apply the calculated layout to the original graph instance.
54       */
55      void applyGraphLayout();
56      /***
57       * Returns <code>true</code> if the layout needs to be recalculated.
58       *
59       * @return                              <code>true</code> if the layout needs to be recalculated.
60       */
61      boolean shouldExecuteLayout();
62  }