Issue #427 open editor when joining session
Change-Id: I6094a7a909584acb8b10236119ec3eb5dd965e59 Former-commit-id:c29a5a75d9
[formerly223eb82fe0
[formerly f1c0549a84b0aa0d4829ca1bc584165ca98dbbb6]] Former-commit-id:223eb82fe0
Former-commit-id:19bb87346c
This commit is contained in:
parent
f03f683fd1
commit
d75858ffa0
5 changed files with 42 additions and 24 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Object, Object>();
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -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<Property> properties = message.getProperties();
|
||||
|
@ -124,10 +127,10 @@ public class PeerToPeerChat extends BaseSession implements IPeerToPeer {
|
|||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public EventBus getEventPublisher() {
|
||||
|
|
|
@ -129,14 +129,15 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
|||
private Map<Object, Object> initSubscribers = new HashMap<Object, Object>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue