|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
com.jgraph.graph.GraphView
An object that defines the view of a graphmodel. This object maps between model cells and views and provides a set of methods to change these views. The view may also contain its own set of attributes and is therefore an extension of an Observable, which may be observed by the GraphUI. It uses the model to send its changes to the command history.
Nested Class Summary | |
class |
GraphView.GraphViewEdit
An implementation of GraphViewChange. |
static class |
GraphView.GraphViewLayerEdit
An implementation of GraphViewChange. |
Field Summary | |
protected CellViewFactory |
factory
|
protected GraphModel |
graphModel
|
protected CellMapper |
mapper
|
protected java.util.Map |
mapping
|
protected PortView[] |
ports
|
protected java.util.List |
roots
|
Constructor Summary | |
GraphView(GraphModel model,
CellViewFactory factory)
Constructs a view for the specified model that uses factory to create its views. |
Method Summary | |
GraphView.GraphViewEdit |
createEdit(java.util.Map viewAttributeMap)
|
void |
edit(java.util.Map viewAttributeMap)
Applies the specified (cellView, attribute) pairs. |
CellView[] |
getAllDescendants(CellView[] views)
Returns all views, including descendants that have a parent in views , especially the PortViews. |
java.lang.Object[] |
getCells(CellView[] views)
Takes an array of views and returns the array of the corresponding cells by using getCell for each view. |
CellViewFactory |
getFactory()
Returns the factory that was passed to the constructor. |
CellView[] |
getMapping(java.lang.Object[] cells)
Returns the views for the specified array of cells. |
CellView[] |
getMapping(java.lang.Object[] cells,
boolean create)
Returns the views for the specified array of cells. |
CellView |
getMapping(java.lang.Object cell,
boolean create)
Returns the view for the specified cell. |
GraphModel |
getModel()
Returns the current model. |
PortView[] |
getPorts()
Returns the ports of the view. |
CellView[] |
getRoots()
Returns the roots of the view. |
CellView[] |
getRoots(java.awt.Rectangle clip)
Return all cells that intersect the given rectangle. |
void |
graphChanged(GraphModelEvent.GraphModelChange change)
Called from BasicGraphUI.ModelHandler to update the view based on the specified GraphModelEvent. |
void |
insertRoots(CellView[] views)
Adds the specified model root cells to the view. |
java.lang.Object[] |
order(java.lang.Object[] cells)
Returns the specified cells in view-order if the model is not ordered. |
void |
putMapping(java.lang.Object cell,
CellView view)
Associates the specified model cell with the specified view. |
protected void |
refreshAndUpdate(CellView view,
boolean create,
boolean recurse)
Refresh and then update view . |
CellView |
removeMapping(java.lang.Object cell)
Removes the associaten for the specified model cell and returns the view that was previously associated with the cell. |
CellView[] |
removeRoots(java.lang.Object[] cells)
Removes the specified model root cells from the view by removing the mapping between the cell and its view. |
protected void |
setAttributesWithModelKeys(java.util.Map map)
Handles an attributeMap that uses cells as keys. |
void |
setFactory(CellViewFactory factory)
Sets the factory that creates the cell views. |
void |
setModel(GraphModel model)
Sets the current model. |
void |
toBack(CellView[] views)
Sends the specified views to back. |
void |
toFront(CellView[] views)
Brings the specified views to front. |
static void |
translateViews(CellView[] views,
int dx,
int dy)
Translates the specified views by the given amount. |
protected void |
updatePorts()
Updates the cached array of ports. |
Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected GraphModel graphModel
protected java.util.Map mapping
protected CellMapper mapper
protected CellViewFactory factory
protected java.util.List roots
protected PortView[] ports
Constructor Detail |
public GraphView(GraphModel model, CellViewFactory factory)
factory
to create its views.
model
- the model that constitues the data sourceMethod Detail |
public void setFactory(CellViewFactory factory)
public CellViewFactory getFactory()
public void setModel(GraphModel model)
public GraphModel getModel()
public CellView[] getRoots()
public CellView[] getRoots(java.awt.Rectangle clip)
public PortView[] getPorts()
protected void updatePorts()
protected void refreshAndUpdate(CellView view, boolean create, boolean recurse)
view
. create
is passed to
the refresh invocation. recurse
is used to indicate if this method
should also be applied to all child views. (Ports are no child views!)
public void graphChanged(GraphModelEvent.GraphModelChange change)
protected void setAttributesWithModelKeys(java.util.Map map)
public void insertRoots(CellView[] views)
public CellView[] removeRoots(java.lang.Object[] cells)
public CellView getMapping(java.lang.Object cell, boolean create)
getMapping
in interface CellMapper
create
- whether a new view should createdpublic CellView[] getMapping(java.lang.Object[] cells)
public CellView[] getMapping(java.lang.Object[] cells, boolean create)
public void putMapping(java.lang.Object cell, CellView view)
putMapping
in interface CellMapper
cell
- the cell that constitutes the model elementview
- the view that constitutes the view elementpublic CellView removeMapping(java.lang.Object cell)
public void edit(java.util.Map viewAttributeMap)
public GraphView.GraphViewEdit createEdit(java.util.Map viewAttributeMap)
public void toBack(CellView[] views)
public void toFront(CellView[] views)
public java.lang.Object[] getCells(CellView[] views)
getCell
for each view.
public java.lang.Object[] order(java.lang.Object[] cells)
public static void translateViews(CellView[] views, int dx, int dy)
public CellView[] getAllDescendants(CellView[] views)
views
, especially the PortViews.
Note: Iterative Implementation.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |