Issue #429 lots of color changes

Former-commit-id: ac71a592948b71c629f5f535a8d06840b3905c2a
This commit is contained in:
Matt Nash 2012-04-19 15:34:25 -05:00
parent 5f47f98662
commit 064657306f
17 changed files with 437 additions and 155 deletions

View file

@ -124,14 +124,9 @@ public class SessionContainer {
* @return the colorManager * @return the colorManager
*/ */
public SessionColorManager getColorManager() { public SessionColorManager getColorManager() {
if (colorManager == null) {
colorManager = new SessionColorManager();
}
return colorManager; return colorManager;
} }
/**
* @param colorManager
* the colorManager to set
*/
public void setColorManager(SessionColorManager colorManager) {
this.colorManager = colorManager;
}
} }

View file

@ -76,9 +76,12 @@ import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence; import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type; import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
import com.raytheon.uf.viz.collaboration.comm.identity.ISession; import com.raytheon.uf.viz.collaboration.comm.identity.ISession;
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.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterChangeEvent; import com.raytheon.uf.viz.collaboration.comm.identity.event.IRosterChangeEvent;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo; 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.IRosterEntry; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterGroup;
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager; import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterManager;
@ -93,6 +96,7 @@ import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
import com.raytheon.uf.viz.collaboration.data.LoginUser; import com.raytheon.uf.viz.collaboration.data.LoginUser;
import com.raytheon.uf.viz.collaboration.data.OrphanGroup; import com.raytheon.uf.viz.collaboration.data.OrphanGroup;
import com.raytheon.uf.viz.collaboration.data.SessionGroup; import com.raytheon.uf.viz.collaboration.data.SessionGroup;
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor; import com.raytheon.uf.viz.collaboration.ui.editor.CollaborationEditor;
import com.raytheon.uf.viz.collaboration.ui.login.ChangeStatusDialog; import com.raytheon.uf.viz.collaboration.ui.login.ChangeStatusDialog;
import com.raytheon.uf.viz.collaboration.ui.login.LoginData; import com.raytheon.uf.viz.collaboration.ui.login.LoginData;
@ -253,8 +257,15 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
System.out.println("subject: " System.out.println("subject: "
+ session.getVenue().getInfo().getVenueSubject()); + session.getVenue().getInfo().getVenueSubject());
try { try {
session.sendInvitation(ids, session.getVenue().getInfo() VenueInvite invite = null;
.getVenueSubject()); if (session instanceof ISharedDisplaySession) {
invite = buildDisplayInvite(sessionId, session
.getVenue().getInfo().getVenueSubject(), "");
} else {
invite = buildInvite(sessionId, session.getVenue()
.getInfo().getVenueSubject(), "");
}
session.sendInvitation(ids, invite);
} catch (CollaborationException e) { } catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Error sending invitiation", e); "Error sending invitiation", e);
@ -637,13 +648,47 @@ public class CollaborationGroupView extends ViewPart implements IPartListener {
usersList.add(user.getId()); usersList.add(user.getId());
} }
String b = result.getInviteMessage(); String b = result.getInviteMessage();
session.sendInvitation(usersList, b);
VenueInvite invite = null;
if (session instanceof ISharedDisplaySession) {
invite = buildDisplayInvite(session.getSessionId(),
result.getSubject(), b);
} else {
invite = buildInvite(session.getSessionId(),
result.getSubject(), b);
}
session.sendInvitation(usersList, invite);
} }
} catch (Exception e) { } catch (Exception e) {
statusHandler.error("Error sending invitation", e); statusHandler.error("Error sending invitation", e);
} }
} }
}
private VenueInvite buildInvite(String sessionId, String subject,
String body) {
VenueInvite invite = new VenueInvite();
invite.setMessage(body);
invite.setSessionId(sessionId);
invite.setSubject(subject);
return invite;
}
private VenueInvite buildDisplayInvite(String sessionId, String subject,
String msg) {
SharedDisplayVenueInvite invite = new SharedDisplayVenueInvite();
invite.setMessage(msg);
invite.setSessionId(sessionId);
invite.setSubject(subject);
invite.setColors(SharedDisplaySessionMgr.getSessionContainer(sessionId)
.getColorManager().getColors());
invite.setDataProvider(SharedDisplaySessionMgr
.getSessionContainer(sessionId).getSession()
.getCurrentDataProvider());
invite.setSessionLeader(SharedDisplaySessionMgr
.getSessionContainer(sessionId).getSession()
.getCurrentSessionLeader());
return invite;
} }
private void createCollaborationView(CreateSessionData result) { private void createCollaborationView(CreateSessionData result) {

View file

@ -57,7 +57,6 @@ public class ColorChangeEvent {
private Integer blue; private Integer blue;
public ColorChangeEvent() { public ColorChangeEvent() {
} }
public ColorChangeEvent(UserId user, RGB color) { public ColorChangeEvent(UserId user, RGB color) {

View file

@ -44,29 +44,19 @@ import com.raytheon.viz.core.ColorUtil;
* @version 1.0 * @version 1.0
*/ */
// TODO make so this supports multiple sessions
public class SessionColorManager { public class SessionColorManager {
private Map<UserId, RGB> colors; private Map<UserId, RGB> colors;
private static SessionColorManager colorManager = null;
private static RGB[] rgbPresets = null; private static RGB[] rgbPresets = null;
public static SessionColorManager getColorManager() {
if (colorManager == null) {
colorManager = new SessionColorManager();
rgbPresets = ColorUtil.getResourceColorPresets();
}
return colorManager;
}
/** /**
* *
*/ */
private SessionColorManager() { public SessionColorManager() {
if (colors == null) { if (colors == null) {
colors = new HashMap<UserId, RGB>(); colors = new HashMap<UserId, RGB>();
rgbPresets = ColorUtil.getResourceColorPresets();
} }
} }
@ -77,26 +67,8 @@ public class SessionColorManager {
return colors; return colors;
} }
/** public void setColors(Map<UserId, RGB> map) {
* @param colors colors = map;
* the colors to set
*/
public void setColors(Map<UserId, RGB> colors) {
this.colors = colors;
}
/**
* Add a user with a new color value
*
* @param user
*/
public RGB addUser(UserId user) {
int count = colors.size();
if (rgbPresets.length <= colors.size()) {
count = rgbPresets.length % colors.size();
}
colors.put(user, rgbPresets[count]);
return rgbPresets[count];
} }
public RGB getColorFromUser(UserId user) { public RGB getColorFromUser(UserId user) {
@ -106,6 +78,19 @@ public class SessionColorManager {
return colors.get(user); return colors.get(user);
} }
/**
* Add a user with a new color value
*
* @param user
*/
public void addUser(UserId user) {
int count = colors.size();
if (rgbPresets.length <= count) {
count = rgbPresets.length % colors.size();
}
colors.put(user, rgbPresets[count]);
}
public void clearColors() { public void clearColors() {
colors.clear(); colors.clear();
} }

View file

@ -20,6 +20,7 @@
package com.raytheon.uf.viz.collaboration.ui.role; package com.raytheon.uf.viz.collaboration.ui.role;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Event;
import com.google.common.eventbus.Subscribe; import com.google.common.eventbus.Subscribe;
@ -34,6 +35,8 @@ 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.TransferRoleCommand;
import com.raytheon.uf.viz.collaboration.data.SessionContainer; import com.raytheon.uf.viz.collaboration.data.SessionContainer;
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr; import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.ColorChangeEvent;
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup; import com.raytheon.uf.viz.collaboration.ui.editor.EditorSetup;
import com.raytheon.uf.viz.collaboration.ui.editor.SharedEditorData; import com.raytheon.uf.viz.collaboration.ui.editor.SharedEditorData;
import com.raytheon.uf.viz.collaboration.ui.editor.SharedResource; import com.raytheon.uf.viz.collaboration.ui.editor.SharedResource;
@ -94,13 +97,24 @@ public class DataProviderEventController extends AbstractRoleEventController {
AbstractEditor editor = EditorUtil AbstractEditor editor = EditorUtil
.getActiveEditorAs(AbstractEditor.class); .getActiveEditorAs(AbstractEditor.class);
SharedEditorData se = EditorSetup.extractSharedEditorData(editor); SharedEditorData se = EditorSetup.extractSharedEditorData(editor);
// new color for each user
SessionColorManager manager = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId())
.getColorManager();
RGB color = manager.getColorFromUser(event.getParticipant());
ColorChangeEvent cce = new ColorChangeEvent(event.getParticipant(),
color);
try { try {
session.sendObjectToVenue(cce);
session.sendObjectToPeer(event.getParticipant(), se); session.sendObjectToPeer(event.getParticipant(), se);
} catch (CollaborationException e) { } catch (CollaborationException e) {
statusHandler.handle(Priority.PROBLEM, statusHandler.handle(Priority.PROBLEM,
"Error sending initialization data to new participant " "Error sending initialization data to new participant "
+ event.getParticipant().getName(), e); + event.getParticipant().getName(), e);
} }
} }
} }
@ -213,6 +227,10 @@ public class DataProviderEventController extends AbstractRoleEventController {
@Override @Override
public void startup() { public void startup() {
super.startup(); super.startup();
SessionColorManager manager = SharedDisplaySessionMgr
.getSessionContainer(session.getSessionId()).getColorManager();
manager.addUser(session.getCurrentDataProvider());
super.activateTelestrator(); super.activateTelestrator();
wrappingListener = new ResourceWrapperListener(); wrappingListener = new ResourceWrapperListener();
for (IDisplayPaneContainer container : SharedDisplaySessionMgr for (IDisplayPaneContainer container : SharedDisplaySessionMgr

View file

@ -34,7 +34,6 @@ import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
@ -48,7 +47,6 @@ import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
import com.raytheon.uf.viz.collaboration.comm.identity.IMessage; 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.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.Activator; import com.raytheon.uf.viz.collaboration.ui.Activator;
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager;
import com.raytheon.uf.viz.core.icon.IconUtil; import com.raytheon.uf.viz.core.icon.IconUtil;
/** /**
@ -87,8 +85,6 @@ public abstract class AbstractSessionView extends ViewPart implements
private StyledText composeText; private StyledText composeText;
protected Map<UserId, Color> colors;
// protected Action chatAction; // protected Action chatAction;
protected abstract String getSessionImageName(); protected abstract String getSessionImageName();
@ -103,12 +99,6 @@ public abstract class AbstractSessionView extends ViewPart implements
public AbstractSessionView() { public AbstractSessionView() {
imageMap = new HashMap<String, Image>(); imageMap = new HashMap<String, Image>();
colors = new HashMap<UserId, Color>();
Map<UserId, RGB> rgbs = SessionColorManager.getColorManager()
.getColors();
for (UserId user : rgbs.keySet()) {
colors.put(user, new Color(Display.getCurrent(), rgbs.get(user)));
}
} }
private void initComponents(Composite parent) { private void initComponents(Composite parent) {
@ -273,18 +263,14 @@ public abstract class AbstractSessionView extends ViewPart implements
} }
} }
StyleRange range = new StyleRange(messagesText.getCharCount() + offset, styleAndAppendText(sb, offset, name, fqName, ranges);
name.length() + 1, colors.get(fqName), null, SWT.BOLD);
messagesText.append(sb.toString());
messagesText.setStyleRange(range);
for (StyleRange newRange : ranges) {
messagesText.setStyleRange(newRange);
}
messagesText.setTopIndex(messagesText.getLineCount() - 1);
// room for other fun things here, such as sounds and such // room for other fun things here, such as sounds and such
executeSightsSounds(); executeSightsSounds();
} }
protected abstract void styleAndAppendText(StringBuilder sb, int offset,
String name, String fqName, List<StyleRange> ranges);
/** /**
* Find keys words in body of message starting at offset. /** * Find keys words in body of message starting at offset. /**
* *
@ -339,10 +325,6 @@ public abstract class AbstractSessionView extends ViewPart implements
getViewSite().getWorkbenchWindow().getPartService() getViewSite().getWorkbenchWindow().getPartService()
.removePartListener(this); .removePartListener(this);
} }
for (Color color : colors.values()) {
color.dispose();
}
SessionColorManager.getColorManager().clearColors();
} }
/* /*

View file

@ -28,13 +28,17 @@ import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableColorProvider; import org.eclipse.jface.viewers.ITableColorProvider;
import org.eclipse.jface.viewers.ITableFontProvider; import org.eclipse.jface.viewers.ITableFontProvider;
import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession; import com.raytheon.uf.viz.collaboration.comm.identity.IVenueSession;
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager; import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
import com.raytheon.uf.viz.collaboration.data.CollaborationUser; import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils; import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
/** /**
@ -63,6 +67,8 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
protected Map<String, Image> imageMap; protected Map<String, Image> imageMap;
protected Map<String, Color> colors;
public ParticipantsLabelProvider() { public ParticipantsLabelProvider() {
listeners = new ArrayList<ILabelProviderListener>(); listeners = new ArrayList<ILabelProviderListener>();
imageMap = new HashMap<String, Image>(); imageMap = new HashMap<String, Image>();
@ -78,6 +84,12 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
for (String key : imageMap.keySet()) { for (String key : imageMap.keySet()) {
imageMap.get(key).dispose(); imageMap.get(key).dispose();
} }
if (colors != null) {
for (Color col : colors.values()) {
col.dispose();
}
}
} }
@Override @Override
@ -128,7 +140,20 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
@Override @Override
public Color getForeground(Object element, int columnIndex) { public Color getForeground(Object element, int columnIndex) {
return null; if (colors == null) {
colors = new HashMap<String, Color>();
}
String id = ((CollaborationUser) element).getId();
RGB color = SharedDisplaySessionMgr.getSessionContainer(sessionId)
.getColorManager().getColors().get(id);
// add to map so we can dispose
if (color == null) {
colors.put(id, Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
} else {
colors.put(id, new Color(Display.getCurrent(), color));
}
return colors.get(id);
} }
@Override @Override

View file

@ -20,9 +20,15 @@ package com.raytheon.uf.viz.collaboration.ui.session;
* further licensing information. * further licensing information.
**/ **/
import java.util.List;
import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.IMenuManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
@ -57,12 +63,18 @@ public class PeerToPeerView extends AbstractSessionView {
public static final String ID = "com.raytheon.uf.viz.collaboration.PeerToPeerView"; public static final String ID = "com.raytheon.uf.viz.collaboration.PeerToPeerView";
private static Color userColor = null;
private static Color chatterColor = null;
protected IMessageListener messageListener; protected IMessageListener messageListener;
private IQualifiedID peer; private IQualifiedID peer;
public PeerToPeerView() { public PeerToPeerView() {
super(); super();
userColor = Display.getCurrent().getSystemColor(SWT.COLOR_DARK_BLUE);
chatterColor = Display.getCurrent().getSystemColor(SWT.COLOR_RED);
} }
/* /*
@ -179,6 +191,27 @@ public class PeerToPeerView extends AbstractSessionView {
} }
} }
protected void styleAndAppendText(StringBuilder sb, int offset,
String name, String fqName, List<StyleRange> ranges) {
Color color = null;
if (!fqName.equals(CollaborationDataManager.getInstance().getLoginId())) {
color = userColor;
} else {
color = chatterColor;
}
StyleRange range = new StyleRange(messagesText.getCharCount(), offset,
color, null, SWT.NORMAL);
ranges.add(range);
range = new StyleRange(messagesText.getCharCount() + offset,
name.length() + 1, color, null, SWT.BOLD);
ranges.add(range);
messagesText.append(sb.toString());
for (StyleRange newRange : ranges) {
messagesText.setStyleRange(newRange);
}
messagesText.setTopIndex(messagesText.getLineCount() - 1);
};
protected String getSessionImageName() { protected String getSessionImageName() {
return PEER_TO_PEER_IMAGE_NAME; return PEER_TO_PEER_IMAGE_NAME;
} }

View file

@ -21,7 +21,9 @@ package com.raytheon.uf.viz.collaboration.ui.session;
**/ **/
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import org.eclipse.jface.action.Action; import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener; import org.eclipse.jface.action.IMenuListener;
@ -34,12 +36,15 @@ import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel; import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseTrackAdapter; import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
@ -72,6 +77,7 @@ import com.raytheon.uf.viz.collaboration.comm.provider.session.CollaborationConn
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; 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.CollaborationDataManager;
import com.raytheon.uf.viz.collaboration.data.CollaborationUser; import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils; import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.VizApp;
@ -115,6 +121,10 @@ public class SessionView extends AbstractSessionView {
protected Action chatAction; protected Action chatAction;
protected Map<UserId, RGB> colors;
protected Map<RGB, Color> mappedColors;
public SessionView() { public SessionView() {
super(); super();
} }
@ -124,6 +134,11 @@ public class SessionView extends AbstractSessionView {
super.createPartControl(parent); super.createPartControl(parent);
createActions(); createActions();
createContextMenu(); createContextMenu();
SharedDisplaySessionMgr.getSessionContainer(sessionId).getSession()
.getEventPublisher().register(this);
colors = SharedDisplaySessionMgr.getSessionContainer(sessionId)
.getColorManager().getColors();
mappedColors = new HashMap<RGB, Color>();
} }
@Override @Override
@ -396,6 +411,18 @@ public class SessionView extends AbstractSessionView {
disposeArrow(highlightedRightArrow); disposeArrow(highlightedRightArrow);
disposeArrow(downArrow); disposeArrow(downArrow);
disposeArrow(rightArrow); disposeArrow(rightArrow);
if (mappedColors != null) {
for (Color col : mappedColors.values()) {
col.dispose();
}
mappedColors.clear();
}
if (colors != null) {
colors.clear();
}
SharedDisplaySessionMgr.getSessionContainer(sessionId)
.getColorManager().clearColors();
super.dispose(); super.dispose();
} }
@ -426,6 +453,33 @@ public class SessionView extends AbstractSessionView {
} }
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.collaboration.ui.session.AbstractSessionView#
* styleAndAppendText(java.lang.StringBuilder, int, java.lang.String,
* java.lang.String, java.util.List)
*/
@Override
protected void styleAndAppendText(StringBuilder sb, int offset,
String name, String fqName, List<StyleRange> ranges) {
int index = fqName.indexOf("/");
RGB rgb = colors.get(fqName.substring(0, index));
if (mappedColors.get(rgb) == null) {
Color col = new Color(Display.getCurrent(), rgb);
mappedColors.put(rgb, col);
}
StyleRange range = new StyleRange(messagesText.getCharCount() + offset,
name.length() + 1, mappedColors.get(rgb), null, SWT.BOLD);
messagesText.append(sb.toString());
messagesText.setStyleRange(range);
for (StyleRange newRange : ranges) {
messagesText.setStyleRange(newRange);
}
messagesText.setTopIndex(messagesText.getLineCount() - 1);
}
public String getRoom() { public String getRoom() {
return sessionId; return sessionId;
} }
@ -502,10 +556,10 @@ public class SessionView extends AbstractSessionView {
boolean down, boolean fill) { boolean down, boolean fill) {
gc.setAntialias(SWT.ON); gc.setAntialias(SWT.ON);
// "Erase" the canvas by filling it in with a rectangle. // "Erase" the canvas by filling it in with a rectangle.
gc.setBackground(Display.getCurrent().getSystemColor( gc.setBackground(Display.getDefault().getSystemColor(
SWT.COLOR_WIDGET_BACKGROUND)); SWT.COLOR_WIDGET_BACKGROUND));
gc.fillRectangle(0, 0, imgWidth, imgHeight); gc.fillRectangle(0, 0, imgWidth, imgHeight);
gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
int[] polyArray = null; int[] polyArray = null;
if (down) { if (down) {
polyArray = new int[] { 2, 3, 5, 6, 8, 3 }; polyArray = new int[] { 2, 3, 5, 6, 8, 3 };

View file

@ -34,12 +34,11 @@ import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority; 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.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.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager; import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr;
import com.raytheon.uf.viz.collaboration.ui.ColorChangeEvent; import com.raytheon.uf.viz.collaboration.ui.ColorChangeEvent;
import com.raytheon.uf.viz.collaboration.ui.SessionColorManager; import com.raytheon.uf.viz.collaboration.ui.login.LoginData;
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent; import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent;
import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent.CollaborationEventType; import com.raytheon.uf.viz.collaboration.ui.telestrator.event.CollaborationDrawingEvent.CollaborationEventType;
import com.raytheon.uf.viz.core.IGraphicsTarget; import com.raytheon.uf.viz.core.IGraphicsTarget;
@ -47,6 +46,7 @@ import com.raytheon.uf.viz.core.drawables.IWireframeShape;
import com.raytheon.uf.viz.core.drawables.PaintProperties; import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.uf.viz.core.rsc.capabilities.ColorableCapability;
import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability;
import com.raytheon.uf.viz.drawing.DrawingLayer; import com.raytheon.uf.viz.drawing.DrawingLayer;
import com.raytheon.uf.viz.drawing.PathDrawingResourceData; import com.raytheon.uf.viz.drawing.PathDrawingResourceData;
@ -83,9 +83,11 @@ public class CollaborationDrawingLayer extends DrawingLayer {
protected static final transient IUFStatusHandler statusHandler = UFStatus protected static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(CollaborationDrawingLayer.class); .getHandler(CollaborationDrawingLayer.class);
private Multimap<String, ShapeContainer> collaboratorShapes; private Multimap<UserId, ShapeContainer> collaboratorShapes;
private Multimap<String, ShapeContainer> deletedCollaboratorShapes; private Multimap<UserId, ShapeContainer> deletedCollaboratorShapes;
private String sessionId;
private Map<UserId, RGB> colors; private Map<UserId, RGB> colors;
@ -103,9 +105,9 @@ public class CollaborationDrawingLayer extends DrawingLayer {
AbstractEditor editor = EditorUtil AbstractEditor editor = EditorUtil
.getActiveEditorAs(AbstractEditor.class); .getActiveEditorAs(AbstractEditor.class);
CollaborationDataManager mgr = CollaborationDataManager.getInstance(); CollaborationDataManager mgr = CollaborationDataManager.getInstance();
// TODO, needs to be modified
for (String str : mgr.getSessions().keySet()) { for (String str : mgr.getSessions().keySet()) {
mgr.getSession(str).registerEventHandler(this); mgr.getSession(str).registerEventHandler(this);
break;
} }
} }
@ -130,7 +132,11 @@ public class CollaborationDrawingLayer extends DrawingLayer {
this.deletedCollaboratorShapes = LinkedHashMultimap.create(); this.deletedCollaboratorShapes = LinkedHashMultimap.create();
this.deletedCollaboratorShapes = Multimaps this.deletedCollaboratorShapes = Multimaps
.synchronizedMultimap(this.deletedCollaboratorShapes); .synchronizedMultimap(this.deletedCollaboratorShapes);
colors = SessionColorManager.getColorManager().getColors(); colors = SharedDisplaySessionMgr.getSessionContainer(sessionId)
.getColorManager().getColors();
LoginData data = CollaborationDataManager.getInstance().getLoginData();
UserId id = new UserId(data.getUser(), data.getServer());
color = colors.get(id);
} }
/* /*
@ -144,6 +150,8 @@ public class CollaborationDrawingLayer extends DrawingLayer {
@Override @Override
protected void paintInternal(IGraphicsTarget target, protected void paintInternal(IGraphicsTarget target,
PaintProperties paintProps) throws VizException { PaintProperties paintProps) throws VizException {
getCapability(ColorableCapability.class).setSuppressingMenuItems(true);
getCapability(OutlineCapability.class).setSuppressingMenuItems(true);
if (target instanceof DispatchGraphicsTarget) { if (target instanceof DispatchGraphicsTarget) {
// Ensure we paint to our own target only // Ensure we paint to our own target only
target = ((DispatchGraphicsTarget) target).getWrappedObject(); target = ((DispatchGraphicsTarget) target).getWrappedObject();
@ -153,12 +161,10 @@ public class CollaborationDrawingLayer extends DrawingLayer {
OutlineCapability outline = getCapability(OutlineCapability.class); OutlineCapability outline = getCapability(OutlineCapability.class);
// paint the shapes that come over from others // paint the shapes that come over from others
synchronized (collaboratorShapes) { synchronized (collaboratorShapes) {
for (String userName : collaboratorShapes.keySet()) { for (UserId userName : collaboratorShapes.keySet()) {
for (ShapeContainer sh : collaboratorShapes.get(userName)) { for (ShapeContainer sh : collaboratorShapes.get(userName)) {
if (sh != null) { if (sh != null) {
sh.getShape().clearLabels(); color = colors.get(userName);
RGB color = SessionColorManager.getColorManager()
.getColors().get(userName);
if (color == null) { if (color == null) {
color = new RGB(255, 0, 0); color = new RGB(255, 0, 0);
} }
@ -191,7 +197,7 @@ public class CollaborationDrawingLayer extends DrawingLayer {
allowDraw = !allowDraw; allowDraw = !allowDraw;
getEventBus().post(event); getEventBus().post(event);
case UNDO: case UNDO:
String userName = event.getUserName(); UserId userName = event.getUserName();
Collection<ShapeContainer> container = collaboratorShapes Collection<ShapeContainer> container = collaboratorShapes
.get(userName); .get(userName);
Iterator<ShapeContainer> itr = container.iterator(); Iterator<ShapeContainer> itr = container.iterator();
@ -222,11 +228,6 @@ public class CollaborationDrawingLayer extends DrawingLayer {
case CLEAR: case CLEAR:
resetTemp(); resetTemp();
clearSelfShapes(event.getUserName()); clearSelfShapes(event.getUserName());
// TODO check if session leader, otherwise only remove my wireframe
// shapes
if (/* if session leader */false) {
disposeInternal();
}
break; break;
case ERASE: case ERASE:
// TODO need to functionize this as it is mostly the same as // TODO need to functionize this as it is mostly the same as
@ -237,7 +238,7 @@ public class CollaborationDrawingLayer extends DrawingLayer {
/ (double) paintProps.getCanvasBounds().width; / (double) paintProps.getCanvasBounds().width;
double cursorSize = 16; double cursorSize = 16;
double size = extentPercentageX * cursorSize; double size = extentPercentageX * cursorSize;
Multimap<String, ShapeContainer> containers = HashMultimap.create(); Multimap<UserId, ShapeContainer> containers = HashMultimap.create();
synchronized (collaboratorShapes) { synchronized (collaboratorShapes) {
for (ShapeContainer cont : collaboratorShapes.get(userName)) { for (ShapeContainer cont : collaboratorShapes.get(userName)) {
Geometry line = event.getContainer().getGeom(); Geometry line = event.getContainer().getGeom();
@ -297,7 +298,7 @@ public class CollaborationDrawingLayer extends DrawingLayer {
/** /**
* @param userName * @param userName
*/ */
private void clearSelfShapes(String userName) { private void clearSelfShapes(UserId userName) {
for (ShapeContainer cont : collaboratorShapes.get(userName)) { for (ShapeContainer cont : collaboratorShapes.get(userName)) {
cont.getShape().dispose(); cont.getShape().dispose();
} }
@ -328,6 +329,7 @@ public class CollaborationDrawingLayer extends DrawingLayer {
@Override @Override
public void addTempEraseLine(LineString line) { public void addTempEraseLine(LineString line) {
super.addTempEraseLine(line); super.addTempEraseLine(line);
// for erasing the line on the fly...
// sendEraseEvent(line); // sendEraseEvent(line);
} }
@ -359,7 +361,9 @@ public class CollaborationDrawingLayer extends DrawingLayer {
super.undoAdd(); super.undoAdd();
CollaborationDrawingEvent event = new CollaborationDrawingEvent(); CollaborationDrawingEvent event = new CollaborationDrawingEvent();
event.setType(CollaborationEventType.UNDO); event.setType(CollaborationEventType.UNDO);
event.setUserName(CollaborationDataManager.getInstance().getLoginId()); LoginData data = CollaborationDataManager.getInstance().getLoginData();
UserId userId = new UserId(data.getUser(), data.getServer());
event.setUserName(userId);
sendGenericEvent(event); sendGenericEvent(event);
} }
@ -373,7 +377,9 @@ public class CollaborationDrawingLayer extends DrawingLayer {
super.redoAdd(); super.redoAdd();
CollaborationDrawingEvent event = new CollaborationDrawingEvent(); CollaborationDrawingEvent event = new CollaborationDrawingEvent();
event.setType(CollaborationEventType.REDO); event.setType(CollaborationEventType.REDO);
event.setUserName(CollaborationDataManager.getInstance().getLoginId()); LoginData data = CollaborationDataManager.getInstance().getLoginData();
UserId userId = new UserId(data.getUser(), data.getServer());
event.setUserName(userId);
sendGenericEvent(event); sendGenericEvent(event);
} }
@ -389,7 +395,9 @@ public class CollaborationDrawingLayer extends DrawingLayer {
CollaborationDrawingEvent eObject = new CollaborationDrawingEvent(); CollaborationDrawingEvent eObject = new CollaborationDrawingEvent();
eObject.setType(CollaborationEventType.ERASE); eObject.setType(CollaborationEventType.ERASE);
eObject.setContainer(container); eObject.setContainer(container);
eObject.setUserName(CollaborationDataManager.getInstance().getLoginId()); LoginData data = CollaborationDataManager.getInstance().getLoginData();
UserId userId = new UserId(data.getUser(), data.getServer());
eObject.setUserName(userId);
sendGenericEvent(eObject); sendGenericEvent(eObject);
} }
@ -399,7 +407,9 @@ public class CollaborationDrawingLayer extends DrawingLayer {
CollaborationDrawingEvent tObject = new CollaborationDrawingEvent(); CollaborationDrawingEvent tObject = new CollaborationDrawingEvent();
tObject.setType(CollaborationEventType.DRAW); tObject.setType(CollaborationEventType.DRAW);
tObject.setContainer(container); tObject.setContainer(container);
tObject.setUserName(CollaborationDataManager.getInstance().getLoginId()); LoginData data = CollaborationDataManager.getInstance().getLoginData();
UserId userId = new UserId(data.getUser(), data.getServer());
tObject.setUserName(userId);
sendGenericEvent(tObject); sendGenericEvent(tObject);
} }
@ -413,24 +423,21 @@ public class CollaborationDrawingLayer extends DrawingLayer {
super.reset(); super.reset();
CollaborationDrawingEvent event = new CollaborationDrawingEvent(); CollaborationDrawingEvent event = new CollaborationDrawingEvent();
event.setType(CollaborationEventType.CLEAR); event.setType(CollaborationEventType.CLEAR);
event.setUserName(CollaborationDataManager.getInstance().getLoginId()); // TODO, fix
// event.setUserName(CollaborationDataManager.getInstance().getLoginId());
sendGenericEvent(event); sendGenericEvent(event);
} }
private void sendGenericEvent(CollaborationDrawingEvent event) { private void sendGenericEvent(CollaborationDrawingEvent event) {
Map<String, IVenueSession> sessions = CollaborationDataManager try {
.getInstance().getSessions(); SharedDisplaySessionMgr.getSessionContainer(sessionId).getSession()
for (String str : sessions.keySet()) { .sendObjectToVenue(event);
try { } catch (CollaborationException e) {
((ISharedDisplaySession) sessions.get(str)) statusHandler.handle(Priority.ERROR, "Unable to send event", e);
.sendObjectToVenue(event);
} catch (CollaborationException e) {
statusHandler.handle(Priority.ERROR, "Unable to send event", e);
}
} }
} }
public void addCollaborationShape(String userName, ShapeContainer container) { public void addCollaborationShape(UserId userName, ShapeContainer container) {
// if (tempRemoteShape == null){ // if (tempRemoteShape == null){
tempRemoteShape = target.createWireframeShape(false, getDescriptor()); tempRemoteShape = target.createWireframeShape(false, getDescriptor());
// } // }
@ -459,6 +466,14 @@ public class CollaborationDrawingLayer extends DrawingLayer {
return allowDraw; return allowDraw;
} }
/**
* @param sessionId
* the sessionId to set
*/
public void setSessionId(String sessionId) {
this.sessionId = sessionId;
}
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -467,23 +482,23 @@ public class CollaborationDrawingLayer extends DrawingLayer {
@Override @Override
protected void disposeInternal() { protected void disposeInternal() {
super.disposeInternal(); super.disposeInternal();
if (/* is session leader */false) { // if (/* is session leader */false) {
// synchronized (collaboratorShapes) { // // synchronized (collaboratorShapes) {
// for (IWireframeShape shape : collaboratorShapes.values()) { // // for (IWireframeShape shape : collaboratorShapes.values()) {
// shape.dispose(); // // shape.dispose();
// } // // }
// } // // }
//
for (ShapeContainer cont : collaboratorShapes.values()) { // for (ShapeContainer cont : collaboratorShapes.values()) {
cont.getShape().dispose(); // cont.getShape().dispose();
} // }
//
for (ShapeContainer cont : deletedCollaboratorShapes.values()) { // for (ShapeContainer cont : deletedCollaboratorShapes.values()) {
cont.getShape().dispose(); // cont.getShape().dispose();
} // }
//
collaboratorShapes.clear(); // collaboratorShapes.clear();
deletedCollaboratorShapes.clear(); // deletedCollaboratorShapes.clear();
} // }
} }
} }

View file

@ -64,6 +64,7 @@ public class CollaborationPathDrawingResourceData extends
IDescriptor descriptor) throws VizException { IDescriptor descriptor) throws VizException {
CollaborationDrawingLayer layer = new CollaborationDrawingLayer(this, CollaborationDrawingLayer layer = new CollaborationDrawingLayer(this,
loadProperties); loadProperties);
layer.setSessionId(sessionId);
return layer; return layer;
} }

View file

@ -21,6 +21,7 @@ package com.raytheon.uf.viz.collaboration.ui.telestrator.event;
import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerialize;
import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
import com.raytheon.uf.viz.collaboration.ui.telestrator.ShapeContainer; import com.raytheon.uf.viz.collaboration.ui.telestrator.ShapeContainer;
import com.raytheon.uf.viz.drawing.events.DrawingEvent; import com.raytheon.uf.viz.drawing.events.DrawingEvent;
@ -52,7 +53,7 @@ public class CollaborationDrawingEvent extends DrawingEvent {
private ShapeContainer container; private ShapeContainer container;
@DynamicSerializeElement @DynamicSerializeElement
private String userName; private UserId userName;
@DynamicSerializeElement @DynamicSerializeElement
private CollaborationEventType type; private CollaborationEventType type;
@ -82,7 +83,7 @@ public class CollaborationDrawingEvent extends DrawingEvent {
/** /**
* @return the userName * @return the userName
*/ */
public String getUserName() { public UserId getUserName() {
return userName; return userName;
} }
@ -90,7 +91,7 @@ public class CollaborationDrawingEvent extends DrawingEvent {
* @param userName * @param userName
* the userName to set * the userName to set
*/ */
public void setUserName(String userName) { public void setUserName(UserId userName) {
this.userName = userName; this.userName = userName;
} }

View file

@ -22,6 +22,7 @@ package com.raytheon.uf.viz.collaboration.comm.identity;
import java.util.List; import java.util.List;
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue; import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenue;
import com.raytheon.uf.viz.collaboration.comm.identity.invite.VenueInvite;
/** /**
* *
@ -80,7 +81,7 @@ public interface IVenueSession extends ISession {
* The intended subject of the venue conversation. * The intended subject of the venue conversation.
* @return * @return
*/ */
public void sendInvitation(String id, String body) public void sendInvitation(String id, VenueInvite invite)
throws CollaborationException; throws CollaborationException;
/** /**
@ -92,7 +93,7 @@ public interface IVenueSession extends ISession {
* Any text that the user may wish to include. * Any text that the user may wish to include.
* @return * @return
*/ */
public void sendInvitation(List<String> ids, String body) public void sendInvitation(List<String> ids, VenueInvite invite)
throws CollaborationException; throws CollaborationException;
} }

View file

@ -0,0 +1,148 @@
/**
* 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.provider.event;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
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;
/**
* TODO Add Description
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Apr 19, 2012 mnash Initial creation
*
* </pre>
*
* @author mnash
* @version 1.0
*/
@DynamicSerialize
public class ColorPopulator {
@DynamicSerializeElement
private List<UserId> userName;
@DynamicSerializeElement
private List<Integer> red;
@DynamicSerializeElement
private List<Integer> green;
@DynamicSerializeElement
private List<Integer> blue;
public ColorPopulator() {
}
public ColorPopulator(Map<UserId, RGB> rgbs) {
userName = new ArrayList<UserId>();
red = new ArrayList<Integer>();
green = new ArrayList<Integer>();
blue = new ArrayList<Integer>();
for (UserId key : rgbs.keySet()) {
userName.add(key);
red.add(rgbs.get(key).red);
green.add(rgbs.get(key).green);
blue.add(rgbs.get(key).blue);
}
}
public Map<UserId, RGB> getColors() {
Map<UserId, RGB> colors = new HashMap<UserId, RGB>();
for (int i = 0; i < userName.size(); i++) {
colors.put(userName.get(i),
new RGB(red.get(i), green.get(i), blue.get(i)));
}
return colors;
}
/**
* @return the userName
*/
public List<UserId> getUserName() {
return userName;
}
/**
* @param userName
* the userName to set
*/
public void setUserName(List<UserId> userName) {
this.userName = userName;
}
/**
* @return the red
*/
public List<Integer> getRed() {
return red;
}
/**
* @param red
* the red to set
*/
public void setRed(List<Integer> red) {
this.red = red;
}
/**
* @return the green
*/
public List<Integer> getGreen() {
return green;
}
/**
* @param green
* the green to set
*/
public void setGreen(List<Integer> green) {
this.green = green;
}
/**
* @return the blue
*/
public List<Integer> getBlue() {
return blue;
}
/**
* @param blue
* the blue to set
*/
public void setBlue(List<Integer> blue) {
this.blue = blue;
}
}

View file

@ -427,11 +427,13 @@ public class CollaborationConnection implements IEventPublisher {
String host = Tools.parseHost(account); String host = Tools.parseHost(account);
UserId me = new UserId(name, host); UserId me = new UserId(name, host);
session.setUserId(me); session.setUserId(me);
if (invitation instanceof SharedDisplayVenueInvite) { if (invitation.getInvite() instanceof SharedDisplayVenueInvite) {
SharedDisplayVenueInvite invite = (SharedDisplayVenueInvite) invitation; SharedDisplayVenueInvite invite = (SharedDisplayVenueInvite) invitation
.getInvite();
session.setCurrentDataProvider(invite.getDataProvider()); session.setCurrentDataProvider(invite.getDataProvider());
session.setCurrentSessionLeader(invite.getSessionLeader()); session.setCurrentSessionLeader(invite.getSessionLeader());
} }
sessions.put(session.getSessionId(), session); sessions.put(session.getSessionId(), session);
} }
} catch (Exception e) { } catch (Exception e) {

View file

@ -24,15 +24,13 @@ import org.eclipse.ecf.core.IContainer;
import com.google.common.eventbus.EventBus; import com.google.common.eventbus.EventBus;
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException; 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.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.identity.user.SharedDisplayRole;
import com.raytheon.uf.viz.collaboration.comm.provider.TextMessage; 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.Tools;
import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId;
/** /**
* A session that shares editors. * TODO Add Description
* *
* <pre> * <pre>
* *
@ -116,7 +114,7 @@ public class SharedDisplaySession extends VenueSession implements
} }
/** /**
* @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#hasRole(com.raytheon.uf.viz.collaboration.comm.identity.user.SharedDisplayRole) * @see com.raytheon.uf.viz.collaboration.comm.identity.ISharedDisplaySession#hasRole(com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole)
*/ */
@Override @Override
public boolean hasRole(SharedDisplayRole role) { public boolean hasRole(SharedDisplayRole role) {
@ -140,15 +138,4 @@ public class SharedDisplaySession extends VenueSession implements
public void setCurrentDataProvider(UserId id) { public void setCurrentDataProvider(UserId id) {
dataProvider = id; dataProvider = id;
} }
@Override
protected VenueInvite buildInvite(String 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;
}
} }

View file

@ -232,12 +232,11 @@ public class VenueSession extends BaseSession implements IVenueSession {
* java.lang.String, java.lang.String, java.lang.String) * java.lang.String, java.lang.String, java.lang.String)
*/ */
@Override @Override
public void sendInvitation(String id, String body) public void sendInvitation(String id, VenueInvite invite)
throws CollaborationException { throws CollaborationException {
IChatRoomInvitationSender sender = getConnectionPresenceAdapter() IChatRoomInvitationSender sender = getConnectionPresenceAdapter()
.getChatRoomManager().getInvitationSender(); .getChatRoomManager().getInvitationSender();
if (sender != null) { if (sender != null) {
VenueInvite invite = buildInvite(body);
String msgBody = Tools.marshallData(invite); String msgBody = Tools.marshallData(invite);
ID roomId = venueInfo.getConnectedID(); ID roomId = venueInfo.getConnectedID();
ID userId = IDFactory.getDefault().createID( ID userId = IDFactory.getDefault().createID(
@ -266,11 +265,11 @@ public class VenueSession extends BaseSession implements IVenueSession {
* java.lang.String, java.lang.String, java.lang.String) * java.lang.String, java.lang.String, java.lang.String)
*/ */
@Override @Override
public void sendInvitation(List<String> ids, String body) public void sendInvitation(List<String> ids, VenueInvite invite)
throws CollaborationException { throws CollaborationException {
if (ids != null) { if (ids != null) {
for (String id : ids) { for (String id : ids) {
sendInvitation(id, body); sendInvitation(id, invite);
} }
} }
} }
@ -510,12 +509,4 @@ public class VenueSession extends BaseSession implements IVenueSession {
} }
return message; return message;
} }
protected VenueInvite buildInvite(String msg) {
VenueInvite invite = new VenueInvite();
invite.setMessage(msg);
invite.setSessionId(this.sessionId);
invite.setSubject(this.getSubject());
return invite;
}
} }