JGraph X 1.4.1.0


com.mxgraph.sharing
Class mxSharedDiagram

java.lang.Object
  extended by com.mxgraph.sharing.mxSharedDiagram

public class mxSharedDiagram
extends Object

Implements a diagram that may be shared among multiple sessions.


Nested Class Summary
static interface mxSharedDiagram.mxDiagramChangeListener
          Defines the requirements for an object that listens to changes on the shared diagram.
 
Field Summary
protected  List<mxSharedDiagram.mxDiagramChangeListener> diagramChangeListeners
          Holds a list of diagram change listeners.
protected  StringBuffer history
          Holds the history of all changes of initial state.
protected  String initialState
          Holds the initial state of the diagram.
 
Constructor Summary
mxSharedDiagram(String initialState)
          Constructs a new diagram with the given initial state.
 
Method Summary
 void addDiagramChangeListener(mxSharedDiagram.mxDiagramChangeListener listener)
          Adds the given listener to the list of diagram change listeners.
 void clearHistory()
          Clears the history of all changes.
 void dispatch(Object sender, String xml)
          Appends the given string to the history and dispatches the change to all sessions that are listening to this shared diagram.
 String getDelta()
          Returns the history of all changes as a string.
 String getInitialState()
          Returns the initial state of the diagram.
 void removeDiagramChangeListener(mxSharedDiagram.mxDiagramChangeListener listener)
          Removes the given listener from the list of diagram change listeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

diagramChangeListeners

protected List<mxSharedDiagram.mxDiagramChangeListener> diagramChangeListeners
Holds a list of diagram change listeners.


initialState

protected String initialState
Holds the initial state of the diagram.


history

protected StringBuffer history
Holds the history of all changes of initial state.

Constructor Detail

mxSharedDiagram

public mxSharedDiagram(String initialState)
Constructs a new diagram with the given initial state.

Parameters:
initialState - Initial state of the diagram.
Method Detail

getInitialState

public String getInitialState()
Returns the initial state of the diagram.


clearHistory

public void clearHistory()
Clears the history of all changes.


getDelta

public String getDelta()
Returns the history of all changes as a string.


dispatch

public void dispatch(Object sender,
                     String xml)
Appends the given string to the history and dispatches the change to all sessions that are listening to this shared diagram.

Parameters:
sender - Session where the change originated from.
xml - XML string that represents the change.

addDiagramChangeListener

public void addDiagramChangeListener(mxSharedDiagram.mxDiagramChangeListener listener)
Adds the given listener to the list of diagram change listeners.

Parameters:
listener - Diagram change listener to be added.

removeDiagramChangeListener

public void removeDiagramChangeListener(mxSharedDiagram.mxDiagramChangeListener listener)
Removes the given listener from the list of diagram change listeners.

Parameters:
listener - Diagram change listener to be removed.

JGraph X 1.4.1.0


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