diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/data/SessionContainer.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/data/SessionContainer.java index 40fafd8ae7..b768d7b6ee 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/data/SessionContainer.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/data/SessionContainer.java @@ -124,14 +124,9 @@ public class SessionContainer { * @return the colorManager */ public SessionColorManager getColorManager() { + if (colorManager == null) { + colorManager = new SessionColorManager(); + } return colorManager; } - - /** - * @param colorManager - * the colorManager to set - */ - public void setColorManager(SessionColorManager colorManager) { - this.colorManager = colorManager; - } } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationGroupView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationGroupView.java index 7818be87e5..8edb06cee6 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationGroupView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/CollaborationGroupView.java @@ -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.Type; 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.event.IRosterChangeEvent; 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.IRosterGroup; 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.OrphanGroup; 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.login.ChangeStatusDialog; import com.raytheon.uf.viz.collaboration.ui.login.LoginData; @@ -253,8 +257,15 @@ public class CollaborationGroupView extends ViewPart implements IPartListener { System.out.println("subject: " + session.getVenue().getInfo().getVenueSubject()); try { - session.sendInvitation(ids, session.getVenue().getInfo() - .getVenueSubject()); + VenueInvite invite = null; + 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) { statusHandler.handle(Priority.PROBLEM, "Error sending invitiation", e); @@ -637,13 +648,47 @@ public class CollaborationGroupView extends ViewPart implements IPartListener { usersList.add(user.getId()); } 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) { 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) { diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/ColorChangeEvent.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/ColorChangeEvent.java index dd43db8fa7..86b498e7ba 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/ColorChangeEvent.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/ColorChangeEvent.java @@ -57,7 +57,6 @@ public class ColorChangeEvent { private Integer blue; public ColorChangeEvent() { - } public ColorChangeEvent(UserId user, RGB color) { diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/SessionColorManager.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/SessionColorManager.java index 3af26a7873..1bb7003aa5 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/SessionColorManager.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/SessionColorManager.java @@ -44,29 +44,19 @@ import com.raytheon.viz.core.ColorUtil; * @version 1.0 */ -// TODO make so this supports multiple sessions public class SessionColorManager { private Map colors; - private static SessionColorManager colorManager = 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) { colors = new HashMap(); + rgbPresets = ColorUtil.getResourceColorPresets(); } } @@ -77,26 +67,8 @@ public class SessionColorManager { return colors; } - /** - * @param colors - * the colors to set - */ - public void setColors(Map 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 void setColors(Map map) { + colors = map; } public RGB getColorFromUser(UserId user) { @@ -106,6 +78,19 @@ public class SessionColorManager { 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() { colors.clear(); } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/DataProviderEventController.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/DataProviderEventController.java index ac56643182..94f8b9b894 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/DataProviderEventController.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/role/DataProviderEventController.java @@ -20,6 +20,7 @@ package com.raytheon.uf.viz.collaboration.ui.role; import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Event; 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.data.SessionContainer; 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.SharedEditorData; import com.raytheon.uf.viz.collaboration.ui.editor.SharedResource; @@ -94,13 +97,24 @@ public class DataProviderEventController extends AbstractRoleEventController { AbstractEditor editor = EditorUtil .getActiveEditorAs(AbstractEditor.class); 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 { + session.sendObjectToVenue(cce); session.sendObjectToPeer(event.getParticipant(), se); } catch (CollaborationException e) { statusHandler.handle(Priority.PROBLEM, "Error sending initialization data to new participant " + event.getParticipant().getName(), e); } + } } @@ -213,6 +227,10 @@ public class DataProviderEventController extends AbstractRoleEventController { @Override public void startup() { super.startup(); + + SessionColorManager manager = SharedDisplaySessionMgr + .getSessionContainer(session.getSessionId()).getColorManager(); + manager.addUser(session.getCurrentDataProvider()); super.activateTelestrator(); wrappingListener = new ResourceWrapperListener(); for (IDisplayPaneContainer container : SharedDisplaySessionMgr diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AbstractSessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AbstractSessionView.java index 6a117e68b5..65969c9b41 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AbstractSessionView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/AbstractSessionView.java @@ -34,7 +34,6 @@ import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; 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.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; /** @@ -87,8 +85,6 @@ public abstract class AbstractSessionView extends ViewPart implements private StyledText composeText; - protected Map colors; - // protected Action chatAction; protected abstract String getSessionImageName(); @@ -103,12 +99,6 @@ public abstract class AbstractSessionView extends ViewPart implements public AbstractSessionView() { imageMap = new HashMap(); - colors = new HashMap(); - Map rgbs = SessionColorManager.getColorManager() - .getColors(); - for (UserId user : rgbs.keySet()) { - colors.put(user, new Color(Display.getCurrent(), rgbs.get(user))); - } } private void initComponents(Composite parent) { @@ -273,18 +263,14 @@ public abstract class AbstractSessionView extends ViewPart implements } } - StyleRange range = new StyleRange(messagesText.getCharCount() + offset, - 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); + styleAndAppendText(sb, offset, name, fqName, ranges); // room for other fun things here, such as sounds and such executeSightsSounds(); } + protected abstract void styleAndAppendText(StringBuilder sb, int offset, + String name, String fqName, List ranges); + /** * Find keys words in body of message starting at offset. /** * @@ -339,10 +325,6 @@ public abstract class AbstractSessionView extends ViewPart implements getViewSite().getWorkbenchWindow().getPartService() .removePartListener(this); } - for (Color color : colors.values()) { - color.dispose(); - } - SessionColorManager.getColorManager().clearColors(); } /* diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java index 72e96f9811..9e737f0a7c 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/ParticipantsLabelProvider.java @@ -28,13 +28,17 @@ import org.eclipse.jface.viewers.ILabelProviderListener; import org.eclipse.jface.viewers.ITableColorProvider; import org.eclipse.jface.viewers.ITableFontProvider; import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; 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.data.CollaborationDataManager; import com.raytheon.uf.viz.collaboration.data.CollaborationUser; +import com.raytheon.uf.viz.collaboration.data.SharedDisplaySessionMgr; import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils; /** @@ -63,6 +67,8 @@ public class ParticipantsLabelProvider implements ITableColorProvider, protected Map imageMap; + protected Map colors; + public ParticipantsLabelProvider() { listeners = new ArrayList(); imageMap = new HashMap(); @@ -78,6 +84,12 @@ public class ParticipantsLabelProvider implements ITableColorProvider, for (String key : imageMap.keySet()) { imageMap.get(key).dispose(); } + + if (colors != null) { + for (Color col : colors.values()) { + col.dispose(); + } + } } @Override @@ -128,7 +140,20 @@ public class ParticipantsLabelProvider implements ITableColorProvider, @Override public Color getForeground(Object element, int columnIndex) { - return null; + if (colors == null) { + colors = new HashMap(); + } + 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 diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/PeerToPeerView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/PeerToPeerView.java index 4a05233a0c..45c73f645a 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/PeerToPeerView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/PeerToPeerView.java @@ -20,9 +20,15 @@ package com.raytheon.uf.viz.collaboration.ui.session; * further licensing information. **/ +import java.util.List; + import org.eclipse.jface.action.IMenuManager; +import org.eclipse.swt.SWT; 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.Display; import com.raytheon.uf.common.status.IUFStatusHandler; 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"; + private static Color userColor = null; + + private static Color chatterColor = null; + protected IMessageListener messageListener; private IQualifiedID peer; public PeerToPeerView() { 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 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() { return PEER_TO_PEER_IMAGE_NAME; } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java index d542e3df2a..ef7165985a 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/session/SessionView.java @@ -21,7 +21,9 @@ package com.raytheon.uf.viz.collaboration.ui.session; **/ import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.eclipse.jface.action.Action; 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.custom.CLabel; import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.custom.StyleRange; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseTrackAdapter; +import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; 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.data.CollaborationDataManager; 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.core.VizApp; @@ -115,6 +121,10 @@ public class SessionView extends AbstractSessionView { protected Action chatAction; + protected Map colors; + + protected Map mappedColors; + public SessionView() { super(); } @@ -124,6 +134,11 @@ public class SessionView extends AbstractSessionView { super.createPartControl(parent); createActions(); createContextMenu(); + SharedDisplaySessionMgr.getSessionContainer(sessionId).getSession() + .getEventPublisher().register(this); + colors = SharedDisplaySessionMgr.getSessionContainer(sessionId) + .getColorManager().getColors(); + mappedColors = new HashMap(); } @Override @@ -396,6 +411,18 @@ public class SessionView extends AbstractSessionView { disposeArrow(highlightedRightArrow); disposeArrow(downArrow); 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(); } @@ -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 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() { return sessionId; } @@ -502,10 +556,10 @@ public class SessionView extends AbstractSessionView { boolean down, boolean fill) { gc.setAntialias(SWT.ON); // "Erase" the canvas by filling it in with a rectangle. - gc.setBackground(Display.getCurrent().getSystemColor( + gc.setBackground(Display.getDefault().getSystemColor( SWT.COLOR_WIDGET_BACKGROUND)); 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; if (down) { polyArray = new int[] { 2, 3, 5, 6, 8, 3 }; diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationDrawingLayer.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationDrawingLayer.java index 8ecc61475b..c9df39de12 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationDrawingLayer.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationDrawingLayer.java @@ -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.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.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.login.LoginData; 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.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.exception.VizException; 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.drawing.DrawingLayer; import com.raytheon.uf.viz.drawing.PathDrawingResourceData; @@ -83,9 +83,11 @@ public class CollaborationDrawingLayer extends DrawingLayer { protected static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(CollaborationDrawingLayer.class); - private Multimap collaboratorShapes; + private Multimap collaboratorShapes; - private Multimap deletedCollaboratorShapes; + private Multimap deletedCollaboratorShapes; + + private String sessionId; private Map colors; @@ -103,9 +105,9 @@ public class CollaborationDrawingLayer extends DrawingLayer { AbstractEditor editor = EditorUtil .getActiveEditorAs(AbstractEditor.class); CollaborationDataManager mgr = CollaborationDataManager.getInstance(); + // TODO, needs to be modified for (String str : mgr.getSessions().keySet()) { mgr.getSession(str).registerEventHandler(this); - break; } } @@ -130,7 +132,11 @@ public class CollaborationDrawingLayer extends DrawingLayer { this.deletedCollaboratorShapes = LinkedHashMultimap.create(); this.deletedCollaboratorShapes = Multimaps .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 protected void paintInternal(IGraphicsTarget target, PaintProperties paintProps) throws VizException { + getCapability(ColorableCapability.class).setSuppressingMenuItems(true); + getCapability(OutlineCapability.class).setSuppressingMenuItems(true); if (target instanceof DispatchGraphicsTarget) { // Ensure we paint to our own target only target = ((DispatchGraphicsTarget) target).getWrappedObject(); @@ -153,12 +161,10 @@ public class CollaborationDrawingLayer extends DrawingLayer { OutlineCapability outline = getCapability(OutlineCapability.class); // paint the shapes that come over from others synchronized (collaboratorShapes) { - for (String userName : collaboratorShapes.keySet()) { + for (UserId userName : collaboratorShapes.keySet()) { for (ShapeContainer sh : collaboratorShapes.get(userName)) { if (sh != null) { - sh.getShape().clearLabels(); - RGB color = SessionColorManager.getColorManager() - .getColors().get(userName); + color = colors.get(userName); if (color == null) { color = new RGB(255, 0, 0); } @@ -191,7 +197,7 @@ public class CollaborationDrawingLayer extends DrawingLayer { allowDraw = !allowDraw; getEventBus().post(event); case UNDO: - String userName = event.getUserName(); + UserId userName = event.getUserName(); Collection container = collaboratorShapes .get(userName); Iterator itr = container.iterator(); @@ -222,11 +228,6 @@ public class CollaborationDrawingLayer extends DrawingLayer { case CLEAR: resetTemp(); clearSelfShapes(event.getUserName()); - // TODO check if session leader, otherwise only remove my wireframe - // shapes - if (/* if session leader */false) { - disposeInternal(); - } break; case ERASE: // 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 cursorSize = 16; double size = extentPercentageX * cursorSize; - Multimap containers = HashMultimap.create(); + Multimap containers = HashMultimap.create(); synchronized (collaboratorShapes) { for (ShapeContainer cont : collaboratorShapes.get(userName)) { Geometry line = event.getContainer().getGeom(); @@ -297,7 +298,7 @@ public class CollaborationDrawingLayer extends DrawingLayer { /** * @param userName */ - private void clearSelfShapes(String userName) { + private void clearSelfShapes(UserId userName) { for (ShapeContainer cont : collaboratorShapes.get(userName)) { cont.getShape().dispose(); } @@ -328,6 +329,7 @@ public class CollaborationDrawingLayer extends DrawingLayer { @Override public void addTempEraseLine(LineString line) { super.addTempEraseLine(line); + // for erasing the line on the fly... // sendEraseEvent(line); } @@ -359,7 +361,9 @@ public class CollaborationDrawingLayer extends DrawingLayer { super.undoAdd(); CollaborationDrawingEvent event = new CollaborationDrawingEvent(); 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); } @@ -373,7 +377,9 @@ public class CollaborationDrawingLayer extends DrawingLayer { super.redoAdd(); CollaborationDrawingEvent event = new CollaborationDrawingEvent(); 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); } @@ -389,7 +395,9 @@ public class CollaborationDrawingLayer extends DrawingLayer { CollaborationDrawingEvent eObject = new CollaborationDrawingEvent(); eObject.setType(CollaborationEventType.ERASE); 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); } @@ -399,7 +407,9 @@ public class CollaborationDrawingLayer extends DrawingLayer { CollaborationDrawingEvent tObject = new CollaborationDrawingEvent(); tObject.setType(CollaborationEventType.DRAW); 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); } @@ -413,24 +423,21 @@ public class CollaborationDrawingLayer extends DrawingLayer { super.reset(); CollaborationDrawingEvent event = new CollaborationDrawingEvent(); event.setType(CollaborationEventType.CLEAR); - event.setUserName(CollaborationDataManager.getInstance().getLoginId()); + // TODO, fix + // event.setUserName(CollaborationDataManager.getInstance().getLoginId()); sendGenericEvent(event); } private void sendGenericEvent(CollaborationDrawingEvent event) { - Map sessions = CollaborationDataManager - .getInstance().getSessions(); - for (String str : sessions.keySet()) { - try { - ((ISharedDisplaySession) sessions.get(str)) - .sendObjectToVenue(event); - } catch (CollaborationException e) { - statusHandler.handle(Priority.ERROR, "Unable to send event", e); - } + try { + SharedDisplaySessionMgr.getSessionContainer(sessionId).getSession() + .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){ tempRemoteShape = target.createWireframeShape(false, getDescriptor()); // } @@ -459,6 +466,14 @@ public class CollaborationDrawingLayer extends DrawingLayer { return allowDraw; } + /** + * @param sessionId + * the sessionId to set + */ + public void setSessionId(String sessionId) { + this.sessionId = sessionId; + } + /* * (non-Javadoc) * @@ -467,23 +482,23 @@ public class CollaborationDrawingLayer extends DrawingLayer { @Override protected void disposeInternal() { super.disposeInternal(); - if (/* is session leader */false) { - // synchronized (collaboratorShapes) { - // for (IWireframeShape shape : collaboratorShapes.values()) { - // shape.dispose(); - // } - // } - - for (ShapeContainer cont : collaboratorShapes.values()) { - cont.getShape().dispose(); - } - - for (ShapeContainer cont : deletedCollaboratorShapes.values()) { - cont.getShape().dispose(); - } - - collaboratorShapes.clear(); - deletedCollaboratorShapes.clear(); - } + // if (/* is session leader */false) { + // // synchronized (collaboratorShapes) { + // // for (IWireframeShape shape : collaboratorShapes.values()) { + // // shape.dispose(); + // // } + // // } + // + // for (ShapeContainer cont : collaboratorShapes.values()) { + // cont.getShape().dispose(); + // } + // + // for (ShapeContainer cont : deletedCollaboratorShapes.values()) { + // cont.getShape().dispose(); + // } + // + // collaboratorShapes.clear(); + // deletedCollaboratorShapes.clear(); + // } } } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationPathDrawingResourceData.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationPathDrawingResourceData.java index 12abd1c59d..8dabd9b0b5 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationPathDrawingResourceData.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/CollaborationPathDrawingResourceData.java @@ -64,6 +64,7 @@ public class CollaborationPathDrawingResourceData extends IDescriptor descriptor) throws VizException { CollaborationDrawingLayer layer = new CollaborationDrawingLayer(this, loadProperties); + layer.setSessionId(sessionId); return layer; } diff --git a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/event/CollaborationDrawingEvent.java b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/event/CollaborationDrawingEvent.java index 45c1d95abe..b1b563734e 100644 --- a/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/event/CollaborationDrawingEvent.java +++ b/cave/com.raytheon.uf.viz.collaboration.ui/src/com/raytheon/uf/viz/collaboration/ui/telestrator/event/CollaborationDrawingEvent.java @@ -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.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.drawing.events.DrawingEvent; @@ -52,7 +53,7 @@ public class CollaborationDrawingEvent extends DrawingEvent { private ShapeContainer container; @DynamicSerializeElement - private String userName; + private UserId userName; @DynamicSerializeElement private CollaborationEventType type; @@ -82,7 +83,7 @@ public class CollaborationDrawingEvent extends DrawingEvent { /** * @return the userName */ - public String getUserName() { + public UserId getUserName() { return userName; } @@ -90,7 +91,7 @@ public class CollaborationDrawingEvent extends DrawingEvent { * @param userName * the userName to set */ - public void setUserName(String userName) { + public void setUserName(UserId userName) { this.userName = userName; } diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/identity/IVenueSession.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/identity/IVenueSession.java index c3d895bc07..eacb121203 100644 --- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/identity/IVenueSession.java +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/identity/IVenueSession.java @@ -22,6 +22,7 @@ package com.raytheon.uf.viz.collaboration.comm.identity; import java.util.List; 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. * @return */ - public void sendInvitation(String id, String body) + public void sendInvitation(String id, VenueInvite invite) throws CollaborationException; /** @@ -92,7 +93,7 @@ public interface IVenueSession extends ISession { * Any text that the user may wish to include. * @return */ - public void sendInvitation(List ids, String body) + public void sendInvitation(List ids, VenueInvite invite) throws CollaborationException; } diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/event/ColorPopulator.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/event/ColorPopulator.java new file mode 100644 index 0000000000..3adedce000 --- /dev/null +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/event/ColorPopulator.java @@ -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 + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Apr 19, 2012            mnash     Initial creation
+ * 
+ * 
+ * + * @author mnash + * @version 1.0 + */ + +@DynamicSerialize +public class ColorPopulator { + @DynamicSerializeElement + private List userName; + + @DynamicSerializeElement + private List red; + + @DynamicSerializeElement + private List green; + + @DynamicSerializeElement + private List blue; + + public ColorPopulator() { + } + + public ColorPopulator(Map rgbs) { + userName = new ArrayList(); + red = new ArrayList(); + green = new ArrayList(); + blue = new ArrayList(); + 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 getColors() { + Map colors = new HashMap(); + 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 getUserName() { + return userName; + } + + /** + * @param userName + * the userName to set + */ + public void setUserName(List userName) { + this.userName = userName; + } + + /** + * @return the red + */ + public List getRed() { + return red; + } + + /** + * @param red + * the red to set + */ + public void setRed(List red) { + this.red = red; + } + + /** + * @return the green + */ + public List getGreen() { + return green; + } + + /** + * @param green + * the green to set + */ + public void setGreen(List green) { + this.green = green; + } + + /** + * @return the blue + */ + public List getBlue() { + return blue; + } + + /** + * @param blue + * the blue to set + */ + public void setBlue(List blue) { + this.blue = blue; + } +} diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java index 9c2b7028f5..376ca55d1c 100644 --- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/CollaborationConnection.java @@ -427,11 +427,13 @@ public class CollaborationConnection implements IEventPublisher { String host = Tools.parseHost(account); UserId me = new UserId(name, host); session.setUserId(me); - if (invitation instanceof SharedDisplayVenueInvite) { - SharedDisplayVenueInvite invite = (SharedDisplayVenueInvite) invitation; + if (invitation.getInvite() instanceof SharedDisplayVenueInvite) { + SharedDisplayVenueInvite invite = (SharedDisplayVenueInvite) invitation + .getInvite(); session.setCurrentDataProvider(invite.getDataProvider()); session.setCurrentSessionLeader(invite.getSessionLeader()); } + sessions.put(session.getSessionId(), session); } } catch (Exception e) { diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java index f2880a435b..36d611039a 100644 --- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java +++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/SharedDisplaySession.java @@ -24,15 +24,13 @@ 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; import com.raytheon.uf.viz.collaboration.comm.provider.Tools; import com.raytheon.uf.viz.collaboration.comm.provider.user.UserId; /** - * A session that shares editors. + * TODO Add Description * *
  * 
@@ -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
     public boolean hasRole(SharedDisplayRole role) {
@@ -140,15 +138,4 @@ public class SharedDisplaySession extends VenueSession implements
     public void setCurrentDataProvider(UserId 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;
-    }
 }
diff --git a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java
index 5ce9be4f17..474e3f186e 100644
--- a/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java
+++ b/cave/com.raytheon.uf.viz.collaboration/src/com/raytheon/uf/viz/collaboration/comm/provider/session/VenueSession.java
@@ -232,12 +232,11 @@ public class VenueSession extends BaseSession implements IVenueSession {
      *      java.lang.String, java.lang.String, java.lang.String)
      */
     @Override
-    public void sendInvitation(String id, String body)
+    public void sendInvitation(String id, VenueInvite invite)
             throws CollaborationException {
         IChatRoomInvitationSender sender = getConnectionPresenceAdapter()
                 .getChatRoomManager().getInvitationSender();
         if (sender != null) {
-            VenueInvite invite = buildInvite(body);
             String msgBody = Tools.marshallData(invite);
             ID roomId = venueInfo.getConnectedID();
             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)
      */
     @Override
-    public void sendInvitation(List ids, String body)
+    public void sendInvitation(List ids, VenueInvite invite)
             throws CollaborationException {
         if (ids != null) {
             for (String id : ids) {
-                sendInvitation(id, body);
+                sendInvitation(id, invite);
             }
         }
     }
@@ -510,12 +509,4 @@ public class VenueSession extends BaseSession implements IVenueSession {
         }
         return message;
     }
-
-    protected VenueInvite buildInvite(String msg) {
-        VenueInvite invite = new VenueInvite();
-        invite.setMessage(msg);
-        invite.setSessionId(this.sessionId);
-        invite.setSubject(this.getSubject());
-        return invite;
-    }
 }