1 /*
2 * Copyright (c) 2005, The JUNG Authors
3 * All rights reserved.
4 *
5 * This software is open-source under the BSD license; see either "license.txt"
6 * or https://github.com/jrtom/jung/blob/master/LICENSE for a description.
7 *
8 * Created on May 4, 2005
9 */
10
11 package edu.uci.ics.jung.visualization;
12
13 import java.awt.Dimension;
14
15 import javax.swing.event.ChangeListener;
16
17 import edu.uci.ics.jung.algorithms.layout.Layout;
18 import edu.uci.ics.jung.algorithms.layout.util.Relaxer;
19 import edu.uci.ics.jung.visualization.util.ChangeEventSupport;
20
21 /**
22 * Interface for the state holding model of the VisualizationViewer.
23 * Refactored and extracted from the 1.6.0 version of VisualizationViewer
24 *
25 * @author Tom Nelson
26 */
27 public interface VisualizationModel<V, E> extends ChangeEventSupport {
28
29 Relaxer getRelaxer();
30
31 /**
32 * set the graph Layout
33 * @param layout the layout to use
34 */
35 void setGraphLayout(Layout<V,E> layout);
36
37 /**
38 * Sets the graph Layout and initialize the Layout size to
39 * the passed dimensions. The passed Dimension will often be
40 * the size of the View that will display the graph.
41 * @param layout the layout to use
42 * @param d the dimensions to use
43 */
44 void setGraphLayout(Layout<V,E> layout, Dimension d);
45
46 /**
47 * @return the current graph layout
48 */
49 Layout<V,E> getGraphLayout();
50
51 /**
52 * Register <code>l</code> as a listeners to changes in the model. The View registers
53 * in order to repaint itself when the model changes.
54 * @param l the listener to add
55 */
56 void addChangeListener(ChangeListener l);
57
58 /**
59 * Removes a ChangeListener.
60 * @param l the listener to be removed
61 */
62 void removeChangeListener(ChangeListener l);
63
64 /**
65 * Returns an array of all the <code>ChangeListener</code>s added
66 * with addChangeListener().
67 *
68 * @return all of the <code>ChangeListener</code>s added or an empty
69 * array if no listeners have been added
70 */
71 ChangeListener[] getChangeListeners();
72 }