|
mxGraph 1.10.4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.mxgraph.sharing.mxSession
public class mxSession
Implements a session that may be attached to a shared diagram. The session contains a synchronized buffer which is used to hold the pending edits which are to be sent to a specific client. The update mechnism between the server and the client uses HTTP requests (polling). The request is kept on the server for an amount of time or wakes up / returns immediately if the buffer is no longer empty.
Field Summary | |
---|---|
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 Summary | |
---|---|
mxSession(String id,
mxSharedState diagram)
Constructs a new session with the given ID. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int DEFAULT_TIMEOUT
protected String id
protected mxSharedState diagram
protected StringBuffer buffer
protected long lastTimeMillis
Constructor Detail |
---|
public mxSession(String id, mxSharedState diagram)
id
- Specifies the session ID to be used.diagram
- Reference to the shared diagram.Method Detail |
---|
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
InterruptedException
public String poll(long timeout) throws InterruptedException
timeout
- Time in milliseconds to wait for changes.
InterruptedException
public void diagramChanged(Object sender, String edits)
mxSharedState.mxDiagramChangeListener
diagramChanged
in interface mxSharedState.mxDiagramChangeListener
sender
- Session where the change was received from.edits
- String that represents the edits.public long inactiveTimeMillis()
public void destroy()
|
mxGraph 1.10.4.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |