public abstract class AbstractLayout extends java.lang.Object implements Layout, ChangeEventSupport
Modifier and Type | Field and Description |
---|---|
protected ChangeEventSupport |
changeSupport |
protected VertexLocationFunction |
vertex_locations |
Constructor and Description |
---|
AbstractLayout(Graph g)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(javax.swing.event.ChangeListener l)
Adds a
ChangeListener . |
abstract void |
advancePositions()
Implementors must override this method in order to create a Layout.
|
void |
applyFilter(Graph g)
Applies the filter to the current graph.
|
boolean |
dontMove(Vertex v)
Deprecated.
As of version 1.7.5, superseded by
Layout.isLocked(Vertex) . |
void |
fireStateChanged()
Notifies all listeners that have registered interest for
notification on this event type.
|
void |
forceMove(Vertex picked,
double x,
double y)
Forcibly moves a vertex to the (x,y) location by setting its x and y
locations to the inputted location.
|
protected Vertex |
getAVertex(Edge e)
Utility method, gets a single vertex from this edge.
|
java.lang.Object |
getBaseKey()
Returns a visualization-specific key (that is, specific both to this
instance and AbstractLayout) that can be used to access
UserData related to the AbstractLayout.
|
javax.swing.event.ChangeListener[] |
getChangeListeners()
Returns an array of all the
ChangeListener s added
with addChangeListener(). |
Coordinates |
getCoordinates(ArchetypeVertex v)
Returns the Coordinates object that stores the vertex' x and y location.
|
java.awt.Dimension |
getCurrentSize()
Returns the current size of the visualization space, accoring to the
last call to resize().
|
Edge |
getEdge(double x,
double y)
Deprecated.
Use PickSupport instead
|
Edge |
getEdge(double x,
double y,
double maxDistance)
Deprecated.
Use PickSupport instead
|
Graph |
getGraph()
Accessor for the graph that represets all vertices.
|
java.awt.geom.Point2D |
getLocation(ArchetypeVertex v) |
java.lang.String |
getStatus()
Returns the current status of the sytem, or null if there
is no particular status to report.
|
Vertex |
getVertex(double x,
double y)
Deprecated.
Use PickSupport instead
|
Vertex |
getVertex(double x,
double y,
double maxDistance)
Deprecated.
Use PickSupport instead
|
java.util.Iterator |
getVertexIterator() |
java.util.Set |
getVisibleEdges()
Returns the set of edges from the original getGraph that are
now visible.
|
protected Graph |
getVisibleGraph()
Accessor for the graph that represets all visible vertices.
|
java.util.Set |
getVisibleVertices()
Returns the set of vertices from the original getGraph that
are now visible.
|
double |
getX(Vertex v)
Returns the x coordinate of the vertex from the Coordinates object.
|
double |
getY(Vertex v)
Returns the y coordinate of the vertex from the Coordinates object.
|
protected abstract void |
initialize_local_vertex(Vertex v)
Initializes the local information on a single vertex.
|
protected void |
initialize_local()
Initializes all local information, and is called immediately within the
initialize() process.
|
void |
initialize(java.awt.Dimension size)
Initializer, calls intialize_local and initializeLocations
to start construction process.
|
void |
initialize(java.awt.Dimension size,
VertexLocationFunction v_locations) |
protected void |
initializeLocation(Vertex v,
Coordinates coord,
java.awt.Dimension d)
Sets random locations for a vertex within the dimensions of the space.
|
protected void |
initializeLocations()
This method calls initialize_local_vertex for each vertex,
and also adds initial coordinate information for each vertex.
|
boolean |
isLocked(Vertex v)
Returns
true if the position of vertex v
is locked. |
void |
lockVertex(Vertex v)
Adds the vertex to the DontMove list
|
protected void |
offsetVertex(Vertex v,
double xOffset,
double yOffset) |
protected void |
postInitialize()
may be overridden to do something after initializeLocations call
|
void |
removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener.
|
void |
resize(java.awt.Dimension size)
When a visualization is resized, it presumably wants to fix the
locations of the vertices and possibly to reinitialize its data.
|
void |
restart()
Resets the vertex positions to their initial locations.
|
void |
unlockVertex(Vertex v)
Removes the vertex from the DontMove list
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
incrementsAreDone, isIncremental
protected ChangeEventSupport changeSupport
protected VertexLocationFunction vertex_locations
public AbstractLayout(Graph g)
g
- public boolean dontMove(Vertex v)
Layout.isLocked(Vertex)
.if (dontmove( v )) { ... }
public boolean isLocked(Vertex v)
Layout
true
if the position of vertex v
is locked.isLocked
in interface Layout
Layout.lockVertex(Vertex)
,
Layout.unlockVertex(Vertex)
public java.util.Iterator getVertexIterator()
getVertexIterator
in interface VertexLocationFunction
public void initialize(java.awt.Dimension size)
initialize
in interface Layout
public void initialize(java.awt.Dimension size, VertexLocationFunction v_locations)
protected void initialize_local()
protected void postInitialize()
protected abstract void initialize_local_vertex(Vertex v)
public java.lang.Object getBaseKey()
protected void initializeLocations()
protected void initializeLocation(Vertex v, Coordinates coord, java.awt.Dimension d)
coord
- d
- public java.lang.String getStatus()
public abstract void advancePositions()
Note that "locked" vertices are not to be moved; however, it is the policy of the visualization to decide how to handle them, and what to do with the vertices around them. Prototypical code might include a clipping like
for (Iterator i = getVertices().iterator(); i.hasNext() ) { Vertex v = (Vertex) i.next(); if (! dontmove.contains( v ) ) { ... // handle the node } else { // ignore the node } }
advancePositions
in interface Layout
Layout.advancePositions()
protected Graph getVisibleGraph()
getVisibleEdges()
,
getVisibleVertices()
public java.awt.Dimension getCurrentSize()
getCurrentSize
in interface Layout
protected Vertex getAVertex(Edge e)
public Coordinates getCoordinates(ArchetypeVertex v)
v
- A Vertex that is a part of the Graph being visualized.public double getX(Vertex v)
getX
in interface Layout
v
- The vertex being examinedLayout.getX(edu.uci.ics.jung.graph.Vertex)
public double getY(Vertex v)
getY
in interface Layout
v
- The vertex being examinedLayout.getX(edu.uci.ics.jung.graph.Vertex)
public java.awt.geom.Point2D getLocation(ArchetypeVertex v)
getLocation
in interface Layout
getLocation
in interface VertexLocationFunction
v
- a Vertex of interestpublic void resize(java.awt.Dimension size)
protected void offsetVertex(Vertex v, double xOffset, double yOffset)
v
- xOffset
- yOffset
- public void restart()
Layout
restart
in interface Layout
Layout.restart()
public Vertex getVertex(double x, double y)
public Vertex getVertex(double x, double y, double maxDistance)
public Edge getEdge(double x, double y)
public Edge getEdge(double x, double y, double maxDistance)
x
- y
- maxDistance
- public Graph getGraph()
public java.util.Set getVisibleEdges()
getVisibleEdges
in interface Layout
public java.util.Set getVisibleVertices()
getVisibleVertices
in interface Layout
public void forceMove(Vertex picked, double x, double y)
public void lockVertex(Vertex v)
lockVertex
in interface Layout
v
- vertexLayout.unlockVertex(Vertex)
,
Layout.isLocked(Vertex)
public void unlockVertex(Vertex v)
unlockVertex
in interface Layout
v
- vertexLayout.lockVertex(Vertex)
,
Layout.isLocked(Vertex)
public void applyFilter(Graph g)
applyFilter
in interface Layout
g
- a filtered graph that is a subgraph of the Graph returned by getGraph
Layout.applyFilter(Graph g)
public void addChangeListener(javax.swing.event.ChangeListener l)
ChangeListener
.addChangeListener
in interface ChangeEventSupport
l
- the listener to be addedpublic void removeChangeListener(javax.swing.event.ChangeListener l)
removeChangeListener
in interface ChangeEventSupport
l
- the listener to be removedpublic javax.swing.event.ChangeListener[] getChangeListeners()
ChangeListener
s added
with addChangeListener().getChangeListeners
in interface ChangeEventSupport
ChangeListener
s added or an empty
array if no listeners have been addedpublic void fireStateChanged()
fireStateChanged
in interface ChangeEventSupport
EventListenerList