Issue #427 cleanup
Change-Id: I3ae5c84feead4bccf49007ddb16a9ed61fa49024 Former-commit-id:68a3867d06
[formerly2e5272cff9
] [formerlyec92c842c4
[formerly 93a7d3b6f52331034efe1e02fdd073959eee56ee]] Former-commit-id:ec92c842c4
Former-commit-id:a924bd6489
This commit is contained in:
parent
d7421465f7
commit
a16929c9bc
11 changed files with 307 additions and 277 deletions
|
@ -62,7 +62,6 @@ import com.raytheon.uf.viz.collaboration.ui.login.LoginDialog;
|
|||
import com.raytheon.uf.viz.collaboration.ui.role.DataProviderEventController;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.IRoleEventController;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.ParticipantEventController;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.SessionLeaderEventController;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
|
||||
import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
|
@ -442,11 +441,7 @@ public class CollaborationDataManager {
|
|||
DataProviderEventController dpec = new DataProviderEventController(
|
||||
displaySession);
|
||||
dpec.startup();
|
||||
SessionLeaderEventController slec = new SessionLeaderEventController(
|
||||
displaySession);
|
||||
slec.startup();
|
||||
roleEventControllersMap.put(sessionId, dpec);
|
||||
roleEventControllersMap.put(sessionId, slec);
|
||||
// TODO set displaySession's data provider and session leader.
|
||||
}
|
||||
// TODO Start CAVE editor associated with this session and make sure the
|
||||
|
|
|
@ -29,7 +29,8 @@ import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
|||
|
||||
/**
|
||||
* CollaborationInputHandler that holds other handlers that should only be used
|
||||
* when part of a collaboration session.
|
||||
* when part of a collaboration session. Essentially it's a layer of handlers
|
||||
* specific for collaboration.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -234,4 +235,13 @@ public class CollaborationInputHandler implements IInputHandler {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of registered handlers
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<IInputHandler> getRegisteredHandlers() {
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,9 +20,15 @@
|
|||
package com.raytheon.uf.viz.collaboration.ui.role;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathDrawingTool;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathToolbar;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.drawing.PathToolbar;
|
||||
import com.raytheon.uf.viz.drawing.tools.PathDrawingTool;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Abstract role event controller that shares fields and methods that are common
|
||||
* to other event controllers.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -57,4 +63,24 @@ public abstract class AbstractRoleEventController implements
|
|||
session.unRegisterEventHandler(this);
|
||||
}
|
||||
|
||||
protected void activateTelestrator() {
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// activate the drawing tool by default for the session leader
|
||||
PathDrawingTool tool = new CollaborationPathDrawingTool();
|
||||
tool.activate();
|
||||
|
||||
// open the path drawing toolbar
|
||||
PathToolbar toolbar = CollaborationPathToolbar.getToolbar();
|
||||
toolbar.open();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void deactivateTelestrator() {
|
||||
// TODO this must be handled better
|
||||
PathToolbar.getToolbar().close();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueParticipantEvent;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
|
||||
|
@ -65,6 +67,17 @@ public class DataProviderEventController extends AbstractRoleEventController {
|
|||
super(session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startup() {
|
||||
super.startup();
|
||||
super.activateTelestrator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdown() {
|
||||
super.shutdown();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void participantChanged(VenueParticipantEvent event) {
|
||||
if (event.getEventType().equals(ParticipantEventType.ARRIVED)) {
|
||||
|
@ -76,8 +89,8 @@ public class DataProviderEventController extends AbstractRoleEventController {
|
|||
.getInstance().getActiveEditor();
|
||||
SharedEditor se = EditorSetup.extractSharedEditor(editor);
|
||||
try {
|
||||
session.sendInitData(event.getParticipant().getQualifiedId(),
|
||||
se);
|
||||
session.sendObjectToPeer(event.getParticipant()
|
||||
.getQualifiedId(), se);
|
||||
} catch (CollaborationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error sending initialization data to new participant "
|
||||
|
@ -87,13 +100,23 @@ public class DataProviderEventController extends AbstractRoleEventController {
|
|||
}
|
||||
|
||||
@Subscribe
|
||||
public void sessionLeaderInput(InputEvent event) {
|
||||
// TODO TBD will this pick up events sent by the data provider (ie this
|
||||
// cave) too? if so, need to rework it cause this code should only
|
||||
// execute on the data provider when someone else's cave is the session
|
||||
// leader. ideally no InputEvents are sent when data provider and
|
||||
// session leader are one and the same
|
||||
public void roleTransferred(TransferRoleCommand cmd) {
|
||||
if (cmd.getRole() == ParticipantRole.SESSION_LEADER) {
|
||||
System.out.println("Current session's username: "
|
||||
+ session.getUserID().getFQName());
|
||||
if (cmd.getUser().equals(session.getUserID().getFQName())) {
|
||||
// this cave should assume session leader control
|
||||
InputUtil.enableDataProviderInput(session.getSessionId());
|
||||
} else if (cmd.getUser().equals(
|
||||
session.getCurrentSessionLeader().getFQName())) {
|
||||
// this cave should release session leader control
|
||||
InputUtil.disableDataProviderInput(session.getSessionId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void sessionLeaderInput(InputEvent event) {
|
||||
// TODO should we handle more than 1?
|
||||
AbstractEditor editor = CollaborationDataManager.getInstance()
|
||||
.getActivelySharedEditors(session.getSessionId()).get(0);
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.role;
|
||||
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
* Interface for an event controller. Starting up an IRoleEventController is
|
||||
* akin to subscribing to events specific to that specific role.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
|
|
@ -0,0 +1,151 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.role;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.event.CollaborationInputHandler;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.event.EventForwardingInputHandler;
|
||||
import com.raytheon.uf.viz.core.IDisplayPane;
|
||||
import com.raytheon.uf.viz.core.rsc.IInputHandler;
|
||||
import com.raytheon.uf.viz.core.rsc.IInputHandler.InputPriority;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 9, 2012 njensen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class InputUtil {
|
||||
|
||||
/**
|
||||
* Gets the CollaborationInputHandler associated with an editor.
|
||||
*
|
||||
* @param editor
|
||||
* @return
|
||||
*/
|
||||
public static CollaborationInputHandler getCollaborationInputHandler(
|
||||
AbstractEditor editor) {
|
||||
CollaborationInputHandler handler = null;
|
||||
IInputHandler[] array = editor.getMouseManager()
|
||||
.getHandlersForPriority(InputPriority.SYSTEM_RESOURCE);
|
||||
for (IInputHandler h : array) {
|
||||
if (h instanceof CollaborationInputHandler) {
|
||||
handler = (CollaborationInputHandler) h;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return handler;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables the data provider's input on the actively shared editors by
|
||||
* adding a CollaborationInputHandler that disables other inputs.
|
||||
*
|
||||
* @param sessionId
|
||||
* the session to disable input for
|
||||
*/
|
||||
public static void disableDataProviderInput(String sessionId) {
|
||||
List<AbstractEditor> list = CollaborationDataManager.getInstance()
|
||||
.getActivelySharedEditors(sessionId);
|
||||
for (AbstractEditor editor : list) {
|
||||
CollaborationInputHandler handler = getCollaborationInputHandler(editor);
|
||||
if (handler == null) {
|
||||
handler = new CollaborationInputHandler();
|
||||
editor.registerMouseHandler(handler,
|
||||
InputPriority.SYSTEM_RESOURCE);
|
||||
}
|
||||
List<IInputHandler> handlers = handler.getRegisteredHandlers();
|
||||
for (IInputHandler input : handlers) {
|
||||
handler.unregisterInputHandler(input);
|
||||
}
|
||||
// TODO need to leave telestrator power in the editor
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables the standard input on editors for a data provider by removing a
|
||||
* CollaborationInputHandler on the shared editors.
|
||||
*
|
||||
* @param sessionId
|
||||
* the session to enable the input on editors
|
||||
*/
|
||||
public static void enableDataProviderInput(String sessionId) {
|
||||
List<AbstractEditor> list = CollaborationDataManager.getInstance()
|
||||
.getActivelySharedEditors(sessionId);
|
||||
for (AbstractEditor editor : list) {
|
||||
CollaborationInputHandler handler = getCollaborationInputHandler(editor);
|
||||
if (handler != null) {
|
||||
editor.unregisterMouseHandler(handler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a session leader's input on a CollaborationEditor by adding an
|
||||
* EventForwardingInputHandler that sends events back to the Data Provider.
|
||||
*
|
||||
* @param editor
|
||||
* the editor to enable input for
|
||||
*/
|
||||
public static void enableSessionLeaderInput(CollaborationEditor editor) {
|
||||
IDisplayPane pane = editor.getActiveDisplayPane();
|
||||
ISharedDisplaySession session = (ISharedDisplaySession) CollaborationDataManager
|
||||
.getInstance().getSession(
|
||||
CollaborationDataManager.getInstance().getSessionId(
|
||||
editor));
|
||||
CollaborationInputHandler handler = getCollaborationInputHandler(editor);
|
||||
EventForwardingInputHandler mouseHandler = new EventForwardingInputHandler(
|
||||
session, pane);
|
||||
handler.registerInputHandler(mouseHandler);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disables a session leader's input on the CollaborationEditor by removing
|
||||
* the EventForwardingInputHandler.
|
||||
*
|
||||
* @param editor
|
||||
* the editor to disable input for
|
||||
*/
|
||||
public static void disableSessionLeaderInput(CollaborationEditor editor) {
|
||||
CollaborationInputHandler handler = getCollaborationInputHandler(editor);
|
||||
for (IInputHandler h : handler.getRegisteredHandlers()) {
|
||||
handler.unregisterInputHandler(h);
|
||||
}
|
||||
// TODO need to leave telestrator power in the editor
|
||||
}
|
||||
|
||||
}
|
|
@ -23,20 +23,17 @@ import com.google.common.eventbus.Subscribe;
|
|||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IInitData;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
|
||||
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.rsc.CollaborationResource;
|
||||
import com.raytheon.uf.viz.collaboration.ui.rsc.CollaborationResourceData;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathDrawingTool;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathToolbar;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.core.drawables.IDescriptor;
|
||||
import com.raytheon.uf.viz.core.drawables.ResourcePair;
|
||||
import com.raytheon.uf.viz.drawing.PathToolbar;
|
||||
import com.raytheon.uf.viz.drawing.tools.PathDrawingTool;
|
||||
|
||||
/**
|
||||
* Handles the events of a session that are specific to the Participant role.
|
||||
|
@ -67,25 +64,23 @@ public class ParticipantEventController extends AbstractRoleEventController {
|
|||
}
|
||||
|
||||
@Subscribe
|
||||
public void initDataArrived(IInitData initData) {
|
||||
if (initData instanceof SharedEditor) {
|
||||
final SharedEditor se = (SharedEditor) initData;
|
||||
VizApp.runAsync(new Runnable() {
|
||||
public void initDataArrived(final SharedEditor se) {
|
||||
// TODO need to detect if we already have a CollaborationEditor for
|
||||
// this session. If so, that implies DataProvider changed and we
|
||||
// should reuse the editor, reinitializing the descriptor and
|
||||
// renderable display but keeping the drawing and telestrator
|
||||
VizApp.runSync(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
CollaborationEditor editor = EditorSetup.createEditor(se);
|
||||
initializeResources(editor.getActiveDisplayPane()
|
||||
.getDescriptor());
|
||||
CollaborationDataManager.getInstance().editorCreated(
|
||||
session.getSessionId(), editor);
|
||||
|
||||
// activate the drawing tool by default for participants
|
||||
PathDrawingTool tool = new CollaborationPathDrawingTool();
|
||||
tool.activate();
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void run() {
|
||||
CollaborationEditor editor = EditorSetup.createEditor(se);
|
||||
initializeResources(editor.getActiveDisplayPane()
|
||||
.getDescriptor());
|
||||
CollaborationDataManager.getInstance().editorCreated(
|
||||
session.getSessionId(), editor);
|
||||
}
|
||||
});
|
||||
super.activateTelestrator(); // TODO should this be elsewhere?
|
||||
}
|
||||
|
||||
private void initializeResources(IDescriptor desc) {
|
||||
|
@ -97,25 +92,6 @@ public class ParticipantEventController extends AbstractRoleEventController {
|
|||
this.session.registerEventHandler(collabRsc);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
|
||||
* #startup()
|
||||
*/
|
||||
@Override
|
||||
public void startup() {
|
||||
super.startup();
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PathToolbar toolbar = CollaborationPathToolbar.getToolbar();
|
||||
toolbar.open();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -126,10 +102,27 @@ public class ParticipantEventController extends AbstractRoleEventController {
|
|||
@Override
|
||||
public void shutdown() {
|
||||
super.shutdown();
|
||||
CollaborationPathToolbar.getToolbar().close();
|
||||
|
||||
super.deactivateTelestrator(); // TODO should this be here?
|
||||
if (this.collabRsc != null) {
|
||||
this.session.unRegisterEventHandler(collabRsc);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void roleTransferred(TransferRoleCommand cmd) {
|
||||
if (cmd.getRole() == ParticipantRole.SESSION_LEADER) {
|
||||
System.out.println("Current session's username: "
|
||||
+ session.getUserID().getFQName());
|
||||
if (cmd.getUser().equals(session.getUserID().getFQName())) {
|
||||
// this cave should assume session leader control
|
||||
InputUtil.enableSessionLeaderInput(CollaborationDataManager
|
||||
.getInstance().getEditor(session.getSessionId()));
|
||||
} else if (cmd.getUser().equals(
|
||||
session.getCurrentSessionLeader().getFQName())) {
|
||||
// this cave should release session leader control
|
||||
InputUtil.disableSessionLeaderInput(CollaborationDataManager
|
||||
.getInstance().getEditor(session.getSessionId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,110 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.role;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.DataUser;
|
||||
|
||||
/**
|
||||
* Handles the events of a session that are common to all collaborators
|
||||
* regardless of role.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 5, 2012 njensen Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class RoleAgnosticEventController extends AbstractRoleEventController {
|
||||
|
||||
protected RoleAgnosticEventController(ISharedDisplaySession session) {
|
||||
super(session);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void roleTransferred(TransferRoleCommand command) {
|
||||
// update the user data for this change
|
||||
String oldUserName = null;
|
||||
ParticipantRole changedRole = command.getRole();
|
||||
if (changedRole.equals(ParticipantRole.DATA_PROVIDER)) {
|
||||
oldUserName = session.getCurrentDataProvider().getFQName();
|
||||
} else if (changedRole.equals(ParticipantRole.SESSION_LEADER)) {
|
||||
oldUserName = session.getCurrentDataProvider().getFQName();
|
||||
}
|
||||
DataUser oldUser = CollaborationDataManager.getInstance().getUser(
|
||||
oldUserName);
|
||||
oldUser.removeSessionRole(session.getSessionId(), changedRole);
|
||||
DataUser newUser = CollaborationDataManager.getInstance().getUser(
|
||||
command.getUser());
|
||||
newUser.addSessionRole(session.getSessionId(), changedRole);
|
||||
|
||||
// shut down the role specific events if applicable
|
||||
if (session.getUserID().getFQName().equals(oldUserName)) {
|
||||
Collection<IRoleEventController> list = CollaborationDataManager
|
||||
.getInstance().getEventControllers(session.getSessionId());
|
||||
Iterator<IRoleEventController> itr = list.iterator();
|
||||
while (itr.hasNext()) {
|
||||
IRoleEventController rc = itr.next();
|
||||
if (changedRole == ParticipantRole.SESSION_LEADER
|
||||
&& rc instanceof SessionLeaderEventController) {
|
||||
rc.shutdown();
|
||||
itr.remove();
|
||||
} else if (changedRole == ParticipantRole.DATA_PROVIDER
|
||||
&& rc instanceof DataProviderEventController) {
|
||||
rc.shutdown();
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// start up new role if applicable
|
||||
if (session.getUserID().getFQName().equals(command.getUser())) {
|
||||
Collection<IRoleEventController> list = CollaborationDataManager
|
||||
.getInstance().getEventControllers(session.getSessionId());
|
||||
if (changedRole.equals(ParticipantRole.SESSION_LEADER)) {
|
||||
SessionLeaderEventController slec = new SessionLeaderEventController(
|
||||
session);
|
||||
slec.startup();
|
||||
list.add(slec);
|
||||
} else if (changedRole.equals(ParticipantRole.DATA_PROVIDER)) {
|
||||
DataProviderEventController dpec = new DataProviderEventController(
|
||||
session);
|
||||
dpec.startup();
|
||||
list.add(dpec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.role;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathDrawingTool;
|
||||
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathToolbar;
|
||||
import com.raytheon.uf.viz.core.VizApp;
|
||||
import com.raytheon.uf.viz.drawing.PathToolbar;
|
||||
import com.raytheon.uf.viz.drawing.tools.PathDrawingTool;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 2, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SessionLeaderEventController extends AbstractRoleEventController {
|
||||
|
||||
/**
|
||||
* @param session
|
||||
*/
|
||||
public SessionLeaderEventController(ISharedDisplaySession session) {
|
||||
super(session);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
|
||||
* #startup()
|
||||
*/
|
||||
@Override
|
||||
public void startup() {
|
||||
super.startup();
|
||||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// activate the drawing tool by default for the session leader
|
||||
PathDrawingTool tool = new CollaborationPathDrawingTool();
|
||||
tool.activate();
|
||||
|
||||
// open the path drawing toolbar
|
||||
PathToolbar toolbar = CollaborationPathToolbar.getToolbar();
|
||||
toolbar.open();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.collaboration.ui.role.AbstractRoleEventController
|
||||
* #shutdown()
|
||||
*/
|
||||
@Override
|
||||
public void shutdown() {
|
||||
super.shutdown();
|
||||
PathToolbar.getToolbar().close();
|
||||
}
|
||||
|
||||
}
|
|
@ -91,7 +91,29 @@ public interface ISharedDisplaySession extends IEventPublisher {
|
|||
void sendRenderableObject(IRenderable renderable)
|
||||
throws CollaborationException;
|
||||
|
||||
void sendTransferRole(String fqName, ParticipantRole role)
|
||||
/**
|
||||
* Sends the object to the other collaborators on the session. The object
|
||||
* must be serializable and once received by the others, will be posted to
|
||||
* the session's event bus.
|
||||
*
|
||||
* @param obj
|
||||
* the serializable object to send
|
||||
* @throws CollaborationException
|
||||
*/
|
||||
public void sendObjectToVenue(Object obj) throws CollaborationException;
|
||||
|
||||
/**
|
||||
* Sends the object to a specific collaborator on the session. The object
|
||||
* must be serializable and once received by the other, will be posted to
|
||||
* the session's event bus.
|
||||
*
|
||||
* @param id
|
||||
* the id of the collaborator to send to
|
||||
* @param obj
|
||||
* the serializable object to send
|
||||
* @throws CollaborationException
|
||||
*/
|
||||
public void sendObjectToPeer(IQualifiedID id, Object obj)
|
||||
throws CollaborationException;
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,7 +54,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IRenderable;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IChatID;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||
|
@ -65,11 +64,9 @@ import com.raytheon.uf.viz.collaboration.comm.provider.Errors;
|
|||
import com.raytheon.uf.viz.collaboration.comm.provider.Presence;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.Tools;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.event.VenueParticipantEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.info.InfoAdapter;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.info.Venue;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.roster.Roster;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.RosterId;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueParticipant;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.VenueUserId;
|
||||
|
@ -421,19 +418,32 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
|||
}
|
||||
|
||||
@Override
|
||||
public void sendTransferRole(String participant, ParticipantRole role)
|
||||
throws CollaborationException {
|
||||
if (participant != null && role != ParticipantRole.PARTICIPANT) {
|
||||
TransferRoleCommand trc = new TransferRoleCommand();
|
||||
trc.setRole(role);
|
||||
trc.setUser(participant);
|
||||
String message = Tools.marshallData(trc);
|
||||
public void sendObjectToVenue(Object obj) throws CollaborationException {
|
||||
if (obj != null) {
|
||||
String message = Tools.marshallData(obj);
|
||||
if (message != null) {
|
||||
sendTextMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendObjectToPeer(
|
||||
com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID participant,
|
||||
Object obj) throws CollaborationException {
|
||||
PeerToPeerChat session = getP2PSession();
|
||||
if (session != null) {
|
||||
String message = Tools.marshallData(obj);
|
||||
if (message != null) {
|
||||
|
||||
TextMessage msg = new TextMessage(participant, message);
|
||||
msg.setProperty(Tools.PROP_SESSION_ID, getSessionId());
|
||||
|
||||
session.sendPeerToPeer(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the identification of the user who is the DataProvider.
|
||||
*
|
||||
|
@ -575,7 +585,7 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
|||
e.printStackTrace();
|
||||
errorStatus = Errors.BAD_NAME;
|
||||
}
|
||||
// TODO :
|
||||
// TODO :
|
||||
// sendSubscription(subject);
|
||||
return errorStatus;
|
||||
}
|
||||
|
@ -609,8 +619,10 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
|||
.getRosterManager().getPresenceSender();
|
||||
org.eclipse.ecf.presence.IPresence presence = new org.eclipse.ecf.presence.Presence(
|
||||
org.eclipse.ecf.presence.IPresence.Type.SUBSCRIBE);
|
||||
|
||||
sender.sendPresenceUpdate(createID("pkorman@awipscm.omaha.us.ray.com"), presence);
|
||||
|
||||
sender.sendPresenceUpdate(
|
||||
createID("pkorman@awipscm.omaha.us.ray.com"),
|
||||
presence);
|
||||
}
|
||||
|
||||
System.out.println("Subscribe message sent.");
|
||||
|
|
Loading…
Add table
Reference in a new issue