JGraph X 0.15.0.3


com.mxgraph.model
Interface mxIGraphModel

All Superinterfaces:
mxEventSource.mxIEventSource
All Known Implementing Classes:
mxGraphModel

public interface mxIGraphModel
extends mxEventSource.mxIEventSource

Defines the requirements for a graph model to be used with mxGraph.


Nested Class Summary
static class mxIGraphModel.mxAtomicGraphModelChange
          Defines the interface for an atomic change of the graph model.
 
Field Summary
static String EVENT_AFTER_EXECUTE
          Holds the name for the afterExecute event.
static String EVENT_BEFORE_EXECUTE
          Holds the name for the beforeExecute event.
static String EVENT_BEFORE_UNDO
          Holds the name for the beforeUndo event.
static String EVENT_BEGIN_UPDATE
          Holds the name for the beginUpdate event.
static String EVENT_CHANGE
          Holds the name for the change event.
static String EVENT_END_UPDATE
          Holds the name for the endUpdate event.
static String EVENT_EXECUTE
          Holds the name for the execute event.
static String EVENT_NOTIFY
          Holds the name for the norify event.
static String EVENT_UNDO
          Holds the name for the undo event.
 
Method Summary
 Object add(Object parent, Object child, int index)
          Adds the specified child to the parent at the given index.
 void beginUpdate()
          Increments the updateLevel by one.
 Object[] cloneCells(Object[] cells, boolean includeChildren)
          Returns an array of clones for the given array of cells.
 boolean contains(Object cell)
          Returns true if the model contains the given cell.
 void endUpdate()
          Decrements the updateLevel by one and fires a notification event if the updateLevel reaches 0.
 Object getChildAt(Object parent, int index)
          Returns the child of the given parent at the given index.
 int getChildCount(Object cell)
          Returns the number of children in the given cell.
 Object getEdgeAt(Object cell, int index)
          Returns the edge of cell at the given index.
 int getEdgeCount(Object cell)
          Returns the number of distinct edges connected to the given cell.
 mxGeometry getGeometry(Object cell)
          Returns the geometry of the given cell.
 Object getParent(Object child)
          Returns the parent of the given cell.
 Object getRoot()
          Returns the root of the model or the topmost parent of the given cell.
 String getStyle(Object cell)
          Returns the style of the given cell.
 Object getTerminal(Object edge, boolean isSource)
          Returns the source or target terminal of the given edge depending on the value of the boolean parameter.
 Object getValue(Object cell)
          Returns the user object of the given cell.
 boolean isAncestor(Object parent, Object child)
          Returns true if the given parent is an ancestor of the given child.
 boolean isCollapsed(Object cell)
          Returns true if the given cell is collapsed.
 boolean isConnectable(Object cell)
          Returns true if the given cell is connectable.
 boolean isEdge(Object cell)
          Returns true if the given cell is an edge.
 boolean isVertex(Object cell)
          Returns true if the given cell is a vertex.
 boolean isVisible(Object cell)
          Returns true if the given cell is visible.
 Object remove(Object cell)
          Removes the specified cell from the model.
 boolean setCollapsed(Object cell, boolean isCollapsed)
          Sets the collapsed state of the given cell.
 mxGeometry setGeometry(Object cell, mxGeometry geometry)
          Sets the geometry of the given cell.
 Object setRoot(Object root)
          Sets the root of the model and resets all structures.
 String setStyle(Object cell, String style)
          Sets the style of the given cell.
 Object setTerminal(Object edge, Object terminal, boolean isSource)
          Sets the source or target terminal of the given edge using.
 Object setValue(Object cell, Object value)
          Sets the user object of then given cell.
 boolean setVisible(Object cell, boolean isVisible)
          Sets the visible state of the given cell.
 
Methods inherited from interface com.mxgraph.util.mxEventSource.mxIEventSource
addListener, removeListener, removeListener
 

Field Detail

EVENT_CHANGE

static final String EVENT_CHANGE
Holds the name for the change event. First and only argument in the argument array is the list of mxAtomicGraphChanges that have been executed on the model. To add a change listener to the graph model: addListener( mxIGraphModel.EVENT_CHANGE, new mxEventListener() { public void invoke(Object source, Object[] args) { graphModelChanged((mxIGraphModel) source, (List) args[0]); } });

See Also:
Constant Field Values

