From 38243e08beeb0d16f59942a49dd59d5698e756c8 Mon Sep 17 00:00:00 2001 From: Nate Jensen Date: Tue, 3 Apr 2012 08:44:58 -0500 Subject: [PATCH] Issue #427 open editor when joining session Change-Id: I6094a7a909584acb8b10236119ec3eb5dd965e59 Former-commit-id: d75858ffa07435dbd64267e31f6b765cd483c033 [formerly 19bb87346c043b7fadbe8aca5fda0c3af797c75b] [formerly 223eb82fe0f373743fd5eb19a10f3cfb329afa42] [formerly d75858ffa07435dbd64267e31f6b765cd483c033 [formerly 19bb87346c043b7fadbe8aca5fda0c3af797c75b] [formerly 223eb82fe0f373743fd5eb19a10f3cfb329afa42] [formerly c29a5a75d9a9415004ac935aef8f0a0857bc69a6 [formerly 223eb82fe0f373743fd5eb19a10f3cfb329afa42 [formerly f1c0549a84b0aa0d4829ca1bc584165ca98dbbb6]]]] Former-commit-id: c29a5a75d9a9415004ac935aef8f0a0857bc69a6 Former-commit-id: 7c5b10222e9a9bef2af7037f5ccfda7b67d280af [formerly b740924cdc458d2fa70be69d2c1aa13a6db9f519] [formerly fc1d5c60e4ec9729575efed47af8bb8e49d4f3b5 [formerly 6319166680ea4b76923778f93cc2abd62fea689b]] Former-commit-id: 6e1fa133a8684b61cab2e2c8a7bfad9b76152409 [formerly 28ed07b65a03fb91e9748e641c229d04a3223982] Former-commit-id: cfc10b64f68cab2f4780ba6253cc6ad66f787441 --- .../CollaborationEditorInputHandler.java | 3 ++- .../ui/role/ParticipantEventController.java | 23 +++++++++++------ .../comm/provider/session/BaseSession.java | 6 +++-- .../comm/provider/session/PeerToPeerChat.java | 9 ++++--- .../comm/provider/session/VenueSession.java | 25 +++++++++++-------- 5 files changed, 42 insertions(+), 24 deletions(-) diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/editor/CollaborationEditorInputHandler.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/editor/CollaborationEditorInputHandler.java index 28ffc20813..8ac11c224e 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/editor/CollaborationEditorInputHandler.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/editor/CollaborationEditorInputHandler.java @@ -77,7 +77,8 @@ public class CollaborationEditorInputHandler implements IInputHandler { protected boolean isSessionLeader() { // TODO does this work? - return session.getUserID().equals(session.getCurrentSessionLeader()); + // return session.getUserID().equals(session.getCurrentSessionLeader()); + return false; } /* diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/ParticipantEventController.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/ParticipantEventController.java index 412143227f..a657968ff1 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/ParticipantEventController.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/ParticipantEventController.java @@ -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.EditorSetup; 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; /** @@ -60,13 +61,21 @@ public class ParticipantEventController extends AbstractRoleEventController { @Subscribe public void initDataArrived(IInitData initData) { if (initData instanceof SharedEditor) { - SharedEditor se = (SharedEditor) initData; - CollaborationEditor editor = EditorSetup.createEditor(se); - editor.registerMouseHandler(new CollaborationEditorInputHandler( - session, editor.getDisplayPanes()[0]), - InputPriority.SYSTEM_RESOURCE); - CollaborationDataManager.getInstance().editorCreated( - session.getSessionId(), editor); + final SharedEditor se = (SharedEditor) initData; + VizApp.runAsync(new Runnable() { + + @Override + public void run() { + CollaborationEditor editor = EditorSetup.createEditor(se); + editor.registerMouseHandler( + new CollaborationEditorInputHandler(session, editor + .getDisplayPanes()[0]), + InputPriority.SYSTEM_RESOURCE); + CollaborationDataManager.getInstance().editorCreated( + session.getSessionId(), editor); + } + + }); } } diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/BaseSession.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/BaseSession.java index e0741210ab..e58071717b 100644 --- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/BaseSession.java +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/BaseSession.java @@ -90,7 +90,8 @@ public abstract class BaseSession implements ISession { * @param sessionId */ protected BaseSession(IContainer container, EventBus externalBus, - SessionManager manager, String sessionId) throws CollaborationException { + SessionManager manager, String sessionId) + throws CollaborationException { // Set the session identifier. this.sessionId = sessionId; managerEventBus = externalBus; @@ -100,7 +101,7 @@ public abstract class BaseSession implements ISession { eventSubscribers = new HashMap(); setup(); } - + /** * * @throws ECFException @@ -240,6 +241,7 @@ public abstract class BaseSession implements ISession { */ public ID createID(String name) throws IDCreateException { ID id = null; + name += "/foo"; // TODO fix this in a better way if (connectionNamespace != null) { id = IDFactory.getDefault().createID(connectionNamespace, name); } diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerChat.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerChat.java index 54eabb2fdd..5f3d5afb26 100644 --- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerChat.java +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/PeerToPeerChat.java @@ -80,7 +80,10 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer { // Assume success int status = Errors.NO_ERROR; 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 body = message.getBody(); Collection properties = message.getProperties(); @@ -124,10 +127,10 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer { return status; } - + /** * - * @return + * @return */ @Override public EventBus getEventPublisher() { diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java index b44f57a38e..0d9c9fca17 100644 --- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java @@ -129,14 +129,15 @@ public class VenueSession extends BaseSession implements IVenueSession, private Map initSubscribers = new HashMap(); private String subject; - + /** * * @param container * @param eventBus */ VenueSession(IContainer container, EventBus externalBus, - SessionManager manager, String sessionId) throws CollaborationException { + SessionManager manager, String sessionId) + throws CollaborationException { super(container, externalBus, manager, sessionId); } @@ -228,7 +229,7 @@ public class VenueSession extends BaseSession implements IVenueSession, } return venue; } - + /** * @return the subject */ @@ -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) { this.subject = subject; @@ -271,7 +273,7 @@ public class VenueSession extends BaseSession implements IVenueSession, ID userId = IDFactory.getDefault().createID( getConnectionNamespace(), id); - + try { sender.sendInvitation(roomId, userId, subject, body); } catch (ECFException e) { @@ -309,7 +311,7 @@ public class VenueSession extends BaseSession implements IVenueSession, } return status; } - + /** * * @param body @@ -349,9 +351,10 @@ public class VenueSession extends BaseSession implements IVenueSession, PeerToPeerChat session = getP2PSession(); if (session != null) { String message = Tools.marshallData(initData); - if (message != null) { - session.sendPeerToPeer(participant.getFQName(), message); - } + IMessage msg = new CollaborationMessage(participant, message); + msg.setProperty(Tools.PROP_SESSION_ID, this.getSessionId()); + session.sendPeerToPeer(msg); + } } @@ -367,7 +370,7 @@ public class VenueSession extends BaseSession implements IVenueSession, if (!initSubscribers.containsKey(subscriber)) { initSubscribers.put(subscriber, subscriber); } - + PeerToPeerChat session = getP2PSession(); if (session != null) { session.registerEventHandler(subscriber); @@ -512,7 +515,7 @@ public class VenueSession extends BaseSession implements IVenueSession, void setSessionLeader(IChatID id) { sessionLeader = id; } - + /** * */