com.mxgraph.sharing
public class mxSession extends Object implements mxSharedState.mxDiagramChangeListener
| Modifier and Type | Field and Description |
|---|---|
protected StringBuffer |
buffer
Holds the send buffer for this session.
|
static int |
DEFAULT_TIMEOUT
Default timeout is 10000 ms.
|
protected mxSharedState |
diagram
Reference to the shared diagram.
|
protected String |
id
Holds the session ID.
|
protected long |
lastTimeMillis
Holds the last active time millis.
|
| Constructor and Description |
|---|
mxSession(String id,
mxSharedState diagram)
Constructs a new session with the given ID.
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroys the session and removes its listener from the shared diagram.
|
void |
diagramChanged(Object sender,
String edits)
Fires when the shared diagram was changed.
|
String |
getId()
Returns the session ID.
|
String |
getInitialMessage()
Returns an XML string that represents the current state of the session
and the shared diagram.
|
long |
inactiveTimeMillis()
Returns the number of milliseconds this session has been inactive.
|
String |
init()
Initializes the session buffer and returns a string that represents the
state of the session.
|
String |
poll()
Returns the changes received by other sessions for the shared diagram.
|
String |
poll(long timeout)
Returns the changes received by other sessions for the shared diagram.
|
void |
receive(Node message)
Posts the change represented by the given XML string to the shared diagram.
|
public static int DEFAULT_TIMEOUT
protected String id
protected mxSharedState diagram
protected StringBuffer buffer
protected long lastTimeMillis
public mxSession(String id, mxSharedState diagram)
id - Specifies the session ID to be used.diagram - Reference to the shared diagram.public String getId()
public String init()
public String getInitialMessage()
public void receive(Node message)
message - XML that represents the change.public String poll() throws InterruptedException
InterruptedExceptionpublic String poll(long timeout) throws InterruptedException
timeout - Time in milliseconds to wait for changes.InterruptedExceptionpublic void diagramChanged(Object sender, String edits)
mxSharedState.mxDiagramChangeListenerdiagramChanged in interface mxSharedState.mxDiagramChangeListenersender - Session where the change was received from.edits - String that represents the edits.public long inactiveTimeMillis()
public void destroy()
Copyright (c) 2010 Gaudenz Alder. All rights reserved.