EVENT_BEFORE_EXECUTE

static final String EVENT_BEFORE_EXECUTE
Holds the name for the beforeExecute event. First and only argument in the argument array is the mxAtomicGraphChange that will be executed on the model. This event fires whenever an undoable change is executed on the model.

See Also:
Constant Field Values

EVENT_EXECUTE

static final String EVENT_EXECUTE
Holds the name for the execute event. First and only argument in the argument array is the mxAtomicGraphChange that has been executed on the model. This event fires before the change event.

See Also:
Constant Field Values

EVENT_AFTER_EXECUTE

static final String EVENT_AFTER_EXECUTE
Holds the name for the afterExecute event. First and only argument in the argument array is the mxAtomicGraphChange that has been executed on the model. This event fires after the change event.

See Also:
Constant Field Values

EVENT_BEFORE_UNDO

static final String EVENT_BEFORE_UNDO
Holds the name for the beforeUndo event. First and only argument in the argument array is the current edit that is currently in progress in the model. This event fires before notify is called on the currentEdit in the model.

See Also:
Constant Field Values

EVENT_UNDO

static final String EVENT_UNDO
Holds the name for the undo event. First and only argument in the argument array is the current edit that is currently in progress in the model. This event fires after notify has been called on the currentEdit in the model, it fires only once per undoable edit.

See Also:
Constant Field Values

EVENT_NOTIFY

static final String EVENT_NOTIFY
Holds the name for the norify event. First and only argument in the argument array is the list of mxAtomicGraphChanges that have been executed on the model. This event fires after the change event.

See Also:
Constant Field Values

EVENT_BEGIN_UPDATE

static final String EVENT_BEGIN_UPDATE
Holds the name for the beginUpdate event. This event has no arguments and fires after the updateLevel has been changed in model.

See Also:
Constant Field Values

EVENT_END_UPDATE

static final String EVENT_END_UPDATE
Holds the name for the endUpdate event. This event has no arguments and fires after the updateLevel has been changed in the model.

See Also:
Constant Field Values
Method Detail

getRoot

Object getRoot()
Returns the root of the model or the topmost parent of the given cell.

Returns:
Returns the root cell.

setRoot

Object setRoot(Object root)
Sets the root of the model and resets all structures.

Parameters:
root - Cell that specifies the new root.

cloneCells

Object[] cloneCells(Object[] cells,
                    boolean includeChildren)
Returns an array of clones for the given array of cells. Depending on the value of includeChildren, a deep clone is created for each cell. Connections are restored based if the corresponding cell is contained in the passed in array.

Parameters:
cells - Array of cells to be cloned.
includeChildren - Boolean indicating if the cells should be cloned with all descendants.
Returns:
Returns a cloned array of cells.

isAncestor

boolean isAncestor(Object parent,
                   Object child)
Returns true if the given parent is an ancestor of the given child.

Parameters:
parent - Cell that specifies the parent.
child - Cell that specifies the child.
Returns:
Returns true if child is an ancestor of parent.

contains

boolean contains(Object cell)
Returns true if the model contains the given cell.

Parameters:
cell - Cell to be checked.
Returns:
Returns true if the cell is in the model.

getParent

Object getParent(Object child)
Returns the parent of the given cell.

Parameters:
child - Cell whose parent should be returned.
Returns:
Returns the parent of the given cell.

add

Object add(Object parent,
           Object child,
           int index)
Adds the specified child to the parent at the given index. If no index is specified then the child is appended to the parent's array of children.

Parameters:
parent - Cell that specifies the parent to contain the child.
child - Cell that specifies the child to be inserted.
index - Integer that specifies the index of the child.
Returns:
Returns the inserted child.

remove

Object remove(Object cell)
Removes the specified cell from the model. This operation will remove the cell and all of its children from the model.

Parameters:
cell - Cell that should be removed.
Returns:
Returns the removed cell.

getChildCount

int getChildCount(Object cell)
Returns the number of children in the given cell.

Parameters:
cell - Cell whose number of children should be returned.
Returns:
Returns the number of children in the given cell.

getChildAt

Object getChildAt(Object parent,
                  int index)
Returns the child of the given parent at the given index.

Parameters:
parent - Cell that represents the parent.
index - Integer that specifies the index of the child to be returned.
Returns:
Returns the child at index in parent.

