public class mxSession extends java.lang.Object implements mxSharedDiagram.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 mxSharedDiagram |
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,
mxSharedDiagram 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 xml)
Fires when the shared diagram was changed.
|
java.lang.String |
getId()
Returns the session ID.
|
java.lang.String |
getInitialState()
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 |
post(java.lang.String xml)
Posts the change represented by the given XML string to the shared diagram.
|
public static int DEFAULT_TIMEOUT
protected java.lang.String id
protected mxSharedDiagram diagram
protected java.lang.StringBuffer buffer
protected long lastTimeMillis
public mxSession(java.lang.String id, mxSharedDiagram diagram)
id
- Specifies the session ID to be used.diagram
- Reference to the shared diagram.public java.lang.String getId()
public java.lang.String getInitialState()
public java.lang.String init()
public void post(java.lang.String xml)
xml
- XML string that represents the change.public java.lang.String poll() throws java.lang.InterruptedException
java.lang.InterruptedException
public java.lang.String poll(long timeout) throws java.lang.InterruptedException
timeout
- Time in milliseconds to wait for changes.java.lang.InterruptedException
public long inactiveTimeMillis()
public void diagramChanged(java.lang.Object sender, java.lang.String xml)
mxSharedDiagram.mxDiagramChangeListener
diagramChanged
in interface mxSharedDiagram.mxDiagramChangeListener
sender
- Session where the change was received from.xml
- XML string that represents the change.public void destroy()
Copyright (c) 2010 Gaudenz Alder. All rights reserved.