public class mxSession extends java.lang.Object implements mxSharedState.mxDiagramChangeListener
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.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 java.lang.String |
id
Holds the session ID.
|
protected long |
lastTimeMillis
Holds the last active time millis.
|
| Constructor and Description |
|---|
mxSession(java.lang.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(java.lang.Object sender,
java.lang.String edits)
Fires when the shared diagram was changed.
|
java.lang.String |
getId()
Returns the session ID.
|
java.lang.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.
|
java.lang.String |
init()
Initializes the session buffer and returns a string that represents the
state of the session.
|
java.lang.String |
poll()
Returns the changes received by other sessions for the shared diagram.
|
java.lang.String |
poll(long timeout)
Returns the changes received by other sessions for the shared diagram.
|
void |
receive(org.w3c.dom.Node message)
Posts the change represented by the given XML string to the shared diagram.
|
public static int DEFAULT_TIMEOUT
protected java.lang.String id
protected mxSharedState diagram
protected java.lang.StringBuffer buffer
protected long lastTimeMillis
public mxSession(java.lang.String id,
mxSharedState diagram)
id - Specifies the session ID to be used.diagram - Reference to the shared diagram.public java.lang.String getId()
public java.lang.String init()
public java.lang.String getInitialMessage()
public void receive(org.w3c.dom.Node message)
message - XML that represents the change.public java.lang.String poll()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic java.lang.String poll(long timeout)
throws java.lang.InterruptedException
timeout - Time in milliseconds to wait for changes.java.lang.InterruptedExceptionpublic void diagramChanged(java.lang.Object sender,
java.lang.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.