Issue #427 open editor when joining session

Change-Id: I6094a7a909584acb8b10236119ec3eb5dd965e59

Former-commit-id: 223eb82fe0 [formerly 223eb82fe0 [formerly f1c0549a84b0aa0d4829ca1bc584165ca98dbbb6]]
Former-commit-id: c29a5a75d9
Former-commit-id: 6319166680
This commit is contained in:
Nate Jensen 2012-04-03 08:44:58 -05:00
parent 7ff96826db
commit 28ed07b65a
5 changed files with 42 additions and 24 deletions

View file

@ -77,7 +77,8 @@ public class CollaborationEditorInputHandler implements IInputHandler {
protected boolean isSessionLeader() { protected boolean isSessionLeader() {
// TODO does this work? // TODO does this work?
return session.getUserID().equals(session.getCurrentSessionLeader()); // return session.getUserID().equals(session.getCurrentSessionLeader());
return false;
} }
/* /*

View file

@ -29,6 +29,7 @@ import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditorInputHandler; import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditorInputHandler;
import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup; import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
import com.raytheon.uf.viz.collaboration.ui.editor.SharedEditor; import com.raytheon.uf.viz.collaboration.ui.editor.SharedEditor;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority; import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority;
/** /**
@ -60,13 +61,21 @@ public class ParticipantEventController extends AbstractRoleEventController {
@Subscribe @Subscribe
public void initDataArrived(IInitData initData) { public void initDataArrived(IInitData initData) {
if (initData instanceof SharedEditor) { if (initData instanceof SharedEditor) {
SharedEditor se = (SharedEditor) initData; final SharedEditor se = (SharedEditor) initData;
CollaborationEditor editor = EditorSetup.createEditor(se); VizApp.runAsync(new Runnable() {
editor.registerMouseHandler(new CollaborationEditorInputHandler(
session, editor.getDisplayPanes()[0]), @Override
InputPriority.SYSTEM_RESOURCE); public void run() {
CollaborationDataManager.getInstance().editorCreated( CollaborationEditor editor = EditorSetup.createEditor(se);
session.getSessionId(), editor); editor.registerMouseHandler(
new CollaborationEditorInputHandler(session, editor
.getDisplayPanes()[0]),
InputPriority.SYSTEM_RESOURCE);
CollaborationDataManager.getInstance().editorCreated(
session.getSessionId(), editor);
}
});
} }
} }

View file

@ -90,7 +90,8 @@ public abstract class BaseSession implements ISession {
* @param sessionId * @param sessionId
*/ */
protected BaseSession(IContainer container, EventBus externalBus, protected BaseSession(IContainer container, EventBus externalBus,
SessionManager manager, String sessionId) throws CollaborationException { SessionManager manager, String sessionId)
throws CollaborationException {
// Set the session identifier. // Set the session identifier.
this.sessionId = sessionId; this.sessionId = sessionId;
managerEventBus = externalBus; managerEventBus = externalBus;
@ -240,6 +241,7 @@ public abstract class BaseSession implements ISession {
*/ */
public ID createID(String name) throws IDCreateException { public ID createID(String name) throws IDCreateException {
ID id = null; ID id = null;
name += "/foo"; // TODO fix this in a better way
if (connectionNamespace != null) { if (connectionNamespace != null) {
id = IDFactory.getDefault().createID(connectionNamespace, name); id = IDFactory.getDefault().createID(connectionNamespace, name);
} }

View file

@ -80,7 +80,10 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer {
// Assume success // Assume success
int status = Errors.NO_ERROR; int status = Errors.NO_ERROR;
if (chatSender != null) { if (chatSender != null) {
ID toID = createID(message.getTo().getName()); // TODO fix this in a better way
String fqName = message.getTo().getFQName()
.replace("conference.", "");
ID toID = createID(fqName);
String subject = message.getSubject(); String subject = message.getSubject();
String body = message.getBody(); String body = message.getBody();
Collection<Property> properties = message.getProperties(); Collection<Property> properties = message.getProperties();

View file

@ -136,7 +136,8 @@ public class VenueSession extends BaseSession implements IVenueSession,
* @param eventBus * @param eventBus
*/ */
VenueSession(IContainer container, EventBus externalBus, VenueSession(IContainer container, EventBus externalBus,
SessionManager manager, String sessionId) throws CollaborationException { SessionManager manager, String sessionId)
throws CollaborationException {
super(container, externalBus, manager, sessionId); super(container, externalBus, manager, sessionId);
} }
@ -237,7 +238,8 @@ public class VenueSession extends BaseSession implements IVenueSession,
} }
/** /**
* @param subject the subject to set * @param subject
* the subject to set
*/ */
public void setSubject(String subject) { public void setSubject(String subject) {
this.subject = subject; this.subject = subject;
@ -349,9 +351,10 @@ public class VenueSession extends BaseSession implements IVenueSession,
PeerToPeerChat session = getP2PSession(); PeerToPeerChat session = getP2PSession();
if (session != null) { if (session != null) {
String message = Tools.marshallData(initData); String message = Tools.marshallData(initData);
if (message != null) { IMessage msg = new CollaborationMessage(participant, message);
session.sendPeerToPeer(participant.getFQName(), message); msg.setProperty(Tools.PROP_SESSION_ID, this.getSessionId());
} session.sendPeerToPeer(msg);
} }
} }