Merge branch '11-Collaboration' of ssh://lightning.omaha.us.ray.com:29418/thunder into 11-Collaboration
Former-commit-id:8b514dc862
[formerly8b514dc862
[formerly df62b7a1fece621ad2c46112e0029da6fc3a230c]] Former-commit-id:c376abf87a
Former-commit-id:d3c4f6bf7b
This commit is contained in:
commit
52573a106a
3 changed files with 85 additions and 54 deletions
|
@ -89,34 +89,40 @@ public class CollaborationSessionView extends SessionView {
|
|||
|
||||
@Override
|
||||
public Menu getMenu(Menu parent) {
|
||||
if (menu == null) {
|
||||
if (menu == null || menu.isDisposed()) {
|
||||
menu = new Menu(parent);
|
||||
}
|
||||
Action leaderAction = new Action("Session Leader") {
|
||||
public void run() {
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||
.getSelection();
|
||||
CollaborationUser selectedUser = (CollaborationUser) selection
|
||||
.getFirstElement();
|
||||
switchLeader(selectedUser.getId());
|
||||
ISharedDisplaySession session = (ISharedDisplaySession) CollaborationDataManager
|
||||
.getInstance().getSession(sessionId);
|
||||
if (session.hasRole(ParticipantRole.SESSION_LEADER)) {
|
||||
Action leaderAction = new Action("Session Leader") {
|
||||
public void run() {
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||
.getSelection();
|
||||
CollaborationUser selectedUser = (CollaborationUser) selection
|
||||
.getFirstElement();
|
||||
switchLeader(selectedUser.getId());
|
||||
};
|
||||
};
|
||||
};
|
||||
ActionContributionItem leaderItem = new ActionContributionItem(
|
||||
leaderAction);
|
||||
leaderItem.fill(menu, -1);
|
||||
ActionContributionItem leaderItem = new ActionContributionItem(
|
||||
leaderAction);
|
||||
leaderItem.fill(menu, -1);
|
||||
}
|
||||
|
||||
Action dataProviderAction = new Action("Data Provider") {
|
||||
public void run() {
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||
.getSelection();
|
||||
CollaborationUser selectedUser = (CollaborationUser) selection
|
||||
.getFirstElement();
|
||||
switchDataProvider(selectedUser.getId());
|
||||
if (session.hasRole(ParticipantRole.DATA_PROVIDER)) {
|
||||
Action dataProviderAction = new Action("Data Provider") {
|
||||
public void run() {
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||
.getSelection();
|
||||
CollaborationUser selectedUser = (CollaborationUser) selection
|
||||
.getFirstElement();
|
||||
switchDataProvider(selectedUser.getId());
|
||||
};
|
||||
};
|
||||
};
|
||||
ActionContributionItem dataProviderItem = new ActionContributionItem(
|
||||
dataProviderAction);
|
||||
dataProviderItem.fill(menu, -1);
|
||||
ActionContributionItem dataProviderItem = new ActionContributionItem(
|
||||
dataProviderAction);
|
||||
dataProviderItem.fill(menu, -1);
|
||||
}
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
@ -152,6 +158,13 @@ public class CollaborationSessionView extends SessionView {
|
|||
.getInstance().getSession(this.sessionId);
|
||||
try {
|
||||
session.sendObjectToVenue(trc);
|
||||
CollaborationDataManager.getInstance().getUser(vp.getFQName())
|
||||
.addSessionRole(sessionId, ParticipantRole.SESSION_LEADER);
|
||||
CollaborationDataManager
|
||||
.getInstance()
|
||||
.getUser(session.getUserID().getFQName())
|
||||
.removeSessionRole(sessionId,
|
||||
ParticipantRole.SESSION_LEADER);
|
||||
} catch (CollaborationException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Unable to send message to transfer role", e);
|
||||
|
@ -182,6 +195,32 @@ public class CollaborationSessionView extends SessionView {
|
|||
return new ParticipantRole[] { ParticipantRole.PARTICIPANT };
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String buildParticipantTooltip(CollaborationUser user) {
|
||||
StringBuilder builder = new StringBuilder(
|
||||
super.buildParticipantTooltip(user));
|
||||
ISharedDisplaySession session = (ISharedDisplaySession) CollaborationDataManager
|
||||
.getInstance().getSession(sessionId);
|
||||
// TODO these should be smarter ifs
|
||||
boolean isSessionLeader = Tools.parseName(user.getId()).equals(
|
||||
session.getCurrentSessionLeader().getName());
|
||||
boolean isDataProvider = Tools.parseName(user.getId()).equals(
|
||||
session.getCurrentSessionLeader().getName());
|
||||
System.out.println(isSessionLeader);
|
||||
System.out.println(isDataProvider);
|
||||
if (isSessionLeader || isDataProvider) {
|
||||
builder.append("-- Roles --");
|
||||
if (isSessionLeader) {
|
||||
builder.append("\nSession Leader");
|
||||
}
|
||||
if (isDataProvider) {
|
||||
builder.append("\nData Provider");
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Collection<String> findAlertWords(StringBuilder builder,
|
||||
int offset) {
|
||||
|
@ -230,11 +269,18 @@ public class CollaborationSessionView extends SessionView {
|
|||
@Override
|
||||
protected void fillContextMenu(IMenuManager manager) {
|
||||
super.fillContextMenu(manager);
|
||||
// check if data provider
|
||||
// check if session leader
|
||||
if (!CollaborationDataManager.getInstance().getSession(sessionId)
|
||||
.hasRole(ParticipantRole.SESSION_LEADER)) {
|
||||
manager.add(switchToAction);
|
||||
ISharedDisplaySession session = (ISharedDisplaySession) CollaborationDataManager
|
||||
.getInstance().getSession(this.sessionId);
|
||||
if (session.hasRole(ParticipantRole.DATA_PROVIDER)
|
||||
|| session.hasRole(ParticipantRole.SESSION_LEADER)) {
|
||||
IStructuredSelection selection = (IStructuredSelection) usersTable
|
||||
.getSelection();
|
||||
CollaborationUser selectedUser = (CollaborationUser) selection
|
||||
.getFirstElement();
|
||||
String selectedUserName = Tools.parseName(selectedUser.getId());
|
||||
if (!selectedUserName.equals(session.getUserID().getName())) {
|
||||
manager.add(switchToAction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,6 @@ import com.raytheon.uf.viz.collaboration.comm.identity.event.ParticipantEventTyp
|
|||
import com.raytheon.uf.viz.collaboration.comm.identity.info.IVenueInfo;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.roster.IRosterEntry;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.IVenueParticipant;
|
||||
import com.raytheon.uf.viz.collaboration.comm.identity.user.ParticipantRole;
|
||||
import com.raytheon.uf.viz.collaboration.comm.provider.session.SessionManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationDataManager;
|
||||
import com.raytheon.uf.viz.collaboration.data.CollaborationUser;
|
||||
|
@ -345,24 +344,8 @@ public class SessionView extends AbstractSessionView {
|
|||
new Point(e.x, e.y));
|
||||
if (item != null) {
|
||||
CollaborationUser user = (CollaborationUser) item.getData();
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Status : ")
|
||||
.append(user.getMode().getMode()).append("\n");
|
||||
builder.append("Message : \"")
|
||||
.append(user.getStatusMessage()).append("\"\n");
|
||||
builder.append("-- Roles --");
|
||||
// TODO, this might not work at this point?
|
||||
if (CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId)
|
||||
.hasRole(ParticipantRole.SESSION_LEADER)) {
|
||||
builder.append("\nSession Leader");
|
||||
}
|
||||
if (CollaborationDataManager.getInstance()
|
||||
.getSession(sessionId)
|
||||
.hasRole(ParticipantRole.DATA_PROVIDER)) {
|
||||
builder.append("\nData Provider");
|
||||
}
|
||||
usersTable.getTable().setToolTipText(builder.toString());
|
||||
usersTable.getTable().setToolTipText(
|
||||
buildParticipantTooltip(user));
|
||||
} else {
|
||||
usersTable.getTable().setToolTipText("");
|
||||
}
|
||||
|
@ -385,12 +368,6 @@ public class SessionView extends AbstractSessionView {
|
|||
user.setType(Type.AVAILABLE);
|
||||
}
|
||||
|
||||
// ParticipantRole[] roles = user.getRoles(sessionId);
|
||||
// for (ParticipantRole role : roles) {
|
||||
// user.addRole(role);
|
||||
// }
|
||||
user.addRole(ParticipantRole.DATA_PROVIDER);
|
||||
user.addRole(ParticipantRole.SESSION_LEADER);
|
||||
user.setText(participant.getFQName());
|
||||
users.add(user);
|
||||
}
|
||||
|
@ -404,6 +381,15 @@ public class SessionView extends AbstractSessionView {
|
|||
((GridData) usersComp.getLayoutData()).exclude = true;
|
||||
}
|
||||
|
||||
protected String buildParticipantTooltip(CollaborationUser user) {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Status : ").append(user.getMode().getMode())
|
||||
.append("\n");
|
||||
builder.append("Message : \"").append(user.getStatusMessage())
|
||||
.append("\"\n");
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// dispose of the images first
|
||||
|
|
|
@ -465,7 +465,6 @@ public class VenueSession extends BaseSession implements IVenueSession,
|
|||
*/
|
||||
@Override
|
||||
public boolean hasRole(ParticipantRole role) {
|
||||
// TODO do we need this method?
|
||||
boolean result = true;
|
||||
if (role.equals(ParticipantRole.DATA_PROVIDER)
|
||||
&& !this.getUserID().equals(this.getCurrentDataProvider())) {
|
||||
|
|
Loading…
Add table
Reference in a new issue