Issue #244 Gett color coding on messages
Change-Id: Ibe54e07c26336899198093b0a104f8796ebc0d47 Former-commit-id:24affbfe73
[formerly9bd5aa57b6
] [formerly24affbfe73
[formerly9bd5aa57b6
] [formerlyd9ca310d94
[formerly 3fa0c543f02ccb556b5d1898e359f1e2b6e63819]]] Former-commit-id:d9ca310d94
Former-commit-id:7ebba67ec3
[formerly30fe4140ba
] Former-commit-id:c2c3215e2d
This commit is contained in:
parent
e3b025bcfc
commit
5ce1b1bdd6
9 changed files with 161 additions and 160 deletions
|
@ -17,6 +17,7 @@ Require-Bundle: com.raytheon.viz.ui,
|
||||||
org.geotools;bundle-version="2.6.4",
|
org.geotools;bundle-version="2.6.4",
|
||||||
com.google.guava;bundle-version="1.0.0",
|
com.google.guava;bundle-version="1.0.0",
|
||||||
com.raytheon.viz.core;bundle-version="1.12.1174"
|
com.raytheon.viz.core;bundle-version="1.12.1174"
|
||||||
|
com.raytheon.uf.viz.drawing;bundle-version="1.0.0"
|
||||||
Import-Package: com.raytheon.uf.common.status,
|
Import-Package: com.raytheon.uf.common.status,
|
||||||
com.raytheon.uf.viz.core.maps.display,
|
com.raytheon.uf.viz.core.maps.display,
|
||||||
com.raytheon.uf.viz.core.maps.rsc,
|
com.raytheon.uf.viz.core.maps.rsc,
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class CollaborationUser extends CollaborationNode implements
|
||||||
return "contact_disabled";
|
return "contact_disabled";
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataUser.RoleType[] getRoles(String session) {
|
public DataUser.RoleType[] getRoles() {
|
||||||
return CollaborationDataManager.getInstance().getUser(id)
|
return CollaborationDataManager.getInstance().getUser(id)
|
||||||
.getSessionRoles(session);
|
.getSessionRoles(session);
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ import org.eclipse.ui.IWorkbenchPage;
|
||||||
import org.eclipse.ui.PartInitException;
|
import org.eclipse.ui.PartInitException;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.part.ViewPart;
|
import org.eclipse.ui.part.ViewPart;
|
||||||
|
import org.osgi.framework.Bundle;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -93,6 +94,7 @@ import com.raytheon.uf.viz.collaboration.ui.session.CollaborationSessionView;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView;
|
import com.raytheon.uf.viz.collaboration.ui.session.PeerToPeerView;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.session.SessionView;
|
import com.raytheon.uf.viz.collaboration.ui.session.SessionView;
|
||||||
import com.raytheon.uf.viz.core.VizApp;
|
import com.raytheon.uf.viz.core.VizApp;
|
||||||
|
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||||
import com.raytheon.uf.viz.drawing.PathToolbar;
|
import com.raytheon.uf.viz.drawing.PathToolbar;
|
||||||
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||||
|
|
||||||
|
@ -207,6 +209,7 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private void createActions() {
|
private void createActions() {
|
||||||
|
Bundle bundle = Activator.getDefault().getBundle();
|
||||||
|
|
||||||
createSessionAction = new Action("Create Session...") {
|
createSessionAction = new Action("Create Session...") {
|
||||||
@Override
|
@Override
|
||||||
|
@ -215,8 +218,8 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
createSessionAction.setImageDescriptor(CollaborationUtils
|
createSessionAction.setImageDescriptor(IconUtil.getImageDescriptor(
|
||||||
.getImageDescriptor("add_collaborate.gif"));
|
bundle, "add_collaborate.gif"));
|
||||||
createSessionAction.setEnabled(CollaborationDataManager.getInstance()
|
createSessionAction.setEnabled(CollaborationDataManager.getInstance()
|
||||||
.isConnected());
|
.isConnected());
|
||||||
|
|
||||||
|
@ -228,8 +231,8 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
isChecked());
|
isChecked());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
linkToEditorAction.setImageDescriptor(CollaborationUtils
|
linkToEditorAction.setImageDescriptor(IconUtil.getImageDescriptor(
|
||||||
.getImageDescriptor("link_to_editor.gif"));
|
bundle, "link_to_editor.gif"));
|
||||||
linkToEditorAction.setChecked(CollaborationDataManager.getInstance()
|
linkToEditorAction.setChecked(CollaborationDataManager.getInstance()
|
||||||
.getLinkCollaboration());
|
.getLinkCollaboration());
|
||||||
|
|
||||||
|
@ -243,8 +246,8 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
// session.sendInvitation(invitation)
|
// session.sendInvitation(invitation)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
inviteAction.setImageDescriptor(CollaborationUtils
|
inviteAction.setImageDescriptor(IconUtil.getImageDescriptor(bundle,
|
||||||
.getImageDescriptor("invite.gif"));
|
"invite.gif"));
|
||||||
|
|
||||||
joinAction = new Action("Join Session") {
|
joinAction = new Action("Join Session") {
|
||||||
@Override
|
@Override
|
||||||
|
@ -266,8 +269,8 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
populateTree();
|
populateTree();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
logonAction.setImageDescriptor(CollaborationUtils
|
logonAction.setImageDescriptor(IconUtil.getImageDescriptor(bundle,
|
||||||
.getImageDescriptor("logout.gif"));
|
"logout.gif"));
|
||||||
|
|
||||||
logoutAction = new Action("Logout") {
|
logoutAction = new Action("Logout") {
|
||||||
@Override
|
@Override
|
||||||
|
@ -276,8 +279,8 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
logoutAction.setImageDescriptor(CollaborationUtils
|
logoutAction.setImageDescriptor(IconUtil.getImageDescriptor(bundle,
|
||||||
.getImageDescriptor("logout.gif"));
|
"logout.gif"));
|
||||||
|
|
||||||
aliasAction = new Action("Alias") {
|
aliasAction = new Action("Alias") {
|
||||||
@Override
|
@Override
|
||||||
|
@ -299,16 +302,16 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
System.out.println("Add User");
|
System.out.println("Add User");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
addUserAction.setImageDescriptor(CollaborationUtils
|
addUserAction.setImageDescriptor(IconUtil.getImageDescriptor(bundle,
|
||||||
.getImageDescriptor("add_contact.gif"));
|
"add_contact.gif"));
|
||||||
|
|
||||||
addGroupAction = new Action("Create Group") {
|
addGroupAction = new Action("Create Group") {
|
||||||
public void run() {
|
public void run() {
|
||||||
System.out.println("Create Group here");
|
System.out.println("Create Group here");
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
addGroupAction.setImageDescriptor(CollaborationUtils
|
addGroupAction.setImageDescriptor(IconUtil.getImageDescriptor(bundle,
|
||||||
.getImageDescriptor("add_group.gif"));
|
"add_group.gif"));
|
||||||
|
|
||||||
selectGroups = new Action("Select System Groups...") {
|
selectGroups = new Action("Select System Groups...") {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -341,8 +344,8 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
refreshActiveSessions();
|
refreshActiveSessions();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
refreshActiveSessionsAction.setImageDescriptor(CollaborationUtils
|
refreshActiveSessionsAction.setImageDescriptor(IconUtil
|
||||||
.getImageDescriptor("refresh.gif"));
|
.getImageDescriptor(bundle, "refresh.gif"));
|
||||||
refreshActiveSessionsAction
|
refreshActiveSessionsAction
|
||||||
.setToolTipText("Refresh the Active Sessions Entries.");
|
.setToolTipText("Refresh the Active Sessions Entries.");
|
||||||
|
|
||||||
|
@ -351,8 +354,8 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
usersTreeViewer.collapseAll();
|
usersTreeViewer.collapseAll();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
collapseAllAction.setImageDescriptor(CollaborationUtils
|
collapseAllAction.setImageDescriptor(IconUtil.getImageDescriptor(
|
||||||
.getImageDescriptor("collapseall.gif"));
|
bundle, "collapseall.gif"));
|
||||||
|
|
||||||
IMenuCreator creator = new IMenuCreator() {
|
IMenuCreator creator = new IMenuCreator() {
|
||||||
|
|
||||||
|
@ -467,8 +470,9 @@ public class CollaborationGroupView extends ViewPart {
|
||||||
};
|
};
|
||||||
action.setId(type.name());
|
action.setId(type.name());
|
||||||
ActionContributionItem item = new ActionContributionItem(action);
|
ActionContributionItem item = new ActionContributionItem(action);
|
||||||
action.setImageDescriptor(CollaborationUtils
|
action.setImageDescriptor(IconUtil.getImageDescriptor(Activator
|
||||||
.getImageDescriptor(type.name().toLowerCase() + ".gif"));
|
.getDefault().getBundle(), type.name().toLowerCase()
|
||||||
|
+ ".gif"));
|
||||||
item.fill(menu, -1);
|
item.fill(menu, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,14 +19,9 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.collaboration.ui;
|
package com.raytheon.uf.viz.collaboration.ui;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.FileLocator;
|
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
import org.eclipse.ecf.core.identity.ID;
|
import org.eclipse.ecf.core.identity.ID;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
|
@ -34,6 +29,7 @@ import com.raytheon.uf.common.status.UFStatus;
|
||||||
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.Mode;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
|
import com.raytheon.uf.viz.collaboration.data.CollaborationNode;
|
||||||
|
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methods for sending, receiving messages
|
* Methods for sending, receiving messages
|
||||||
|
@ -75,26 +71,6 @@ public class CollaborationUtils {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get an descriptor for the file in the icon directory. DEPRECATED: Use
|
|
||||||
* IconUtil instead
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
* - file name
|
|
||||||
* @return imageDescriptor
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static ImageDescriptor getImageDescriptor(String name) {
|
|
||||||
String iconPath = "icons" + File.separator;
|
|
||||||
URL url = FileLocator.find(Activator.getDefault().getBundle(),
|
|
||||||
new Path(iconPath + name), null);
|
|
||||||
if (url != null && url.getFile() == null) {
|
|
||||||
url = FileLocator.find(Activator.getDefault().getBundle(),
|
|
||||||
new Path(".." + File.separator + iconPath + name), null);
|
|
||||||
}
|
|
||||||
return ImageDescriptor.createFromURL(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an image associated with the node.
|
* Get an image associated with the node.
|
||||||
*
|
*
|
||||||
|
@ -102,33 +78,9 @@ public class CollaborationUtils {
|
||||||
* @return image
|
* @return image
|
||||||
*/
|
*/
|
||||||
public static Image getNodeImage(CollaborationNode node) {
|
public static Image getNodeImage(CollaborationNode node) {
|
||||||
// Image nodeImage = null;
|
|
||||||
String name = node.getImageKey().toLowerCase() + ".gif";
|
String name = node.getImageKey().toLowerCase() + ".gif";
|
||||||
return getImageDescriptor(name).createImage();
|
return IconUtil.getImageDescriptor(Activator.getDefault().getBundle(),
|
||||||
// if (node instanceof CollaborationUser) {
|
name).createImage();
|
||||||
// CollaborationUser user = (CollaborationUser) node;
|
|
||||||
// if (user.getMode() == IPresence.Mode.AVAILABLE) {
|
|
||||||
// nodeImage = getImageDescriptor("available.gif").createImage();
|
|
||||||
// } else if (user.getMode() == IPresence.Mode.AWAY) {
|
|
||||||
// nodeImage = getImageDescriptor("away.gif").createImage();
|
|
||||||
// } else if (user.getMode() == IPresence.Mode.DND) {
|
|
||||||
// nodeImage = getImageDescriptor("do_not_disturb.gif")
|
|
||||||
// .createImage();
|
|
||||||
// } else {
|
|
||||||
// nodeImage = getImageDescriptor("available.gif").createImage();
|
|
||||||
// }
|
|
||||||
// } else if (node instanceof SessionGroup) {
|
|
||||||
// if (!((SessionGroup) node).isSessionRoot()) {
|
|
||||||
// nodeImage = getImageDescriptor("session_group.gif")
|
|
||||||
// .createImage();
|
|
||||||
// } else {
|
|
||||||
// // nodeImage = getImageDescriptor("").createImage();
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// } else if (node instanceof CollaborationGroup) {
|
|
||||||
// nodeImage = getImageDescriptor("group.gif").createImage();
|
|
||||||
// }
|
|
||||||
// return nodeImage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendChatMessage(List<String> ids, String message) {
|
public static void sendChatMessage(List<String> ids, String message) {
|
||||||
|
|
|
@ -40,7 +40,8 @@ import org.eclipse.ui.IPartListener;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
import org.eclipse.ui.part.ViewPart;
|
import org.eclipse.ui.part.ViewPart;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||||
|
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||||
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -199,8 +200,9 @@ public abstract class AbstractSessionView extends ViewPart implements
|
||||||
private Image getImage() {
|
private Image getImage() {
|
||||||
Image image = imageMap.get(SESSION_IMAGE_KEY);
|
Image image = imageMap.get(SESSION_IMAGE_KEY);
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
image = CollaborationUtils
|
image = IconUtil.getImageDescriptor(
|
||||||
.getImageDescriptor(getSessionImageName()).createImage();
|
Activator.getDefault().getBundle(), getSessionImageName())
|
||||||
|
.createImage();
|
||||||
if (image != null) {
|
if (image != null) {
|
||||||
imageMap.put(SESSION_IMAGE_KEY, image);
|
imageMap.put(SESSION_IMAGE_KEY, image);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,11 @@
|
||||||
**/
|
**/
|
||||||
package com.raytheon.uf.viz.collaboration.ui.session;
|
package com.raytheon.uf.viz.collaboration.ui.session;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
|
||||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
*
|
*
|
||||||
|
@ -43,19 +43,42 @@ import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||||
|
|
||||||
public class ParticipantsContentProvider implements IStructuredContentProvider {
|
public class ParticipantsContentProvider implements IStructuredContentProvider {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface
|
||||||
|
* .viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
oldInput = newInput;
|
oldInput = newInput;
|
||||||
viewer.refresh();
|
viewer.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java
|
||||||
|
* .lang.Object)
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
return (CollaborationUser[]) inputElement;
|
if (inputElement instanceof List<?>) {
|
||||||
|
List<?> list = (List<?>) inputElement;
|
||||||
|
return list.toArray();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,14 @@ import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.Font;
|
import org.eclipse.swt.graphics.Font;
|
||||||
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.osgi.framework.Bundle;
|
||||||
|
|
||||||
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.DataUser.RoleType;
|
import com.raytheon.uf.viz.collaboration.data.DataUser.RoleType;
|
||||||
|
import com.raytheon.uf.viz.collaboration.ui.Activator;
|
||||||
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
import com.raytheon.uf.viz.collaboration.ui.CollaborationUtils;
|
||||||
|
import com.raytheon.uf.viz.core.icon.IconUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO Add Description
|
* TODO Add Description
|
||||||
|
@ -173,18 +176,19 @@ public class ParticipantsLabelProvider implements ITableColorProvider,
|
||||||
Image image = imageMap.get(modKey.toString());
|
Image image = imageMap.get(modKey.toString());
|
||||||
|
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
|
Bundle bundle = Activator.getDefault().getBundle();
|
||||||
image = CollaborationUtils.getNodeImage(user);
|
image = CollaborationUtils.getNodeImage(user);
|
||||||
// original image is 16x16
|
// original image is 16x16
|
||||||
GC gc = new GC(image, SWT.LEFT_TO_RIGHT);
|
GC gc = new GC(image, SWT.LEFT_TO_RIGHT);
|
||||||
|
|
||||||
if (t.contains(RoleType.LEADER)) {
|
if (t.contains(RoleType.LEADER)) {
|
||||||
Image im = CollaborationUtils.getImageDescriptor(
|
Image im = IconUtil.getImageDescriptor(bundle,
|
||||||
"session_leader.png").createImage();
|
"session_leader.png").createImage();
|
||||||
gc.drawImage(im, 7, 7);
|
gc.drawImage(im, 7, 7);
|
||||||
im.dispose();
|
im.dispose();
|
||||||
}
|
}
|
||||||
if (t.contains(RoleType.DATA_PROVIDER)) {
|
if (t.contains(RoleType.DATA_PROVIDER)) {
|
||||||
Image im = CollaborationUtils.getImageDescriptor(
|
Image im = IconUtil.getImageDescriptor(bundle,
|
||||||
"data_provider.png").createImage();
|
"data_provider.png").createImage();
|
||||||
gc.drawImage(im, 0, 16);
|
gc.drawImage(im, 0, 16);
|
||||||
im.dispose();
|
im.dispose();
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package com.raytheon.uf.viz.collaboration.ui.session;
|
package com.raytheon.uf.viz.collaboration.ui.session;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -49,7 +48,7 @@ import com.raytheon.uf.viz.collaboration.data.DataUser.RoleType;
|
||||||
public class SessionColorAdvisor {
|
public class SessionColorAdvisor {
|
||||||
private static Map<RoleType, Color> colors = null;
|
private static Map<RoleType, Color> colors = null;
|
||||||
|
|
||||||
public static Color getColor(List<RoleType> type, boolean isSelf) {
|
public static Color getColor(RoleType[] type, boolean isSelf) {
|
||||||
if (colors == null) {
|
if (colors == null) {
|
||||||
colors = new HashMap<RoleType, Color>();
|
colors = new HashMap<RoleType, Color>();
|
||||||
colors.put(RoleType.LEADER,
|
colors.put(RoleType.LEADER,
|
||||||
|
@ -63,15 +62,23 @@ public class SessionColorAdvisor {
|
||||||
return Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);
|
return Display.getCurrent().getSystemColor(SWT.COLOR_BLACK);
|
||||||
}
|
}
|
||||||
RoleType rType = null;
|
RoleType rType = null;
|
||||||
if (type == null || type.isEmpty()) {
|
if (type == null || type.length == 0) {
|
||||||
rType = RoleType.PARTICIPANT;
|
rType = RoleType.PARTICIPANT;
|
||||||
} else if (type.contains(RoleType.LEADER)) {
|
} else if (type.length == 1) {
|
||||||
rType = RoleType.LEADER;
|
rType = type[0];
|
||||||
} else if (type.contains(RoleType.DATA_PROVIDER)) {
|
|
||||||
rType = RoleType.DATA_PROVIDER;
|
|
||||||
} else {
|
} else {
|
||||||
rType = RoleType.PARTICIPANT;
|
rType = RoleType.PARTICIPANT;
|
||||||
|
for (RoleType rt : type) {
|
||||||
|
if (rt == RoleType.DATA_PROVIDER) {
|
||||||
|
rType = rt;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (rt == RoleType.LEADER) {
|
||||||
|
rType = rt;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return colors.get(rType);
|
return colors.get(rType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,6 @@ package com.raytheon.uf.viz.collaboration.ui.session;
|
||||||
**/
|
**/
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -63,6 +62,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
import com.raytheon.uf.viz.collaboration.comm.identity.CollaborationException;
|
||||||
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.identity.IPresence;
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Mode;
|
||||||
|
import com.raytheon.uf.viz.collaboration.comm.identity.IPresence.Type;
|
||||||
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.IVenueParticipantEvent;
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.IVenueParticipantEvent;
|
||||||
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventType;
|
||||||
|
@ -201,8 +202,7 @@ public class SessionView extends AbstractSessionView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
addMessage(msg.getFrom().getName(), msg.getTimeStamp(),
|
addMessage(msg);
|
||||||
msg.getBody());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -339,8 +339,7 @@ public class SessionView extends AbstractSessionView {
|
||||||
builder.append("type: ").append(user.getType())
|
builder.append("type: ").append(user.getType())
|
||||||
.append("\n");
|
.append("\n");
|
||||||
builder.append("-- Roles --");
|
builder.append("-- Roles --");
|
||||||
for (RoleType type : RoleType.values()) {// user.getRoles(sessionId))
|
for (RoleType type : user.getRoles()) {
|
||||||
// {
|
|
||||||
// TODO fake XXX take this out
|
// TODO fake XXX take this out
|
||||||
if (type == RoleType.UNKNOWN) {
|
if (type == RoleType.UNKNOWN) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -358,16 +357,21 @@ public class SessionView extends AbstractSessionView {
|
||||||
.getSession(sessionId);
|
.getSession(sessionId);
|
||||||
List<CollaborationUser> users = new ArrayList<CollaborationUser>();
|
List<CollaborationUser> users = new ArrayList<CollaborationUser>();
|
||||||
if (session != null) {
|
if (session != null) {
|
||||||
for (IVenueParticipant part : session.getVenue().getParticipants()) {
|
for (IVenueParticipant participant : session.getVenue()
|
||||||
// CollaborationUser user = new
|
.getParticipants()) {
|
||||||
// CollaborationUser(part.getName());
|
|
||||||
CollaborationUser user = new CollaborationUser(part.getFQName());
|
|
||||||
|
|
||||||
RoleType[] roles = user.getRoles(sessionId);
|
CollaborationUser user = new CollaborationUser(
|
||||||
for (RoleType role : roles) {
|
participant.getFQName());
|
||||||
user.addRole(role);
|
user.setMode(Mode.AVAILABLE);
|
||||||
}
|
user.setType(Type.AVAILABLE);
|
||||||
user.setText(part.getFQName());
|
|
||||||
|
// RoleType[] roles = user.getRoles(sessionId);
|
||||||
|
// for (RoleType role : roles) {
|
||||||
|
// user.addRole(role);
|
||||||
|
// }
|
||||||
|
user.addRole(RoleType.DATA_PROVIDER);
|
||||||
|
user.addRole(RoleType.LEADER);
|
||||||
|
user.setText(participant.getFQName());
|
||||||
// user.setMode(mode);
|
// user.setMode(mode);
|
||||||
// user.setType(Type.AVAILABLE);
|
// user.setType(Type.AVAILABLE);
|
||||||
users.add(user);
|
users.add(user);
|
||||||
|
@ -378,7 +382,7 @@ public class SessionView extends AbstractSessionView {
|
||||||
.getSystemColor(SWT.COLOR_DARK_GRAY));
|
.getSystemColor(SWT.COLOR_DARK_GRAY));
|
||||||
comp.setEnabled(false);
|
comp.setEnabled(false);
|
||||||
}
|
}
|
||||||
usersTable.setInput(users.toArray(new CollaborationUser[users.size()]));
|
usersTable.setInput(users);
|
||||||
((GridData) usersComp.getLayoutData()).exclude = true;
|
((GridData) usersComp.getLayoutData()).exclude = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -398,27 +402,33 @@ public class SessionView extends AbstractSessionView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addUsers(java.util.List<CollaborationUser> users) {
|
// @SuppressWarnings("unchecked")
|
||||||
for (CollaborationUser user : users) {
|
// public void addUser(CollaborationUser user) {
|
||||||
addUser(user);
|
// List<CollaborationUser> list = (List<CollaborationUser>) usersTable
|
||||||
}
|
// .getInput();
|
||||||
}
|
// list.add(user);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @SuppressWarnings("unchecked")
|
||||||
|
// public void clearUsers() {
|
||||||
|
// List<CollaborationUser> list = (List<CollaborationUser>) usersTable
|
||||||
|
// .getInput();
|
||||||
|
// list.clear();
|
||||||
|
// ;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @SuppressWarnings("unchecked")
|
||||||
|
// public void removeUser(CollaborationUser user) {
|
||||||
|
// List<CollaborationUser> list = (List<CollaborationUser>) usersTable
|
||||||
|
// .getInput();
|
||||||
|
// list.remove(user);
|
||||||
|
// }
|
||||||
|
|
||||||
public void addUser(CollaborationUser user) {
|
public void addMessage(IMessage message) {
|
||||||
usersTable.add(user);
|
String name = message.getFrom().getFQName();
|
||||||
}
|
String user = message.getFrom().getName();
|
||||||
|
|
||||||
public void clearUsers() {
|
|
||||||
usersTable.getTable().removeAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void removeUser(CollaborationUser user) {
|
|
||||||
usersTable.remove(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addMessage(String user, long timestamp, String message) {
|
|
||||||
Calendar cal = Calendar.getInstance();
|
Calendar cal = Calendar.getInstance();
|
||||||
cal.setTimeInMillis(timestamp);
|
cal.setTimeInMillis(message.getTimeStamp());
|
||||||
String time = String.format("%1$tI:%1$tM:%1$tS %1$Tp", cal);
|
String time = String.format("%1$tI:%1$tM:%1$tS %1$Tp", cal);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
if (messagesText.getCharCount() != 0) {
|
if (messagesText.getCharCount() != 0) {
|
||||||
|
@ -428,7 +438,7 @@ public class SessionView extends AbstractSessionView {
|
||||||
sb.append("(").append(time).append(") ");
|
sb.append("(").append(time).append(") ");
|
||||||
offset = sb.length();
|
offset = sb.length();
|
||||||
|
|
||||||
sb.append(user).append(": ").append(message);
|
sb.append(user).append(": ").append(message.getBody());
|
||||||
|
|
||||||
// here is the place to put the font and color changes for keywords
|
// here is the place to put the font and color changes for keywords
|
||||||
// read in localization file once and then don't read in again, per
|
// read in localization file once and then don't read in again, per
|
||||||
|
@ -448,11 +458,17 @@ public class SessionView extends AbstractSessionView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX determine from the user data
|
RoleType[] type = null;
|
||||||
// get self
|
for (CollaborationUser u : (List<CollaborationUser>) usersTable
|
||||||
List<RoleType> type = new ArrayList<RoleType>();
|
.getInput()) {
|
||||||
type.add(RoleType.LEADER);
|
if (name.equals(u.getId())) {
|
||||||
Color color = SessionColorAdvisor.getColor(type, false);
|
type = u.getRoles();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Color color = SessionColorAdvisor.getColor(type, name
|
||||||
|
.equals(CollaborationDataManager.getInstance().getLoginId()));
|
||||||
StyleRange range = new StyleRange(messagesText.getCharCount() + offset,
|
StyleRange range = new StyleRange(messagesText.getCharCount() + offset,
|
||||||
user.length() + 1, color, null, SWT.BOLD);
|
user.length() + 1, color, null, SWT.BOLD);
|
||||||
messagesText.append(sb.toString());
|
messagesText.append(sb.toString());
|
||||||
|
@ -645,9 +661,11 @@ public class SessionView extends AbstractSessionView {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void participantArrived(IVenueParticipant participant) {
|
private void participantArrived(IVenueParticipant participant) {
|
||||||
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
||||||
String name = participant.getName();
|
.getInput();
|
||||||
|
String name = participant.getFQName();
|
||||||
for (CollaborationUser user : users) {
|
for (CollaborationUser user : users) {
|
||||||
if (name.equals(user.getId())) {
|
if (name.equals(user.getId())) {
|
||||||
return;
|
return;
|
||||||
|
@ -655,57 +673,47 @@ public class SessionView extends AbstractSessionView {
|
||||||
}
|
}
|
||||||
CollaborationUser user = new CollaborationUser(name);
|
CollaborationUser user = new CollaborationUser(name);
|
||||||
user.setText(name);
|
user.setText(name);
|
||||||
CollaborationUser[] usersNew = Arrays.copyOf(users, users.length + 1);
|
users.add(user);
|
||||||
usersNew[users.length] = user;
|
usersTable.refresh();
|
||||||
usersTable.setInput(usersNew);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void participantDeparted(IVenueParticipant participant) {
|
private void participantDeparted(IVenueParticipant participant) {
|
||||||
System.out.println("++++ handle departed here: "
|
System.out.println("++++ handle departed here: "
|
||||||
+ participant.getName() + ", " + participant.getFQName());
|
+ participant.getName() + ", " + participant.getFQName());
|
||||||
int index = -1;
|
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
||||||
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
.getInput();
|
||||||
String name = participant.getName();
|
String name = participant.getFQName();
|
||||||
for (int i = 0; i < users.length; ++i) {
|
for (int i = 0; i < users.size(); ++i) {
|
||||||
if (name.equals(users[i].getId())) {
|
if (name.equals(users.get(i).getId())) {
|
||||||
index = i;
|
users.remove(i);
|
||||||
|
usersTable.refresh();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (index >= 0) {
|
|
||||||
CollaborationUser[] usersNew = new CollaborationUser[users.length - 1];
|
|
||||||
for (int i = 0; i < index; ++i) {
|
|
||||||
usersNew[i] = users[i];
|
|
||||||
}
|
|
||||||
for (int i = index + 1; i < users.length; ++i) {
|
|
||||||
usersNew[i - 1] = users[i];
|
|
||||||
}
|
|
||||||
usersTable.setInput(usersNew);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
private void participantPresenceUpdated(IVenueParticipant participant,
|
private void participantPresenceUpdated(IVenueParticipant participant,
|
||||||
IPresence presence) {
|
IPresence presence) {
|
||||||
|
List<CollaborationUser> users = (List<CollaborationUser>) usersTable
|
||||||
|
.getInput();
|
||||||
System.out.println("++++ handle presence updated here: "
|
System.out.println("++++ handle presence updated here: "
|
||||||
+ presence.getMode() + "/" + presence.getType() + ": "
|
+ presence.getMode() + "/" + presence.getType() + ": "
|
||||||
+ participant.getName() + ", " + participant.getFQName());
|
+ participant.getName() + ", " + participant.getFQName());
|
||||||
CollaborationUser[] users = (CollaborationUser[]) usersTable.getInput();
|
|
||||||
String name = participant.getFQName();
|
String name = participant.getFQName();
|
||||||
int index = -1;
|
for (CollaborationUser user : users) {
|
||||||
for (int i = 0; i < users.length; ++i) {
|
if (name.equals(user.getId())) {
|
||||||
if (name.equals(users[i].getId())) {
|
user.setMode(presence.getMode());
|
||||||
index = i;
|
user.setType(presence.getType());
|
||||||
break;
|
usersTable.refresh();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CollaborationUser user = null;
|
CollaborationUser user = new CollaborationUser(name);
|
||||||
if (index >= 0) {
|
|
||||||
user = users[index];
|
|
||||||
} else {
|
|
||||||
user = new CollaborationUser(name);
|
|
||||||
}
|
|
||||||
user.setMode(presence.getMode());
|
user.setMode(presence.getMode());
|
||||||
user.setType(presence.getType());
|
user.setType(presence.getType());
|
||||||
|
// usersTable.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue