Issue #444 add further capability of transferring session leader

Former-commit-id: b2621eb89e [formerly 49a19d4b6a56252e4e17f4563cdd4f94ef0ab3cc]
Former-commit-id: 746fd1464c
This commit is contained in:
Matt Nash 2012-05-11 16:29:27 -05:00
parent fd766443b7
commit 01f852004b
13 changed files with 84 additions and 33 deletions

View file

@ -402,7 +402,6 @@ public class VenueSession extends BaseSession implements IVenueSession {
}
};
venueContainer.addMessageListener(intListener);
}
} catch (Exception e) {
throw new CollaborationException(

View file

@ -49,7 +49,10 @@ public class IDConverter {
String name = Tools.parseName(id.getName());
String host = Tools.parseHost(id.getName());
String rsc = Tools.parseResource(id.getName());
return new UserId(name, host, rsc);
UserId uid = new UserId(name, host, rsc);
uid.setId(id);
return uid;
}
/**

View file

@ -114,9 +114,9 @@ import com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView;
import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView;
import com.raytheon.uf.viz.collaboration.ui.session.SessionView;
import com.raytheon.uf.viz.collaboration.ui.telestrator.CollaborationPathToolbar;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.icon.IconUtil;
import com.raytheon.uf.viz.drawing.PathToolbar;
import com.raytheon.viz.ui.VizWorkbenchManager;
/**
@ -314,11 +314,11 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
// loop through all the views so that we can bring the one
// that
// was selected to the top...
IVenueSession session = (IVenueSession) selection
.getFirstElement();
for (IViewReference ref : getViewSite()
.getWorkbenchWindow().getActivePage()
.getViewReferences()) {
IVenueSession session = (IVenueSession) selection
.getFirstElement();
if (session.getSessionId().equals(ref.getSecondaryId())) {
PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage()
@ -468,7 +468,7 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
drawToolbarAction = new Action("Drawing Toolbar") {
@Override
public void run() {
PathToolbar.getToolbar().open();
CollaborationPathToolbar.getToolbar().open();
}
};
drawToolbarAction.setImageDescriptor(IconUtil.getImageDescriptor(
@ -671,7 +671,8 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
// the user, both the logged in user as well as his buddies
if (o instanceof IRosterEntry) {
IRosterEntry user = (IRosterEntry) o;
if (user.getPresence().getType() == Type.AVAILABLE) {
if (user.getPresence() != null
&& user.getPresence().getType() == Type.AVAILABLE) {
MenuManager inviteManager = new MenuManager("Invite to...");
// get current open chats
Map<String, IVenueSession> sessions = CollaborationDataManager

View file

@ -164,7 +164,8 @@ public class UsersTreeLabelProvider extends ColumnLabelProvider {
builder.append("ID: ").append(
IDConverter.convertFrom(user.getUser()).getFQName());
builder.append("\nStatus: ");
if (user.getPresence().getType() == Type.UNAVAILABLE) {
if (user.getPresence() == null
|| user.getPresence().getType() == Type.UNAVAILABLE) {
builder.append("Offline");
} else {
builder.append(CollaborationUtils.formatMode(user.getPresence()

View file

@ -57,8 +57,8 @@ public class ChatRoomAction extends AbstractHandler {
PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getActivePage().showView(SessionView.ID);
} catch (PartInitException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to open product browser", e);
statusHandler.handle(Priority.PROBLEM, "Unable to open chat room",
e);
}
return event;
}

View file

@ -86,7 +86,7 @@ public abstract class AbstractRoleEventController implements
protected void deactivateTelestrator() {
// TODO this must be handled better
PathToolbar.getToolbar().close();
CollaborationPathToolbar.getToolbar().close();
if (tool != null) {
tool.deactivate();
session.unRegisterEventHandler(tool);

View file

@ -23,6 +23,7 @@ package com.raytheon.uf.viz.collaboration.ui.session;
import java.util.Collection;
import org.eclipse.ecf.presence.roster.IRosterEntry;
import org.eclipse.ecf.presence.roster.RosterEntry;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IMenuCreator;
@ -48,6 +49,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.comm.provider.TransferRoleCommand;
import com.raytheon.uf.viz.collaboration.comm.provider.user.IDConverter;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
@ -122,8 +124,14 @@ public class CollaborationSessionView extends SessionView {
.getSelection();
IRosterEntry selectedUser = (IRosterEntry) selection
.getFirstElement();
switchLeader((UserId) selectedUser.getUser());
usersTable.refresh();
usersTable.remove(selectedUser);
UserId id = IDConverter.convertFrom(selectedUser
.getUser());
selectedUser = new RosterEntry(
selectedUser.getParent(), id,
selectedUser.getPresence());
switchLeader(id);
usersTable.refresh(selectedUser);
};
};
ActionContributionItem leaderItem = new ActionContributionItem(
@ -138,8 +146,14 @@ public class CollaborationSessionView extends SessionView {
.getSelection();
IRosterEntry selectedUser = (IRosterEntry) selection
.getFirstElement();
switchDataProvider((UserId) selectedUser.getUser());
usersTable.refresh();
usersTable.remove(selectedUser);
UserId id = IDConverter.convertFrom(selectedUser
.getUser());
selectedUser = new RosterEntry(
selectedUser.getParent(), id,
selectedUser.getPresence());
switchDataProvider(id);
usersTable.refresh(selectedUser);
};
};
ActionContributionItem dataProviderItem = new ActionContributionItem(
@ -171,7 +185,7 @@ public class CollaborationSessionView extends SessionView {
.getSelection();
IRosterEntry entry = (IRosterEntry) selection.getFirstElement();
ColorChangeEvent event = new ColorChangeEvent(
(UserId) entry.getUser(), rgb);
IDConverter.convertFrom(entry.getUser()), rgb);
try {
session.sendObjectToVenue(event);
} catch (CollaborationException e) {

View file

@ -255,7 +255,7 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
}
}
return boldFont;
return null;
}
@Override
@ -349,10 +349,12 @@ public class ParticipantsLabelProvider extends ColumnLabelProvider {
IVenueSession session = CollaborationDataManager.getInstance()
.getSession(sessionId);
if (session instanceof SharedDisplaySession) {
boolean isSessionLeader = user.getUser().equals(
((SharedDisplaySession) session).getCurrentSessionLeader());
boolean isDataProvider = user.getUser().equals(
((SharedDisplaySession) session).getCurrentDataProvider());
UserId id = IDConverter.convertFrom(user.getUser());
boolean isSessionLeader = id
.equals(((SharedDisplaySession) session)
.getCurrentSessionLeader());
boolean isDataProvider = id.equals(((SharedDisplaySession) session)
.getCurrentDataProvider());
if (isSessionLeader || isDataProvider) {
if (isSessionLeader) {
builder.append("\nSession Leader");

View file

@ -363,7 +363,6 @@ public class SessionView extends AbstractSessionView {
ColumnViewerToolTipSupport.enableFor(usersTable, ToolTip.RECREATE);
List<IRosterEntry> users = new ArrayList<IRosterEntry>();
if (session != null) {
session.getVenue().getParticipants();
Map<UserId, IRosterEntry> usersMap = session.getConnection()
.getContactsManager().getUsersMap();
for (UserId participant : session.getVenue().getParticipants()) {
@ -373,7 +372,8 @@ public class SessionView extends AbstractSessionView {
RosterEntry rEntry = new RosterEntry(session
.getConnection().getRosterManager().getRoster(),
participant, CollaborationDataManager.getInstance()
.getCollaborationConnection(true).getPresence());
.getCollaborationConnection(true)
.getPresence());
users.add(rEntry);
} else if (entry != null) {
users.add(usersMap.get(participant));
@ -416,7 +416,8 @@ public class SessionView extends AbstractSessionView {
session.unRegisterEventHandler(this);
CollaborationDataManager mgr = CollaborationDataManager.getInstance();
mgr.closeSession(sessionId);
mgr.getCollaborationConnection(true).getEventPublisher().unregister(this);
mgr.getCollaborationConnection(true).getEventPublisher()
.unregister(this);
super.dispose();
}
@ -664,6 +665,7 @@ public class SessionView extends AbstractSessionView {
// TODO Keep as a place holder for now since it may be needed to set
// leader/provider roles.
List<IRosterEntry> users = (List<IRosterEntry>) usersTable.getInput();
if (users != null) {
for (IRosterEntry entry : users) {
if (entry.getUser().equals(participant)) {
((RosterEntry) entry).setPresence(presence);
@ -671,4 +673,5 @@ public class SessionView extends AbstractSessionView {
}
}
}
}
}

View file

@ -33,6 +33,8 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
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.event.IVenueParticipantEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
@ -164,7 +166,7 @@ public class CollaborationDrawingLayer extends DrawingLayer {
for (ShapeContainer sh : collaboratorShapes.get(userName)) {
if (sh != null) {
RGB col = colorManager.getColors().get(userName);
if (sh.getShape() != null) {
if (sh.getShape() != null && col != null) {
target.drawWireframeShape(sh.getShape(), col,
outline.getOutlineWidth(),
outline.getLineStyle(), imaging.getAlpha());
@ -185,6 +187,17 @@ public class CollaborationDrawingLayer extends DrawingLayer {
issueRefresh();
}
@Subscribe
public void participantChanged(IVenueParticipantEvent event) {
if (event.getEventType().equals(ParticipantEventType.DEPARTED)) {
System.out
.println(event.getParticipant().getFQName() + " departed");
resetTemp();
clearSelfShapes(event.getParticipant());
issueRefresh();
}
}
@Subscribe
public void handle(CollaborationDrawingEvent event) {
switch (event.getType()) {

View file

@ -65,6 +65,7 @@ public class CollaborationPathToolbar extends PathToolbar {
*/
protected CollaborationPathToolbar(Shell parentShell) {
super(parentShell);
setText("Collaboration Drawing");
}
public static PathToolbar getToolbar() {
@ -98,8 +99,8 @@ public class CollaborationPathToolbar extends PathToolbar {
public void run() {
if (event instanceof CollaborationDrawingEvent) {
CollaborationDrawingEvent cde = (CollaborationDrawingEvent) event;
if (!cde.getUserName().equals(
CollaborationDataManager.getInstance()
if (!cde.getUserName()
.equals(CollaborationDataManager.getInstance()
.getCollaborationConnection(true).getUser())) {
if (cde.getType() == CollaborationEventType.DISABLE) {
disableAll();
@ -128,7 +129,7 @@ public class CollaborationPathToolbar extends PathToolbar {
.getSessionContainer(sessionId).getSession();
if (session != null
&& !session.hasRole(SharedDisplayRole.SESSION_LEADER)
&& leaderOnly != null) {
&& leaderOnly != null && !leaderOnly.isDisposed()) {
leaderOnly.setEnabled(false);
}
}
@ -159,7 +160,9 @@ public class CollaborationPathToolbar extends PathToolbar {
}
public void disableAll() {
if (toolbar != null && !toolbar.isDisposed()) {
toolbar.setEnabled(!toolbar.getEnabled());
}
}
}

View file

@ -21,5 +21,6 @@ Import-Package: com.raytheon.uf.common.time,
com.raytheon.viz.ui.cmenu,
com.vividsolutions.jts.geom
Export-Package: com.raytheon.uf.viz.drawing,
com.raytheon.uf.viz.drawing.actions,
com.raytheon.uf.viz.drawing.events,
com.raytheon.uf.viz.drawing.tools

View file

@ -283,6 +283,17 @@ public class PathToolbar extends CaveSWTDialog {
updateToolbar();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
super.disposed();
pathToolbar = null;
}
public void updateToolbar() {
if (this.isDisposed()) {
return;