1 package de.fzi.wim.guibase.graphview.layout;
2
3 import java.util.Collection;
4
5 import de.fzi.wim.guibase.graphview.graph.*;
6
7 /***
8 * A layout strategy used by the layouter. The layouter provides a thread container for the
9 * strategy, which then doesn't have to worry about synchronization and threading.
10 */
11 public interface LayoutStrategy {
12 /***
13 * Returns the graph of the strategy.
14 *
15 * @return the graph of the strategy
16 */
17 Graph getGraph();
18 /***
19 * Notifies the strategy that elements were inserted into the graph.
20 *
21 * @param nodes the inserted nodes (may be <code>null</code>)
22 * @param edges the inserted edges (may be <code>null</code>)
23 */
24 void elementsAdded(Collection nodes,Collection edges);
25 /***
26 * Notifies the strategy that elements were removed from the graph.
27 *
28 * @param nodes the removed nodes (may be <code>null</code>)
29 * @param edges the removed edges (may be <code>null</code>)
30 */
31 void elementsRemoved(Collection nodes,Collection edges);
32 /***
33 * Notifies the strategy that the graph has been radically changed.
34 */
35 void graphContentsChanged();
36 /***
37 * Notifies the strategy that the graph has changed due tue an event that is not caused by
38 * the strategy itself.
39 */
40 void notifyGraphLayoutUpdated();
41 /***
42 * Executes one step in the layout.
43 */
44 void executeGraphLayoutStep();
45 /***
46 * Returns <code>true</code> if more steps in the layout should be executed.
47 *
48 * @return <code>true</code> if more steps should be executed
49 */
50 boolean shouldExecuteStep();
51 }