getTerminal

Object getTerminal(Object edge,
                   boolean isSource)
Returns the source or target terminal of the given edge depending on the value of the boolean parameter.

Parameters:
edge - Cell that specifies the edge.
isSource - Boolean indicating which end of the edge should be returned.
Returns:
Returns the source or target of the given edge.

setTerminal

Object setTerminal(Object edge,
                   Object terminal,
                   boolean isSource)
Sets the source or target terminal of the given edge using.

Parameters:
edge - Cell that specifies the edge.
terminal - Cell that specifies the new terminal.
isSource - Boolean indicating if the terminal is the new source or target terminal of the edge.
Returns:
Returns the new terminal.

getEdgeCount

int getEdgeCount(Object cell)
Returns the number of distinct edges connected to the given cell.

Parameters:
cell - Cell that represents the vertex.
Returns:
Returns the number of edges connected to cell.

getEdgeAt

Object getEdgeAt(Object cell,
                 int index)
Returns the edge of cell at the given index.

Parameters:
cell - Cell that specifies the vertex.
index - Integer that specifies the index of the edge to return.
Returns:
Returns the edge at the given index.

isVertex

boolean isVertex(Object cell)
Returns true if the given cell is a vertex.

Parameters:
cell - Cell that represents the possible vertex.
Returns:
Returns true if the given cell is a vertex.

isEdge

boolean isEdge(Object cell)
Returns true if the given cell is an edge.

Parameters:
cell - Cell that represents the possible edge.
Returns:
Returns true if the given cell is an edge.

isConnectable

boolean isConnectable(Object cell)
Returns true if the given cell is connectable.

Parameters:
cell - Cell whose connectable state should be returned.
Returns:
Returns the connectable state of the given cell.

getValue

Object getValue(Object cell)
Returns the user object of the given cell.

Parameters:
cell - Cell whose user object should be returned.
Returns:
Returns the user object of the given cell.

setValue

Object setValue(Object cell,
                Object value)
Sets the user object of then given cell.

Parameters:
cell - Cell whose user object should be changed.
value - Object that defines the new user object.
Returns:
Returns the new value.

getGeometry

mxGeometry getGeometry(Object cell)
Returns the geometry of the given cell.

Parameters:
cell - Cell whose geometry should be returned.
Returns:
Returns the geometry of the given cell.

setGeometry

mxGeometry setGeometry(Object cell,
                       mxGeometry geometry)
Sets the geometry of the given cell.

Parameters:
cell - Cell whose geometry should be changed.
geometry - Object that defines the new geometry.
Returns:
Returns the new geometry.

getStyle

String getStyle(Object cell)
Returns the style of the given cell.

Parameters:
cell - Cell whose style should be returned.
Returns:
Returns the style of the given cell.

setStyle

String setStyle(Object cell,
                String style)
Sets the style of the given cell.

Parameters:
cell - Cell whose style should be changed.
style - String of the form stylename[;key=value] to specify the new cell style.
Returns:
Returns the new style.

isCollapsed

boolean isCollapsed(Object cell)
Returns true if the given cell is collapsed.

Parameters:
cell - Cell whose collapsed state should be returned.
Returns:
Returns the collapsed state of the given cell.

setCollapsed

boolean setCollapsed(Object cell,
                     boolean isCollapsed)
Sets the collapsed state of the given cell.

Parameters:
cell - Cell whose collapsed state should be changed.
isCollapsed - Boolean that specifies the new collpased state.
Returns:
Returns the new collapsed state.

isVisible

boolean isVisible(Object cell)
Returns true if the given cell is visible.

Parameters:
cell - Cell whose visible state should be returned.
Returns:
Returns the visible state of the given cell.

setVisible

boolean setVisible(Object cell,
                   boolean isVisible)
Sets the visible state of the given cell.

Parameters:
cell - Cell whose visible state should be changed.
isVisible - Boolean that specifies the new visible state.
Returns:
Returns the new visible state.

beginUpdate

void beginUpdate()
Increments the updateLevel by one. The event notification is queued until updateLevel reaches 0 by use of endUpdate.


endUpdate

void endUpdate()
Decrements the updateLevel by one and fires a notification event if the updateLevel reaches 0.


JGraph X 0.15.0.3


Copyright (c) 2008 Gaudenz Alder. All rights reserved.