Issue #429 first round fixes color
Former-commit-id: 901770d888a39df452e60d9ac6c5d7e071d6a810
This commit is contained in:
parent
da5e17d6e3
commit
d34e2722b0
12 changed files with 156 additions and 75 deletions
|
@ -56,6 +56,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterChangeEvent;
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterEventSubscriber;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.ITextMessageEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenueInvite;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRoster;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
|
||||
|
@ -550,8 +551,7 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
| SWT.OK | SWT.CANCEL);
|
||||
box.setText("Invitation");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean sharedDisplay = invitation.getInvite()
|
||||
.isSharedDisplayVenue();
|
||||
boolean sharedDisplay = invitation.getInvite() instanceof SharedDisplayVenueInvite;
|
||||
sb.append("You are invited to a ");
|
||||
if (sharedDisplay) {
|
||||
sb.append("collaboration session.\n");
|
||||
|
@ -576,6 +576,13 @@ public class CollaborationDataManager implements IRosterEventSubscriber {
|
|||
String sessionId = session.getSessionId();
|
||||
sessionsMap.put(sessionId, session);
|
||||
if (sharedDisplay) {
|
||||
SharedDisplaySessionMgr
|
||||
.getSessionContainer(sessionId)
|
||||
.getColorManager()
|
||||
.setColors(
|
||||
((SharedDisplayVenueInvite) invitation
|
||||
.getInvite()).getColors());
|
||||
|
||||
ISharedDisplaySession displaySession = (ISharedDisplaySession) session;
|
||||
SharedDisplaySessionMgr.joinSession(displaySession,
|
||||
SharedDisplayRole.PARTICIPANT);
|
||||
|
|
|
@ -22,6 +22,7 @@ package com.raytheon.uf.viz.collaboration.data;
|
|||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
|
||||
import com.raytheon.uf.viz.collaboration.ui.role.IRoleEventController;
|
||||
import com.raytheon.viz.ui.editor.AbstractEditor;
|
||||
|
@ -55,6 +56,8 @@ public class SessionContainer {
|
|||
/** subscribes to events related to the session based on role **/
|
||||
private IRoleEventController roleEventController;
|
||||
|
||||
private SessionColorManager colorManager;
|
||||
|
||||
/**
|
||||
* the editor associated with a session, only valid if not fulfilling the
|
||||
* Data Provider role
|
||||
|
@ -117,4 +120,18 @@ public class SessionContainer {
|
|||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the colorManager
|
||||
*/
|
||||
public SessionColorManager getColorManager() {
|
||||
return colorManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param colorManager
|
||||
* the colorManager to set
|
||||
*/
|
||||
public void setColorManager(SessionColorManager colorManager) {
|
||||
this.colorManager = colorManager;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.swt.graphics.RGB;
|
|||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
|
||||
/**
|
||||
* Event for when a new user enters and a color is added
|
||||
|
@ -44,7 +45,7 @@ import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
|||
@DynamicSerialize
|
||||
public class ColorChangeEvent {
|
||||
@DynamicSerializeElement
|
||||
private String userName;
|
||||
private UserId userName;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private Integer red;
|
||||
|
@ -59,7 +60,7 @@ public class ColorChangeEvent {
|
|||
|
||||
}
|
||||
|
||||
public ColorChangeEvent(String user, RGB color) {
|
||||
public ColorChangeEvent(UserId user, RGB color) {
|
||||
this.userName = user;
|
||||
if (color != null) {
|
||||
red = color.red;
|
||||
|
@ -72,14 +73,14 @@ public class ColorChangeEvent {
|
|||
* @param userName
|
||||
* the userName to set
|
||||
*/
|
||||
public void setUserName(String userName) {
|
||||
public void setUserName(UserId userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userName
|
||||
*/
|
||||
public String getUserName() {
|
||||
public UserId getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.viz.core.ColorUtil;
|
||||
|
||||
/**
|
||||
|
@ -46,7 +47,7 @@ import com.raytheon.viz.core.ColorUtil;
|
|||
// TODO make so this supports multiple sessions
|
||||
public class SessionColorManager {
|
||||
|
||||
private Map<String, RGB> colors;
|
||||
private Map<UserId, RGB> colors;
|
||||
|
||||
private static SessionColorManager colorManager = null;
|
||||
|
||||
|
@ -65,23 +66,31 @@ public class SessionColorManager {
|
|||
*/
|
||||
private SessionColorManager() {
|
||||
if (colors == null) {
|
||||
colors = new HashMap<String, RGB>();
|
||||
colors = new HashMap<UserId, RGB>();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the colors
|
||||
*/
|
||||
public Map<String, RGB> getColors() {
|
||||
public Map<UserId, RGB> getColors() {
|
||||
return colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param colors
|
||||
* the colors to set
|
||||
*/
|
||||
public void setColors(Map<UserId, RGB> colors) {
|
||||
this.colors = colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a user with a new color value
|
||||
*
|
||||
* @param user
|
||||
*/
|
||||
private RGB addUser(String user) {
|
||||
public RGB addUser(UserId user) {
|
||||
int count = colors.size();
|
||||
if (rgbPresets.length <= colors.size()) {
|
||||
count = rgbPresets.length % colors.size();
|
||||
|
@ -90,10 +99,10 @@ public class SessionColorManager {
|
|||
return rgbPresets[count];
|
||||
}
|
||||
|
||||
public RGB getColorFromUser(String user) {
|
||||
// if (colors.get(user) == null) {
|
||||
addUser(user);
|
||||
// }
|
||||
public RGB getColorFromUser(UserId user) {
|
||||
if (colors.get(user) == null) {
|
||||
addUser(user);
|
||||
}
|
||||
return colors.get(user);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,13 +19,7 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.collaboration.ui.role;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.ColorChangeEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
||||
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;
|
||||
|
@ -75,19 +69,6 @@ public abstract class AbstractRoleEventController implements
|
|||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
// assign a color that everyone will receive
|
||||
String user = CollaborationDataManager.getInstance()
|
||||
.getLoginId();
|
||||
RGB color = SessionColorManager.getColorManager()
|
||||
.getColorFromUser(user);
|
||||
System.out.println("color for " + user + " is : "
|
||||
+ color.toString());
|
||||
ColorChangeEvent cce = new ColorChangeEvent(user, color);
|
||||
session.sendObjectToVenue(cce);
|
||||
} catch (CollaborationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// activate the drawing tool by default for the session leader
|
||||
tool = new CollaborationPathDrawingTool();
|
||||
((CollaborationPathDrawingTool) tool).setSession(session
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.eclipse.ui.part.ViewPart;
|
|||
import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
|
||||
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
||||
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||
|
@ -86,7 +87,7 @@ public abstract class AbstractSessionView extends ViewPart implements
|
|||
|
||||
private StyledText composeText;
|
||||
|
||||
protected Map<String, Color> colors;
|
||||
protected Map<UserId, Color> colors;
|
||||
|
||||
// protected Action chatAction;
|
||||
|
||||
|
@ -102,10 +103,10 @@ public abstract class AbstractSessionView extends ViewPart implements
|
|||
|
||||
public AbstractSessionView() {
|
||||
imageMap = new HashMap<String, Image>();
|
||||
colors = new HashMap<String, Color>();
|
||||
Map<String, RGB> rgbs = SessionColorManager.getColorManager()
|
||||
colors = new HashMap<UserId, Color>();
|
||||
Map<UserId, RGB> rgbs = SessionColorManager.getColorManager()
|
||||
.getColors();
|
||||
for (String user : rgbs.keySet()) {
|
||||
for (UserId user : rgbs.keySet()) {
|
||||
colors.put(user, new Color(Display.getCurrent(), rgbs.get(user)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ 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.IVenueSession;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.ui.ColorChangeEvent;
|
||||
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
|
||||
|
@ -86,7 +87,7 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
|
||||
private Multimap<String, ShapeContainer> deletedCollaboratorShapes;
|
||||
|
||||
private Map<String, RGB> colors;
|
||||
private Map<UserId, RGB> colors;
|
||||
|
||||
private IWireframeShape tempRemoteShape = null;
|
||||
|
||||
|
@ -447,7 +448,7 @@ public class CollaborationDrawingLayer extends DrawingLayer {
|
|||
// }
|
||||
}
|
||||
|
||||
public void addColor(String userName, RGB color) {
|
||||
public void addColor(UserId userName, RGB color) {
|
||||
colors.put(userName, color);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@ Require-Bundle: org.eclipse.core.runtime,
|
|||
com.google.guava;bundle-version="1.0.0";visibility:=reexport,
|
||||
com.raytheon.uf.common.serialization;bundle-version="1.12.1174",
|
||||
com.raytheon.uf.viz.core;bundle-version="1.12.1174",
|
||||
org.jivesoftware.smack;bundle-version="3.1.100"
|
||||
org.jivesoftware.smack;bundle-version="3.1.100",
|
||||
org.eclipse.swt;bundle-version="3.6.2"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Export-Package: com.raytheon.uf.viz.collaboration,
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
/**
|
||||
* 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.comm.identity.invite;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 19, 2012 mnash Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SharedDisplayVenueInvite extends VenueInvite {
|
||||
|
||||
@DynamicSerializeElement
|
||||
private UserId sessionLeader;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private UserId dataProvider;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private Map<UserId, RGB> colors;
|
||||
|
||||
public UserId getSessionLeader() {
|
||||
return sessionLeader;
|
||||
}
|
||||
|
||||
public void setSessionLeader(UserId sessionLeader) {
|
||||
this.sessionLeader = sessionLeader;
|
||||
}
|
||||
|
||||
public UserId getDataProvider() {
|
||||
return dataProvider;
|
||||
}
|
||||
|
||||
public void setDataProvider(UserId dataProvider) {
|
||||
this.dataProvider = dataProvider;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the colors
|
||||
*/
|
||||
public Map<UserId, RGB> getColors() {
|
||||
return colors;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param colors
|
||||
* the colors to set
|
||||
*/
|
||||
public void setColors(Map<UserId, RGB> colors) {
|
||||
this.colors = colors;
|
||||
}
|
||||
}
|
|
@ -21,7 +21,6 @@ package com.raytheon.uf.viz.collaboration.comm.identity.invite;
|
|||
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
|
||||
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
|
||||
|
||||
/**
|
||||
* An invite message for inviting another user to a venue.
|
||||
|
@ -49,12 +48,6 @@ public class VenueInvite {
|
|||
@DynamicSerializeElement
|
||||
private String message;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private UserId sessionLeader;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private UserId dataProvider;
|
||||
|
||||
@DynamicSerializeElement
|
||||
private String sessionId;
|
||||
|
||||
|
@ -74,22 +67,6 @@ public class VenueInvite {
|
|||
this.message = message;
|
||||
}
|
||||
|
||||
public UserId getSessionLeader() {
|
||||
return sessionLeader;
|
||||
}
|
||||
|
||||
public void setSessionLeader(UserId sessionLeader) {
|
||||
this.sessionLeader = sessionLeader;
|
||||
}
|
||||
|
||||
public UserId getDataProvider() {
|
||||
return dataProvider;
|
||||
}
|
||||
|
||||
public void setDataProvider(UserId dataProvider) {
|
||||
this.dataProvider = dataProvider;
|
||||
}
|
||||
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
@ -97,9 +74,4 @@ public class VenueInvite {
|
|||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
public boolean isSharedDisplayVenue() {
|
||||
return (sessionLeader != null && dataProvider != null);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterEventSubscri
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueInvitationEvent;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.RosterChangeType;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.invite.SharedDisplayVenueInvite;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IQualifiedID;
|
||||
|
@ -426,11 +427,11 @@ public class CollaborationConnection implements IEventPublisher {
|
|||
String host = Tools.parseHost(account);
|
||||
UserId me = new UserId(name, host);
|
||||
session.setUserId(me);
|
||||
session.setCurrentDataProvider(invitation.getInvite()
|
||||
.getDataProvider());
|
||||
session.setCurrentSessionLeader(invitation.getInvite()
|
||||
.getSessionLeader());
|
||||
|
||||
if (invitation instanceof SharedDisplayVenueInvite) {
|
||||
SharedDisplayVenueInvite invite = (SharedDisplayVenueInvite) invitation;
|
||||
session.setCurrentDataProvider(invite.getDataProvider());
|
||||
session.setCurrentSessionLeader(invite.getSessionLeader());
|
||||
}
|
||||
sessions.put(session.getSessionId(), session);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.ecf.core.IContainer;
|
|||
import com.google.common.eventbus.EventBus;
|
||||
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.invite.SharedDisplayVenueInvite;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage;
|
||||
|
@ -142,10 +143,12 @@ public class SharedDisplaySession extends VenueSession implements
|
|||
|
||||
@Override
|
||||
protected VenueInvite buildInvite(String msg) {
|
||||
VenueInvite invite = super.buildInvite(msg);
|
||||
SharedDisplayVenueInvite invite = new SharedDisplayVenueInvite();
|
||||
invite.setMessage(msg);
|
||||
invite.setSessionId(this.sessionId);
|
||||
invite.setSubject(this.getSubject());
|
||||
invite.setDataProvider(this.getCurrentDataProvider());
|
||||
invite.setSessionLeader(this.getCurrentSessionLeader());
|
||||
return invite;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue